Package dataMap

Class OfflineDataMap<TmapPoint extends OfflineDataMapPoint>

java.lang.Object
dataMap.OfflineDataMap<TmapPoint>
Direct Known Subclasses:
BinaryOfflineDataMap, DBOfflineDataMap, OfflineFileDataMap, TideManager.TideDataMap, WavFileDataMap

public abstract class OfflineDataMap<TmapPoint extends OfflineDataMapPoint> extends 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 Details Link icon

  • Constructor Details Link icon

  • Method Details Link icon

    • getListIterator Link icon

      public 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 Link icon

      public PamDataBlock getParentDataBlock()
      Returns:
      the parentDataBlock
    • setParentDataBlock Link icon

      public void setParentDataBlock(PamDataBlock parentDataBlock)
      Parameters:
      parentDataBlock - the parentDataBlock to set
    • clear Link icon

      public void clear()
      Clear the data map.
    • castMapPoint Link icon

      public TmapPoint 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.
      Parameters:
      mapPoint -
      Returns:
      cast map point (throw exception if not possible)
    • addDataPoint Link icon

      public void addDataPoint(TmapPoint mapPoint)
      Add a new map point into the list.
      Parameters:
      mapPoint - new map point to add
    • getNumMapPoints Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      public String getDataMapName()
      Get the name of the data map - will default to the name of the underlying data store
      Returns:
      datamap name
    • sortRanges Link icon

      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 Link icon

      public long getFirstDataTime()
      Returns:
      the firstDataTime
    • setFirstDataTime Link icon

      public void setFirstDataTime(long firstDataTime)
      Parameters:
      firstDataTime - the firstDataTime to set
    • getLastDataTime Link icon

      public long getLastDataTime()
      Returns:
      the lastDataTime
    • setLastDataTime Link icon

      public void setLastDataTime(long lastDataTime)
      Parameters:
      lastDataTime - the lastDataTime to set
    • getDataCount Link icon

      public int getDataCount()
      Returns:
      The total amount of data available.
    • getHighestPoint Link icon

      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 Link icon

      public long getMapStartTime()
      Get the start time of the first datamap point or Long.minval
      Returns:
    • getMapEndTime Link icon

      public long getMapEndTime()
      Get the start time of the first datamap point or Long.minval
      Returns:
    • getLowestPoint Link icon

      public double getLowestPoint(int vScaleType)
      Returns:
      the lowestPoint
    • getLowestNonZeroPoint Link icon

      public double getLowestNonZeroPoint(int vScaleType)
      Returns:
      the lowestNonZeroPoint
    • scaleData Link icon

      public static double scaleData(double count, long duration, int scaleType)
    • getOfflineDataSource Link icon

      public OfflineDataStore getOfflineDataSource()
      Returns:
      the offlineDataSource
    • getSpecialDrawing Link icon

      public DataMapDrawing getSpecialDrawing()
      Returns:
      the specialDrawing
    • setSpecialDrawing Link icon

      public void setSpecialDrawing(DataMapDrawing specialDrawing)
      Parameters:
      specialDrawing - the specialDrawing to set
    • isInGap Link icon

      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 Link icon

      public TmapPoint findMapPoint(long timeMillis)
      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 Link icon

      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 Link icon

      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 Link icon

      public List<TmapPoint> getMapPoints()
      Returns:
      the mapPoints
    • getMapPoints Link icon

      public List<TmapPoint> getMapPoints(long dataStart, long dataEnd)
      Get a list of map points that cover the given times
      Parameters:
      dataStart - start time
      dataEnd - end time
      Returns:
      a list or null
    • getRootlessMapPoints Link icon

      public List<TmapPoint> getRootlessMapPoints()
    • setMapPoints Link icon

      public void setMapPoints(List<TmapPoint> mapPoints)
      Parameters:
      mapPoints - the mapPoints to set
    • compareLists Link icon

      public void compareLists(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. Assumes that both lists are sorted and that start times are unique.
      Parameters:
      list1 -
      list2 -
    • getLowestUID Link icon

      public Long getLowestUID()
      Returns:
      the lowestUID
    • setLowestUID Link icon

      public void setLowestUID(Long lowestUID)
      Parameters:
      lowestUID - the lowestUID to set
    • getHighestUID Link icon

      public Long getHighestUID()
      Returns:
      the highestUID
    • setHighestUID Link icon

      public void setHighestUID(Long highestUID)
      Parameters:
      highestUID - the highestUID to set
    • getMissingUIDs Link icon

      public long getMissingUIDs()
      Returns:
      the missingUIDs
    • setMissingUIDs Link icon

      public void setMissingUIDs(long missingUIDs)
      Parameters:
      missingUIDs - the missingUIDs to set
    • getLastMapPoint Link icon

      public TmapPoint getLastMapPoint()
    • newPamDataUnit Link icon

      public TmapPoint newPamDataUnit(PamDataUnit pamDataUnit)
      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 Link icon

      public TmapPoint updatedPamDataUnit(PamDataUnit pamDataUnit)
      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 Link icon

      public void addDataMapObserver(DataMapObserver dataMapObserver)
      Add a data map observer to get notificatoins when data are updated.
      Parameters:
      dataMapObserver -
    • notifyMapObservers Link icon

      public void notifyMapObservers(OfflineDataMapPoint mapPoint)
      Notify datamap observers that a data point has changed / been added, etc.
      Parameters:
      mapPoint -
    • checkOverlaps Link icon

      public ArrayList<MapOverlap> checkOverlaps()
      Check to see if any data maps overlap in time.
      Returns:
      list of overlaps.
    • getAllStartsAndEnds Link icon

      public long[][] getAllStartsAndEnds()
      Get start and end times for all points in a datamap as a 2xn array.
      Returns: