Class ReplayTimeline<E>
java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.recorder.datastructures.ReplayTimeline<E>
- Type Parameters:
E- the type of the events
A generic timeline class that replays a series of events in chronological order. Events can be
retrieved in both forward and reverse order.
-
Constructor Summary
ConstructorsConstructorDescriptionReplayTimeline(Stack<Pair<Long, E>> recording) Creates a new Timeline.ReplayTimeline(RecordTimeline<E> recording) Creates a new Timeline. -
Method Summary
-
Constructor Details
-
ReplayTimeline
Creates a new Timeline.- Parameters:
recording- the recording to replay from a RecordTimeline object.
-
ReplayTimeline
Creates a new Timeline.- Parameters:
recording- the recording to replay from a stack of pairs.
-
-
Method Details
-
next
Returns the next action in the timeline.- Returns:
- returns the time and event of the next action.
-
hasNext
public boolean hasNext()Checks if there are any more actions in the timeline.- Returns:
- Whether there are more actions in the timeline.
-
peek
Returns the next action in the timeline without removing it.- Returns:
- returns the time and event of the next action.
-
toString
-