Package edu.cmu.tetrad.util.dist
Class SingleValue
java.lang.Object
edu.cmu.tetrad.util.dist.SingleValue
- All Implemented Interfaces:
- Distribution,- TetradSerializable,- Serializable
A pretend distribution that always returns the given value when nextRandom() is called.
- Version:
- $Id: $Id
- Author:
- josephramsey
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionSingleValue(double value) Constructs single value "distribution" using the given value.
- 
Method SummaryModifier and TypeMethodDescriptiongetName()Returns the name of the distribution.intReturns the number of parameters in the distribution.doublegetParameter(int index) Returns the index'th parameter.getParameterName(int index) Returns the name of the index'th parameter.doubleReturns the next random number from the distribution.static SingleValueGenerates a simple exemplar of this class to test serialization.voidsetParameter(int index, double value) Sets the index'th parameter to the given value.toString()Returns a string representation of the object.
- 
Constructor Details- 
SingleValuepublic SingleValue(double value) Constructs single value "distribution" using the given value.- Parameters:
- value- A real number.
 
 
- 
- 
Method Details- 
serializableInstanceGenerates a simple exemplar of this class to test serialization.- Returns:
- The exemplar.
 
- 
setParameterpublic void setParameter(int index, double value) Sets the index'th parameter to the given value.- Specified by:
- setParameterin interface- Distribution
- Parameters:
- index- The index of the parameter. Must be >= 0 and < number of parameters.
- value- The value to set.
- Throws:
- IllegalArgumentException- If index is not a valid parameter index.
 
- 
getParameterpublic double getParameter(int index) Returns the index'th parameter.- Specified by:
- getParameterin interface- Distribution
- Parameters:
- index- The index of the parameter. Must be >= 0 and < # parameters.
- Returns:
- The value of the parameter.
- Throws:
- IllegalArgumentException- If index is not a valid parameter index.
 
- 
getParameterNameReturns the name of the index'th parameter.- Specified by:
- getParameterNamein interface- Distribution
- Parameters:
- index- The index of the parameter. Must be >= 0 and < number of parameters.
- Returns:
- The name of the parameter.
- Throws:
- IllegalArgumentException- If index is not a valid parameter index.
 
- 
getNumParameterspublic int getNumParameters()Returns the number of parameters in the distribution.- Specified by:
- getNumParametersin interface- Distribution
- Returns:
- the number of parameters.
 
- 
nextRandompublic double nextRandom()Returns the next random number from the distribution.- Specified by:
- nextRandomin interface- Distribution
- Returns:
- A random number generated from the distribution.
 
- 
toStringReturns a string representation of the object.
- 
getNameReturns the name of the distribution.- Specified by:
- getNamein interface- Distribution
- Returns:
- the name.
 
 
-