Interface ObjectFactory


public interface ObjectFactory
A factory for producing certain SymbolicObjects.
  • Method Details

    • numberFactory

      NumberFactory numberFactory()
      Returns:
      the numberFactory of the ObjectFactory
    • setExpressionComparator

      void setExpressionComparator(Comparator<SymbolicExpression> c)
      Sets the expression comparator for this object factory. This needs to be done before this factory is initialized with method init().
      Parameters:
      c - the expression comparator
    • setTypeComparator

      void setTypeComparator(Comparator<SymbolicType> c)
      Sets the type comparator of for this factory. This needs to be done before this factory is initialized with method init().
      Parameters:
      c - the type comparator
    • setTypeSequenceComparator

      void setTypeSequenceComparator(Comparator<SymbolicTypeSequence> c)
      Sets the type sequence comparator of this factory. This needs to be done before this factory is initialized with method init().
      Parameters:
      c - the type sequence comparator
    • init

      void init()
      Initializes the fields of this factory. Preconditions: The expression comparator, collection comparator, type comparator, and type sequence comparator have all been set for this object.
    • comparator

      Comparator<SymbolicObject> comparator()
      Returns a Comparator on all SymbolicObjects. This object comparator is based on the expression comparator, collection comparator, type comparator, and type sequence comparator that were provided to this factory. Preconditions: the factory has been initialized via method init()
      Returns:
      the object comparator
    • canonic

      <T extends SymbolicObject> T canonic(T object)
      Returns the canonic representative of the object's equivalence class. This will be used for the "canonicalization" of all symbolic objects in a universe. See "Flyweight Pattern".
      Parameters:
      object - any symbolic object
      Returns:
      the canonic representative
    • canonize

      <T extends SymbolicObject> void canonize(T[] objectArray)
      Canonizes each object in an array.
      Parameters:
      objectArray - array of SymbolicObjects, none of which is null
      See Also:
    • trueObj

      BooleanObject trueObj()
      Returns:
      the BooleanObject with value true
    • falseObj

      BooleanObject falseObj()
      Returns:
      the BooleanObject with value false
    • zeroIntObj

      IntObject zeroIntObj()
      Returns:
      the IntObject with value 0
    • oneIntObj

      IntObject oneIntObj()
      Returns:
      the IntObject with value 1
    • zeroIntegerObj

      NumberObject zeroIntegerObj()
      Returns:
      the NumberObject with value (
      invalid reference
      IntegerNumber
      ) 0
    • oneIntegerObj

      NumberObject oneIntegerObj()
      Returns:
      the NumberObject with value (
      invalid reference
      IntegerNumber
      ) 1
    • zeroRealObj

      NumberObject zeroRealObj()
      Returns:
      the NumberObject with value (
      invalid reference
      RationalNumber
      ) 0
    • oneRealObj

      NumberObject oneRealObj()
      Returns:
      the NumberObject with value (
      invalid reference
      RationalNumber
      ) 1
    • numberObject

      NumberObject numberObject(Number value)
      Returns:
      the NumberObject wrapping the given value
    • charObject

      CharObject charObject(char value)
      Returns:
      the CharObject wrapping the given char
    • stringObject

      StringObject stringObject(String string)
      Returns:
      the StringObject wrapping the given string
    • intObject

      IntObject intObject(int value)
      Returns:
      the IntObject wrapping the given int
    • booleanObject

      BooleanObject booleanObject(boolean value)
      Returns:
      the BooleanObject wrapping the given boolean value
    • objectWithId

      SymbolicObject objectWithId(int index)
      Gets the canonic object with the given ID number. This factory stores all canonic objects. This method should return the object in constant time. Preconditions: the index should in the range [0,n), where n is the current number of canonic objects.
      Returns:
      the canonic object with the given ID number
    • numObjects

      int numObjects()
      Returns:
      the current number of canonic objects
    • sequence

      <T extends SymbolicExpression> SymbolicSequence<T> sequence(Iterable<? extends T> elements)
      Returns a SymbolicSequence comprising the given sequence of elements. The elements must all be non-null.
      Parameters:
      elements - any object providing an iterator over SymbolicExpression
      Returns:
      a single SymbolicSequence which wraps the given list of elements
    • sequence

      <T extends SymbolicExpression> SymbolicSequence<T> sequence(T[] elements)
      Returns a SymbolicSequence comprising the sequence of elements specified as an array.
      Parameters:
      elements - any array of SymbolicExpression, all elements of which must be non-null
      Returns:
      a single SymbolicSequence which wraps the given list of elements
    • singletonSequence

      <T extends SymbolicExpression> SymbolicSequence<T> singletonSequence(T element)
      Returns the sequence of length 1 consisting of the given element.
      Parameters:
      element - a non-null element of T
      Returns:
      the sequence consisting of just the one element
    • emptySequence

      <T extends SymbolicExpression> SymbolicSequence<T> emptySequence()
      Returns the empty sequence.
      Returns:
      the empty sequence