Package org.jfree.data.time
Class TimePeriodValue
- java.lang.Object
-
- org.jfree.data.time.TimePeriodValue
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
public class TimePeriodValue extends java.lang.Object implements java.lang.Cloneable, java.io.SerializableRepresents a time period and an associated value.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private TimePeriodperiodThe time period.private static longserialVersionUIDFor serialization.private java.lang.NumbervalueThe value associated with the time period.
-
Constructor Summary
Constructors Constructor Description TimePeriodValue(TimePeriod period, double value)Constructs a new data item.TimePeriodValue(TimePeriod period, java.lang.Number value)Constructs a new data item.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clones the object.booleanequals(java.lang.Object obj)Tests this object for equality with the target object.TimePeriodgetPeriod()Returns the time period.java.lang.NumbergetValue()Returns the value.inthashCode()Returns a hash code value for the object.voidsetValue(java.lang.Number value)Sets the value for this data item.java.lang.StringtoString()Returns a string representing this instance, primarily for use in debugging.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
period
private TimePeriod period
The time period.
-
value
private java.lang.Number value
The value associated with the time period.
-
-
Constructor Detail
-
TimePeriodValue
public TimePeriodValue(TimePeriod period, java.lang.Number value)
Constructs a new data item.- Parameters:
period- the time period (nullnot permitted).value- the value associated with the time period.- Throws:
java.lang.IllegalArgumentException- ifperiodisnull.
-
TimePeriodValue
public TimePeriodValue(TimePeriod period, double value)
Constructs a new data item.- Parameters:
period- the time period (nullnot permitted).value- the value associated with the time period.- Throws:
java.lang.IllegalArgumentException- ifperiodisnull.
-
-
Method Detail
-
getPeriod
public TimePeriod getPeriod()
Returns the time period.- Returns:
- The time period (never
null).
-
getValue
public java.lang.Number getValue()
Returns the value.- Returns:
- The value (possibly
null). - See Also:
setValue(Number)
-
setValue
public void setValue(java.lang.Number value)
Sets the value for this data item.- Parameters:
value- the new value (nullpermitted).- See Also:
getValue()
-
equals
public boolean equals(java.lang.Object obj)
Tests this object for equality with the target object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code value for the object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- The hashcode
-
clone
public java.lang.Object clone()
Clones the object.Note: no need to clone the period or value since they are immutable classes.
- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
-
toString
public java.lang.String toString()
Returns a string representing this instance, primarily for use in debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string.
-
-