movements
Class PersonMovementSplitter

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

class PersonMovementSplitter
extends PersonMovement

This class implements a movement of a participant that is a portion of an already existing longer movement.

For example, suppose we have a PersonMovement object that specifies the movement of a participant over a 4 bar period of time. However, due to, say, transitioning requirements, the participant does not make the first half bar of the movement nor the last half bar of the movement, then we can use this class to create a three bar movement for the middle three bars. This would be done by constructing an object of this class from the original four bar movement, a startTick of half a bar and an endTick of three and a half bars.


Field Summary
private  int startTick
           
private  PersonMovement subMovement
           
protected  int tickLength
           
 
Constructor Summary
(package private) PersonMovementSplitter(PersonMovement personMovement, int startTick, int endTick)
           
 
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 secondarySplitStartTick, int secondarySplitEndTick)
          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

subMovement

private PersonMovement subMovement

startTick

private int startTick

tickLength

protected int tickLength
Constructor Detail

PersonMovementSplitter

PersonMovementSplitter(PersonMovement personMovement,
                       int startTick,
                       int endTick)
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

splitMovementInternal

protected PersonMovement splitMovementInternal(int secondarySplitStartTick,
                                               int secondarySplitEndTick)
Description copied from class: PersonMovement
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.

Overrides:
splitMovementInternal 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.



Copyright © 2003 Nigel Westbury