- java.lang.Object
-
- fr.inria.mochy.core.equalization.Token
-
- Direct Known Subclasses:
StopsLoicToken
public class Token extends Object
a token represents a train/metro... which stays a defined time in a place (moving or stopped/station) and is managed by the transitions
-
-
Field Summary
Fields Modifier and Type Field Description Token
postToken
Token
previousToken
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
advanceTime(float time)
advance the time as specified in parameter and update the position of the tokenfloat
allowedTime()
return the time to browse the place where it isvoid
blockToken()
block this token and the pre token at its headwayvoid
changePlace(EquPlace p, float timeToBrowse)
change the place when a token is at the end set the timeToBrowse for the new placefloat
getGhostSpeed()
get the ghost speed, the future speed the token will have when it will quit a stop placeEquPlace
getPlace()
get the place where the token isfloat
getSpeed()
get the speed of the tokenfloat
getTimeToBrowse()
get the time to browse the place for the tokenfloat
getxPlace()
get the position of the token in the placeFloat
getXTotal()
get the position of the token in the net loopboolean
isAtTheEnd()
check if the token is at the end of the placeboolean
isBlocked()
check if the token is blockedfloat
roundXTotal()
round the position of the token in the net loop up to 2 decimalsvoid
setGhostSpeed(float f)
set the ghost speed, the future speed the token will have when it will quit a stop placevoid
setSpeed(float f)
set the speed of the tokenvoid
setTimeToBrowse(float value)
set the time to browse the place for the tokenvoid
setXTotal(float xTotal)
set the position of the token in the net loopvoid
unblockToken()
unblock this token and its previous blocked tokens
-
-
-
Constructor Detail
-
Token
public Token()
instantiate a token
-
Token
public Token(EquPlace p, float timeToBrowse)
instantiate a token, set his place, time to browse the place, speed and its position in the net loop
-
-
Method Detail
-
isAtTheEnd
public boolean isAtTheEnd()
check if the token is at the end of the place
-
changePlace
public void changePlace(EquPlace p, float timeToBrowse)
change the place when a token is at the end set the timeToBrowse for the new place
-
allowedTime
public float allowedTime()
return the time to browse the place where it is
-
advanceTime
public void advanceTime(float time)
advance the time as specified in parameter and update the position of the token- Parameters:
time
-
-
blockToken
public void blockToken()
block this token and the pre token at its headway
-
unblockToken
public void unblockToken()
unblock this token and its previous blocked tokens
-
getxPlace
public float getxPlace()
get the position of the token in the place
-
getPlace
public EquPlace getPlace()
get the place where the token is
-
getXTotal
public Float getXTotal()
get the position of the token in the net loop
-
roundXTotal
public float roundXTotal()
round the position of the token in the net loop up to 2 decimals
-
setXTotal
public void setXTotal(float xTotal)
set the position of the token in the net loop
-
getSpeed
public float getSpeed()
get the speed of the token
-
setSpeed
public void setSpeed(float f)
set the speed of the token- Parameters:
f
- the speed
-
getGhostSpeed
public float getGhostSpeed()
get the ghost speed, the future speed the token will have when it will quit a stop place
-
setGhostSpeed
public void setGhostSpeed(float f)
set the ghost speed, the future speed the token will have when it will quit a stop place- Parameters:
f
-
-
isBlocked
public boolean isBlocked()
check if the token is blocked
-
getTimeToBrowse
public float getTimeToBrowse()
get the time to browse the place for the token
-
setTimeToBrowse
public void setTimeToBrowse(float value)
set the time to browse the place for the token
-
-