Package dataMap
Class OfflineDataMap<TmapPoint extends OfflineDataMapPoint>
java.lang.Object
dataMap.OfflineDataMap<TmapPoint>
- Direct Known Subclasses:
 BinaryOfflineDataMap,DBOfflineDataMap,OfflineFileDataMap,TideManager.TideDataMap,WavFileDataMap
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
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intVertical scaling - scale each Map data point to a data rate, or don't bother scaling at all.static final intstatic final intstatic final intstatic final int - 
Constructor Summary
ConstructorsConstructorDescriptionOfflineDataMap(OfflineDataStore offlineDataStore, PamDataBlock parentDataBlock)  - 
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataMapObserver(DataMapObserver dataMapObserver) Add a data map observer to get notificatoins when data are updated.voidaddDataPoint(TmapPoint mapPoint) Add a new map point into the list.castMapPoint(OfflineDataMapPoint mapPoint) This is an annoying little function that will cast data map points created in the offline file servers, which also use types but because they are constructed differently, the two classes don't realise they have the same type.Check to see if any data maps overlap in time.voidclear()Clear the data map.voidcompareLists(List<TmapPoint> list1, List<TmapPoint> list2) Compare two map point lists and see which of list1 are in list 2 and which of list 2 are in list 1.findMapPoint(long timeMillis) find a map point for a given time in millisecondslong[][]Get start and end times for all points in a datamap as a 2xn array.intGet the name of the data map - will default to the name of the underlying data storelongdoublegetHighestPoint(int vScaleType) Return the highest point on the map using the given scalelongGet an iterator over the map contents.doublegetLowestNonZeroPoint(int vScaleType) doublegetLowestPoint(int vScaleType) longGet the start time of the first datamap point or Long.minvalgetMapPoints(long dataStart, long dataEnd) Get a list of map points that cover the given timeslongGet the start time of the first datamap point or Long.minvallonglonggetNextDataStart(long timeMillis) Get the next data start point.intintgetNumMapPoints(long firstTime, long endTime) Get the number of map points AFTER or INCLUDING a given timelonggetPrevDataEnd(long timeMillis) Get the previous data end point.intisInGap(long timeMillis) Work out where the time is within a map.newPamDataUnit(PamDataUnit pamDataUnit) Called when new (not reloaded) data are added to a datablock so that the data map can update.voidnotifyMapObservers(OfflineDataMapPoint mapPoint) Notify datamap observers that a data point has changed / been added, etc.intNeeded to sort out some damaged binary data maps which are corrupted by being opened in viewer while data still writing.static doublescaleData(double count, long duration, int scaleType) voidsetFirstDataTime(long firstDataTime) voidsetHighestUID(Long highestUID) voidsetLastDataTime(long lastDataTime) voidsetLowestUID(Long lowestUID) voidsetMapPoints(List<TmapPoint> mapPoints) voidsetMissingUIDs(long missingUIDs) voidsetParentDataBlock(PamDataBlock parentDataBlock) voidsetSpecialDrawing(DataMapDrawing specialDrawing) voidSort all map points into ascending order based on start time.voidCalled after de-serailisation of a data map so that the min and max times stored in this object (which is not serialised can be extracted from the list of data which WAS serialised.updatedPamDataUnit(PamDataUnit pamDataUnit) Called when new (not reloaded) data are updated in a datablock so that the data map can update. 
- 
Field Details
- 
SCALE_NONE
public static final int SCALE_NONEVertical scaling - scale each Map data point to a data rate, or don't bother scaling at all.- See Also:
 
 - 
SCALE_PERSECOND
public static final int SCALE_PERSECOND- See Also:
 
 - 
SCALE_PERMINUTE
public static final int SCALE_PERMINUTE- See Also:
 
 - 
SCALE_PERHOUR
public static final int SCALE_PERHOUR- See Also:
 
 - 
SCALE_PERDAY
public static final int SCALE_PERDAY- See Also:
 
 - 
IN_GAP
public static final int IN_GAP- See Also:
 
 - 
BEFORE_FIRST
public static final int BEFORE_FIRST- See Also:
 
 - 
AFTER_LAST
public static final int AFTER_LAST- See Also:
 
 - 
POINT_START
public static final int POINT_START- See Also:
 
 - 
