Package sudoku
Class AgentMap<T>
- java.lang.Object
-
- sudoku.AgentMap<T>
-
public class AgentMap<T> extends Object
Map from global Table id to internal index and Table reference. Data structure for storing Tables - agents registered to this Player.
-
-
Constructor Summary
Constructors Constructor Description AgentMap(int maxAgentCount)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
getAgent(int i)
Get agent reference by internal index.T
getAgentById(int id)
Get agent reference by global id.int
getAgentCount()
int
getIndex(int id)
Get internal index by global id.boolean
isFull()
Check whether more agents can be registered.void
register(int globalId, T agentRef)
Register new agent in the map.
-
-
-
Method Detail
-
getAgent
public T getAgent(int i)
Get agent reference by internal index.- Parameters:
i
- internal index- Returns:
- agent reference
-
getAgentById
public T getAgentById(int id)
Get agent reference by global id.- Parameters:
id
- agent global id- Returns:
- agent reference
-
getIndex
public int getIndex(int id)
Get internal index by global id.- Parameters:
id
- agent global id- Returns:
- internal index
-
register
public void register(int globalId, T agentRef)
Register new agent in the map. Does not perform a check for registering more agents than it should.- Parameters:
globalId
- registered agent's global idagentRef
- reference to the registered agent
-
isFull
public boolean isFull()
Check whether more agents can be registered.- Returns:
- true, if cannot register more agents
-
getAgentCount
public int getAgentCount()
-
-