Package adams.data.trail
Class Step
- java.lang.Object
-
- adams.data.container.AbstractDataPoint
-
- adams.data.trail.Step
-
- All Implemented Interfaces:
adams.core.CloneHandler
,adams.data.container.DataPoint
,Serializable
,Comparable
public class Step extends adams.data.container.AbstractDataPoint
Represents a single step in a trail.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static adams.core.DateFormat
m_Format
for formatting the timestamp.protected HashMap<String,Object>
m_MetaData
the optional meta-data.protected Date
m_Timestamp
the timestamp of the step.protected float
m_X
the X of the step.protected float
m_Y
the Y of the step.
-
Constructor Summary
Constructors Constructor Description Step()
Initializes the step with default values.Step(Date timestamp, float x, float y)
Initializes the step with the given timestamp and position, but no meta-data.Step(Date timestamp, float x, float y, HashMap<String,Object> metaData)
Initializes the step with the given timestamp and position, but no meta-data.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addMetaData(String key, Object value)
Adds the meta-data.void
assign(adams.data.container.DataPoint other)
Obtains the stored variables from the other data point.int
compareTo(Object o)
Compares the object to another.boolean
equals(Object obj)
Checks whether the provided object is a Step with the same timestamp and X/Y.protected static adams.core.DateFormat
getFormat()
Returns the formatter.HashMap<String,Object>
getMetaData()
Returns the meta-data, if any.Date
getTimestamp()
Returns the timestamp.float
getX()
Returns the X of the step.float
getY()
Returns the Y of the step.boolean
hasMetaData()
Checks whether any meta-data is present.void
setMetaData(HashMap<String,Object> value)
Sets the meta-data to use.void
setTimestamp(Date value)
Sets the timestamp.void
setX(float value)
Sets the X of the step.void
setY(float value)
Sets the Y of the step.String
toString()
Returns a string representation of the point.
-
-
-
Field Detail
-
m_Timestamp
protected Date m_Timestamp
the timestamp of the step.
-
m_X
protected float m_X
the X of the step.
-
m_Y
protected float m_Y
the Y of the step.
-
m_Format
protected static adams.core.DateFormat m_Format
for formatting the timestamp.
-
-
Constructor Detail
-
Step
public Step()
Initializes the step with default values.
-
Step
public Step(Date timestamp, float x, float y)
Initializes the step with the given timestamp and position, but no meta-data.- Parameters:
timestamp
- the timestampx
- the Xy
- the Y
-
-
Method Detail
-
getFormat
protected static adams.core.DateFormat getFormat()
Returns the formatter.- Returns:
- the formatter
-
assign
public void assign(adams.data.container.DataPoint other)
Obtains the stored variables from the other data point.- Specified by:
assign
in interfaceadams.data.container.DataPoint
- Overrides:
assign
in classadams.data.container.AbstractDataPoint
- Parameters:
other
- the data point to get the values from
-
setTimestamp
public void setTimestamp(Date value)
Sets the timestamp.- Parameters:
value
- the timestamp
-
getTimestamp
public Date getTimestamp()
Returns the timestamp.- Returns:
- the timestamp
-
setX
public void setX(float value)
Sets the X of the step.- Parameters:
value
- the X
-
getX
public float getX()
Returns the X of the step.- Returns:
- the X
-
setY
public void setY(float value)
Sets the Y of the step.- Parameters:
value
- the Y
-
getY
public float getY()
Returns the Y of the step.- Returns:
- the Y
-
hasMetaData
public boolean hasMetaData()
Checks whether any meta-data is present.- Returns:
- true if meta-data present
-
setMetaData
public void setMetaData(HashMap<String,Object> value)
Sets the meta-data to use.- Parameters:
value
- the meta-data, can be null
-
getMetaData
public HashMap<String,Object> getMetaData()
Returns the meta-data, if any.- Returns:
- the meta-data, null if none available
-
addMetaData
public void addMetaData(String key, Object value)
Adds the meta-data.- Parameters:
key
- the keyvalue
- the value
-
compareTo
public int compareTo(Object o)
Compares the object to another. Only uses timestamp, x and y.- Specified by:
compareTo
in interfaceComparable
- Specified by:
compareTo
in classadams.data.container.AbstractDataPoint
- Parameters:
o
- the object to be compared.- Returns:
- -1 of smaller, 0 if equal, +1 if larger
-
equals
public boolean equals(Object obj)
Checks whether the provided object is a Step with the same timestamp and X/Y.- Overrides:
equals
in classadams.data.container.AbstractDataPoint
- Parameters:
obj
- the reference object with which to compare.- Returns:
- true if the same step
- See Also:
compareTo(Object)
-
toString
public String toString()
Returns a string representation of the point.- Specified by:
toString
in classadams.data.container.AbstractDataPoint
- Returns:
- the string representation
-
-