Package org.jfree.data
Class ComparableObjectItem
- java.lang.Object
-
- org.jfree.data.ComparableObjectItem
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable
- Direct Known Subclasses:
OHLCItem
,VectorDataItem
,XIntervalDataItem
,XYIntervalDataItem
,YIntervalDataItem
public class ComparableObjectItem extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable, java.io.Serializable
Represents one (Comparable, Object) data item for use in aComparableObjectSeries
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
obj
The y-value.private static long
serialVersionUID
For serialization.private java.lang.Comparable
x
The x-value.
-
Constructor Summary
Constructors Constructor Description ComparableObjectItem(java.lang.Comparable x, java.lang.Object y)
Constructs a new data item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Returns a clone of this object.int
compareTo(java.lang.Object o1)
Returns an integer indicating the order of this object relative to another object.boolean
equals(java.lang.Object obj)
Tests if this object is equal to another.protected java.lang.Comparable
getComparable()
Returns the x-value.protected java.lang.Object
getObject()
Returns the y-value.int
hashCode()
Returns a hash code.protected void
setObject(java.lang.Object y)
Sets the y-value for this data item.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
x
private java.lang.Comparable x
The x-value.
-
obj
private java.lang.Object obj
The y-value.
-
-
Method Detail
-
getComparable
protected java.lang.Comparable getComparable()
Returns the x-value.- Returns:
- The x-value (never
null
).
-
getObject
protected java.lang.Object getObject()
Returns the y-value.- Returns:
- The y-value (possibly
null
).
-
setObject
protected void setObject(java.lang.Object y)
Sets the y-value for this data item. Note that there is no corresponding method to change the x-value.- Parameters:
y
- the new y-value (null
permitted).
-
compareTo
public int compareTo(java.lang.Object o1)
Returns an integer indicating the order of this object relative to another object.For the order we consider only the x-value: negative == "less-than", zero == "equal", positive == "greater-than".
- Specified by:
compareTo
in interfacejava.lang.Comparable
- Parameters:
o1
- the object being compared to.- Returns:
- An integer indicating the order of this data pair object relative to another object.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of this object.- Overrides:
clone
in classjava.lang.Object
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- not thrown by this class, but subclasses may differ.
-
equals
public boolean equals(java.lang.Object obj)
Tests if this object is equal to another.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to test against for equality (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code.
-
-