com.jjt.utbeg
Class UserParameters

java.lang.Object
  |
  +--com.jjt.utbeg.UserParameters

public class UserParameters
extends Object
implements Serializable

A persistent-capable Collection object for storing and retrieving parameters that a user sets across all exercise Applets.

This Object is backed by a Hashtable internally, and supports PropertyChangeListeners in a Java-bean-like way.

See Also:
Serialized Form

Field Summary
private  PropertyChangeSupport changeSupport
          Utility Object for registering and notifying PropertyChangeListeners.
static String DEPTH_OF_PRIMARY_TARGET
           
static String DEPTH_TO_SHALLOWEST_TARGET
           
private  Hashtable hashtable
          The Collection in which to store key-value pairs, in this case parameterName-parameterValue.
static String[] KNOWN_PARAMETER_NAMES
           
static String NUMBER_OF_RECEIVER_LINES
           
static String NUMBER_OF_SOURCE_LINES
           
static String RECEIVER_LINE_SPACING
           
static String RECEIVER_STATION_SPACING
           
static String REFERENCE_SWATH_SIZE
           
(package private) static long serialVersionUID
          The serialized version number for Objects of this Class.
static String SMALLEST_FEATURE_TO_IMAGE
           
static String SOURCE_LINE_SPACING
           
static String SOURCE_STATION_SPACING
           
static String STACKING_BIN_SIZE
           
 
Constructor Summary
UserParameters()
          Creates a UserParameters Object with no parameters defined.
UserParameters(boolean createTestParameters)
          Test constructor for creating a UserParameters Object with some initial test parameters defined.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
          Registers a listener to be notified when parameters change.
 void dump()
          Debugging aid which dumps this Object to stderr.
protected  PropertyChangeSupport getChangeSupport()
          Returns the internal support object for notifying listeners of property changes.
 double getDouble(String key)
          Returns a double-precision floating point number for a given key.
 double getDouble(String key, double defaultValue)
          Returns a double-precision floating point number for a given key.
 int getInt(String key)
          Returns an integer value for a parameter.
 int getInt(String key, int defaultValue)
          Returns an integer value for a parameter.
static String[] getKnownParameterNames()
          Returns a list of all parameter names known to be stored in UserParameters Objects.
protected  Number getNumber(String key)
          Internal method to return a Number parameter.
 String getValueString(String parameterName)
          Returns the value of a parameter represented by a String.
 boolean hasParameter(String parameterName)
          Determines if a parameter value is stored in this collection.
 void removePropertyChangeListener(PropertyChangeListener l)
          Unregisters a listener for this object.
 void set(String key, double value)
          Sets the value of a parameter.
 void set(String key, int value)
          Sets the value of a parameter.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
The serialized version number for Objects of this Class.

This value must be updated when serialization compatibility is broken. Serialization compatiblility is broken when, among other things, a non- static non-transient field is deleted from the class. static and transient fields are not serialized with Objects, and therefore do not effect serialization. New fields may be added without effecting compatibility.


DEPTH_TO_SHALLOWEST_TARGET

public static final String DEPTH_TO_SHALLOWEST_TARGET

DEPTH_OF_PRIMARY_TARGET

public static final String DEPTH_OF_PRIMARY_TARGET

SMALLEST_FEATURE_TO_IMAGE

public static final String SMALLEST_FEATURE_TO_IMAGE

STACKING_BIN_SIZE

public static final String STACKING_BIN_SIZE

SOURCE_STATION_SPACING

public static final String SOURCE_STATION_SPACING

RECEIVER_STATION_SPACING

public static final String RECEIVER_STATION_SPACING

SOURCE_LINE_SPACING

public static final String SOURCE_LINE_SPACING

RECEIVER_LINE_SPACING

public static final String RECEIVER_LINE_SPACING

REFERENCE_SWATH_SIZE

public static final String REFERENCE_SWATH_SIZE

NUMBER_OF_SOURCE_LINES

public static final String NUMBER_OF_SOURCE_LINES

NUMBER_OF_RECEIVER_LINES

public static final String NUMBER_OF_RECEIVER_LINES

KNOWN_PARAMETER_NAMES

public static final String[] KNOWN_PARAMETER_NAMES

hashtable

private Hashtable hashtable
The Collection in which to store key-value pairs, in this case parameterName-parameterValue.

changeSupport

private transient PropertyChangeSupport changeSupport
Utility Object for registering and notifying PropertyChangeListeners.

This instance variable is transient, so it it not serialized when this Object is stored persistently.

Constructor Detail

UserParameters

public UserParameters()
Creates a UserParameters Object with no parameters defined.

UserParameters

public UserParameters(boolean createTestParameters)
Test constructor for creating a UserParameters Object with some initial test parameters defined.
Method Detail

getDouble

public double getDouble(String key,
                        double defaultValue)
Returns a double-precision floating point number for a given key.
Parameters:
key - the name of the parameter to return.
defaultValue - the value to return if none is found.
Returns:
the value of key, or defaultValue if the value is not stored.
Throws:
ClassCastException - if the parameter key is not a Number.

getDouble

public double getDouble(String key)
Returns a double-precision floating point number for a given key.
Parameters:
key - the name of the parameter to return.
Returns:
the value of key, or Double.NaN if the value is not stored.
Throws:
ClassCastException - if the parameter key is not a Number.

getInt

public int getInt(String key,
                  int defaultValue)
Returns an integer value for a parameter.
Parameters:
key - the name of the parameter to return.
Returns:
the value of key, or defaultValue if the value is not stored.
Throws:
ClassCastException - if the parameter key is not a Number.

getNumber

protected Number getNumber(String key)
Internal method to return a Number parameter.
Parameters:
key - the key within the Hashtable to return.
Returns:
the Number value corresponding to key.
Throws:
ClassCastException - if the value is not a Number.

getInt

public int getInt(String key)
Returns an integer value for a parameter.
Parameters:
key - the name of the parameter to return.
Returns:
the value of key, or Integer.MIN_VALUE if the value is not stored.
Throws:
ClassCastException - if the parameter key is not a Number.

set

public void set(String key,
                int value)
Sets the value of a parameter.
Parameters:
key - the name of the parameter to set.
value - the value to set the parameter as.

set

public void set(String key,
                double value)
Sets the value of a parameter.
Parameters:
key - the name of the parameter to set.
value - the value to set the parameter as.

getChangeSupport

protected PropertyChangeSupport getChangeSupport()
Returns the internal support object for notifying listeners of property changes.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)
Registers a listener to be notified when parameters change.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Unregisters a listener for this object.

hasParameter

public boolean hasParameter(String parameterName)
Determines if a parameter value is stored in this collection.

getValueString

public String getValueString(String parameterName)
Returns the value of a parameter represented by a String.
Returns:
the String representation of the value, or null if the parameter is not stored.

getKnownParameterNames

public static String[] getKnownParameterNames()
Returns a list of all parameter names known to be stored in UserParameters Objects.

dump

public void dump()
Debugging aid which dumps this Object to stderr.