Package adams.data.trail
Class Trail
- java.lang.Object
-
- adams.data.container.AbstractDataContainer<Step>
-
- adams.data.trail.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
-
-
Field Summary
Fields Modifier and Type Field Description static StringFIELD_HEIGHTthe report field for the height.static StringFIELD_WIDTHthe report field for the width.protected BufferedImagem_Backgroundthe background image.protected static StepComparatorm_Comparatorthe comparator to use.protected Stepm_MaxXthe step with the maximum X.protected Stepm_MaxYthe step with the maximum Y.protected Stepm_MinXthe step with the minimum X.protected Stepm_MinYthe step with the minimum Y.protected adams.data.Notesm_Notesthe notes.protected adams.data.report.Reportm_Reportthe attached report.static StringPREFIX_META
-
Constructor Summary
Constructors Constructor Description Trail()Initializes the trail.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(adams.data.container.DataContainer<Step> other)Obtains the stored variables from the other data point, but not the actual data points.BufferedImagegetBackground()Returns the optional background image.adams.data.container.DataPointComparator<Step>getComparator()Returns the comparator in use.FloatgetHeight()Returns the optional height of the area for the trail.StepgetMaxX()Returns the step with the largest X value.StepgetMaxY()Returns the step with the largest Y value.StepgetMinX()Returns the step with the smallest X value.StepgetMinY()Returns the step with the smallest Y value.adams.data.NotesgetNotes()Returns the currently stored notes.adams.data.report.ReportgetReport()Returns the report.StepgetStep(Date timestamp)Returns the step associated with the given timestamp.FloatgetWidth()Returns the optional width of the area for the trail.booleanhasBackground()Checks whether a background is set.booleanhasHeight()Checks whether a height is set.booleanhasReport()Checks whether a report is present.booleanhasWidth()Checks whether a width is set.protected voidinvalidateMinMax()Invalidates the min/max X/Y members.protected booleanmodifiedListener(boolean modified)Method that gets notified about changes in the collection of data points.voidnewBackground()Creates a new background image with white as background color.voidnewBackground(Color bgcolor)Creates a new background image.StepComparatornewComparator()Returns a new instance of the default comparator.StepnewPoint()Returns a new instance of a DataContainer point.voidsetBackground(BufferedImage value)Sets the optional background image.voidsetHeight(Float value)Sets the optional height of the area for the trail.voidsetReport(adams.data.report.Report value)Sets a new report.voidsetWidth(Float value)Sets the optional width of the area for the trail.adams.data.spreadsheet.SpreadSheettoSpreadSheet()Returns the content as spreadsheet.TrailStatistictoStatistic()Returns a statistic object for this object.StringtoString()Returns a string representation of the sequence.protected voidvalidateMinMax()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
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Field Detail
-
FIELD_WIDTH
public static final String FIELD_WIDTH
the report field for the width.- See Also:
- Constant Field Values
-
FIELD_HEIGHT
public static final String FIELD_HEIGHT
the report field for the height.- See Also:
- Constant Field Values
-
PREFIX_META
public static final String PREFIX_META
- See Also:
- Constant Field Values
-
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.
-
-
Method Detail
-
newComparator
public StepComparator newComparator()
Returns a new instance of the default comparator.- Specified by:
newComparatorin interfaceadams.data.container.DataContainer<Step>- Returns:
- the comparator instance
-
getComparator
public adams.data.container.DataPointComparator<Step> getComparator()
Returns the comparator in use.- Specified by:
getComparatorin interfaceadams.data.container.DataContainer<Step>- Returns:
- the comparator in use
-
newPoint
public Step newPoint()
Returns a new instance of a DataContainer point.- Specified by:
newPointin interfaceadams.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.
-
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:
modifiedListenerin classadams.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:
getNotesin interfaceadams.data.NotesHandler- Returns:
- the current notes
-
setReport
public void setReport(adams.data.report.Report value)
Sets a new report.- Specified by:
setReportin interfaceadams.data.report.MutableReportHandler<adams.data.report.Report>- Parameters:
value- the new report
-
hasReport
public boolean hasReport()
Checks whether a report is present.- Specified by:
hasReportin interfaceadams.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:
getReportin interfaceadams.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:
toSpreadSheetin interfaceadams.data.spreadsheet.SpreadSheetSupporter- Returns:
- the content
-
toStatistic
public TrailStatistic toStatistic()
Returns a statistic object for this object.- Specified by:
toStatisticin interfaceadams.data.statistics.InformativeStatisticSupporter<TrailStatistic>- Returns:
- statistics for this object
-
-