org.eclipse.palamedes.gdl.core.model.utils
Class AbstractState<T>

java.lang.Object
  extended by org.eclipse.palamedes.gdl.core.model.utils.AbstractState<T>
All Implemented Interfaces:
IGameState
Direct Known Subclasses:
StateAdapter

public abstract class AbstractState<T>
extends java.lang.Object
implements IGameState


Field Summary
protected  java.util.Map<java.lang.String,java.util.List<IFluent>> fluentMap
           
protected  java.util.List<IFluent> fluents
           
protected  T nativeState
           
 
Constructor Summary
AbstractState(T state)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.util.List<IMove[]> getCombinedLegalMoves()
          Returns the combined legal moves.
 java.util.List<IFluent> getFluentByName(java.lang.String name)
          Returns the fluents with the given name.
 java.util.List<java.lang.String> getFluentNames()
          Returns the fluents with the given name.
 java.util.List<IFluent> getFluents()
          Returns a list containing all fluents of the game state.
 int getGoalValue(int roleIndex)
          Returns the goal value for the player specified by roleIndex of the state if the state is a goal state; otherwise -1.
 int[] getGoalValues()
          Returns the goal values in the same order as IGame.getRoleNames()
 IMove[][] getLegalMoves()
          Returns an array of the legal moves of each player.
 T getNativeState()
          Returns the state object that was provided by the reasoner.
 int hashCode()
           
abstract  void initFluentList()
           
 boolean isTerminal()
          Returns true if the state is a terminal state; otherwise false.
 void setGoalValues(int[] goalValues)
          Sets the goal value of the game state.
 void setLegalMoves(IMove[][] legalMovesArray)
          Sets the legal moves for this game state.
 void setTerminal()
          Sets the terminal flag of the state.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nativeState

protected final T nativeState

fluents

protected java.util.List<IFluent> fluents

fluentMap

protected java.util.Map<java.lang.String,java.util.List<IFluent>> fluentMap
Constructor Detail

AbstractState

public AbstractState(T state)
Method Detail

initFluentList

public abstract void initFluentList()

getCombinedLegalMoves

public java.util.List<IMove[]> getCombinedLegalMoves()
Description copied from interface: IGameState
Returns the combined legal moves.

Specified by:
getCombinedLegalMoves in interface IGameState

getFluentByName

public java.util.List<IFluent> getFluentByName(java.lang.String name)
Description copied from interface: IGameState
Returns the fluents with the given name.

Specified by:
getFluentByName in interface IGameState

getFluents

public java.util.List<IFluent> getFluents()
Description copied from interface: IGameState
Returns a list containing all fluents of the game state.

Specified by:
getFluents in interface IGameState

getFluentNames

public java.util.List<java.lang.String> getFluentNames()
Description copied from interface: IGameState
Returns the fluents with the given name.

Specified by:
getFluentNames in interface IGameState

getGoalValues

public int[] getGoalValues()
Description copied from interface: IGameState
Returns the goal values in the same order as IGame.getRoleNames()

Specified by:
getGoalValues in interface IGameState
See Also:
IGame.getRoleNames()

isTerminal

public boolean isTerminal()
Description copied from interface: IGameState
Returns true if the state is a terminal state; otherwise false.

Specified by:
isTerminal in interface IGameState

getGoalValue

public int getGoalValue(int roleIndex)
Description copied from interface: IGameState
Returns the goal value for the player specified by roleIndex of the state if the state is a goal state; otherwise -1.

Specified by:
getGoalValue in interface IGameState

setGoalValues

public void setGoalValues(int[] goalValues)
Description copied from interface: IGameState
Sets the goal value of the game state. If the value is unknown it should get a -1.

Specified by:
setGoalValues in interface IGameState

setTerminal

public void setTerminal()
Description copied from interface: IGameState
Sets the terminal flag of the state.

Specified by:
setTerminal in interface IGameState

getNativeState

public T getNativeState()
Description copied from interface: IGameState
Returns the state object that was provided by the reasoner.

Specified by:
getNativeState in interface IGameState

getLegalMoves

public IMove[][] getLegalMoves()
Description copied from interface: IGameState
Returns an array of the legal moves of each player. If not already resolved the method returns null.

Specified by:
getLegalMoves in interface IGameState

setLegalMoves

public void setLegalMoves(IMove[][] legalMovesArray)
Description copied from interface: IGameState
Sets the legal moves for this game state.

Specified by:
setLegalMoves in interface IGameState

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object