You can create arrays using the create statement (see action script example below): Code Block |
---|
| create anArray;
append "Hello World!" to anArray; |
Most of the time the xUML Runtime will create the array implicitly on appending the first item. There is one exception to this rule, though: Arrays that contain array elements having a complex type with multiplicity. Let's assume you have an array of complex type ArrayElement and this complex type has a property subArray with multiplicity 0..*. What you can do, if subArray is NULL : Code Block |
---|
set array1[0].subArray = anotherArray; |
The reference subArray is changed to point to anotherArray . What you can't do, if subArray is NULL: Code Block |
---|
append "something" to array1[0].subArray; |
In this case (get statement on the right side of a statement), the Runtime will throw a get error for array1[0].subArray .
|