Package org.anchoranalysis.spatial.axis
Class AxisConverter
Object
AxisConverter
Converts to/from
Axis
to a String
and int
representations, checking for
invalid input.
The int
representation is is 0
for the X-axis, 1
for the
Y-axis, and 2
for the Z-axis.
- Author:
- Owen Feehan
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Axis
createFromString
(String axisAsString) Maps a string of x, y, z (case ignored) to a corresponding axis type.static int
dimensionIndexFor
(Axis axis) A corresponding index representing for the dimension anAxis
represents.static int
Multiplexes the a value corresponding to a particular axis.
-
Field Details
-
INVALID_AXIS_STRING
Human-readable error message used when an invalidString
-value foraxis
is passed.- See Also:
-
INVALID_AXIS_INDEX
Human-readable error message used when an invalidint
-value foraxis
is passed.- See Also:
-
-
Method Details
-
createFromString
Maps a string of x, y, z (case ignored) to a corresponding axis type.- Parameters:
axisAsString
- the string indicating the axis.- Returns:
- the corresponding
Axis
foraxisAsString
. - Throws:
AxisConversionException
- ifaxisAsString
does not correspond to an axis.
-
dimensionIndexFor
A corresponding index representing for the dimension anAxis
represents.This is
0
for the X-axis,1
for the Y-axis, and2
for the Z-axis.- Parameters:
axis
- the axis to find an index for.- Returns:
- the index corresponding to
axis
. - Throws:
AxisConversionException
- ifaxis
is unrecognized.
-
valueFor
Multiplexes the a value corresponding to a particular axis.- Parameters:
axis
- the axis used to select a value.x
- a possible-value, representing the X-axis.y
- a possible-value, representing the Y-axis.z
- a possible-value, representing the Z-axis.- Returns:
- one of
x
ory
orz
corresponding toaxis
.
-