Class Operators


public final class Operators extends Object
This class implements all the built-in operators both arithmetic and boolean.

Boolean values will be treated as follows:

  1. if the absolute value is less than 1e-12 it will be considered false. About this... I know is not the ideal approach, but we have a LOT of arithmetic "hacks" all around some projects and this behavior is actually expected.
  2. if the absolute value is bigger or equal than 1e-12 it will be considered true
  3. the boolean results will always be 1.0 for true and 0.0 for false
  4. boolean operations will always have lower precedence than arithmetic operations (i.e. they will be evaluated last)
  5. The precedence (order) of the boolean operators will always be ¬ & | (in accordance to the analogy with arithmetic operators), so that:
                 a & b| b & ¬c -> ((a & b) | (b & (¬c)))
  • Method Details

    • getBuiltinOperator

      public static Operator getBuiltinOperator(char symbol, int numArguments)
      Retrieves a Built-in operator.
      symbol - Symbol representing the operator
      numArguments - Number of arguments of the operator
      An operator matching the criteria if one exists or null otherwise
      See Also:
    • getOperators

      public static Operator[] getOperators()
      Array with all the available operators
      Operator array
      See Also: