Package org.oristool.lello
Class ValueOperations
java.lang.Object
org.oristool.lello.ValueOperations
This class contains all the logic behind Lello unary and binary operators.
All the methods throw an exception if the arguments are not compatible with
the operation; compatible types are combined by first converting them to the
same type, always converting the less accurate to the most accurate.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ValueImplements addition.static ValueImplements logical AND.static ValueImplements division.static ValueImplements equality comparison.static ValueImplements greater than comparison.static ValueImplements greater than or equal comparison.static ValueImplements less than comparison.static ValueImplements less than or equal comparison.static ValueImplements modulus (also floating point modulus).static ValueImplements multiplication.static ValueImplements unary minus.static ValueImplements inequality comparison.static ValueImplements logical NOT.static ValueImplements logical OR.static ValueImplements unary plus.static ValueImplements power.static ValueImplements subtraction.
-
Constructor Details
-
ValueOperations
public ValueOperations()
-
-
Method Details
-
add
Implements addition.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Their sum.
-
sub
Implements subtraction.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Their difference.
-
mul
Implements multiplication.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Their product.
-
div
Implements division.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Their quotient.
-
mod
Implements modulus (also floating point modulus).- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- The remainder of lhs / rhs.
-
raise
Implements power. The result is always REAL.- Parameters:
lhs- Base.rhs- Exponent.- Returns:
- lhs^rhs as REAL.
-
lt
Implements less than comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that
lhs < rhsor not.
-
lte
Implements less than or equal comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that
lhs <= rhsor not.
-
gt
Implements greater than comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that
lhs > rhsor not.
-
gte
Implements greater than or equal comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that
lhs >= rhsor not.
-
eq
Implements equality comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that lhs == rhs or not.
-
neq
Implements inequality comparison.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- Whether it is true that lhs != rhs or not.
-
and
Implements logical AND.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- lhs AND rhs.
-
or
Implements logical OR.- Parameters:
lhs- Left hand side operand.rhs- Right hand side operand.- Returns:
- lhs OR rhs.
-
pos
Implements unary plus.- Parameters:
u- The operand.- Returns:
- Value +u.
-
neg
Implements unary minus.- Parameters:
u- The operand.- Returns:
- Value -u.
-
not
Implements logical NOT.- Parameters:
u- The operand.- Returns:
- Value NOT(u).
-