Java Reference
In-Depth Information
The syntax for Integer and Real literals is as expected:
5
// Integer
4456
// Integer
8.9
// Real
0.95
// Real
Additionally, common arithmetic operators are used:
1 + 2
// addition
4 - 3
// subtraction
2 * 3
// multiplication
3 / 7
// divide
- 32
// unary minus operator
Finally, the well-known compare operators are defined:
4 > 5 // greater than
4 < 5 // smaller than
4 >= 5 // greater than or equal
4 <= 5 // smaller than or equal
Collections
A literal exists for lists:
{1,2,3,4} // a List with four integers
No other special concrete syntax is used for collections. If you need a Set,
you must call the toSet() operation on the List literal:
{1,2,4,4}.toSet() // a Set with 3 Integers
As with OCL, the expression language defines several special operations on
collections. These operations are not members of the type system, so they cannot
be used in a reflective manner.
select
Sometimes an expression yields a large collection, but one is interested in only a
special subset of the collection. The expression language has special constructs to
specify a selection out of a specific collection. These are the select() and
Search WWH ::




Custom Search