movements
Class TrackGenerator

java.lang.Object
  extended bymovements.TrackGenerator

class TrackGenerator
extends java.lang.Object

This class takes as input a series of positions to which a participant must move and outputs a PersonMovement object that makes a track going through each position in turn.

The starting point is set by passing it to the constructor. Data is then input by making calls to the addPosition method. The movement object is then obtained by calling the getMovement method.

The movement will be made at a constant speed. The total time to be taken for the entire track is passed to getMovement. The caller cannot specify the time at which the participant gets to the intermediate points. If the participant is supposed to be at a particular point at a particular time then the user of this class must call getMovement when the point with the time fix is reached to generate the movement up to that point and then start over.


Field Summary
private  int m_numberOfTrackSegments
           
private  TrackSegment[] m_trackSegments
           
private  ParticipantPosition position
           
 
Constructor Summary
(package private) TrackGenerator(ParticipantPosition startingPosition)
          Construct an empty list of tracks.
 
Method Summary
(package private)  void addWayPoint(ParticipantPosition wayPoint)
          Adds a way point.
(package private)  PersonMovement getMovement(int tickLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

position

private ParticipantPosition position

m_numberOfTrackSegments

private int m_numberOfTrackSegments

m_trackSegments

private TrackSegment[] m_trackSegments
Constructor Detail

TrackGenerator

TrackGenerator(ParticipantPosition startingPosition)
Construct an empty list of tracks.

Parameters:
startingPosition - The caller must not modify the contents of this object after this method has been called. The behavior of this class will be undefined if they are.
Method Detail

addWayPoint

void addWayPoint(ParticipantPosition wayPoint)
           throws MoveBackwardsException,
                  TurnOnSpotException
Adds a way point. The way point includes the direction in which the participant is both moving and facing when at the way point.

Parameters:
wayPoint - The caller must not modify the contents of this object after this method has been called. The behavior of this class will be undefined if they are.
Throws:
MoveBackwardsException
TurnOnSpotException

getMovement

PersonMovement getMovement(int tickLength)


Copyright © 2003 Nigel Westbury