Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Time Class Reference

#include <SoccerTypes.h>

List of all members.

Public Methods

 Time (int iTime=-1, int iStopped=0)
bool updateTime (int iTime)
bool setTimeStopped (int iTime)
int getTime ()
int getTimeStopped ()
int getTimeDifference (Time t)
bool isStopped ()
Time getTimeAddedWith (int iCycles)
bool addToTime (int iCycles)
void show (ostream &os=cout)
Time operator+ (const int &i)
Time operator+ (Time t)
Time operator- (const int &i)
int operator- (Time t)
void operator= (const int &i)
void operator+= (Time t)
void operator+= (const int &i)
void operator-= (Time t)
void operator-= (const int &i)
bool operator!= (Time t)
bool operator!= (const int &i)
bool operator== (Time t)
bool operator== (const int &i)
bool operator< (Time t)
bool operator< (const int &i)
bool operator<= (Time t)
bool operator<= (const int &i)
bool operator> (Time t)
bool operator> (const int &i)
bool operator>= (Time t)
bool operator>= (const int &i)

Private Attributes

int m_iTime
int m_iStopped

Friends

ostream & operator<< (ostream &os, Time t)


Detailed Description

This class contains the time representation of the soccer server. It is represented by an ordered pair (t,s) where t denotes the current server cycle and s is the number of cycles since the clock has stopped. Here the value for t equals that of the time stamp contained in the last message received from the server, whereas the value $s$ will always be 0 while the game is in progress. It is only during certain dead ball situations (e.g. an offside call leading to a free kick) that this value will be different, since in these cases the server time will stop while cycles continue to pass (i.e. actions can still be performed). Representing the time in this way has the advantage that it allows the players to reason about the number of cycles between events in a meaningful way.

Definition at line 523 of file SoccerTypes.h.


Constructor & Destructor Documentation

Time::Time int    iTime = -1,
int    iStopped = 0
 

This is the constructor for the Time class, it receives two arguments. The actual time and how long the time has stopped.

Parameters:
iTime  actual time
iStopped  number of cycles time stopped

Definition at line 75 of file SoccerTypes.cpp.

References m_iStopped, and m_iTime.

Referenced by getTimeAddedWith(), operator!=(), operator+(), and operator<().


Member Function Documentation

bool Time::addToTime int    iCycles
 

This method adds 'iCycles' to the current time. The current values are updated. The method getTimeAddedWith is used to calculated the new time.

Parameters:
iCycles  time added to the current time
Returns:
boolean indicating whether update was successful

Definition at line 195 of file SoccerTypes.cpp.

References getTimeAddedWith().

Referenced by operator+=(), and operator-=().

int Time::getTime  
 

This method returns the actual time, that is the number of cycles that have passed.

Returns:
actual time.

Definition at line 112 of file SoccerTypes.cpp.

References m_iTime.

Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Object::getConfidence(), WorldModel::getCurrentCycle(), getTimeAddedWith(), getTimeDifference(), WorldModel::getTimeSinceLastCatch(), BasicCoach::mainLoopNormal(), WorldModel::mapUnknownPlayers(), operator+(), operator+=(), operator-=(), operator<<(), WorldModel::predictNrCyclesToPoint(), WorldModel::processPerfectHearInfoBall(), WorldModel::processPlayerMessage(), WorldModel::removeGhosts(), BasicPlayer::searchBall(), WorldModel::show(), show(), WorldModel::updateAfterSeeMessage(), and WorldModel::updateAgentAndBallAfterSense().

Time Time::getTimeAddedWith int    iCycles
 

This method returns a new time class denoting the time when 'iCycles' are added to the current time. There are different situations possible. When the added time is positive and the time stands still, the cycles are added to the stopped time, otherwise they are added to the actual time. When the added time is negative and the time stands still, the cycles are subtracted from the stopped time. Otherwise the time is subtracted from the actual time.

Parameters:
iCycles  denotes the time that should be added (when negative subtracted) to the current time
Returns:
new time object with 'iCycles' added to the current time. 'iCycles' can be negative in which case a subtraction is performed.

Definition at line 161 of file SoccerTypes.cpp.

References getTime(), getTimeStopped(), and Time().

Referenced by addToTime(), operator+(), and operator-().

int Time::getTimeDifference Time    t
 

This method returns the time difference between two time objects.

Parameters:
t  Time with which current time should be compared
Returns:
time difference

Definition at line 128 of file SoccerTypes.cpp.

References getTime(), and getTimeStopped().

Referenced by SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Object::getConfidence(), operator!=(), operator-(), and operator<().

int Time::getTimeStopped  
 

This method returns the time the time has stopped, that is the number of cycles the time stood on the current value.

Returns:
stopped time

