Interface ReferenceableAxis<P>
-
- Type Parameters:
P
- The type of object used to identify positions on this axis
- All Superinterfaces:
DiscreteDomain<P,Extent<P>>
,Domain<P>
- All Known Subinterfaces:
RegularAxis
,TimeAxis
,VerticalAxis
- All Known Implementing Classes:
AbstractIrregularAxis
,AbstractReferenceableAxis
,DefinedBoundsAxis
,ReferenceableAxisImpl
,RegularAxisImpl
,TimeAxisImpl
,VerticalAxisImpl
public interface ReferenceableAxis<P> extends DiscreteDomain<P,Extent<P>>
A one-dimensional axis of a referenceable frid, which maps between integer indices along the axis and real-world coordinates.
ReferenceableAxes can be composed to form
RectilinearGrid
s.If the values of the axis are numeric, the must either increase or decrease monotonically with increasing axis index.
- Author:
- Jon Blower, Guy Griffiths
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
equals(Object obj)
int
findIndexOf(P position)
Finds the index along this axis that corresponds with the given position.Extent<P>
getCoordinateBounds(int index)
Gets the coordinate bounds associated with the point at the given index.Extent<P>
getCoordinateExtent()
Gets the extent encompassing all the positions on this axis.P
getCoordinateValue(int index)
Gets the coordinate value at the given indexList<P>
getCoordinateValues()
Gets all of the coordinate values of the axisString
getName()
int
hashCode()
boolean
isAscending()
Returns true if the values on the axis are in ascending order according to their natural ordering.int
size()
boolean
wraps()
Returns true if the values on the axis wrap around (e.g.-
Methods inherited from interface uk.ac.rdg.resc.edal.domain.DiscreteDomain
getDomainObjects
-
-
-
-
Method Detail
-
getName
String getName()
- Returns:
- The name of the axis.
-
getCoordinateValue
P getCoordinateValue(int index)
Gets the coordinate value at the given index- Parameters:
index
- The index of the required position on the axis. Must be within the axis'extent
.- Returns:
- the coordinate value at the given index
- Throws:
IndexOutOfBoundsException
- if the axis' extent does not contain this index.
-
getCoordinateValues
List<P> getCoordinateValues()
Gets all of the coordinate values of the axis- Returns:
- A list of coordinate values
-
isAscending
boolean isAscending()
Returns true if the values on the axis are in ascending order according to their natural ordering.
-
wraps
boolean wraps()
Returns true if the values on the axis wrap around (e.g. longitude)
-
getCoordinateBounds
Extent<P> getCoordinateBounds(int index)
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.- Parameters:
index
-- 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.
-
findIndexOf
int findIndexOf(P position)
Finds the index along this axis that corresponds with the given position. Formally, this returns an index such that getCoordinateBounds(index).contains(position) returns true. Returns -1 if the given position is not associated with any axis index.
If this is a longitude axis, this method will handle the case of longitude values wrapping, therefore values of -180 and +180 are treated as equivalent by this method, irrespective of the values in
getCoordinateValue(int)
.- Parameters:
position
-- Returns:
- the index of the given coordinate value, or -1 if not found.
-
getCoordinateExtent
Extent<P> getCoordinateExtent()
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).
-
size
int size()
- Returns:
- The extent of this axis. Indices within this axis will run from 0
to
size()
- 1
-
-