Interface NumericExpressionFactory

All Known Subinterfaces:
IdealFactory

public interface NumericExpressionFactory
A NumericExpressionFactory provides all of the functionality needed to create and manipulate expressions of numeric type. For example, it must provide methods to instantiate new numeric expression instances, to add, subtract, multiply, and divide numeric expressions, etc. A general ExpressionFactory will use one or more NumericExpressionFactorys by delegating out all numerical operations to it. Different implementations of NumericExpressionFactory can deal with arithmetic issues in different ways, e.g., by treating real types as the mathematical reals or as finite-precision floating point numbers, and so on.
  • Method Details

    • init

      void init()
      Initialize this numeric expression factory. This factory should not be used until it has been initialized. Pre-conditions: the boolean factory, object factory, and type factory have alrady been initialized.
    • booleanFactory

      BooleanExpressionFactory booleanFactory()
      Returns the boolean expression factory used by this numeric expression factory. The boolean factory is needed to produce relational expressions such as "xinvalid input: '<'y".
      Returns:
      the boolean expression factory used by this factory
    • numberFactory

      NumberFactory numberFactory()
      Returns the number factory used by this numeric factory.
      Returns:
      the number factory
    • objectFactory

      ObjectFactory objectFactory()
      Returns the object factory used by this numeric factory.
      Returns:
      the object factory
    • typeFactory

      SymbolicTypeFactory typeFactory()
      Returns the type factory used by this numeric expression factory.
      Returns:
      the type factory
    • comparator

      Returns a comparator on all numeric expressions that are controlled by this factory
      Returns:
      a comparator on numeric expressions
    • number

      NumericExpression number(NumberObject numberObject)
    • number

      NumericExpression number(int value)
    • symbolicConstant

      NumericSymbolicConstant symbolicConstant(StringObject name, SymbolicType type)
    • expression

      NumericExpression expression(SymbolicExpression.SymbolicOperator operator, SymbolicType numericType, SymbolicObject... arguments)
      Returns an expression, given the operator, type, and array of arguments
      Parameters:
      operator - A SymbolicOperator
      numericType - A SymbolicType
      arguments - array of arguments
      Returns:
      Returns a NumericExpression
    • zeroInt

      Returns a symbolic expression of integer type with the value of 0
      Returns:
    • zeroReal

      NumericExpression zeroReal()
      Returns a symbolic expression of real type with the value of 0
      Returns:
    • oneInt

      Returns a symbolic expression of integer type with the value of 1
      Returns:
    • oneReal

      Returns a symbolic expression of real type with the value of 1
      Returns:
    • add

      Returns a symbolic expression which is the result of adding arg1 from arg0. The two given expressions must have the same (numeric) type: either both integers, or both real.
      Parameters:
      arg0 - a symbolic expression of a numeric type
      arg1 - a symbolic expression of the same numeric type
      Returns:
      arg0+arg1
    • subtract

      Returns a symbolic expression which is the result of subtracting arg1 and arg0. The two given expressions must have the same (numeric) type: either both integers, or both real.
      Parameters:
      arg0 - a symbolic expression of a numeric type
      arg1 - a symbolic expression of the same numeric type
      Returns:
      arg0-arg1
    • multiply

      Returns a symbolic expression which is the result of multiplying the two given symbolic exprssions. The two given expressions must have the same (numeric) type: either both integers, or both real.
      Parameters:
      arg0 - a symbolic expression of a numeric type
      arg1 - a symbolic expression of the same numeric type
      Returns:
      arg0 * arg1, the product of arg0 and arg1.
    • divide

      Returns a symbolic expression which is the result of dividing arg0 by arg1. The two given expressions must have the same (numeric) type: either both integers, or both real. In the integer case, division is interpreted as "integer division", which rounds towards 0.
      Parameters:
      arg0 - a symbolic expression of a numeric type
      arg1 - a symbolic expression of the same numeric type
      Returns:
      arg0 / arg1
    • modulo

      Returns a symbolic expression which represents arg0 modulo arg1. The two given expressions must have the integer type. What happens for negative integers is unspecified.
      Parameters:
      arg0 - a symbolic expression of integer type
      arg1 - a symbolic expression of integer type
      Returns:
      arg0 % arg1
    • minus

      Returns a symbolic expression which is the negative of the given numerical expression. The given expression must be non-null and have either integer or real type.
      Parameters:
      arg - a symbolic expression of integer or real type
      Returns:
      -arg
    • power

      Concrete power operator: e^b, where b is a NumberObject with a concrete non-negative integer value. This method might actually multiply out the expression, i.e., it does not necessarily return an expression with operator POWER.
      Parameters:
      base - the base expression in the power expression
      exponent - a non-negative concrete NumberObject exponent
    • power

      General power operator: e^b. Both e and b are numeric expressions.
      Parameters:
      base - the base expression in the power expression
      exponent - the exponent in the power expression
    • min

      Returns a NumericExpression which is equivalent to the minimum of all NumericExpressions in exprs.
      Parameters:
      exprs - the NumericExpressions we want the minimum of.
    • max

      Returns a NumericExpression which is equivalent to the maximum of all NumericExpressions in exprs.
      Parameters:
      exprs - the NumericExpressions we want the maximum of.
    • cast

      NumericExpression cast(NumericExpression numericExpression, SymbolicType newType)
      Returns a NumericExpression with the symbolic type passed in the second argument
      Parameters:
      numericExpression - The NumericExpression that will receive the new type
      newType - The new SymbolicType for the numericExpression
      Returns:
      NumericExpression
    • extractNumber

      Number extractNumber(NumericExpression expression)
      Attempts to interpret the given symbolic expression as a concrete number. If this is not possible, returns null.
    • lessThan

      Returns a BooleanExpression with the result of the lessThan operation on 2 NumericExpressions
    • lessThanEquals

      Returns a BooleanExpression with the result of the lessThanEquals operation on 2 NumericExpressions
    • notLessThan

      Returns a BooleanExpression with the result of the notLessThan operation on 2 NumericExpressions
    • notLessThanEquals

      BooleanExpression notLessThanEquals(NumericExpression arg0, NumericExpression arg1)
      Returns a BooleanExpression with the result of the notLessThanEquals operation on 2 NumericExpressions
    • equals

      Returns a BooleanExpression with the result of the equals operation on 2 NumericExpressions
    • neq

      Returns a BooleanExpression with the result of the notEquals operation on 2 NumericExpressions
    • expand

    • floor

    • ceil

    • roundToZero