cz.cuni.pogamut.communication
Enum CommunicationState
java.lang.Object
java.lang.Enum<CommunicationState>
cz.cuni.pogamut.communication.CommunicationState
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<CommunicationState>
public enum CommunicationState
- extends java.lang.Enum<CommunicationState>
Communication states are reflecting things which happens before
the bot is spawned within UT.
It's used within AgentBody class and controled from AgentBody.sendMessageToClient()
which is getting messages from parser.
The communication goes like this:
1) receive HELLO BOT message from server (HelloBot class) => reply with READY
... CommunicationState.START
2) receive NFO message about the server and the type of game
... CommunicationState.MAP_RECEIVE_NFO
3) receive list of map's navpoints
... CommunicationState.MAP_RECEIVE_NAVPOINTS_EXPECTED,
... CommunicationState.MAP_RECEIVING_NAVPOINTS
4) receive list of map's items
... CommunicationState.MAP_RECEIVE_ITEMS_EXPECTED,
... CommunicationState.MAP_RECEIVING_ITEMS
5) await for logic to start
... CommunicationState.AWAITING_LOGIC
6) init the bot
... CommunicationState.BOT_RUNNING
7) after MapFinish message, change to the state
... CommunicationState.FAIL
If game is paused (the agent receive PAUSED message),
the Agent will pause itself and change the CommunicationState
into PAUSED.
After RESUMED message is received, it will change back to BOT_RUNNING
Whenever any exception occured / the communication is different (getting
wrong message at wrong time) the communication state is switched to
CommunicationState.FAIL
Methods inherited from class java.lang.Enum |
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
START
public static final CommunicationState START
MAP_RECEIVE_NFO
public static final CommunicationState MAP_RECEIVE_NFO
MAP_RECEIVE_NAVPOINTS_EXPECTED
public static final CommunicationState MAP_RECEIVE_NAVPOINTS_EXPECTED
MAP_RECEIVING_NAVPOINTS
public static final CommunicationState MAP_RECEIVING_NAVPOINTS
MAP_RECEIVE_ITEMS_EXPECTED
public static final CommunicationState MAP_RECEIVE_ITEMS_EXPECTED
MAP_RECEIVING_ITEMS
public static final CommunicationState MAP_RECEIVING_ITEMS
MAP_RECEIVE_PLAYERS_EXPECTED
public static final CommunicationState MAP_RECEIVE_PLAYERS_EXPECTED
MAP_RECEIVING_PLAYERS
public static final CommunicationState MAP_RECEIVING_PLAYERS
AWAITING_LOGIC
public static final CommunicationState AWAITING_LOGIC
BOT_RUNNING
public static final CommunicationState BOT_RUNNING
PAUSED
public static final CommunicationState PAUSED
TERMINATED
public static final CommunicationState TERMINATED
FAIL
public static final CommunicationState FAIL
EXCEPTION
public static final CommunicationState EXCEPTION
MAP_FINISHED
public static final CommunicationState MAP_FINISHED
endStates
private static java.util.Set<CommunicationState> endStates
helpMessage
private java.lang.String helpMessage
values
public static CommunicationState[] values()
- Returns an array containing the constants of this enum type, in
the order they are declared. This method may be used to iterate
over the constants as follows:
for (CommunicationState c : CommunicationState.values())
System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in
the order they are declared
valueOf
public static CommunicationState valueOf(java.lang.String name)
- Returns the enum constant of this type with the specified name.
The string must match exactly an identifier used to declare an
enum constant in this type. (Extraneous whitespace characters are
not permitted.)
- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is null
getHelpMessage
public java.lang.String getHelpMessage()
isEndState
public boolean isEndState()
getEndStates
public static java.util.Set<CommunicationState> getEndStates()