|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--de.uni_paderborn.robots.robotArenaInterface.proxy.Proxy
This class is the proxy to be integrated between the arena and a robot.
RobotFunctions,
ProxyFactory| Field Summary | |
private static java.lang.String |
arenaName
The name of the arena. |
private boolean |
doneSomething
Indicates that the proxy has executed at least one action. |
private static int |
exchangeState
The current state of the exchange procedure. |
private static int |
finalRound
The number of the final round. |
private static boolean |
firstOk
Remembers the first robot's answer until the end of the exchange procedure. |
private static CardData |
firstProposal
Remembers the first robot's proposal until the end of the exchange procedure. |
private static int |
firstRobotUID
Remembers the first robot's UID until the end of the exchange procedure. |
private static long |
gameUID
A unique identifier for the game. |
private static ProxyFactory |
proxyFactory
Reference to the ProxyFactory for accessing the database. |
private RobotFunctions |
robot
The robot this proxy belongs to. |
private int |
robotUID
The unique identifier of the robot. |
private static int |
round
The number of the current round. |
private static CardData |
secondProposal
Remembers the second robot's proposal until the end of the exchange procedure. |
private static int |
secondRobotUID
Remembers the second robot's UID until the end of the exchange procedure. |
private static java.util.HashSet |
servedExchangeRobotUIDs
The unique identifier pairs of the robots which have taken part in the exchange procedure. |
private static java.util.HashSet |
servedRobotUIDs
The unique identifiers of the robots which have executed a command in the current round. |
static int |
STATE_WAIT_FOR_FIRST_OK
State for tracking the exchange procedure. |
static int |
STATE_WAIT_FOR_FIRST_PROPOSAL
State for tracking the exchange procedure. |
static int |
STATE_WAIT_FOR_SECOND_OK
State for tracking the exchange procedure. |
static int |
STATE_WAIT_FOR_SECOND_PROPOSAL
State for tracking the exchange procedure. |
private long |
timeForLastAction
The time the robot needed for the last action. |
| Constructor Summary | |
Proxy(RobotFunctions robot,
int robotUID)
Constructs this class. |
|
| Method Summary | |
boolean |
exchangeOk(CardData myCard,
CardData otherCard)
Asks the robot if it wants to exchange his card with the card of the other robot. |
CardData |
exchangeProposal(CardData[] cards)
Asks the robot if it wants to exchange a card. |
AbstractRobotAction |
getCommand(RobotData robotData)
Asks the robot for its next command. |
java.lang.Class |
getRobotClass()
Returns the class of the robot this proxy is wrapped around. |
int |
getRobotUID()
Returns the unique identifier of the robot this proxy is wrapped around. |
long |
getTimeForLastAction()
Returns the time the robot needed for the last action. |
(package private) static void |
init(ProxyFactory pf,
java.lang.String an)
Does the required initialization. |
(package private) static void |
newGame(long gu)
Does the required initialization for a new game. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int STATE_WAIT_FOR_FIRST_PROPOSAL
public static final int STATE_WAIT_FOR_SECOND_PROPOSAL
public static final int STATE_WAIT_FOR_FIRST_OK
public static final int STATE_WAIT_FOR_SECOND_OK
private static int finalRound
private static int exchangeState
private static int firstRobotUID
private static int secondRobotUID
private static CardData firstProposal
private static CardData secondProposal
private static boolean firstOk
private static ProxyFactory proxyFactory
private static java.lang.String arenaName
private static long gameUID
private static int round
private static java.util.HashSet servedRobotUIDs
private static java.util.HashSet servedExchangeRobotUIDs
private int robotUID
private RobotFunctions robot
private long timeForLastAction
private boolean doneSomething
| Constructor Detail |
public Proxy(RobotFunctions robot,
int robotUID)
proxyFactory - reference to the proxy factory (for accessing factory methods)robot - the robot to wrap the proxy aroundarenaName - the name of the arenagameUID - a unique identifier of the game| Method Detail |
static void init(ProxyFactory pf,
java.lang.String an)
static void newGame(long gu)
public AbstractRobotAction getCommand(RobotData robotData)
getCommand in interface RobotFunctionsrobotData - the robot's current data setpublic CardData exchangeProposal(CardData[] cards)
exchangeProposal in interface RobotFunctionscards - the robot's current handnull otherwise
public boolean exchangeOk(CardData myCard,
CardData otherCard)
exchangeOk in interface RobotFunctionsmyCard - the robot's card to be exchanged with the other robot's cardotherCard - the other robot's card to be exchanged with the robot's cardtrue if the robot want the cards to be exchanged or false otherwisepublic int getRobotUID()
public java.lang.Class getRobotClass()
public long getTimeForLastAction()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||