Definition at line 120 of file SoccerTypes.cpp.

References m_iStopped.

Referenced by SenseHandler::analyzeSenseMessage(), getTimeAddedWith(), getTimeDifference(), WorldModel::mapUnknownPlayers(), operator+(), operator+=(), operator<<(), and show().

bool Time::isStopped  
 

This method returns a boolean value indicating whether the time currently is stopped.

Returns:
boolean indicating whether the time currently is stopped

Definition at line 142 of file SoccerTypes.cpp.

References m_iStopped.

Referenced by WorldModel::drawCoordinationGraph(), and WorldModel::isTimeStopped().

bool Time::operator!= const int &    i
 

This method returns a boolean indicating whether the current time is inequal to the time specified by the integer 'i'. 'i' is first converted to the time object (i,0). When the time difference returned by getTimeDifference between these two time objects is inequal to zero true is returned, false otherwise

Parameters:
i  actual time with which current time should be compared
Returns:
bool indicating whether current time equals specified time

Definition at line 307 of file SoccerTypes.cpp.

References getTimeDifference(), and Time().

bool Time::operator!= Time    t
 

This method returns a boolean indicating whether the current time is inequal to the time t. When the time difference returned by getTimeDifference between these two time objects is inequal to zero true is returned, false otherwise.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time equals specified time

Definition at line 319 of file SoccerTypes.cpp.

References getTimeDifference().

Time Time::operator+ Time    t
 

This method returns the result of adding time 't' to the current time. No changes are made to the current object. It is defined by (t1,s1) + (t2,s2) = (t1+t2,s2). The stopped time of the first time tuple is neglected, since this has already been passed.

Parameters:
t  Time object that should be added to the current time
Returns:
new time object with 't' added to the current time

Definition at line 226 of file SoccerTypes.cpp.

References getTime(), getTimeStopped(), and Time().

Time Time::operator+ const int &    i
 

This method returns the time as if 'i' cycles would be added to the current time. The method getTimeAddedWith is used for this. No changes are made to the current object.

Parameters:
iCycles  denotes the time that should be added to the current time
Returns:
new time object with 'iCycles' added to the current time

Definition at line 215 of file SoccerTypes.cpp.

References getTimeAddedWith().

void Time::operator+= const int &    i
 

This method updates the time by adding 'i' cycles to the current time. The method addToTime is used for this.

Parameters:
i  denotes the time that should be added to the current time

Definition at line 263 of file SoccerTypes.cpp.

References addToTime().

void Time::operator+= Time    t
 

This method updates the time by adding the time 't' to the current time. It is defined by (t1,s1) + (t2,s2) = (t1+t2,s2). The stopped time of the first time tuple is neglected, since this has already been passed.

Parameters:
t  Time object that should be added to the current time

Definition at line 273 of file SoccerTypes.cpp.

References getTime(), getTimeStopped(), setTimeStopped(), and updateTime().

int Time::operator- Time    t
 

This method returns the result the difference between the two times and is equal to the method getTimeDifference.

Parameters:
t  Time object that should be subtracted from the current time
Returns:
new time object with 't' subtracted from the current time

Definition at line 245 of file SoccerTypes.cpp.

References getTimeDifference().

Time Time::operator- const int &    i
 

This method returns the time as if 'i' cycles would be subtracted from the current time. The method getTimeAddedWith is used for this. No changes are made to the current object.

Parameters:
iCycles  denotes the time that should be subtracted from the time
Returns:
new time object with 'iCycles' subracted

Definition at line 236 of file SoccerTypes.cpp.

References getTimeAddedWith().

void Time::operator-= const int &    i
 

This method updates the time by subtractign 'i' cycles from the current time. The method addToTime is used for this with '-i' as its argument.

Parameters:
i  denotes the time that should be subtracted

Definition at line 283 of file SoccerTypes.cpp.

References addToTime().

void Time::operator-= Time    t
 

This method updates the time by subtracting time 't' from the current time. It is defined by (t1,s1) + (t2,s2) = (t1-t2,0). The stopped time is set to zero.

Parameters:
t  Time object that should be subtracted from the current time

Definition at line 292 of file SoccerTypes.cpp.

References getTime(), setTimeStopped(), and updateTime().

bool Time::operator< const int &    i
 

This method returns a boolean indicating whether the current time is smaller than the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is smaller than given time

Definition at line 365 of file SoccerTypes.cpp.

References Time().

bool Time::operator< Time    t
 

This method returns a boolean indicating whether the current time is smaller than the time t. When the time difference returned by getTimeDifference is smaller than zero, true is returned, false otherwise

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is smaller than given time

Definition at line 354 of file SoccerTypes.cpp.

References getTimeDifference().

bool Time::operator<= const int &    i
 

