Main Page   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 for $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 413 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 69 of file SoccerTypes.C.

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 188 of file SoccerTypes.C.

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 106 of file SoccerTypes.C.

References m_iTime.

Referenced by SenseHandler::analyzeSeeMessage(), SenseHandler::analyzeSenseMessage(), Object::getConfidence(), WorldModel::getCurrentCycle(), getTimeAddedWith(), getTimeDifference(), WorldModel::getTimeSinceLastCatch(), operator+(), operator+=(), operator-=(), operator<<(), WorldModel::show(), show(), WorldModel::showObjects(), 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 154 of file SoccerTypes.C.

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. When the time is stopped, but the actual time differens the value -1 is returned otherwise the difference in stopped time is returned. When the time is not stopped, the difference in the actual time is returned.

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

Definition at line 125 of file SoccerTypes.C.

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 114 of file SoccerTypes.C.

References m_iStopped.

Referenced by getTimeAddedWith(), getTimeDifference(), 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 138 of file SoccerTypes.C.

References m_iStopped.

Referenced by 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 298 of file SoccerTypes.C.

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 309 of file SoccerTypes.C.

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 219 of file SoccerTypes.C.

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 208 of file SoccerTypes.C.

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 256 of file SoccerTypes.C.

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 266 of file SoccerTypes.C.

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 238 of file SoccerTypes.C.

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 229 of file SoccerTypes.C.

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 276 of file SoccerTypes.C.

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 285 of file SoccerTypes.C.

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 350 of file SoccerTypes.C.

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 340 of file SoccerTypes.C.

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 371 of file SoccerTypes.C.

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 360 of file SoccerTypes.C.

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 247 of file SoccerTypes.C.

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 320 of file SoccerTypes.C.

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 330 of file SoccerTypes.C.

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 390 of file SoccerTypes.C.

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 380 of file SoccerTypes.C.

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 411 of file SoccerTypes.C.

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 399 of file SoccerTypes.C.

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 97 of file SoccerTypes.C.

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 198 of file SoccerTypes.C.

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 81 of file SoccerTypes.C.

References m_iStopped, and m_iTime.

Referenced by SenseHandler::analyzeSeeGlobalMessage(), SenseHandler::analyzeSenseMessage(), 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 423 of file SoccerTypes.C.


Member Data Documentation

int Time::m_iStopped [private]
 

Number of cycles stopped at m_iTime

Definition at line 416 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 415 of file SoccerTypes.h.

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


The documentation for this class was generated from the following files:
Generated on Thu Mar 7 00:37:58 2002 for UvA Trilearn 2001 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001