animation.tr

Class Token

Known Direct Subclasses:
ClaimToken, LostToken, NormalToken, SendToken

(package private) abstract class Token
extends java.lang.Object

Field Summary

protected double
angle
Position as Radiant
protected int
lastStation
Station visited last
protected NetPaint
netPaint
protected int
pos
Position as angle on the circle (0..360)
protected int
priority
Priority of token (0..7)
protected int
reservePriority
(package private) int
xcenter
Dimension of drawing area
(package private) int
xradius
(package private) int
ycenter
(package private) int
yradius

Constructor Summary

Token(int p, NetPaint np)

Method Summary

Token
advanceToken()
Token
advanceToken(int p)
void
drawToken()
abstract void
drawToken(Graphics g)
Draw the token represented
private String
getBinaryString(int i)
String
getPrioString()
String
getReservePrioString()
protected int
isAtStation()
Checks if token is on a station Warning: This algorithm relies on the fact that each degree on the 360 Degree circle will be hit at least once by the token!
void
updateDimensions()

Field Details

angle

protected double angle
Position as Radiant

lastStation

protected int lastStation
Station visited last

netPaint

protected NetPaint netPaint

pos

protected int pos
Position as angle on the circle (0..360)

priority

protected int priority
Priority of token (0..7)

reservePriority

protected int reservePriority

xcenter

(package private)  int xcenter
Dimension of drawing area

xradius

(package private)  int xradius

ycenter

(package private)  int ycenter

yradius

(package private)  int yradius

Constructor Details

Token

(package private)  Token(int p,
                         NetPaint np)
Parameters:
p - initial position as angle of the token on the ring

Method Details

advanceToken

public Token advanceToken()

advanceToken

public Token advanceToken(int p)

drawToken

public void drawToken()

drawToken

public abstract void drawToken(Graphics g)
Draw the token represented

getBinaryString

private String getBinaryString(int i)

getPrioString

public String getPrioString()

getReservePrioString

public String getReservePrioString()

isAtStation

protected int isAtStation()
Checks if token is on a station Warning: This algorithm relies on the fact that each degree on the 360 Degree circle will be hit at least once by the token!
Returns:
number of station or -1 if not on station

updateDimensions

public void updateDimensions()