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.

Method Index

 o canMove()
 o color()
 o erase(Graphics)
Erase this drawable.
 o firstSlotIsNearOrigin()
 o height()
Give the height of this Drawable
 o movePositionBy(TrackPosition, double)
Move a position along the track, possibly progressing to next segment.
 o next()
Get the next segment
 o setFirstSlotIsNearOrigin(boolean)
Set if slot 0 is near the origin.
 o setHeight(int)
Set the height of this segment
 o setNext(TrackSegment)
Set the next segment pointer.

Methods

 o height
  public int height()
Give the height of this Drawable
Overrides:
height in class Drawable
 o 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
 o canMove
  public boolean canMove()
Returns:
true iff this drawable might move around the screen
Overrides:
canMove in class Drawable
 o color
  public Color color()
Returns:
The color this track segment will be drawn
 o setHeight
  protected void setHeight(int h)
Set the height of this segment
Parameters:
h - The new height.
 o 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
 o next
  protected TrackSegment next()
Get the next segment
Returns:
The next segment
 o 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)
 o firstSlotIsNearOrigin
  protected boolean firstSlotIsNearOrigin()
Returns:
true iff slot 0 is near the "origin". Subclasses define what this means.
 o 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