Current Page:
NeXtMidas Training
Primitives
Special Variables
List of Variables
MA
|
|
- The command line
Args (MA ):
- Makes it possible to get the values of command line arguments.
MA.getD(<name>) |
Get parameter <name> as a double . |
MA.getF(<name>) |
Get parameter <name> as a float . |
MA.getX(<name>) |
Get parameter <name> as a XLONG (Java long ). |
MA.getL(<name>) |
Get parameter <name> as a LONG (Java int ). |
MA.getI(<name>) |
Get parameter <name> as an INT (Java short ). |
MA.getB(<name>) |
Get parameter <name> as a byte . |
MA.getS(<name>) |
Get parameter <name> as a String . |
MA.getU(<name>) |
Get parameter <name> as an (untranslated) String . |
MA.getO(<name>) |
Get parameter <name> as an Object . |
MA.getState(<name>) |
Get parameter <name> as a boolean state. |
MA.getTable(<name>) |
Get parameter <name> as a Table object. |
MA.getTime(<name>) |
Get parameter <name> as a Time object. |
etc. |
|
(A complete list is contained in the API for Args!) |
- Note that the
<name> should always be capitalized.
- When adding your command to the dictionary using
UPDATE , the default value
for the argument should be specified as <NAME> = for each
required input command line argument. See Command Dictionary Entries for review.
- To get the value of a switch use the same methods but include a slash before the name.
MA.getD("/POLL")
- The
MA.find(<name>) function will indicate if a named parameter
(or switch) is specified.
- This should not be used to determine if a switch is set
(it returns true when the switch appears on the commandline,
even if set to
FALSE ).
- It is possible to get arguments based on their order on the command line.
- This should only be used for primitives that take in an undefined
number of arguments.
- Some examples
String inStr = MA.getS("IN_STR");
int myint = MA.getL("NUM");
double freq = MA.getD("FREQ");
boolean debug = MA.getState("DEBUG");
double poll = MA.getD("/POLL"); // get /POLL switch
boolean hasPoll = MA.find("/POLL"); // true if /POLL switch is specified
Then when adding your command to Command Dictionary (via UPDATE )
nM> update myprim
Option tree (USER, SITE, UCL, etc): [] -> train
MYPRIM Abbreviation: [MYPRIM] -> myprim
Support [P] -> P
Number of arguments [0] -> 4
Default 1 [] -> IN_STR="please enter your name here"
Default 2 [] -> NUM=
Default 3 [] -> FREQ=
Default 4 [] -> DEBUG=
nM>
nM> defaults myprim
INFO: MYPRIM*;TRAIN P,4 ,IN_STR="please enter your name here",NUM=,FREQ=,DEBUG=,
Java Experts Take Note: |
The naming convention for the integer types differs from Java. This is for historical
reasons, to keep the terminology the same across all Midas frameworks. (The names
originated on VMS which used a 16-bit integer type.)
|
X-Midas Users Take Note: |
The MA.get_(...) methods fill the role of both the M$PICK_(...)
and the M$GET_?SWITCH(...) methods in X-Midas. NeXtMidas also uses names
for the parameters.
|
|
|
|