net.talvi.puffinplot.data
Class SensorLengths

java.lang.Object
  extended by net.talvi.puffinplot.data.SensorLengths

public class SensorLengths
extends java.lang.Object

Represents the effective SQUID sensor lengths of a magnetometer, as determined by the response curves of the SQUID sensors. These sensor lengths are used when loading 2G long core magnetometer data, since in this case the components of the magnetic moment measurements are not pre-corrected for effective sensor length.

Hard-coded, pre-defined sets of sensor lengths can be selected by name, but SensorLengths can also represent any custom set of sensor lengths.


Method Summary
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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getLengths

public java.util.List<java.lang.String> getLengths()
Returns a list of string representations of the sensor lengths in the order x, y, z.

Returns:
a list of string representations of the sensor lengths

toVector

public Vec3 toVector()
Returns the sensor lengths as a three-dimensional vector.

Returns:
the sensor lengths as a three-dimensional vector

save

public void save(java.util.prefs.Preferences prefs)
Writes a string representation of the sensor lengths to a specified Preferences object. The value is stored under the key sensorLengths.

Parameters:
prefs - the preferences object to which to store the sensor lengths

fromPrefs

public static SensorLengths fromPrefs(java.util.prefs.Preferences prefs)
Creates a sensor lengths object from a string representation in a 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.

Parameters:
prefs - a preferences object from which to read the definition
Returns:
the sensor lengths defined in the preferences object

toString

public java.lang.String toString()
Returns a string representation of this object. The string may be passed to fromString(java.lang.String) to reconstruct the original object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this object

fromString

public static SensorLengths fromString(java.lang.String string)
Creates a new sensor lengths object from a string definition. The definition must be in the format produced by toString().

Parameters:
string - a string definition
Returns:
the sensor lengths specified in the string

fromStrings

public 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. Each string must contain a decimal representation of a number.

Parameters:
x - x sensor length
y - y sensor length
z - z sensor length
Returns:
a sensor lengths object representing the specified lengths

getPresetNames

public static java.lang.String[] getPresetNames()
Returns the names of the hard-coded preset sensor lengths.

Returns:
the names of the hard-coded preset sensor lengths

fromPresetName

public static SensorLengths fromPresetName(java.lang.String name)
Creates a sensor lengths object with lengths determined by a named preset.

Parameters:
name - a named preset
Returns:
a sensor lengths object with lengths set according to the preset

getPreset

public java.lang.String getPreset()
Returns the name of the preset sensor lengths, if any. If these sensor lengths were created from a named preset, this method returns the name of the preset. Otherwise it returns null.

Returns:
the name of the preset sensor lengths, if any