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 AxiscreateFromString(String axisAsString) Maps a string of x, y, z (case ignored) to a corresponding axis type.static intdimensionIndexFor(Axis axis) A corresponding index representing for the dimension anAxisrepresents.static intMultiplexes the a value corresponding to a particular axis.
-
Field Details
-
INVALID_AXIS_STRING
Human-readable error message used when an invalidString-value foraxisis passed.- See Also:
-
INVALID_AXIS_INDEX
Human-readable error message used when an invalidint-value foraxisis 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
AxisforaxisAsString. - Throws:
AxisConversionException- ifaxisAsStringdoes not correspond to an axis.
-
dimensionIndexFor
A corresponding index representing for the dimension anAxisrepresents.This is
0for the X-axis,1for the Y-axis, and2for the Z-axis.- Parameters:
axis- the axis to find an index for.- Returns:
- the index corresponding to
axis. - Throws:
AxisConversionException- ifaxisis 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
xoryorzcorresponding toaxis.
-