Package uk.ac.rdg.resc.edal.grid
Class TimeAxisImpl
- java.lang.Object
-
- uk.ac.rdg.resc.edal.grid.AbstractReferenceableAxis<T>
-
- uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis<org.joda.time.DateTime>
-
- uk.ac.rdg.resc.edal.grid.TimeAxisImpl
-
- All Implemented Interfaces:
Serializable
,DiscreteDomain<org.joda.time.DateTime,Extent<org.joda.time.DateTime>>
,Domain<org.joda.time.DateTime>
,TemporalDomain
,ReferenceableAxis<org.joda.time.DateTime>
,TimeAxis
public final class TimeAxisImpl extends AbstractIrregularAxis<org.joda.time.DateTime> implements TimeAxis
An implementation of aTimeAxis
- Author:
- Guy, Jon
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis
axisValues, reversed
-
-
Constructor Summary
Constructors Constructor Description TimeAxisImpl(String name, List<org.joda.time.DateTime> axisValues)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(org.joda.time.DateTime position)
protected double
difference(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)
Returns the difference between the supplied values.boolean
equals(Object obj)
protected org.joda.time.DateTime
extendFirstValue(org.joda.time.DateTime firstVal, org.joda.time.DateTime nextVal)
This should return the lower bound of the first value of the axis, based on the first and second values.protected org.joda.time.DateTime
extendLastValue(org.joda.time.DateTime lastVal, org.joda.time.DateTime secondLastVal)
This should return the upper bound of the last value of the axis, based on the last two values.org.joda.time.Chronology
getChronology()
Return theChronology
used in this time axisExtent<org.joda.time.DateTime>
getCoordinateBounds(int index)
Gets the coordinate bounds associated with the point at the given index.Extent<org.joda.time.DateTime>
getCoordinateExtent()
Gets the extent encompassing all the positions on this axis.Extent<org.joda.time.DateTime>
getExtent()
protected org.joda.time.DateTime
getMidpoint(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)
Returns the midpoint of the supplied values.int
hashCode()
boolean
wraps()
Returns true if the values on the axis wrap around (e.g.-
Methods inherited from class uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis
checkAscending, findIndexOf, getCoordinateValue, isAscending, size
-
Methods inherited from class uk.ac.rdg.resc.edal.grid.AbstractReferenceableAxis
getCoordinateValues, getDomainObjects, getFirstValue, getLastValue, getMaximumValue, getMinimumValue, getName
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface uk.ac.rdg.resc.edal.domain.DiscreteDomain
getDomainObjects
-
Methods inherited from interface uk.ac.rdg.resc.edal.grid.ReferenceableAxis
findIndexOf, getCoordinateValue, getCoordinateValues, getName, size
-
Methods inherited from interface uk.ac.rdg.resc.edal.grid.TimeAxis
isAscending
-
-
-
-
Method Detail
-
wraps
public boolean wraps()
Description copied from interface:ReferenceableAxis
Returns true if the values on the axis wrap around (e.g. longitude)- Specified by:
wraps
in interfaceReferenceableAxis<org.joda.time.DateTime>
-
contains
public boolean contains(org.joda.time.DateTime position)
- Specified by:
contains
in interfaceDomain<org.joda.time.DateTime>
- Overrides:
contains
in classAbstractReferenceableAxis<org.joda.time.DateTime>
- Returns:
- true if the given position is contained within this domain.
-
extendFirstValue
protected org.joda.time.DateTime extendFirstValue(org.joda.time.DateTime firstVal, org.joda.time.DateTime nextVal)
Description copied from class:AbstractReferenceableAxis
This should return the lower bound of the first value of the axis, based on the first and second values. This will generally be equivalent to:firstVal - (nextVal-firstVal)/2
- Specified by:
extendFirstValue
in classAbstractReferenceableAxis<org.joda.time.DateTime>
- Parameters:
firstVal
- The first value of the axisnextVal
- The second value of the axis- Returns:
- The lower bound of the first axis value
-
extendLastValue
protected org.joda.time.DateTime extendLastValue(org.joda.time.DateTime lastVal, org.joda.time.DateTime secondLastVal)
Description copied from class:AbstractReferenceableAxis
This should return the upper bound of the last value of the axis, based on the last two values. This will generally be equivalent to:lastVal + (lastVal-secondLastVal)/2
- Specified by:
extendLastValue
in classAbstractReferenceableAxis<org.joda.time.DateTime>
- Parameters:
lastVal
- The last value of the axissecondLastVal
- The next-to-last value of the axis- Returns:
- The upper bound of the the final axis value
-
difference
protected double difference(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)
Description copied from class:AbstractIrregularAxis
Returns the difference between the supplied values. This is so that certain methods can be abstracted without worrying about non-trivial difference calculation (e.g.DateTime
s)- Specified by:
difference
in classAbstractIrregularAxis<org.joda.time.DateTime>
- Parameters:
pos1
- the first valuepos2
- the second value- Returns:
- the value corresponding to pos1 - pos2
-
getMidpoint
protected org.joda.time.DateTime getMidpoint(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)
Description copied from class:AbstractIrregularAxis
Returns the midpoint of the supplied values. This is so that certain methods can be abstracted without worrying about non-trivial midpoint calculation (e.g.DateTime
s)- Specified by:
getMidpoint
in classAbstractIrregularAxis<org.joda.time.DateTime>
- Parameters:
pos1
- the first valuepos2
- the second value- Returns:
- the midpoint of the values
-
getExtent
public Extent<org.joda.time.DateTime> getExtent()
- Specified by:
getExtent
in interfaceTemporalDomain
-
getChronology
public org.joda.time.Chronology getChronology()
Description copied from interface:TimeAxis
Return theChronology
used in this time axis- Specified by:
getChronology
in interfaceTemporalDomain
- Specified by:
getChronology
in interfaceTimeAxis
-
getCoordinateBounds
public Extent<org.joda.time.DateTime> getCoordinateBounds(int index)
Description copied from interface:ReferenceableAxis
Gets the coordinate bounds associated with the point at the given index. In some types of ReferenceableAxis, each point along the axis is associated with a range of positions, rather than a single infinitesimal position. This method returns this range.- Specified by:
getCoordinateBounds
in interfaceReferenceableAxis<org.joda.time.DateTime>
- Overrides:
getCoordinateBounds
in classAbstractIrregularAxis<org.joda.time.DateTime>
- Returns:
- the coordinate bounds associated with the point at the given index. Returns an Extent with low=high if the bounds are infinitesimal. Never returns null.
-
getCoordinateExtent
public Extent<org.joda.time.DateTime> getCoordinateExtent()
Description copied from interface:ReferenceableAxis
Gets the extent encompassing all the positions on this axis. This will usually be given by the low value of the first set ofcoordinate bounds
and the high value of the last set of coordinate bounds (but beware that values along the axis might decrease, not increase).- Specified by:
getCoordinateExtent
in interfaceReferenceableAxis<org.joda.time.DateTime>
- Overrides:
getCoordinateExtent
in classAbstractReferenceableAxis<org.joda.time.DateTime>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceReferenceableAxis<org.joda.time.DateTime>
- Overrides:
hashCode
in classAbstractIrregularAxis<org.joda.time.DateTime>
-
equals
public boolean equals(Object obj)
- Specified by:
equals
in interfaceReferenceableAxis<org.joda.time.DateTime>
- Overrides:
equals
in classAbstractIrregularAxis<org.joda.time.DateTime>
-
-