Class CompiledFluent

java.lang.Object
edu.uky.cs.nil.sabre.Fluent
edu.uky.cs.nil.sabre.comp.CompiledFluent
All Implemented Interfaces:
Expression, Logical, Simplifiable, Typed, Signed, Unique, Serializable, Comparable<Logical>

public class CompiledFluent extends Fluent implements Unique
A compiled fluent is a fluent whose characters and signature are ground and which defines a unique ID number which corresponds to the fluent's index in its compiled problem's set of fluents.
Author:
Stephen G. Ware
See Also:
  • Field Details

  • Constructor Details

    • CompiledFluent

      protected CompiledFluent(int id, Character character, CompiledFluent parent)
      Constructs a new compiled fluent by prepending a character onto a parent.
      Parameters:
      id - a unique ID number
      character - the first character in this fluent's list of characters
      parent - the fluent's parent; its signature will be copied and the character will be prepended to the start of its parent's list of characters
    • CompiledFluent

      protected CompiledFluent(int id, Signature signature, Type type, String comment)
      Constructs a new compiled fluent with an empty list of characters.
      Parameters:
      id - a unique ID number
      signature - the fluent's signature, which must be ground
      type - the fluent's type
      comment - the comment
      Throws:
      FormatException - if the signature is not ground
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Fluent
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Unique
      Overrides:
      hashCode in class Fluent
    • isGround

      public boolean isGround()
      Description copied from interface: Logical
      Tests whether this logical formula is ground, which means that it contains no variables.
      Specified by:
      isGround in interface Logical
      Overrides:
      isGround in class Fluent
      Returns:
      true if this formula contains no variables, false otherwise
    • apply

      public CompiledFluent apply(Function<Object,Object> function)
      Description copied from interface: Logical
      Applies a given function to every part of this logical formula and then creates a new logical formula of this same type using the results returned from the function. If, for every part of this formula, the function always returns its input as output with no changes, this method should return this object (not just any object that is equal to this object).
      Specified by:
      apply in interface Expression
      Specified by:
      apply in interface Logical
      Specified by:
      apply in interface Simplifiable
      Overrides:
      apply in class Fluent
      Parameters:
      function - the function to apply to all parts of this formula
      Returns:
      a logical formula of the same type as this formula made from the returned objects, or this object if no parts were changed by the function
    • simplify

      public CompiledFluent simplify()
      Description copied from interface: Simplifiable
      Returns a logically equivalent but smaller, simpler, or more convenient form of this logical formula.
      Specified by:
      simplify in interface Expression
      Specified by:
      simplify in interface Simplifiable
      Overrides:
      simplify in class Fluent
      Returns:
      a smaller, simpler, or more convenient logical formula which is equivalent to this formula
    • prepend

      public Fluent prepend(Parameter character)
      Description copied from interface: Expression
      Returns an expression which represents a character's beliefs about this expression.
      Specified by:
      prepend in interface Expression
      Overrides:
      prepend in class Fluent
      Parameters:
      character - the character whose beliefs will be represented
      Returns:
      an expression representing the character's beliefs about this expression
    • removeFirstCharacter

      public CompiledFluent removeFirstCharacter()
      Description copied from class: Fluent
      Returns a new fluent where the first (leftmost) character has been removed from Fluent.characters. If there are no characters, this method returns the same fluent.
      Overrides:
      removeFirstCharacter in class Fluent
      Returns:
      a fluent with the first characters removed