Identifier DimExprs (1) Identifier DimExprs in D (2) Identifier DimExprs R Exp (3) Identifier DimExprs ConstrBlocks (4)where DimExprs and ConstrBlocks are defined as follow:
DimExprs: '['Expression ']'...'['Expression']' ConstrBlocks: ConstrBlock | '{' ConstrBlocks, ..., ConstrBlocks '}' ConstrBlock: '{' Constraint; ...,; Constraint '}'(1) declares an array and impose no constraints on the elements; (2) says that for each element X in the array, X in D holds; (3) says that for each element X in the array, X R Exp holds; (4) imposes the constraints to the array elements as follows: Let A be the identifier of the array. When there is only one constraint block following DimExprs, the constraints apply to all the array elements. In contrast, when there a sequence of constraint blocks {B0, ..., Bn-1} following DimExprs (in this case, the size of the first dimension of the array must be equal to n), then Bi recursively applies to A[i] for i=0,...,n-1.
The following shows three examples:
dj Button bts[10]{width == 30; height==30}; dj Label lbs[3]{{text == "zero"}, {text == "one"}, {text == "two"}}; dj int qs[10] in 0..9;The first declaration declares ten buttons bts[0],...,bts[9] that have the same size
Elements of component and attribute arrays can be referenced in the same way as array elements in Java.