public class TerminalEnvironment extends Object implements Environment
This environment is somewhat deprecated in favour of the more capable
LineEnvironment
.
Modifier and Type | Field and Description |
---|---|
static int |
NUM_TRIES
The number of goes you get to put in an invalid parameter.
|
Constructor and Description |
---|
TerminalEnvironment(String[] args,
Parameter<?>[] params)
Constructs a new Environment based on a String array containing
supplied arguments, and a list of parameters which may be encountered.
|
Modifier and Type | Method and Description |
---|---|
void |
acquireValue(Parameter<?> par)
Sets the value of a parameter.
|
void |
clear(Parameter<?> par) |
void |
clearValue(Parameter<?> par)
Clears a value for a given parameter.
|
PrintStream |
getErrorStream()
Returns System.err.
|
String[] |
getNames()
Returns an array of parameter names which have been specified.
|
PrintStream |
getOutputStream()
Returns System.out.
|
public static int NUM_TRIES
public TerminalEnvironment(String[] args, Parameter<?>[] params) throws UsageException
args
- an array of words found on the command lineparams
- an array of Parameter objects which this Environment
may be asked to get values forUsageException
public void clear(Parameter<?> par)
public void acquireValue(Parameter<?> par) throws TaskException
A more configurable order (cf ADAM PPATH/VPATH) could be implemented by adding some methods to Parameter and getting this method to query them.
acquireValue
in interface Environment
par
- the parameter whose value is to be setTaskException
public void clearValue(Parameter<?> par)
Environment
clearValue
in interface Environment
par
- the Parameter whose value is to be clearedpublic String[] getNames()
Environment
getNames
in interface Environment
public PrintStream getOutputStream()
getOutputStream
in interface Environment
public PrintStream getErrorStream()
getErrorStream
in interface Environment
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.