Package uk.ac.rdg.resc.edal.grid
Class DefinedBoundsAxis
- java.lang.Object
-
- uk.ac.rdg.resc.edal.grid.AbstractReferenceableAxis<T>
-
- uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis<Double>
-
- uk.ac.rdg.resc.edal.grid.ReferenceableAxisImpl
-
- uk.ac.rdg.resc.edal.grid.DefinedBoundsAxis
-
- All Implemented Interfaces:
Serializable
,DiscreteDomain<Double,Extent<Double>>
,Domain<Double>
,ReferenceableAxis<Double>
public class DefinedBoundsAxis extends ReferenceableAxisImpl implements ReferenceableAxis<Double>
Defines aReferenceableAxis
where the bounds between cells are explicitly specified.- Author:
- Guy Griffiths
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis
axisValues, reversed
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Double
extendFirstValue(Double firstVal, Double nextVal)
This should return the lower bound of the first value of the axis, based on the first and second values.protected Double
extendLastValue(Double lastVal, Double secondLastVal)
This should return the upper bound of the last value of the axis, based on the last two values.Extent<Double>
getCoordinateBounds(int index)
Gets the coordinate bounds associated with the point at the given index.Extent<Double>
getCoordinateExtent()
Gets the extent encompassing all the positions on this axis.protected Double
getMidpoint(Double pos1, Double pos2)
Returns the midpoint of the supplied values.-
Methods inherited from class uk.ac.rdg.resc.edal.grid.ReferenceableAxisImpl
difference, equals, findIndexOf, hashCode, wraps
-
Methods inherited from class uk.ac.rdg.resc.edal.grid.AbstractIrregularAxis
checkAscending, getCoordinateValue, isAscending, size
-
Methods inherited from class uk.ac.rdg.resc.edal.grid.AbstractReferenceableAxis
contains, 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
equals, findIndexOf, getCoordinateValue, getCoordinateValues, getName, hashCode, isAscending, size, wraps
-
-
-
-
Method Detail
-
getCoordinateBounds
public Extent<Double> 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<Double>
- Overrides:
getCoordinateBounds
in classAbstractIrregularAxis<Double>
- 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<Double> 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<Double>
- Overrides:
getCoordinateExtent
in classAbstractReferenceableAxis<Double>
-
getMidpoint
protected Double getMidpoint(Double pos1, Double 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)- Overrides:
getMidpoint
in classReferenceableAxisImpl
- Parameters:
pos1
- the first valuepos2
- the second value- Returns:
- the midpoint of the values
-
extendFirstValue
protected Double extendFirstValue(Double firstVal, Double 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
- Overrides:
extendFirstValue
in classReferenceableAxisImpl
- 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 Double extendLastValue(Double lastVal, Double 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
- Overrides:
extendLastValue
in classReferenceableAxisImpl
- 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
-
-