movements
Class PersonMovementAlone

java.lang.Object
  extended bymovements.PersonMovement
      extended bymovements.PersonMovementAlone
All Implemented Interfaces:
java.io.Serializable

class PersonMovementAlone
extends PersonMovement

This class implements a movement of a person over a period of time. A person's position is defined using three co-ordinates giving the distance down the set, the distance across the set, and the direction in which the person is facing. This class contains three instances of SingleDimensionalMovement which give the position of the person and the direction that the person is facing at any point of time during the movement.


Field Summary
private  SingleDimensionalMovement movementAcross
           
private  SingleDimensionalMovement movementDirection
           
private  SingleDimensionalMovement movementDown
           
protected  int tickLength
           
 
Constructor Summary
(package private) PersonMovementAlone(int tickLength, SingleDimensionalMovement movementDown, SingleDimensionalMovement movementAcross, SingleDimensionalMovement movementDirection)
           
 
Method Summary
(package private)  ParticipantPosition getPosition(int ticksIntoMovement)
           
(package private)  void getPosition(ParticipantPosition position, int ticksIntoMovement)
           
(package private)  int getTickLength()
           
(package private)  PersonMovement splitMovement(int subPeriodStartTick, int subPeriodEndTick)
          Provides a movement that covers only a period of this movement.
protected  PersonMovement splitMovementInternal(int subPeriodStartTick, int subPeriodEndTick)
          Provides a movement that covers only a period of this movement.
 void Trace(java.lang.String indent)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

movementDown

private SingleDimensionalMovement movementDown

movementAcross

private SingleDimensionalMovement movementAcross

movementDirection

private SingleDimensionalMovement movementDirection

tickLength

protected int tickLength
Constructor Detail

PersonMovementAlone

PersonMovementAlone(int tickLength,
                    SingleDimensionalMovement movementDown,
                    SingleDimensionalMovement movementAcross,
                    SingleDimensionalMovement movementDirection)
Method Detail

getPosition

void getPosition(ParticipantPosition position,
                 int ticksIntoMovement)
Specified by:
getPosition in class PersonMovement

Trace

public void Trace(java.lang.String indent)
Overrides:
Trace in class PersonMovement

getTickLength

int getTickLength()

getPosition

ParticipantPosition getPosition(int ticksIntoMovement)

splitMovement

final PersonMovement splitMovement(int subPeriodStartTick,
                                   int subPeriodEndTick)
Provides a movement that covers only a period of this movement. This method does some error checking and handles the request in a couple of trivial situations. It calls an implementation specific method to handle the non-trivial cases.


splitMovementInternal

protected PersonMovement splitMovementInternal(int subPeriodStartTick,
                                               int subPeriodEndTick)
Provides a movement that covers only a period of this movement. This is a default implementation that uses the PersonMovementSplitter to provide the desired sub-movement. However, most implementations of PersonMovement can do this more efficiently and so override this method. By allowing each PersonMovement implementation to implement this, we get a simpler tree of PersonMovement objects.



Copyright © 2003 Nigel Westbury