This method returns a boolean indicating whether the current time is smaller than or equal to the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is smaller than or equal to 't'

Definition at line 388 of file SoccerTypes.cpp.

bool Time::operator<= Time    t
 

This method returns a boolean indicating whether the current time is smaller than or equal to the time t.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is smaller to or equal than 't'

Definition at line 376 of file SoccerTypes.cpp.

void Time::operator= const int &    i
 

This method returns a new time object (i,0). The argument 'i' is thus denoted as the actual time.

Parameters:
i  new time
Returns:
time object

Definition at line 254 of file SoccerTypes.cpp.

References setTimeStopped(), and updateTime().

bool Time::operator== const int &    i
 

This method returns a boolean indicating whether the current time equals the time as specified by the integer 'i'. 'i' is first converted to the time object (i,0). When the time difference returned by getTimeDifference between these two time objects equals zero, true is returned, false otherwise

Parameters:
i  actual time with which current time should be compared
Returns:
bool indicating whether current time equals specified time

Definition at line 332 of file SoccerTypes.cpp.

bool Time::operator== Time    t
 

This method returns a boolean indicating whether the current time equals the time t. When the time difference returned by getTimeDifference between these two time objects equals zero, true is returned, false otherwise

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time equals specified time

Definition at line 342 of file SoccerTypes.cpp.

bool Time::operator> const int &    i
 

This method returns a boolean indicating whether the current time is larger than the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is larger than the given time

Definition at line 410 of file SoccerTypes.cpp.

bool Time::operator> Time    t
 

This method returns a boolean indicating whether the current time is larger than the time t, that is it is not smaller than or equal to 't'.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is larger than 't'

Definition at line 397 of file SoccerTypes.cpp.

bool Time::operator>= const int &    i
 

This method returns a boolean indicating whether the current time is larger than or equal to the time denoted by the integer 'i'. Herefore first a time object (i,0) is created.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is larger than or equal to the given time

Definition at line 431 of file SoccerTypes.cpp.

bool Time::operator>= Time    t
 

This method returns a boolean indicating whether the current time is larger than or equal to than the time t, that is it is not smaller than 't'.

Parameters:
t  time with which current time should be compared
Returns:
bool indicating whether current time is larger or equal than 't'

Definition at line 419 of file SoccerTypes.cpp.

bool Time::setTimeStopped int    iTime
 

This methods sets the stopped time, which denotes the number of cycles time stood still.

Parameters:
iTime  new stopped time
Returns:
boolean indicating whether update was successful

Definition at line 103 of file SoccerTypes.cpp.

References m_iStopped.

Referenced by operator+=(), operator-=(), and operator=().

void Time::show ostream &    os = cout
 

This method prints the time to the specified output stream. Time is printed as the two tuple (t,s) where t denotes the actual time and s the number of stopped cycles.

Parameters:
os  output stream to which output is written (default cout)

Definition at line 205 of file SoccerTypes.cpp.

References getTime(), and getTimeStopped().

bool Time::updateTime int    iTime
 

This method updates the time to 'iTime'. When the actual time was already 'iTime' the current time is kept unchanged and the time stopped is raised with one. Otherwise the actual time is changed to 'iTime' and the stopped time is set to 0.

Parameters:
iTime  new time
Returns:
boolean indicating whether update was successful

Definition at line 87 of file SoccerTypes.cpp.

References m_iStopped, and m_iTime.

Referenced by SenseHandler::analyzeFullStateMessage(), SenseHandler::analyzeSeeGlobalMessage(), SenseHandler::analyzeSenseMessage(), BasicPlayer::getInterceptionPointBall(), operator+=(), operator-=(), operator=(), and WorldModel::updateAgentAndBallAfterSense().


Friends And Related Function Documentation

ostream& operator<< ostream &    os,
Time    t
[friend]
 

Overloaded version of the C++ output operator for a Time class. This operator makes it possible to use Time objects in output statements (e.g. cout << t). The current cycle and the stopped time are printed in the format (t1,t2).

Parameters:
os  output stream to which information should be written
v  a Time object which must be printed
Returns:
output stream containing (x,y)

Definition at line 443 of file SoccerTypes.cpp.


Member Data Documentation

int Time::m_iStopped [private]
 

Number of cycles stopped at m_iTime

Definition at line 526 of file SoccerTypes.h.

Referenced by getTimeStopped(), isStopped(), setTimeStopped(), Time(), and updateTime().

int Time::m_iTime [private]
 

Number of cycles, denoting the time

Definition at line 525 of file SoccerTypes.h.

Referenced by getTime(), Time(), and updateTime().


The documentation for this class was generated from the following files:
Generated on Fri Nov 7 11:46:08 2003 for UvA Trilearn 2003 Base Code by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001