|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.games.states.GameState net.sourceforge.cilib.games.states.ListGameState
public class ListGameState
This is a GameState where GameItem's are stored in a list of items. This implies that any items position in the list has not correlation to the items location in the game. This is usefull when you have items in large 2 or 3 dimensional spaces and you would more likely look for an item by searching through a list than quering a location in a known structure.
Field Summary | |
---|---|
protected List<GameItem> |
currentState
|
Fields inherited from class net.sourceforge.cilib.games.states.GameState |
---|
currentIteration, randomizer |
Constructor Summary | |
---|---|
ListGameState()
|
|
ListGameState(ListGameState other)
Copy constructor |
Method Summary | |
---|---|
void |
addGameItem(GameItem item)
Add an item to the game state at the end of the list. |
void |
clearState()
Clear the state and reset it to a start state. |
ListGameState |
getClone()
Create a cloned copy of the current object and return it. |
GameItem |
getItem(Enum itemToken)
Returns first item that contains specified token |
GameItem |
getItem(int index)
Get an item with the specified index in the list. |
GameItem |
getItem(ItemLocation location)
Get an item that matches a given ItemLocation |
int |
getSize()
|
Methods inherited from class net.sourceforge.cilib.games.states.GameState |
---|
getCurrentIteration, getRandomizer, increaseIteration, resetIterationCount, setRandomizer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected List<GameItem> currentState
Constructor Detail |
---|
public ListGameState()
public ListGameState(ListGameState other)
other
- Method Detail |
---|
public int getSize()
public void addGameItem(GameItem item)
item
- the item to addpublic void clearState()
clearState
in class GameState
public GameItem getItem(int index)
index
- the index in the list of items
public GameItem getItem(ItemLocation location)
location
- the location
null
is returnedpublic GameItem getItem(Enum itemToken)
itemToken
- the target token
public ListGameState getClone()
getClone
in interface Cloneable
getClone
in class GameState
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |