is.lill.acre.protocol
Class State

java.lang.Object
  extended by is.lill.acre.protocol.State

public class State
extends java.lang.Object


Field Summary
protected  java.util.Set<Transition> inTransitions
           
protected  java.util.Set<Transition> outTransitions
           
 
Constructor Summary
State(java.lang.String name)
          Constructor
 
Method Summary
 void addInTransition(Transition transition)
           
 void addOutTransition(Transition transition)
          Add a transition that starts at this State
 java.util.Set<Transition> getInTransitions()
           
 java.lang.String getName()
          Get the name of this State
 java.util.Set<State> getNextStates()
          Find all the states that are reachable from this State.
 java.util.Set<Transition> getOutTransitions()
           
 java.util.Set<State> getPreviousStates()
          Find all states from which it is possible to reach this state directly.
 StateType getType()
           
 boolean isInitialState()
           
 boolean isTerminalState()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

inTransitions

protected java.util.Set<Transition> inTransitions

outTransitions

protected java.util.Set<Transition> outTransitions
Constructor Detail

State

public State(java.lang.String name)
Constructor

Parameters:
name -
type - Type of State being created. Options are State.INITIAL, State.MIDDLE or State.TERMINAL.
Method Detail

getInTransitions

public java.util.Set<Transition> getInTransitions()

getOutTransitions

public java.util.Set<Transition> getOutTransitions()

getName

public java.lang.String getName()
Get the name of this State

Returns:
State name

addOutTransition

public void addOutTransition(Transition transition)
Add a transition that starts at this State

Parameters:
transition -

addInTransition

public void addInTransition(Transition transition)

isInitialState

public boolean isInitialState()

isTerminalState

public boolean isTerminalState()

getType

public StateType getType()

getNextStates

public java.util.Set<State> getNextStates()
Find all the states that are reachable from this State. Can be used to search further into the space.

Returns:
A Set of State object representing all available next states

getPreviousStates

public java.util.Set<State> getPreviousStates()
Find all states from which it is possible to reach this state directly. Useful for searching backwards through the search space.

Returns:
A Set of State objects representing all possible previous states.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object