Class 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
    • Constructor Summary

      Constructors 
      Constructor Description
      Token()
      instantiate a token
      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 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 token
      float allowedTime()
      return the time to browse the place where it is
      void blockToken()
      block this token and the pre token at its headway
      void changePlace​(EquPlace p, float timeToBrowse)
      change the place when a token is at the end set the timeToBrowse for the new place
      float getGhostSpeed()
      get the ghost speed, the future speed the token will have when it will quit a stop place
      EquPlace getPlace()
      get the place where the token is
      float getSpeed()
      get the speed of the token
      float getTimeToBrowse()
      get the time to browse the place for the token
      float getxPlace()
      get the position of the token in the place
      Float getXTotal()
      get the position of the token in the net loop
      boolean isAtTheEnd()
      check if the token is at the end of the place
      boolean isBlocked()
      check if the token is blocked
      float roundXTotal()
      round the position of the token in the net loop up to 2 decimals
      void setGhostSpeed​(float f)
      set the ghost speed, the future speed the token will have when it will quit a stop place
      void setSpeed​(float f)
      set the speed of the token
      void setTimeToBrowse​(float value)
      set the time to browse the place for the token
      void setXTotal​(float xTotal)
      set the position of the token in the net loop
      void unblockToken()
      unblock this token and its previous blocked tokens
    • Field Detail

      • previousToken

        public Token previousToken
      • postToken

        public Token postToken
    • 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