Class Trail

  • All Implemented Interfaces:
    adams.core.CloneHandler, adams.core.Mergeable<adams.data.container.DataContainer>, adams.core.UniqueIDHandler, adams.data.container.DataContainer<Step>, adams.data.id.IDHandler, adams.data.id.MutableIDHandler, adams.data.NotesHandler, adams.data.report.MutableReportHandler<adams.data.report.Report>, adams.data.report.ReportHandler<adams.data.report.Report>, adams.data.spreadsheet.SpreadSheetSupporter, adams.data.statistics.InformativeStatisticSupporter<TrailStatistic>, Serializable, Comparable, Iterable<Step>, Collection<Step>

    public class Trail
    extends adams.data.container.AbstractDataContainer<Step>
    implements adams.data.report.MutableReportHandler<adams.data.report.Report>, adams.data.NotesHandler, adams.data.spreadsheet.SpreadSheetSupporter, adams.data.statistics.InformativeStatisticSupporter<TrailStatistic>
    Encapsulates a series of steps, i.e., a trail.
    Version:
    $Revision$
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Trail()
      Initializes the trail.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void assign​(adams.data.container.DataContainer<Step> other)
      Obtains the stored variables from the other data point, but not the actual data points.
      BufferedImage getBackground()
      Returns the optional background image.
      adams.data.container.DataPointComparator<Step> getComparator()
      Returns the comparator in use.
      Float getHeight()
      Returns the optional height of the area for the trail.
      Step getMaxX()
      Returns the step with the largest X value.
      Step getMaxY()
      Returns the step with the largest Y value.
      Step getMinX()
      Returns the step with the smallest X value.
      Step getMinY()
      Returns the step with the smallest Y value.
      adams.data.Notes getNotes()
      Returns the currently stored notes.
      adams.data.report.Report getReport()
      Returns the report.
      Step getStep​(Date timestamp)
      Returns the step associated with the given timestamp.
      Float getWidth()
      Returns the optional width of the area for the trail.
      boolean hasBackground()
      Checks whether a background is set.
      boolean hasHeight()
      Checks whether a height is set.
      boolean hasReport()
      Checks whether a report is present.
      boolean hasWidth()
      Checks whether a width is set.
      protected void invalidateMinMax()
      Invalidates the min/max X/Y members.
      protected boolean modifiedListener​(boolean modified)
      Method that gets notified about changes in the collection of data points.
      void newBackground()
      Creates a new background image with white as background color.
      void newBackground​(Color bgcolor)
      Creates a new background image.
      StepComparator newComparator()
      Returns a new instance of the default comparator.
      Step newPoint()
      Returns a new instance of a DataContainer point.
      void setBackground​(BufferedImage value)
      Sets the optional background image.
      void setHeight​(Float value)
      Sets the optional height of the area for the trail.
      void setReport​(adams.data.report.Report value)
      Sets a new report.
      void setWidth​(Float value)
      Sets the optional width of the area for the trail.
      adams.data.spreadsheet.SpreadSheet toSpreadSheet()
      Returns the content as spreadsheet.
      TrailStatistic toStatistic()
      Returns a statistic object for this object.
      String toString()
      Returns a string representation of the sequence.
      protected void validateMinMax()
      Initializes the min/max X/Y points.
      • Methods inherited from class adams.data.container.AbstractDataContainer

        add, addAll, clear, compareTo, compareToData, compareToHeader, contains, containsAll, ensureCapacity, equals, equalsData, equalsHeader, getClone, getHeader, getID, getUniqueID, hashCode, isEmpty, iterator, mergeWith, newInstance, remove, removeAll, retainAll, setID, size, toArray, toArray, toList, toList, toTreeSet, toTreeSet, trimToSize
    • Field Detail

      • m_Report

        protected adams.data.report.Report m_Report
        the attached report.
      • m_Notes

        protected adams.data.Notes m_Notes
        the notes.
      • m_MinX

        protected Step m_MinX
        the step with the minimum X.
      • m_MaxX

        protected Step m_MaxX
        the step with the maximum X.
      • m_MinY

        protected Step m_MinY
        the step with the minimum Y.
      • m_MaxY

        protected Step m_MaxY
        the step with the maximum Y.
      • m_Background

        protected BufferedImage m_Background
        the background image.
      • m_Comparator

        protected static StepComparator m_Comparator
        the comparator to use.
    • Constructor Detail

      • Trail

        public Trail()
        Initializes the trail.
    • Method Detail

      • newComparator

        public StepComparator newComparator()
        Returns a new instance of the default comparator.
        Specified by:
        newComparator in interface adams.data.container.DataContainer<Step>
        Returns:
        the comparator instance
      • getComparator

        public adams.data.container.DataPointComparator<Step> getComparator()
        Returns the comparator in use.
        Specified by:
        getComparator in interface adams.data.container.DataContainer<Step>
        Returns:
        the comparator in use
      • newPoint

        public Step newPoint()
        Returns a new instance of a DataContainer point.
        Specified by:
        newPoint in interface adams.data.container.DataContainer<Step>
        Returns:
        the new DataContainer point
      • assign

        public void assign​(adams.data.container.DataContainer<Step> other)
        Obtains the stored variables from the other data point, but not the actual data points.
        Specified by:
        assign in interface adams.data.container.DataContainer<Step>
        Overrides:
        assign in class adams.data.container.AbstractDataContainer<Step>
        Parameters:
        other - the data point to get the values from
      • modifiedListener

        protected boolean modifiedListener​(boolean modified)
        Method that gets notified about changes in the collection of data points. Just passes the modified state through.
        Overrides:
        modifiedListener in class adams.data.container.AbstractDataContainer<Step>
        Parameters:
        modified - whether the action modified the collection
        Returns:
        the same as the input
      • invalidateMinMax

        protected void invalidateMinMax()
        Invalidates the min/max X/Y members.
      • validateMinMax

        protected void validateMinMax()
        Initializes the min/max X/Y points.
      • getMinX

        public Step getMinX()
        Returns the step with the smallest X value.
        Returns:
        the smallest X, null if no steps
      • getMaxX

        public Step getMaxX()
        Returns the step with the largest X value.
        Returns:
        the largest X, null if no steps
      • getMinY

        public Step getMinY()
        Returns the step with the smallest Y value.
        Returns:
        the smallest Y, null if no steps
      • getMaxY

        public Step getMaxY()
        Returns the step with the largest Y value.
        Returns:
        the largest Y, null if no steps
      • hasWidth

        public boolean hasWidth()
        Checks whether a width is set.
        Returns:
        true if width is set
      • setWidth

        public void setWidth​(Float value)
        Sets the optional width of the area for the trail.
        Parameters:
        value - the width, null to unset
      • getWidth

        public Float getWidth()
        Returns the optional width of the area for the trail.
        Returns:
        the width, null if not set
      • hasHeight

        public boolean hasHeight()
        Checks whether a height is set.
        Returns:
        true if height is set
      • setHeight

        public void setHeight​(Float value)
        Sets the optional height of the area for the trail.
        Parameters:
        value - the height, null to unset
      • getHeight

        public Float getHeight()
        Returns the optional height of the area for the trail.
        Returns:
        the height, null if not set
      • hasBackground

        public boolean hasBackground()
        Checks whether a background is set.
        Returns:
        true if background is set
      • setBackground

        public void setBackground​(BufferedImage value)
        Sets the optional background image.
        Parameters:
        value - the background, null to unset
      • getBackground

        public BufferedImage getBackground()
        Returns the optional background image.
        Returns:
        the background, null if not set
      • newBackground

        public void newBackground()
        Creates a new background image with white as background color. Uses either the width/height parameters stored in the report or if these are not present, ensures that the trail fits onto the image.
        See Also:
        newBackground(Color)
      • newBackground

        public void newBackground​(Color bgcolor)
        Creates a new background image. Uses either the width/height parameters stored in the report or if these are not present, ensures that the trail fits onto the image.
        Parameters:
        bgcolor - the background color
        See Also:
        BufferedImage.TYPE_INT_ARGB
      • getNotes

        public adams.data.Notes getNotes()
        Returns the currently stored notes.
        Specified by:
        getNotes in interface adams.data.NotesHandler
        Returns:
        the current notes
      • setReport

        public void setReport​(adams.data.report.Report value)
        Sets a new report.
        Specified by:
        setReport in interface adams.data.report.MutableReportHandler<adams.data.report.Report>
        Parameters:
        value - the new report
      • hasReport

        public boolean hasReport()
        Checks whether a report is present.
        Specified by:
        hasReport in interface adams.data.report.ReportHandler<adams.data.report.Report>
        Returns:
        true if a report is present
      • getReport

        public adams.data.report.Report getReport()
        Returns the report.
        Specified by:
        getReport in interface adams.data.report.ReportHandler<adams.data.report.Report>
        Returns:
        the report, can be null if none available
      • getStep

        public Step getStep​(Date timestamp)
        Returns the step associated with the given timestamp.
        Parameters:
        timestamp - the timestamp to get the step for
        Returns:
        the associated step or null if none available for the timestamp
      • toSpreadSheet

        public adams.data.spreadsheet.SpreadSheet toSpreadSheet()
        Returns the content as spreadsheet.
        Specified by:
        toSpreadSheet in interface adams.data.spreadsheet.SpreadSheetSupporter
        Returns:
        the content
      • toStatistic

        public TrailStatistic toStatistic()
        Returns a statistic object for this object.
        Specified by:
        toStatistic in interface adams.data.statistics.InformativeStatisticSupporter<TrailStatistic>
        Returns:
        statistics for this object
      • toString

        public String toString()
        Returns a string representation of the sequence.
        Overrides:
        toString in class adams.data.container.AbstractDataContainer<Step>
        Returns:
        the string representation