POINT_END
public static final int POINT_END- See Also:
 
 - 
IN_DATA
public static final int IN_DATA- See Also:
 
 - 
NO_DATA
public static final int NO_DATA- See Also:
 
 
 - 
 - 
Constructor Details
- 
OfflineDataMap
 
 - 
 - 
Method Details
- 
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
- Returns:
 - the parentDataBlock
 
 - 
setParentDataBlock
- Parameters:
 parentDataBlock- the parentDataBlock to set
 - 
clear
public void clear()Clear the data map. - 
castMapPoint
This is an annoying little function that will cast data map points created in the offline file servers, which also use types but because they are constructed differently, the two classes don't realise they have the same type.- Parameters:
 mapPoint-- Returns:
 - cast map point (throw exception if not possible)
 
 - 
addDataPoint
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.
 
 - 
getNumMapPoints
public int getNumMapPoints(long firstTime, long endTime) Get the number of map points AFTER or INCLUDING a given time- Parameters:
 firstTime- time to start search.- Returns:
 - 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.
 - 
removeDuplicates
public int removeDuplicates()Needed to sort out some damaged binary data maps which are corrupted by being opened in viewer while data still writing. - 
getDataMapName
Get the name of the data map - will default to the name of the underlying data store- Returns:
 - datamap name
 
 - 
sortRanges
public void sortRanges()Called after de-serailisation of a data map so that the min and max times stored in this object (which is not serialised can be extracted from the list of data which WAS serialised. - 
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.
 
 - 
getMapStartTime
public long getMapStartTime()Get the start time of the first datamap point or Long.minval- Returns:
 
 - 
getMapEndTime
public long getMapEndTime()Get the start time of the first datamap point or Long.minval- Returns:
 
 - 
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
- Returns:
 - the offlineDataSource
 
 - 
getSpecialDrawing
- Returns:
 - the specialDrawing
 
 - 
setSpecialDrawing
- 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
 
 - 
findMapPoint
find a map point for a given time in milliseconds- Parameters:
 timeMillis- time in milliseconds- Returns:
 - a map point or null if none found.
 
 - 
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 invalid input: '<' timeMillis- Parameters:
 timeMillis- current time in milliseconds- Returns:
 - start time of the next data start.
 
 - 
getMapPoints
- Returns:
 - the mapPoints
 
 - 
getMapPoints
Get a list of map points that cover the given times- Parameters:
 dataStart- start timedataEnd- end time- Returns:
 - a list or null
 
 - 
getRootlessMapPoints
 - 
setMapPoints
- Parameters:
 mapPoints- the mapPoints to set
 - 
compareLists
Compare two map point lists and see which of list1 are in list 2 and which of list 2 are in list 1. Assumes that both lists are sorted and that start times are unique.- Parameters:
 list1-list2-
 - 
getLowestUID
- Returns:
 - the lowestUID
 
 - 
setLowestUID
- Parameters:
 lowestUID- the lowestUID to set
 - 
getHighestUID
- Returns:
 - the highestUID
 
 - 
setHighestUID
- Parameters:
 highestUID- the highestUID to set
 - 
getMissingUIDs
public long getMissingUIDs()- Returns:
 - the missingUIDs
 
 - 
setMissingUIDs
public void setMissingUIDs(long missingUIDs) - Parameters:
 missingUIDs- the missingUIDs to set
 - 
getLastMapPoint
 - 
newPamDataUnit
Called when new (not reloaded) data are added to a datablock so that the data map can update.- Parameters:
 pamDataUnit-- Returns:
 - current data map point
 
 - 
updatedPamDataUnit
Called when new (not reloaded) data are updated in a datablock so that the data map can update.- Parameters:
 pamDataUnit-- Returns:
 - current data map point
 
 - 
addDataMapObserver
Add a data map observer to get notificatoins when data are updated.- Parameters:
 dataMapObserver-
 - 
notifyMapObservers
Notify datamap observers that a data point has changed / been added, etc.- Parameters:
 mapPoint-
 - 
checkOverlaps
Check to see if any data maps overlap in time.- Returns:
 - list of overlaps.
 
 - 
getAllStartsAndEnds
public long[][] getAllStartsAndEnds()Get start and end times for all points in a datamap as a 2xn array.- Returns:
 
 
 -