public class SensorLengths extends 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(Preferences prefs)
Creates a sensor lengths object from a string representation in a
Preferences object. |
static SensorLengths |
fromPresetName(String name)
Creates a sensor lengths object with lengths determined by a named
preset.
|
static SensorLengths |
fromString(String string)
Creates a new sensor lengths object from a string definition.
|
static SensorLengths |
fromStrings(String x,
String y,
String z)
Creates a new sensor lengths object from three strings specifying
the individual sensor lengths.
|
List<String> |
getLengths()
Returns a list of string representations of the sensor lengths in the
order x, y, z.
|
String |
getPreset()
Returns the name of the preset sensor lengths, if any.
|
static String[] |
getPresetNames()
Returns the names of the hard-coded preset sensor lengths.
|
void |
save(Preferences prefs)
Writes a string representation of the sensor lengths to a specified
Preferences object. |
String |
toString()
Returns a string representation of this object.
|
Vec3 |
toVector()
Returns the sensor lengths as a three-dimensional vector.
|
public List<String> getLengths()
public Vec3 toVector()
public void save(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(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 String toString()
fromString(java.lang.String)
to reconstruct the original object.public static SensorLengths fromString(String string)
toString()
.string
- a string definition (non-null)IllegalArgumentException
- if the string is not recognizedpublic static SensorLengths fromStrings(String x, String y, String z)
x
- x sensor lengthy
- y sensor lengthz
- z sensor lengthpublic static String[] getPresetNames()
public static SensorLengths fromPresetName(String name)
name
- a named presetpublic String getPreset()
null
.Copyright © 2022. All rights reserved.