Class RecordTimeline<E>

java.lang.Object
nz.ac.vuw.ecs.swen225.gp6.recorder.datastructures.RecordTimeline<E>
Type Parameters:
E - the type of the events

public class RecordTimeline<E> extends Object
A generic record timeline class that stores a series of events in chronological order. Events can only be added to the end of the timeline.
  • Constructor Details

    • RecordTimeline

      public RecordTimeline()
      Creates a new Timeline.
    • RecordTimeline

      public RecordTimeline(Stack<Pair<Long,E>> timeline)
      Creates a new timeline from an existing timeline.
      Parameters:
      timeline - the timeline to start from.
  • Method Details

    • add

      public void add(Long time, E actions)
      Add actions to the timeline.
      Parameters:
      time - the time the actions are performed.
      actions - the actions performed.
    • getTimeline

      public Stack<Pair<Long,E>> getTimeline()
      Gets the internal representation of the timeline.
      Returns:
      The stack of pairs representing the timeline.
    • toString

      public String toString()
      Overrides:
      toString in class Object