2.3.  Operators

[Warning]Text not verified for kermeta 2

Priority

Operator

Operand types

Semantic

1

+

Numeric

String

Add two numeric values

Concatenate two strings

1

-

Numeric

Subtract two numerous values

2

*

Numeric

Multiply two numeric values

2

/

Numeric

Divide the first operand by the second

Notice that most of these arithmetic operators are only defined for numeric primitive types like Integer. Except the + operator which is a concatenation operator for String, they are not applicable on String, Boolean nor collections

Priority

Operators

Operand Types

Semantics

3

==

All

True, if op1 value's is the same that op2 value's

3

!=

All

True if op1 value's is different of op2 value's

3

<

Numeric

True if op1value's is strictly smaller than op2 value's

3

<=

Numeric

True if op1 value's is smaller or equals than op2 value's

3

>

Numeric

True if op1 value's is strictly greater than op2 value's

3

>=

Numeric

True if op1 value's is greater or equals than op2 value's

Priority

Operators

Operands Types

Semantics

4

and

Boolean

True if op1 and op2 are evaluated to true

4

or

Boolean

True if one of the operators is evaluated to true

4

not

Boolean

True if op is false.

[Note]Note

The == and != can be applied to any Object, in this case, the comparison is based on the equals operation defined for the object and thus can be redefined to compare only the values of the objects. To be sure to compare the identity of objects even if they redefine the operation equals , you need to compare their oid (ie. their identifiers).

See Section 2.18, “ Objects comparison ” for more details about object comparison.