Array
This node is used to define or use an array, when defining, this allows the array size to be defined or an array of constants to initalise the array.
When using the array this node allows the index to be specified.
Attributes used
"new" set to true when the array is being instantiated.
"constant" if true indicates that the array is being initialised with
a set of constants.
Child Elements
If "constant" is true then child elements are constants containg the values of arrays, such as
Otherwise child element is an expression representing either the size of the array (if "new") or the value of the index if the array is being used.
Comments may also be included.
Schema entry
Holds a constant string, integer, floating point or boolean value
<xs:complexType name="arrayType"> <xs:sequence> <xs:element name="dataType" type="dataType"/> </xs:sequence> <xs:attribute name="size" type="xs:int"/> </xs:complexType>
Examples of usage
usage | java example | XES example |
array initialiser list | int v[]={1,2,3,4}; | <variable isArray="true" name="v" type="int"> <assign operator="="> <array> <constant intConst="1"/> <constant intConst="2"/> <constant intConst="3"/> <constant intConst="4"/> </array> </assign> </variable> |
Java
String[][] names = new int[10][10];
Scala
val names: Array[Array[String]] = new Array[Array[String]](10, 10)