Class SimpleTimePeriod

java.lang.Object
org.jfree.data.time.SimpleTimePeriod
All Implemented Interfaces:
Serializable, TimePeriod

public class SimpleTimePeriod
extends Object
implements TimePeriod, Serializable
An arbitrary period of time, measured to millisecond precision using java.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​(Date start, Date end)
    Creates a new time allocation.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(Object obj)
    Returns true if this time period is equal to another object, and false otherwise.
    Date getEnd()
    Returns the end date/time.
    Date getStart()
    Returns the start date/time.
    int hashCode()
    Returns a hash code for this object instance.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleTimePeriod

      public SimpleTimePeriod​(Date start, Date end)
      Creates a new time allocation.
      Parameters:
      start - the start date/time.
      end - the end date/time.
  • Method Details

    • getStart

      public Date getStart()
      Returns the start date/time.
      Specified by:
      getStart in interface TimePeriod
      Returns:
      the start date/time.
    • getEnd

      public Date getEnd()
      Returns the end date/time.
      Specified by:
      getEnd in interface TimePeriod
      Returns:
      the end date/time.
    • equals

      public boolean equals​(Object obj)
      Returns true if this time period is equal to another object, and false otherwise.

      The test for equality looks only at the start and end values for the time period.

      Overrides:
      equals in class Object
      Parameters:
      obj - the other object.
      Returns:
      A boolean.
    • hashCode

      public int hashCode()
      Returns a hash code for this object instance.

      The approach described by Joshua Bloch in "Effective Java" has been used here:

      http://developer.java.sun.com/developer/Books/effectivejava/Chapter3.pdf

      Overrides:
      hashCode in class Object
      Returns:
      A hash code.