Class Trajectory

java.lang.Object
  |
  +--Trajectory

public class Trajectory
extends Object

This class represents a trajectory, i.e. a sequence

   s0, a0, s1, a1, ..., a(n-1), sn
 
where s0...sn are states and a0...a(n-1) are compound actions. The above trajectory is said to consist of n+1 steps.


Constructor Summary
Trajectory(Vector f)
          Constructs a trajectory whose states are subsets of the given fluents.
 
Method Summary
 void extendTimeSteps(int step)
          Ensures that the trajectory is large enough to contain the given step.
 ActionSequence getActionSequence()
          Returns the sequence of actions a0, a1,...,a(n-1) of the trajectory.
 int getLastTime()
          Returns the index of the last step in the trajectory.
 int getLength()
          Returns the number of steps in the trajectory.
 State getState(int step)
          Retrieves a state from the trajectory based on its index.
 Enumeration getStates()
          Returns an Enumeration of all the states in the trajectory.
 void setState(int step, State state)
          Sets a state in the trajectory.
 String toString()
          Returns a string representation of the whole trajectory States and compound actions are represented as sets, and are comma-separated.
 String toString(int fromStep)
          Returns a string representation of the trajectory, starting from the given step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trajectory

public Trajectory(Vector f)
Constructs a trajectory whose states are subsets of the given fluents.
Parameters:
f - the set of fluents of which the states will be subsets
Method Detail

extendTimeSteps

public void extendTimeSteps(int step)
Ensures that the trajectory is large enough to contain the given step.
Parameters:
step - the step that must be contained in the sequence

setState

public void setState(int step,
                     State state)
Sets a state in the trajectory.
Parameters:
step - the step whose state must be set
state - the new state for the given step

getLength

public int getLength()
Returns the number of steps in the trajectory.
Returns:
the number of steps in the trajectory

getLastTime

public int getLastTime()
Returns the index of the last step in the trajectory.
Returns:
the index of the last step in the trajectory

getState

public State getState(int step)
Retrieves a state from the trajectory based on its index.
Parameters:
step - the index of the state to be retrieved
Returns:
the retrieved state

getStates

public Enumeration getStates()
Returns an Enumeration of all the states in the trajectory.
Returns:
the Enumeration of all the states in the trajectory

getActionSequence

public ActionSequence getActionSequence()
Returns the sequence of actions a0, a1,...,a(n-1) of the trajectory.
Returns:
the ActionSequence contained in the trajectory

toString

public String toString(int fromStep)
Returns a string representation of the trajectory, starting from the given step. States and compound actions are represented as sets, and are comma-separated.
Parameters:
fromStep - the first step to show in the string
Returns:
the string representation of the trajectory

toString

public String toString()
Returns a string representation of the whole trajectory States and compound actions are represented as sets, and are comma-separated.
Overrides:
toString in class Object
Returns:
the string representation of the trajectory