lnsc.page
Class AbstractState

java.lang.Object
  |
  +--lnsc.page.AbstractState
All Implemented Interfaces:
java.lang.Cloneable, State
Direct Known Subclasses:
AbstractStateWithGen, ExperimentState, MonkeyObservableState

public abstract class AbstractState
extends java.lang.Object
implements State

Optional basis for class implementing State interface. Derived classes constructor must fill the protected variables. Add necessary state information and properties. By default do, undo and clone are not supported, but can be added in derived classes. When setting IsCloneable to true, basic cloning is automatically inherited from Object. By default states are observable, and hence getObservableStates return itself. Default implementation for getActionsEnumerator() uses State.getActions().


Constructor Summary
AbstractState()
           
 
Method Summary
 boolean areActionsFixed()
          Indicates whether the list of actions is fixed (always the same) or not.
 java.lang.Object clone()
           
 void doAction(Action a)
          Do an action.
 int getActionCount()
          Indicates how many actions it generates.
 java.util.Enumeration getActionsEnumerator()
          Returns an iterator that list the available actions from the current state.
 State[] getObservableStates()
          Returns the list state of observable states for the agents.
 double getProbability()
          Probability of the state, for non-deterministic StateGenerators only.
 double getValue()
          Value associated to the state.
 boolean isCloneable()
          Indicates whether or not the state can be copied
 boolean isDeterministic()
          Indicates whether only the resulting state is returned or whether a list of possible next states is returned.
 boolean isFinal()
          Indicates whether or not a state is final (generally a goal state).
 boolean isObservable()
          Indicates whether of not a state is observable by agents.
 boolean isValid()
          Indicates whether the state is valid or not.
 boolean supportsDo()
          Indicates whether or not do action is supported locally.
 boolean supportsUndo()
          Indicates whether or not undo action is supported.
 DataSet toDataSet()
          Similar to the toString method, but return state content in the form of a DataSet.
 java.lang.String toString()
           
 void undoAction()
          Undo last action done.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface lnsc.page.State
getActions, getNextStates
 

Constructor Detail

AbstractState

public AbstractState()
Method Detail

areActionsFixed

public boolean areActionsFixed()
Description copied from interface: State
Indicates whether the list of actions is fixed (always the same) or not.

Specified by:
areActionsFixed in interface State
Returns:
true if the list of action is independent of the state, false otherwise

clone

public java.lang.Object clone()
Specified by:
clone in interface State
Overrides:
clone in class java.lang.Object

doAction

public void doAction(Action a)
Description copied from interface: State
Do an action.

Specified by:
doAction in interface State

getActionCount

public int getActionCount()
Description copied from interface: State
Indicates how many actions it generates. For fixed it should return the number of actions, for unfixed, it should return -1.

Specified by:
getActionCount in interface State
Returns:
Number of actions.

getActionsEnumerator

public java.util.Enumeration getActionsEnumerator()
Description copied from interface: State
Returns an iterator that list the available actions from the current state.

Specified by:
getActionsEnumerator in interface State
Returns:
The actions enumerator.

getObservableStates

public State[] getObservableStates()
Description copied from interface: State
Returns the list state of observable states for the agents.

Specified by:
getObservableStates in interface State
Returns:
The list of observable states.

getProbability

public double getProbability()
Description copied from interface: State
Probability of the state, for non-deterministic StateGenerators only.

Specified by:
getProbability in interface State
Returns:
state probability.

getValue

public double getValue()
Description copied from interface: State
Value associated to the state.

Specified by:
getValue in interface State
Returns:
value of the sate.

isCloneable

public boolean isCloneable()
Description copied from interface: State
Indicates whether or not the state can be copied

Specified by:
isCloneable in interface State
Returns:
true if the clone function is implemented.

isDeterministic

public boolean isDeterministic()
Description copied from interface: State
Indicates whether only the resulting state is returned or whether a list of possible next states is returned. (Does not necessarly tells whether the environment is really deterministic or not!)

Specified by:
isDeterministic in interface State
Returns:
true if their is only one resulting state, false otherwise.

isFinal

public boolean isFinal()
Description copied from interface: State
Indicates whether or not a state is final (generally a goal state).

Specified by:
isFinal in interface State
Returns:
true if it is a final state (end of episode), false otherwise.

isObservable

public boolean isObservable()
Description copied from interface: State
Indicates whether of not a state is observable by agents. (Has nothing to do with java.util.Observable!)

Specified by:
isObservable in interface State
Returns:
true us the state is fully obervable by agents.

isValid

public boolean isValid()
Description copied from interface: State
Indicates whether the state is valid or not.

Specified by:
isValid in interface State
Returns:
true if it is valid, false otherwise.

supportsDo

public boolean supportsDo()
Description copied from interface: State
Indicates whether or not do action is supported locally.

Specified by:
supportsDo in interface State
Returns:
true if the do function is implemented.

supportsUndo

public boolean supportsUndo()
Description copied from interface: State
Indicates whether or not undo action is supported.

Specified by:
supportsUndo in interface State
Returns:
true if the undo function is implemented.

toDataSet

public DataSet toDataSet()
Description copied from interface: State
Similar to the toString method, but return state content in the form of a DataSet. Can be null.

Specified by:
toDataSet in interface State
Returns:
A DataSet containing a description of the State.

toString

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

undoAction

public void undoAction()
Description copied from interface: State
Undo last action done.

Specified by:
undoAction in interface State