Class LiteralNode

java.lang.Object
edu.uky.ai.planning.pg.Node
edu.uky.ai.planning.pg.LiteralNode
All Implemented Interfaces:
Comparable<Node>

public class LiteralNode extends Node
Represents a unique literal, or fact, in a plan graph. Literal nodes have producers (step nodes which have this literal as an effect) and consumers (step nodes which have this literal as a precondition).
Author:
Stephen G. Ware
  • Field Details

    • literal

      public final Literal literal
      The literal represented by this node
    • producers

      protected final ArrayList<StepNode> producers
      All step nodes which have this literal as an effect
    • consumers

      protected final ArrayList<StepNode> consumers
      All step nodes which have this literal as a precondition
  • Constructor Details

    • LiteralNode

      protected LiteralNode(PlanGraph graph, Literal literal)
      Constructs a new literal node for the given literal in the given plan graph.
      Parameters:
      graph - the graph in which this node will exist
      literal - the literal this node represents
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • setLevel

      protected boolean setLevel(int level)
      Description copied from class: Node
      Marks this node as having first appeared at the given level.
      Overrides:
      setLevel in class Node
      Parameters:
      level - the index of the level at which this node first appears
      Returns:
      true if this node's level was not previously set, false otherwise
    • getProducers

      public Iterable<StepNode> getProducers(int level)
      Returns all steps at a given level of the plan graph which have this literal as an effect.
      Parameters:
      level - the index of a level in the plan graph
      Returns:
      all steps which exist at that level and which have this literal as an effect
      Throws:
      IllegalArgumentException - if this literal does not exist at the given level
    • getConsumers

      public Iterable<StepNode> getConsumers(int level)
      Returns all steps at the next level of the plan graph which have this literal as a precondition. Note that when this method is called for level n, it returns steps which exist at level n + 1.
      Parameters:
      level - the index of a level in the plan graph at which this node exists
      Returns:
      all steps which exist at the next level and which have this literal as a precondition
      Throws:
      IllegalArgumentException - if this literal does not exist at the given level