Class Node

java.lang.Object
edu.uky.ai.planning.pg.Node
All Implemented Interfaces:
Comparable<Node>
Direct Known Subclasses:
LiteralNode, StepNode

public abstract class Node extends Object implements Comparable<Node>
The abstract superclass of LiteralNode and StepNode.
Author:
Stephen G. Ware
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final PlanGraph
    The graph to which this node belongs
    protected int
    The index of the level at which this node first appears, or -1 if it has not yet appeared
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Node(PlanGraph graph)
    Constructs a new node object in the given plan graph.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Node other)
     
    boolean
    exists(int level)
    Tests whether or not this node exists at a given level.
    int
    Returns the index of the earliest level at which this node appears, or -1 if this node has not yet appeared at any level.
    protected void
    Marks this node as needing to be reset when the plan graph is reset.
    boolean
    mutex(Node node, int level)
    Tests whether or not this node is mutually exclusive with another given node at the given level.
    protected void
    Resets this node (called when the plan graph is being reset).
    protected boolean
    setLevel(int level)
    Marks this node as having first appeared at the given level.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • graph

      protected final PlanGraph graph
      The graph to which this node belongs
    • level

      protected int level
      The index of the level at which this node first appears, or -1 if it has not yet appeared
  • Constructor Details

    • Node

      protected Node(PlanGraph graph)
      Constructs a new node object in the given plan graph.
      Parameters:
      graph - the plan graph
  • Method Details

    • compareTo

      public int compareTo(Node other)
      Specified by:
      compareTo in interface Comparable<Node>
    • exists

      public boolean exists(int level)
      Tests whether or not this node exists at a given level.
      Parameters:
      level - the index of a level in the plan graph
      Returns:
      true if this node appears at the given level, false otherwise
    • getLevel

      public int getLevel()
      Returns the index of the earliest level at which this node appears, or -1 if this node has not yet appeared at any level.
      Returns:
      this node's earliest level or -1
    • setLevel

      protected boolean setLevel(int level)
      Marks this node as having first appeared at the given level.
      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
    • markForReset

      protected void markForReset()
      Marks this node as needing to be reset when the plan graph is reset.
    • mutex

      public boolean mutex(Node node, int level)
      Tests whether or not this node is mutually exclusive with another given node at the given level.
      Parameters:
      node - some other node in the graph
      level - the index of a level in this graph
      Returns:
      true if these nodes are mutex at this level, false otherwise
      Throws:
      IllegalArgumentException - if either node does not exist at the given level
    • reset

      protected void reset()
      Resets this node (called when the plan graph is being reset).