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 booleancontains(org.joda.time.DateTime position)protected doubledifference(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)Returns the difference between the supplied values.booleanequals(Object obj)protected org.joda.time.DateTimeextendFirstValue(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.DateTimeextendLastValue(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.ChronologygetChronology()Return theChronologyused 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.DateTimegetMidpoint(org.joda.time.DateTime pos1, org.joda.time.DateTime pos2)Returns the midpoint of the supplied values.inthashCode()booleanwraps()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:ReferenceableAxisReturns true if the values on the axis wrap around (e.g. longitude)- Specified by:
wrapsin interfaceReferenceableAxis<org.joda.time.DateTime>
-
contains
public boolean contains(org.joda.time.DateTime position)
- Specified by:
containsin interfaceDomain<org.joda.time.DateTime>- Overrides:
containsin 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:AbstractReferenceableAxisThis 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:
extendFirstValuein 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:AbstractReferenceableAxisThis 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:
extendLastValuein 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:AbstractIrregularAxisReturns the difference between the supplied values. This is so that certain methods can be abstracted without worrying about non-trivial difference calculation (e.g.DateTimes)- Specified by:
differencein 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:AbstractIrregularAxisReturns the midpoint of the supplied values. This is so that certain methods can be abstracted without worrying about non-trivial midpoint calculation (e.g.DateTimes)- Specified by:
getMidpointin 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:
getExtentin interfaceTemporalDomain
-
getChronology
public org.joda.time.Chronology getChronology()
Description copied from interface:TimeAxisReturn theChronologyused in this time axis- Specified by:
getChronologyin interfaceTemporalDomain- Specified by:
getChronologyin interfaceTimeAxis
-
getCoordinateBounds
public Extent<org.joda.time.DateTime> getCoordinateBounds(int index)
Description copied from interface:ReferenceableAxisGets 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:
getCoordinateBoundsin interfaceReferenceableAxis<org.joda.time.DateTime>- Overrides:
getCoordinateBoundsin 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:ReferenceableAxisGets the extent encompassing all the positions on this axis. This will usually be given by the low value of the first set ofcoordinate boundsand the high value of the last set of coordinate bounds (but beware that values along the axis might decrease, not increase).- Specified by:
getCoordinateExtentin interfaceReferenceableAxis<org.joda.time.DateTime>- Overrides:
getCoordinateExtentin classAbstractReferenceableAxis<org.joda.time.DateTime>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceReferenceableAxis<org.joda.time.DateTime>- Overrides:
hashCodein classAbstractIrregularAxis<org.joda.time.DateTime>
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceReferenceableAxis<org.joda.time.DateTime>- Overrides:
equalsin classAbstractIrregularAxis<org.joda.time.DateTime>
-
-