gov.sandia.cognition.statistics
Class DefaultDistributionParameter<ParameterType,ConditionalType extends ClosedFormDistribution<?>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.AbstractNamed
          extended by gov.sandia.cognition.statistics.DefaultDistributionParameter<ParameterType,ConditionalType>
Type Parameters:
ParameterType - Type of parameter of the conditional distribution.
ConditionalType - Type of parameterized distribution that generates observations.
All Implemented Interfaces:
DistributionParameter<ParameterType,ConditionalType>, CloneableSerializable, Named, NamedValue<ParameterType>, Serializable, Cloneable
Direct Known Subclasses:
DefaultBayesianParameter

public class DefaultDistributionParameter<ParameterType,ConditionalType extends ClosedFormDistribution<?>>
extends AbstractNamed
implements DistributionParameter<ParameterType,ConditionalType>

Default implementation of DistributionParameter using introspection.

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
protected  ConditionalType conditionalDistribution
          Distribution from which to pull the parameters.
static String MEAN_GETTER
          Getter for the mean, "getMean".
static String MEAN_NAME
          Name of the mean property, "mean".
static String MEAN_SETTER
          Setter for the mean, "setMean".
protected  Method parameterGetter
          Getter for the parameter, the write method.
protected  Method parameterSetter
          Setter for the parameter, the read method.
 
Fields inherited from class gov.sandia.cognition.util.AbstractNamed
name
 
Constructor Summary
DefaultDistributionParameter(ConditionalType conditionalDistribution, PropertyDescriptor descriptor)
          Creates a new instance of DefaultDistributionParameter
DefaultDistributionParameter(ConditionalType conditionalDistribution, String parameterName)
          Creates a new instance of DefaultDistributionParameter
 
Method Summary
protected  void assignParameterMethods(Distribution<?> conditionalDistribution, String parameterName)
          Assigns the getter and setter from the given conditionalDistribution and parameter name.
 DefaultDistributionParameter<ParameterType,ConditionalType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 ConditionalType getConditionalDistribution()
          Gets the conditional distribution associated with the parameter.
 ParameterType getValue()
          Gets the value stored in the name-value pair.
protected  void setConditionalDistribution(ConditionalType conditionalDistribution)
          Setter for conditionalDistribution
 void setName(String name)
          Sets the name of this Object.
 void setValue(ParameterType value)
          Sets the value of the parameter.
 
Methods inherited from class gov.sandia.cognition.util.AbstractNamed
getName, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.Named
getName
 

Field Detail

conditionalDistribution

protected ConditionalType extends ClosedFormDistribution<?> conditionalDistribution
Distribution from which to pull the parameters.


parameterSetter

protected transient Method parameterSetter
Setter for the parameter, the read method.


parameterGetter

protected transient Method parameterGetter
Getter for the parameter, the write method.


MEAN_NAME

public static final String MEAN_NAME
Name of the mean property, "mean".

See Also:
Constant Field Values

MEAN_SETTER

public static final String MEAN_SETTER
Setter for the mean, "setMean".

See Also:
Constant Field Values

MEAN_GETTER

public static final String MEAN_GETTER
Getter for the mean, "getMean".

See Also:
Constant Field Values
Constructor Detail

DefaultDistributionParameter

public DefaultDistributionParameter(ConditionalType conditionalDistribution,
                                    String parameterName)
Creates a new instance of DefaultDistributionParameter

Parameters:
conditionalDistribution - Distribution from which to pull the parameters.
parameterName - Name of the parameter

DefaultDistributionParameter

public DefaultDistributionParameter(ConditionalType conditionalDistribution,
                                    PropertyDescriptor descriptor)
Creates a new instance of DefaultDistributionParameter

Parameters:
conditionalDistribution - Distribution from which to pull the parameters.
descriptor - PropertyDescriptor from the Introspector that has a setter and a getter.
Method Detail

clone

public DefaultDistributionParameter<ParameterType,ConditionalType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractNamed
Returns:
A clone of this object.

assignParameterMethods

protected void assignParameterMethods(Distribution<?> conditionalDistribution,
                                      String parameterName)
Assigns the getter and setter from the given conditionalDistribution and parameter name.

Parameters:
conditionalDistribution - Distribution from which to pull the parameters.
parameterName - Name of the parameter

getValue

public ParameterType getValue()
Description copied from interface: NamedValue
Gets the value stored in the name-value pair.

Specified by:
getValue in interface NamedValue<ParameterType>
Returns:
The value.

setValue

public void setValue(ParameterType value)
Description copied from interface: DistributionParameter
Sets the value of the parameter.

Specified by:
setValue in interface DistributionParameter<ParameterType,ConditionalType extends ClosedFormDistribution<?>>
Parameters:
value - Parameter to set.

getConditionalDistribution

public ConditionalType getConditionalDistribution()
Description copied from interface: DistributionParameter
Gets the conditional distribution associated with the parameter.

Specified by:
getConditionalDistribution in interface DistributionParameter<ParameterType,ConditionalType extends ClosedFormDistribution<?>>
Returns:
Conditional distribution associated with the parameter.

setConditionalDistribution

protected void setConditionalDistribution(ConditionalType conditionalDistribution)
Setter for conditionalDistribution

Parameters:
conditionalDistribution - Conditional conditionalDistribution associated with the parameter.

setName

public void setName(String name)
Description copied from class: AbstractNamed
Sets the name of this Object.

Overrides:
setName in class AbstractNamed
Parameters:
name - The new name for the Object.