dataMap
Class OfflineDataMap<TmapPoint extends OfflineDataMapPoint>

java.lang.Object
  extended by dataMap.OfflineDataMap<TmapPoint>
Direct Known Subclasses:
BinaryOfflineDataMap, DBOfflineDataMap, WavFileDataMap

public abstract class OfflineDataMap<TmapPoint extends OfflineDataMapPoint>
extends java.lang.Object

Class which get's held within a PamDataBlock which provides summary information on data within that block when operating in viewer mode.

It is possible that some datablocks may own two of these things - one for database data and one for binary stored data.

Author:
Doug Gillespie

Field Summary
static int AFTER_LAST
           
static int BEFORE_FIRST
           
private  long firstDataTime
          time of the first data available for this data block
private  long highestPoint
          Point in this store with most data.
static int IN_DATA
           
static int IN_GAP
           
private  long lastDataTime
          time of the last data available for this data block
private  long lowestNonZeroPoint
          Lowest non zero point in the store (can be zero if no data or if highestPoint is zero)
private  long lowestPoint
          Lowest point in this store (can be zero)
private  java.util.List<TmapPoint> mapPoints
           
static int NO_DATA
           
private  OfflineDataStore offlineDataStore
           
private  PamDataBlock parentDataBlock
           
static int POINT_END
           
static int POINT_START
           
static int SCALE_NONE
          Vertical scaling - scale each Map data point to a data rate, or don't bother scaling at all.
static int SCALE_PERDAY
           
static int SCALE_PERHOUR
           
static int SCALE_PERMINUTE
           
static int SCALE_PERSECOND
           
private  DataMapDrawing specialDrawing
           
 
Constructor Summary
OfflineDataMap(OfflineDataStore offlineDataStore, PamDataBlock parentDataBlock)
           
 
Method Summary
 void addDataPoint(TmapPoint mapPoint)
          Add a new map point into the list.
 void clear()
          Clear the data map.
 int getDataCount()
           
 long getFirstDataTime()
           
 double getHighestPoint(int vScaleType)
          Return the highest point on the map using the given scale
 long getLastDataTime()
           
 java.util.Iterator<TmapPoint> getListIterator()
          Get an iterator over the map contents.
 double getLowestNonZeroPoint(int vScaleType)
           
 double getLowestPoint(int vScaleType)
           
 long getNextDataStart(long timeMillis)
          Get the next data start point.
 int getNumMapPoints()
           
 OfflineDataStore getOfflineDataSource()
           
 PamDataBlock getParentDataBlock()
           
 long getPrevDataEnd(long timeMillis)
          Get the previous data end point.
 DataMapDrawing getSpecialDrawing()
           
 int isInGap(long timeMillis)
          Work out where the time is within a map.
static double scaleData(double count, long duration, int scaleType)
           
 void setFirstDataTime(long firstDataTime)
           
 void setLastDataTime(long lastDataTime)
           
 void setSpecialDrawing(DataMapDrawing specialDrawing)
           
 void sortMapPoints()
          Sort all map points into ascending order based on start time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentDataBlock

private PamDataBlock parentDataBlock

offlineDataStore

private OfflineDataStore offlineDataStore

mapPoints

private java.util.List<TmapPoint extends OfflineDataMapPoint> mapPoints

specialDrawing

private DataMapDrawing specialDrawing

firstDataTime

private long firstDataTime
time of the first data available for this data block


lastDataTime

private long lastDataTime
time of the last data available for this data block


highestPoint

private long highestPoint
Point in this store with most data.


lowestPoint

private long lowestPoint
Lowest point in this store (can be zero)


lowestNonZeroPoint

private long lowestNonZeroPoint
Lowest non zero point in the store (can be zero if no data or if highestPoint is zero)


SCALE_NONE

public static final int SCALE_NONE
Vertical scaling - scale each Map data point to a data rate, or don't bother scaling at all.

See Also:
Constant Field Values

SCALE_PERSECOND

