JScience v4.3

org.jscience.geography.coordinates
Class Time

java.lang.Object
  extended by org.jscience.geography.coordinates.Coordinates<TemporalCRS<?>>
      extended by org.jscience.geography.coordinates.Time
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Measurable<Duration>>, Measurable<Duration>, javolution.lang.Immutable, javolution.lang.Realtime, javolution.lang.ValueType, javolution.xml.XMLSerializable, org.opengis.spatialschema.geometry.DirectPosition, org.opengis.spatialschema.geometry.geometry.Position

public final class Time
extends Coordinates<TemporalCRS<?>>
implements Measurable<Duration>

This class represents the temporal UTC time coordinates.

Version:
3.0, February 6, 2006
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Field Summary
static TemporalCRS<Time> CRS
          Holds the coordinate reference system for all instances of this class.
 
Constructor Summary
Time(double value, Unit<Duration> unit)
          Creates the temporal position corresponding to the specified coordinates.
 
Method Summary
 int compareTo(Measurable<Duration> arg0)
           
 Time copy()
          Returns a copy of these coordinates allocated by the calling thread (possibly on the stack).
 double doubleValue(Unit<Duration> unit)
          Returns the value of this measurable stated in the specified unit as a double.
 TemporalCRS<?> getCoordinateReferenceSystem()
          Returns the reference system for this coordinates.
 int getDimension()
          OpenGIS® - The length of coordinate sequence (the number of entries).
 double getOrdinate(int dimension)
          OpenGIS® - Returns the ordinate at the specified dimension.
 long longValue(Unit<Duration> unit)
          Returns the estimated integral value of this measurable stated in the specified unit as a long.
static Time valueOf(java.util.Date date)
          Returns the temporal position corresponding to the specified date.
static Time valueOf(double value, Unit<Duration> unit)
          Returns the temporal position corresponding to the specified coordinates.
 
Methods inherited from class org.jscience.geography.coordinates.Coordinates
clone, getCoordinates, getPosition, setOrdinate, toString, toText
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CRS

public static final TemporalCRS<Time> CRS
Holds the coordinate reference system for all instances of this class.

Constructor Detail

Time

public Time(double value,
            Unit<Duration> unit)
Creates the temporal position corresponding to the specified coordinates.

Parameters:
value - the time since midnight, January 1, 1970 UTC stated in the specified unit.
unit - the duration unit in which the time value is stated.
Method Detail

valueOf

public static Time valueOf(double value,
                           Unit<Duration> unit)
Returns the temporal position corresponding to the specified coordinates.

Parameters:
value - the time since midnight, January 1, 1970 UTC stated in the specified unit.
unit - the duration unit in which the time value is stated.
Returns:
the corresponding temporal position.

valueOf

public static Time valueOf(java.util.Date date)
Returns the temporal position corresponding to the specified date.

Parameters:
date - the date.
Returns:
the corresponding temporal position.

getCoordinateReferenceSystem

public TemporalCRS<?> getCoordinateReferenceSystem()
Description copied from class: Coordinates
Returns the reference system for this coordinates.

Specified by:
getCoordinateReferenceSystem in interface org.opengis.spatialschema.geometry.DirectPosition
Specified by:
getCoordinateReferenceSystem in class Coordinates<TemporalCRS<?>>
Returns:
the associated coordinate reference system.

getDimension

public int getDimension()
Description copied from class: Coordinates
OpenGIS® - The length of coordinate sequence (the number of entries). This is determined by the coordinate reference system.

Specified by:
getDimension in interface org.opengis.spatialschema.geometry.DirectPosition
Specified by:
getDimension in class Coordinates<TemporalCRS<?>>
Returns:
the dimensionality of this position.

getOrdinate

public double getOrdinate(int dimension)
                   throws java.lang.IndexOutOfBoundsException
Description copied from class: Coordinates
OpenGIS® - Returns the ordinate at the specified dimension.

Specified by:
getOrdinate in interface org.opengis.spatialschema.geometry.DirectPosition
Specified by:
getOrdinate in class Coordinates<TemporalCRS<?>>
Parameters:
dimension - The dimension in the range 0 to dimension-1.
Returns:
The coordinate at the specified dimension.
Throws:
java.lang.IndexOutOfBoundsException - if the specified dimension is out of bounds.

doubleValue

public final double doubleValue(Unit<Duration> unit)
Description copied from interface: Measurable
Returns the value of this measurable stated in the specified unit as a double. If the measurable has too great a magnitude to be represented as a double, it will be converted to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY as appropriate.

Specified by:
doubleValue in interface Measurable<Duration>
Parameters:
unit - the unit in which this measurable value is stated.
Returns:
the numeric value after conversion to type double.

longValue

public final long longValue(Unit<Duration> unit)
Description copied from interface: Measurable
Returns the estimated integral value of this measurable stated in the specified unit as a long.

Note: This method differs from the Number.longValue() in the sense that the closest integer value is returned and an ArithmeticException is raised instead of a bit truncation in case of overflow (safety critical).

Specified by:
longValue in interface Measurable<Duration>
Parameters:
unit - the unit in which the measurable value is stated.
Returns:
the numeric value after conversion to type long.

compareTo

public int compareTo(Measurable<Duration> arg0)
Specified by:
compareTo in interface java.lang.Comparable<Measurable<Duration>>

copy

public Time copy()
Description copied from class: Coordinates
Returns a copy of these coordinates allocated by the calling thread (possibly on the stack).

Specified by:
copy in interface javolution.lang.ValueType
Specified by:
copy in class Coordinates<TemporalCRS<?>>
Returns:
an identical and independant copy of these coordinates .

JScience v4.3

Copyright © 2006 JScience.