public class SensorLengths
extends java.lang.Object
Hard-coded, pre-defined sets of sensor lengths can be selected by name, but SensorLengths can also represent any ‘custom’ set of sensor lengths.
Modifier and Type | Method and Description |
---|---|
static SensorLengths |
fromPrefs(java.util.prefs.Preferences prefs)
Creates a sensor lengths object from a string representation in a
Preferences object. |
static SensorLengths |
fromPresetName(java.lang.String name)
Creates a sensor lengths object with lengths determined by a named
preset.
|
static SensorLengths |
fromString(java.lang.String string)
Creates a new sensor lengths object from a string definition.
|
static SensorLengths |
fromStrings(java.lang.String x,
java.lang.String y,
java.lang.String z)
Creates a new sensor lengths object from three strings specifying
the individual sensor lengths.
|
java.util.List<java.lang.String> |
getLengths()
Returns a list of string representations of the sensor lengths in the
order x, y, z.
|
java.lang.String |
getPreset()
Returns the name of the preset sensor lengths, if any.
|
static java.lang.String[] |
getPresetNames()
Returns the names of the hard-coded preset sensor lengths.
|
void |
save(java.util.prefs.Preferences prefs)
Writes a string representation of the sensor lengths to a specified
Preferences object. |
java.lang.String |
toString()
Returns a string representation of this object.
|
Vec3 |
toVector()
Returns the sensor lengths as a three-dimensional vector.
|
public java.util.List<java.lang.String> getLengths()
public Vec3 toVector()
public void save(java.util.prefs.Preferences prefs)
Preferences
object. The value is stored under the key
sensorLengths
.prefs
- the preferences object to which to store the sensor lengthspublic static SensorLengths fromPrefs(java.util.prefs.Preferences prefs)
Preferences
object. The string is read from the key
sensorLengths
. If there is no such key in the preferences object,
each sensor length defaults to 1.prefs
- a preferences object from which to read the definitionpublic java.lang.String toString()
fromString(java.lang.String)
to reconstruct the original object.toString
in class java.lang.Object
public static SensorLengths fromString(java.lang.String string)
toString()
.string
- a string definitionjava.lang.IllegalArgumentException
- if the string is not recognizedpublic static SensorLengths fromStrings(java.lang.String x, java.lang.String y, java.lang.String z)
x
- x sensor lengthy
- y sensor lengthz
- z sensor lengthpublic static java.lang.String[] getPresetNames()
public static SensorLengths fromPresetName(java.lang.String name)
name
- a named presetpublic java.lang.String getPreset()
null
.