Package adams.data.container
Class AbstractDataPoint
- java.lang.Object
-
- adams.data.container.AbstractDataPoint
-
- All Implemented Interfaces:
CloneHandler
,DataPoint
,Serializable
,Comparable
- Direct Known Subclasses:
InstancePoint
,SpreadSheetRowPoint
,TimeseriesPoint
,XYSequencePoint
public abstract class AbstractDataPoint extends Object implements DataPoint
Superclass for data points.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DataContainer
m_Parent
the container this data point belongs to.
-
Constructor Summary
Constructors Constructor Description AbstractDataPoint()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
assign(DataPoint other)
Obtains the stored variables from the other data point.abstract int
compareTo(Object o)
Compares this object with the specified object for order.boolean
equals(Object obj)
Indicates whether some other object is "equal to" this one.Object
getClone()
Returns a clone of itself.DataContainer
getParent()
Returns the spectrum this point belongs to.boolean
hasParent()
Returns whether the point belongs to a spectrum.void
setParent(DataContainer value)
Sets the spectrum this point belongs to.static Double
toDouble(Byte value)
Turns the Byte object into a double.static Double
toDouble(Double value)
Turns the Double object into a double.static Double
toDouble(Float value)
Turns the Float object into a double.static Double
toDouble(Integer value)
Turns the Integer object into a double.static Double
toDouble(Long value)
Turns the Long object into a double.static Double
toDouble(Number value)
Turns the Number object into a double.static Double
toDouble(Object value)
Turns the Short into a double, if possible.static Double
toDouble(Short value)
Turns the Short object into a double.abstract String
toString()
Returns a string representation of the point.
-
-
-
Field Detail
-
m_Parent
protected DataContainer m_Parent
the container this data point belongs to.
-
-
Method Detail
-
setParent
public void setParent(DataContainer value)
Sets the spectrum this point belongs to.
-
getParent
public DataContainer getParent()
Returns the spectrum this point belongs to.
-
hasParent
public boolean hasParent()
Returns whether the point belongs to a spectrum.
-
compareTo
public abstract int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.- Specified by:
compareTo
in interfaceComparable
- Parameters:
o
- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException
- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.
-
getClone
public Object getClone()
Returns a clone of itself. Parent gets set to null!- Specified by:
getClone
in interfaceCloneHandler
- Specified by:
getClone
in interfaceDataPoint
- Returns:
- the clone
-
assign
public void assign(DataPoint other)
Obtains the stored variables from the other data point.
-
toString
public abstract String toString()
Returns a string representation of the point.
-
toDouble
public static Double toDouble(Object value)
Turns the Short into a double, if possible.- Parameters:
value
- the value to convert- Returns:
- the double or null if not a number
-
toDouble
public static Double toDouble(Number value)
Turns the Number object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
toDouble
public static Double toDouble(Byte value)
Turns the Byte object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
toDouble
public static Double toDouble(Short value)
Turns the Short object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
toDouble
public static Double toDouble(Integer value)
Turns the Integer object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
toDouble
public static Double toDouble(Long value)
Turns the Long object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
toDouble
public static Double toDouble(Float value)
Turns the Float object into a double.- Parameters:
value
- the value to convert- Returns:
- the double
-
-