Package org.jfree.data.xy
Class XYDataItem
- java.lang.Object
-
- org.jfree.data.xy.XYDataItem
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable
public class XYDataItem extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable, java.io.SerializableRepresents one (x, y) data item for anXYSeries. Note that subclasses are REQUIRED to support cloning.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDFor serialization.private java.lang.NumberxThe x-value (nullnot permitted).private java.lang.NumberyThe y-value.
-
Constructor Summary
Constructors Constructor Description XYDataItem(double x, double y)Constructs a new data item.XYDataItem(java.lang.Number x, java.lang.Number y)Constructs a new data item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Returns a clone of this object.intcompareTo(java.lang.Object o1)Returns an integer indicating the order of this object relative to another object.booleanequals(java.lang.Object obj)Tests if this object is equal to another.java.lang.NumbergetX()Returns the x-value.doublegetXValue()Returns the x-value as a double primitive.java.lang.NumbergetY()Returns the y-value.doublegetYValue()Returns the y-value as a double primitive.inthashCode()Returns a hash code.voidsetY(double y)Sets the y-value for this data item.voidsetY(java.lang.Number y)Sets the y-value for this data item.java.lang.StringtoString()Returns a string representing this instance, primarily for debugging use.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
x
private java.lang.Number x
The x-value (nullnot permitted).
-
y
private java.lang.Number y
The y-value.
-
-
Constructor Detail
-
XYDataItem
public XYDataItem(java.lang.Number x, java.lang.Number y)Constructs a new data item.- Parameters:
x- the x-value (nullNOT permitted).y- the y-value (nullpermitted).
-
XYDataItem
public XYDataItem(double x, double y)Constructs a new data item.- Parameters:
x- the x-value.y- the y-value.
-
-
Method Detail
-
getX
public java.lang.Number getX()
Returns the x-value.- Returns:
- The x-value (never
null).
-
getXValue
public double getXValue()
Returns the x-value as a double primitive.- Returns:
- The x-value.
- See Also:
getX(),getYValue()
-
getY
public java.lang.Number getY()
Returns the y-value.- Returns:
- The y-value (possibly
null).
-
getYValue
public double getYValue()
Returns the y-value as a double primitive.- Returns:
- The y-value.
- See Also:
getY(),getXValue()
-
setY
public void setY(double 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.
-
setY
public void setY(java.lang.Number 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 (nullpermitted).
-
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:
compareToin 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()
Returns a clone of this object.- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
-
equals
public boolean equals(java.lang.Object obj)
Tests if this object is equal to another.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to test against for equality (nullpermitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code.
-
toString
public java.lang.String toString()
Returns a string representing this instance, primarily for debugging use.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string.
-
-