Package org.jfree.data.time
Class SimpleTimePeriod
- java.lang.Object
-
- org.jfree.data.time.SimpleTimePeriod
-
- All Implemented Interfaces:
Serializable
,Comparable
,TimePeriod
public class SimpleTimePeriod extends Object implements TimePeriod, Comparable, Serializable
An arbitrary period of time, measured to millisecond precision usingjava.util.Date
.This class is intentionally immutable (that is, once constructed, you cannot alter the start and end attributes).
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleTimePeriod(long start, long end)
Creates a new time allocation.SimpleTimePeriod(Date start, Date end)
Creates a new time allocation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object obj)
Returns an integer that indicates the relative ordering of two time periods.boolean
equals(Object obj)
Tests this time period instance for equality with an arbitrary object.Date
getEnd()
Returns the end date/time.long
getEndMillis()
Returns the end date/time in milliseconds.Date
getStart()
Returns the start date/time.long
getStartMillis()
Returns the start date/time in milliseconds.int
hashCode()
Returns a hash code for this object instance.
-
-
-
Method Detail
-
getStart
public Date getStart()
Returns the start date/time.- Specified by:
getStart
in interfaceTimePeriod
- Returns:
- The start date/time (never
null
).
-
getStartMillis
public long getStartMillis()
Returns the start date/time in milliseconds.- Returns:
- The start.
- Since:
- 1.0.10.
-
getEnd
public Date getEnd()
Returns the end date/time.- Specified by:
getEnd
in interfaceTimePeriod
- Returns:
- The end date/time (never
null
).
-
getEndMillis
public long getEndMillis()
Returns the end date/time in milliseconds.- Returns:
- The end.
- Since:
- 1.0.10.
-
equals
public boolean equals(Object obj)
Tests this time period instance for equality with an arbitrary object. The object is considered equal if it is an instance ofTimePeriod
and it has the same start and end dates.
-
compareTo
public int compareTo(Object obj)
Returns an integer that indicates the relative ordering of two time periods.- Specified by:
compareTo
in interfaceComparable
- Parameters:
obj
- the object (null
not permitted).- Returns:
- An integer.
- Throws:
ClassCastException
- ifobj
is not an instance ofTimePeriod
.
-
-