org.jfree.data.xy
Class XYDataItem

java.lang.Object
  extended byorg.jfree.data.xy.XYDataItem
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

public class XYDataItem
extends java.lang.Object
implements java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

Represents one (x, y) data item for an XYSeries.

See Also:
Serialized Form

Constructor Summary
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
 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.
 java.lang.Number getX()
          Returns the x-value.
 java.lang.Number getY()
          Returns the y-value.
 int hashCode()
          Returns a hash code.
 void setY(double y)
          Sets the y-value for this data item.
 void setY(java.lang.Number y)
          Sets the y-value for this data item.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XYDataItem

public XYDataItem(java.lang.Number x,
                  java.lang.Number y)
Constructs a new data item.

Parameters:
x - the x-value (null NOT permitted).
y - the y-value (null permitted).

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).

getY

public java.lang.Number getY()
Returns the y-value.

Returns:
The y-value (possibly null).

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 (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 interface java.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.

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.

Parameters:
obj - the object to test against for equality (null permitted).
Returns:
A boolean.

hashCode

public int hashCode()
Returns a hash code.

Returns:
A hash code.