JIDE 3.5.15

com.jidesoft.chart.model
Class TimePosition

java.lang.Object
  extended by com.jidesoft.chart.model.TimePosition
All Implemented Interfaces:
Positionable, Comparable<Positionable>

public class TimePosition
extends Object
implements Positionable

A Positionable class that makes it easy to create positions on a Time Axis. This class is to a Time Axis as the RealPosition class is to a Numeric Axis.


Constructor Summary
TimePosition()
          Creates a TimePosition using the current system time as the position.
TimePosition(long timeInMillis)
          Creates a TimePosition using the supplied long value as the number of milliseconds since January 1st 1970 (as in java.util.Date.getTime())
TimePosition(String timeString, DateFormat dateFormat)
          Creates a TimePosition using the supplied time string and DateFormat specification.
 
Method Summary
 int compareTo(Positionable o)
           
 boolean equals(Object o)
           
 Date getTime()
          Returns a Date instance for the Time encapsulated by this TimePosition.
 int hashCode()
           
 double position()
          The position of this instance; used for positioning along an axis in a chart.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimePosition

public TimePosition()
Creates a TimePosition using the current system time as the position.


TimePosition

public TimePosition(long timeInMillis)
Creates a TimePosition using the supplied long value as the number of milliseconds since January 1st 1970 (as in java.util.Date.getTime())

Parameters:
timeInMillis - the number of milliseconds since January 1st 1970 at 00:00am

TimePosition

public TimePosition(String timeString,
                    DateFormat dateFormat)
             throws ParseException
Creates a TimePosition using the supplied time string and DateFormat specification. If you need to specify a particular TimeZone for your date, you can specify this on your DateFormat class.

Parameters:
timeString - the time, represented as a string in the supplied DateFormat
dateFormat - the format of the supplied timeString
Throws:
ParseException - if the time string cannot be parsed according to the supplied DateFormat
Method Detail

position

public double position()
The position of this instance; used for positioning along an axis in a chart.

Specified by:
position in interface Positionable
Returns:
the position of this instance

getTime

public Date getTime()
Returns a Date instance for the Time encapsulated by this TimePosition.

Returns:
a Date instance for this time.

compareTo

public int compareTo(Positionable o)
Specified by:
compareTo in interface Comparable<Positionable>

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

JIDE 3.5.15