Class ValueOperations

java.lang.Object
org.oristool.lello.ValueOperations

public class ValueOperations extends Object
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 Details

    • ValueOperations

      public ValueOperations()
  • Method Details

    • add

      public static Value add(Value lhs, Value rhs)
      Implements addition.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Their sum.
    • sub

      public static Value sub(Value lhs, Value rhs)
      Implements subtraction.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Their difference.
    • mul

      public static Value mul(Value lhs, Value rhs)
      Implements multiplication.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Their product.
    • div

      public static Value div(Value lhs, Value rhs)
      Implements division.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Their quotient.
    • mod

      public static Value mod(Value lhs, Value rhs)
      Implements modulus (also floating point modulus).
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      The remainder of lhs / rhs.
    • raise

      public static Value raise(Value lhs, Value rhs)
      Implements power. The result is always REAL.
      Parameters:
      lhs - Base.
      rhs - Exponent.
      Returns:
      lhs^rhs as REAL.
    • lt

      public static Value lt(Value lhs, Value rhs)
      Implements less than comparison.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Whether it is true that lhs < rhs or not.
    • lte

      public static Value lte(Value lhs, Value rhs)
      Implements less than or equal comparison.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Whether it is true that lhs <= rhs or not.
    • gt

      public static Value gt(Value lhs, Value rhs)
      Implements greater than comparison.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Whether it is true that lhs > rhs or not.
    • gte

      public static Value gte(Value lhs, Value rhs)
      Implements greater than or equal comparison.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      Whether it is true that lhs >= rhs or not.
    • eq

      public static Value eq(Value lhs, Value rhs)
      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

      public static Value neq(Value lhs, Value rhs)
      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

      public static Value and(Value lhs, Value rhs)
      Implements logical AND.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      lhs AND rhs.
    • or

      public static Value or(Value lhs, Value rhs)
      Implements logical OR.
      Parameters:
      lhs - Left hand side operand.
      rhs - Right hand side operand.
      Returns:
      lhs OR rhs.
    • pos

      public static Value pos(Value u)
      Implements unary plus.
      Parameters:
      u - The operand.
      Returns:
      Value +u.
    • neg

      public static Value neg(Value u)
      Implements unary minus.
      Parameters:
      u - The operand.
      Returns:
      Value -u.
    • not

      public static Value not(Value u)
      Implements logical NOT.
      Parameters:
      u - The operand.
      Returns:
      Value NOT(u).