Class jovial.slotCar.track.TrackSegment
All Packages Class Hierarchy This Package Previous Next Index
Class jovial.slotCar.track.TrackSegment
java.lang.Object
|
+----jovial.slotCar.animator.Drawable
|
+----jovial.slotCar.track.TrackSegment
- public class TrackSegment
- extends Drawable
Represents a segment of a race track.
-
canMove()
-
-
color()
-
-
erase(Graphics)
- Erase this drawable.
-
firstSlotIsNearOrigin()
-
-
height()
- Give the height of this Drawable
-
movePositionBy(TrackPosition, double)
- Move a position along the track, possibly progressing to next
segment.
-
next()
- Get the next segment
-
setFirstSlotIsNearOrigin(boolean)
- Set if slot 0 is near the origin.
-
setHeight(int)
- Set the height of this segment
-
setNext(TrackSegment)
- Set the next segment pointer.
height
public int height()
- Give the height of this Drawable
- Overrides:
- height in class Drawable
erase
public void erase(Graphics g)
- Erase this drawable. This only needs to do something if canMove() gives
true.
- Parameters:
- g - The graphics on which erasing is to occur
- Overrides:
- erase in class Drawable
canMove
public boolean canMove()
- Returns:
- true iff this drawable might move around the screen
- Overrides:
- canMove in class Drawable
color
public Color color()
- Returns:
- The color this track segment will be drawn
setHeight
protected void setHeight(int h)
- Set the height of this segment
- Parameters:
- h - The new height.
setNext
protected void setNext(TrackSegment next)
- Set the next segment pointer. This is needed so we can make
a circular track!
- Parameters:
- next - The next segment
next
protected TrackSegment next()
- Get the next segment
- Returns:
- The next segment
movePositionBy
protected abstract void movePositionBy(TrackPosition p,
double d)
- Move a position along the track, possibly progressing to next
segment. Should only be called from TrackPosition.
- Parameters:
- p - The position to move
- d - The distance to move it (in pixels)
firstSlotIsNearOrigin
protected boolean firstSlotIsNearOrigin()
- Returns:
- true iff slot 0 is near the "origin". Subclasses define
what this means.
setFirstSlotIsNearOrigin
protected void setFirstSlotIsNearOrigin(boolean f)
- Set if slot 0 is near the origin. If unset, defaults to true
- Parameters:
- f - The new value
All Packages Class Hierarchy This Package Previous Next Index