org.opensha.commons.param.impl
Class EstimateParameter

java.lang.Object
  extended by org.opensha.commons.param.AbstractParameter<Estimate>
      extended by org.opensha.commons.param.impl.EstimateParameter
All Implemented Interfaces:
Serializable, Comparable<Parameter<?>>, Named, XMLSaveable, Parameter<Estimate>

public class EstimateParameter
extends AbstractParameter<Estimate>

Title: EstimateParameter.java

Description: EstimateParameter wraps the Estimate object. constraints are specified in EstimateConstraint which is alist of allowed estimate type names.

Copyright: Copyright (c) 2002

Company:

Version:
1.0
Author:
not attributable
See Also:
Serialized Form

Field Summary
protected static String C
          Class name for debugging.
protected static boolean D
          If true print out debug statements.
 
Fields inherited from class org.opensha.commons.param.AbstractParameter
constraint, defaultValue, editable, independentParameters, info, metadataString, name, units, value, XML_COMPLEX_VAL_EL_NAME, XML_GROUP_METADATA_NAME, XML_METADATA_NAME, XML_NULL_VALUE
 
Fields inherited from interface org.opensha.commons.param.Parameter
XML_INDEPENDENT_PARAMS_NAME
 
Constructor Summary
EstimateParameter(String name)
          Constructor with no constraints specified, all values are allowed.
EstimateParameter(String name, double min, double max)
          Constructor with min/max specified.
EstimateParameter(String name, double min, double max, ArrayList allowedEstimateTypes)
          Constructor with min/max specified.
EstimateParameter(String name, Estimate value)
          No constraints specified, all values allowed.
EstimateParameter(String name, EstimateConstraint constraint, String units, Estimate value)
          Sets the name, units and value.
EstimateParameter(String name, String units)
          Constructor with no No constraints specified, all values are allowed.
EstimateParameter(String name, String units, double min, double max)
          Constructor with min/max specified.
EstimateParameter(String name, String units, double min, double max, ArrayList allowedEstimateTypes)
          Constructor with min/max and list of allowed Estimate types specified Sets the name and units of this parameter.
EstimateParameter(String name, String units, Estimate value)
          Sets the name, units and value.
 
Method Summary
 Object clone()
          Returns a copy so you can't edit or damage the origial.
 AbstractParameterEditorOld getEditor()
          Returns the Editor for this Parameter.
 String getType()
          Returns the type of this parameter.
 boolean isAllowed(Estimate val)
          Determine if the new value being set is allowed by validating against the constraints.
 boolean setIndividualParamValueFromXML(Element el)
          This should set the value of this individual parameter.
 
Methods inherited from class org.opensha.commons.param.AbstractParameter
addIndependentParameter, addParameterChangeFailListener, addParameterChangeListener, checkEditable, compareTo, containsIndependentParameter, equals, firePropertyChange, firePropertyChangeFailed, getConstraint, getConstraintName, getDefaultValue, getDependentParamMetadataString, getIndependentParameter, getIndependentParameterList, getIndependentParametersKey, getInfo, getMetadataString, getName, getNumIndependentParameters, getUnits, getValue, isEditable, isNullAllowed, removeIndependentParameter, removeParameterChangeFailListener, removeParameterChangeListener, setConstraint, setDefaultValue, setDependentParamMetadataString, setIndependentParameters, setIndepParamsFromXML, setInfo, setName, setNonEditable, setUnits, setValue, setValueAsDefault, setValueFromXMLMetadata, toXMLMetadata, toXMLMetadata, unableToSetValue, valueToXML
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C

protected static final String C
Class name for debugging.

See Also:
Constant Field Values

D

protected static final boolean D
If true print out debug statements.

See Also:
Constant Field Values
Constructor Detail

EstimateParameter

public EstimateParameter(String name)
Constructor with no constraints specified, all values are allowed. Also Sets the name of this parameter.


EstimateParameter

public EstimateParameter(String name,
                         String units)
                  throws ConstraintException
Constructor with no No constraints specified, all values are allowed. Sets the name and units of this parameter.

Throws:
ConstraintException

EstimateParameter

public EstimateParameter(String name,
                         Estimate value)
No constraints specified, all values allowed. Sets the name and value.

Parameters:
name - Name of the parameter
value - Integer value of this parameter

EstimateParameter

public EstimateParameter(String name,
                         EstimateConstraint constraint,
                         String units,
                         Estimate value)
                  throws ConstraintException
Sets the name, units and value.

Parameters:
name - Name of the parametet
value - Integer value of this parameter
units - Units of this parameter
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed

EstimateParameter

public EstimateParameter(String name,
                         String units,
                         Estimate value)
                  throws ConstraintException
Sets the name, units and value. All values allowed because constraints not set.

Parameters:
name - Name of the parametet
value - Integer value of this parameter
units - Units of this parameter
Throws:
ConstraintException - thrown if the value is not allowed
ConstraintException - Is thrown if the value is not allowed

EstimateParameter

public EstimateParameter(String name,
                         double min,
                         double max)
Constructor with min/max specified. All types of Estimates classes are allowed Also Sets the name of this parameter.


EstimateParameter

public EstimateParameter(String name,
                         double min,
                         double max,
                         ArrayList allowedEstimateTypes)
Constructor with min/max specified. It also accepts an arraylist of String which are classnames of allowed estimate types Also Sets the name of this parameter.


EstimateParameter

public EstimateParameter(String name,
                         String units,
                         double min,
                         double max)
                  throws ConstraintException
Constructor with min/max specified. Sets the name and units of this parameter.

Throws:
ConstraintException

EstimateParameter

public EstimateParameter(String name,
                         String units,
                         double min,
                         double max,
                         ArrayList allowedEstimateTypes)
                  throws ConstraintException
Constructor with min/max and list of allowed Estimate types specified Sets the name and units of this parameter.

Throws:
ConstraintException
Method Detail

getType

public String getType()
Returns the type of this parameter. The type is just the classname if no constraints are present, else "Constrained" is prepended to the classname. The type is used to determine which parameter GUI editor to use.

Specified by:
getType in interface Parameter<Estimate>
Overrides:
getType in class AbstractParameter<Estimate>

isAllowed

public boolean isAllowed(Estimate val)
Determine if the new value being set is allowed by validating against the constraints.

Specified by:
isAllowed in interface Parameter<Estimate>
Overrides:
isAllowed in class AbstractParameter<Estimate>
Parameters:
val - Object to check if allowed via constraints
Returns:
True if the value is allowed

clone

public Object clone()
Description copied from class: AbstractParameter
Returns a copy so you can't edit or damage the origial.

Specified by:
clone in interface Parameter<Estimate>
Specified by:
clone in class AbstractParameter<Estimate>

setIndividualParamValueFromXML

public boolean setIndividualParamValueFromXML(Element el)
Description copied from class: AbstractParameter
This should set the value of this individual parameter. The values of the independent parameters will be set by the final setValueFromXMLMetadata method

Specified by:
setIndividualParamValueFromXML in class AbstractParameter<Estimate>
Returns:

getEditor

public AbstractParameterEditorOld getEditor()
Description copied from interface: Parameter
Returns the Editor for this Parameter. It is recommended that editors be lazily instantiated.

Returns:
the Editor