2005/5/10

     
 

CfgScript Array Types

artefaktur

| Any Type | Basic Types | Object Types | Array Types | Enum Type | Props Type |

Array types are implemented as an Array of Elements.


Content of this chapter:

   Using Arrays
     ArrayLiteral
   [] operator
   Samples



 Using Arrays

Arrays are the CfgScript corresponding type to build in Array types on ACDK/Java On a given type an Array type can be used as following:

int i = 42;
intArray iarray = new intArray(1);
iarray.set(0, 1);
iarray.append(2);
int j = iarray.get(1);
j == 2;

acdk.lang.IntegerArray integerArray = new acdk.lang.IntegerArray(1);
integerArray.set(0, new acdk.lang.Integer(1));
integerArray.append(new acdk.lang.Integer(2));

integerArray.get(1).equals(new acdk.lang.Integer(2)) == true);

 ArrayLiteral

ArrayLiteral
: '[' [ ElementList ] ']'
;

ElementList
: Expression [ ',' ElementList ]
;


array1 = [ 1, 2, 3, 3 + 1 ];
array2 = [ 1, "Text", [ 'a', 'b' ], new acdk.lang.StringBuffer("asdf") ];


 [] operator

Access via the [] operator is currently not implemented.

 Samples