public class Session
extends java.lang.Object
Session
consists of Round
with in turn consists of Turn
.
From this session object some information about the current negotiation can be extracted.
Important is the startNewRound(Round)
method which is used to add a new round
to the session. At this moment (05-08-2014) adding new rounds to the session is the
responsibility of the SessionManager
.Constructor and Description |
---|
Session(java.util.Map<DeadlineType,java.lang.Object> deadlines)
Create a new instance of the session object.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map<DeadlineType,java.lang.Object> |
getDeadlines()
Gets the deadline constraints
|
Action |
getMostRecentAction()
Get the most recently executed action.
|
Round |
getMostRecentRound()
Get the most recent round.
|
int |
getRoundNumber()
Get the current round number.
|
java.util.ArrayList<Round> |
getRounds()
Gets the number of rounds currently in this session.
|
long |
getRuntimeInNanoSeconds() |
double |
getRuntimeInSeconds() |
int |
getTurnNumber()
Get the current turn number.
|
boolean |
isDeadlineReached()
Check whether one of the deadlines is reached.
|
boolean |
isFirstRound()
Check whether this is the first round (round 1).
|
boolean |
isTimerRunning() |
void |
setDeadlines(java.util.HashMap<DeadlineType,java.lang.Object> deadlines)
Sets the deadline constrains
|
void |
setRuntimeInNanoSeconds(long nanoSeconds) |
void |
setRuntimeInSeconds(double seconds) |
void |
startNewRound(Round round)
Add a round to this session.
|
void |
startTimer()
Updates the timestamp of this
Session . |
void |
stopTimer()
Updates the timestamp of this
Session . |
public Session(java.util.Map<DeadlineType,java.lang.Object> deadlines)
Session
.deadlines
- Map of deadline constraintspublic java.util.Map<DeadlineType,java.lang.Object> getDeadlines()
public void setDeadlines(java.util.HashMap<DeadlineType,java.lang.Object> deadlines)
deadlines
- a map of deadline types and valuespublic void startTimer()
Session
. Use just before starting the negotiation for
most accurate timing. Timing is used in for example time deadline constraints. But might
also be used in log messages as well as statistics.public void stopTimer()
Session
. Use just after finish the negotiation for
most accurate timing. Timing is used in for example time deadline constraints. But might
also be used in log messages as well as statistics. If you need to manually set it, consider
using the setRuntimeInNanoSeconds(long)
function.public java.util.ArrayList<Round> getRounds()
startNewRound(Round)
is
called a new round will be added. Each round already includes all its Turn
s, but some
turns might not yet been done.public Round getMostRecentRound()
getRounds()
method.public void startNewRound(Round round)
Protocol.getRoundStructure(java.util.List, Session)
round
- The round to add to this session.public int getRoundNumber()
public int getTurnNumber()
public boolean isFirstRound()
getRoundNumber()
equals 1public Action getMostRecentAction()
public boolean isDeadlineReached()
public long getRuntimeInNanoSeconds()
public double getRuntimeInSeconds()
public void setRuntimeInNanoSeconds(long nanoSeconds)
public void setRuntimeInSeconds(double seconds)
public boolean isTimerRunning()