org.javasimon.callback.timeline
Class Timeline<TR extends TimeRange>

java.lang.Object
  extended by org.javasimon.callback.timeline.Timeline<TR>
Direct Known Subclasses:
StopwatchTimeline

public abstract class Timeline<TR extends TimeRange>
extends Object

Collection of values sorted on a time line.

Author:
gerald

Field Summary
private  TR lastTimeRange
          Last used time range
protected  CircularList<TR> timeRanges
          List of time ranges
protected  long timeRangeWidth
          Time range width in milliseconds
 
Constructor Summary
protected Timeline(int capacity, long timeRangeWidth)
          Main constructor.
 
Method Summary
protected abstract  TR createTimeRange(long startTimestamp, long endTimestamp)
          Create an time range (factory method).
protected  TR getOrCreateTimeRange(long timestamp)
          Get existing time range if it already exists or create a new one
abstract  TimelineSample<TR> sample()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timeRanges

protected final CircularList<TR extends TimeRange> timeRanges
List of time ranges


timeRangeWidth

protected final long timeRangeWidth
Time range width in milliseconds


lastTimeRange

private TR extends TimeRange lastTimeRange
Last used time range

Constructor Detail

Timeline

protected Timeline(int capacity,
                   long timeRangeWidth)
Main constructor.

Parameters:
capacity - Number of time ranges
timeRangeWidth - Width of each time range
Method Detail

createTimeRange

protected abstract TR createTimeRange(long startTimestamp,
                                      long endTimestamp)
Create an time range (factory method).

Parameters:
startTimestamp - Time range start
endTimestamp - Time range end
Returns:

getOrCreateTimeRange

protected final TR getOrCreateTimeRange(long timestamp)
Get existing time range if it already exists or create a new one

Parameters:
timestamp -
Returns:

sample

public abstract TimelineSample<TR> sample()


Copyright © 2013. All Rights Reserved.