NEW
Revision as of 18:04, 27 April 2020 by ConvertBot (talk | contribs) (creates a new object from the Macro language)
creates a new object from the Macro language
<NAME> - The fully qualified class name (case sensitive) <LABEL> - Results label to referencing the object <TABLE> - Table of arguments to initialize the object via the setKey interface This command creates a new object of type <NAME> and stores it in the results table as <LABEL>. The table <TABLE> is optional - it will initialize the objects by calling setKey on each element in the table. Since NeXtMidas 2.1.0 it is possible to provide arguments to the constructor (see examples). If no arguments are given (as in NeXtMidas 2.0.X and earlier) the no-argument constructor will be used. Since NeXtMidas 2.9.0 it is possible to create new arrays. Note that when creating arrays of Object type Integer, Double, Float, etc, when passing in values you must pass in the same type. For example, to set values in a new Double[], you must use Double (object), not double (primitive type). Examples: 1. Get the current time from a reference to the Time class library: nM> new nxm.sys.lib.Time tref nM> invoke tCurrent tref.current() will give the current time just like nM> timex NOW t 2. Create a new object using a constructor that takes in an argument: nM> new java.lang.Integer(4) temp 3. Create an array an initialize it nM> new int[] array {1,2,3} 4. Create a multi-dimensional array and set a value nM> new java.lang.String[3][5] array nM> res sub1 array(2) ! get the dimension array nM> set sub1(4) "Hey, you! Get off of my cloud!" See Also: INVOKE, SET