public static final int SCALE_PERSECOND
See Also:
Constant Field Values

SCALE_PERMINUTE

public static final int SCALE_PERMINUTE
See Also:
Constant Field Values

SCALE_PERHOUR

public static final int SCALE_PERHOUR
See Also:
Constant Field Values

SCALE_PERDAY

public static final int SCALE_PERDAY
See Also:
Constant Field Values

IN_GAP

public static final int IN_GAP
See Also:
Constant Field Values

BEFORE_FIRST

public static final int BEFORE_FIRST
See Also:
Constant Field Values

AFTER_LAST

public static final int AFTER_LAST
See Also:
Constant Field Values

POINT_START

public static final int POINT_START
See Also:
Constant Field Values

POINT_END

public static final int POINT_END
See Also:
Constant Field Values

IN_DATA

public static final int IN_DATA
See Also:
Constant Field Values

NO_DATA

public static final int NO_DATA
See Also:
Constant Field Values
Constructor Detail

OfflineDataMap

public OfflineDataMap(OfflineDataStore offlineDataStore,
                      PamDataBlock parentDataBlock)
Method Detail

getListIterator

public java.util.Iterator<TmapPoint> getListIterator()
Get an iterator over the map contents.

Objects using this iterator should synchronise on the map object first.

Returns:
an iterator over the map contents.

getParentDataBlock

public PamDataBlock getParentDataBlock()
Returns:
the parentDataBlock

clear

public void clear()
Clear the data map.


addDataPoint

public void addDataPoint(TmapPoint mapPoint)
Add a new map point into the list.

Parameters:
mapPoint - new map point to add

getNumMapPoints

public int getNumMapPoints()
Returns:
the total number of map points.

sortMapPoints

public void sortMapPoints()
Sort all map points into ascending order based on start time.

this should be called after all data have been loaded.


getFirstDataTime

public long getFirstDataTime()
Returns:
the firstDataTime

setFirstDataTime

public void setFirstDataTime(long firstDataTime)
Parameters:
firstDataTime - the firstDataTime to set

getLastDataTime

public long getLastDataTime()
Returns:
the lastDataTime

setLastDataTime

public void setLastDataTime(long lastDataTime)
Parameters:
lastDataTime - the lastDataTime to set

getDataCount

public int getDataCount()
Returns:
The total amount of data available.

getHighestPoint

public double getHighestPoint(int vScaleType)
Return the highest point on the map using the given scale

Parameters:
vScaleType - scale type
Returns:
the highest data value.

getLowestPoint

public double getLowestPoint(int vScaleType)
Returns:
the lowestPoint

getLowestNonZeroPoint

public double getLowestNonZeroPoint(int vScaleType)
Returns:
the lowestNonZeroPoint

scaleData

public static double scaleData(double count,
                               long duration,
                               int scaleType)

getOfflineDataSource

public OfflineDataStore getOfflineDataSource()
Returns:
the offlineDataSource

getSpecialDrawing

public DataMapDrawing getSpecialDrawing()
Returns:
the specialDrawing

setSpecialDrawing

public void setSpecialDrawing(DataMapDrawing specialDrawing)
Parameters:
specialDrawing - the specialDrawing to set

isInGap

public int isInGap(long timeMillis)
Work out where the time is within a map.

Parameters:
timeMillis - time
Returns:
integer field. one or more of

NO_DATA

BEFORE_FIRST

AFTER_LAST

POINT_START

POINT_END

IN_GAP

IN_DATA


getNextDataStart

public long getNextDataStart(long timeMillis)
Get the next data start point. i.e. the time of the start of a map point which is > timeMillis

Parameters:
timeMillis - current time in milliseconds
Returns:
start time of the next data start.

getPrevDataEnd

public long getPrevDataEnd(long timeMillis)
Get the previous data end point. i.e. the time of the end of a map point which is < timeMillis

Parameters:
timeMillis - current time in milliseconds
Returns:
start time of the next data start.