Prev - Next - Down | SDMetrics - the UML design measurement tool |

Contents > 8 Defining Custom Design Metrics and Rules > 8.5 Expression Terms > 8.5.2 Metric Expressions > 8.5.2.1 Mathematical Operators and Functions

- a+b (a plus b, or, if a is a string, the string concatenation of a and b)
- a-b (a minus b)
- a*b (a multiplied by b)
- a/b (a divided by b)
- a^b (a to the power of b)
- a->b or a in b (the number of times a is contained in (multi-)set
b; the alternate notation
`in`can be used to avoid conflicts with the special XML character >, see Section 8.5.5 "Expression Terms and XML")

- ^ and -> (or in)
- the unary - and +
- * and /
- + and -

**Math functions**

`ln(x)`: Returns the natural logarithm of x.`exp(x)`: Returns Euler's number e raised to the power of x.`sqrt(x)`: Returns the square root of x.`abs(x)`: Returns the absolute value of x.`ceil(x)`: Returns the smallest integer greater or equal to x.`floor(x)`: Returns the largest integer smaller or equal to x.`round(x)`: Returns the integer closest to x (`round(x)=floor(x+0.5)`).

`length(s)`: Returns the length of the string s.`size(s)`: Returns the number of elements in set s (respecting cardinality if s is a multiset).`flatsize(s)`: Returns the number of different elements in set s. For regular sets, this is the same as`size`, for multisets, the cardinality of elements is disregarded.`tolowercase(s)`: Returns a string with all upper case letters in s changed to lower case.`parsenumber(s)`: Returns the numerical value of a string that represents a number, e.g. '3' or '-5.15'. The formatting for number constants applies (see Section 8.5.1.1 "Constants").`typeof(e)`: Returns the type of the model element e, as a string.`qualifiedname(e):`Returns the fully qualified name (see Section 4.2.2.1 "Qualified Element Names") of the model element e.

Prev | Up | Next |

Section 8.5.2 "Metric Expressions" | Contents | Section 8.5.2.2 "Special Operators" |