public class SwitchArg extends Object implements Statement, AcceptsStatementVisitor
Modifier and Type | Field and Description |
---|---|
static Map<OsFamily,String> |
OS_TO_CASE_PATTERN |
static Map<OsFamily,String> |
OS_TO_END_SWITCH_PATTERN |
static Map<OsFamily,String> |
OS_TO_SWITCH_PATTERN |
Constructor and Description |
---|
SwitchArg(int arg,
Map<String,Statement> valueToActions)
Generates a switch statement based on
arg . |
Modifier and Type | Method and Description |
---|---|
void |
accept(StatementVisitor visitor) |
boolean |
equals(Object obj) |
Iterable<String> |
functionDependencies(OsFamily family) |
int |
hashCode() |
String |
render(OsFamily family) |
public SwitchArg(int arg, Map<String,Statement> valueToActions)
arg
. If its value is found to be a key in
valueToActions
, the corresponding action is invoked.
Ex. arg is 1
- the first argument to the script./script start
./script stop
arg
- - shell arg to switch onvalueToActions
- - case statements, if the value of the arg matches a key, the corresponding value
will be invoked.public Iterable<String> functionDependencies(OsFamily family)
functionDependencies
in interface Statement
public void accept(StatementVisitor visitor)
accept
in interface AcceptsStatementVisitor
Copyright © 2009–2021 The Apache Software Foundation. All rights reserved.