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.
- Author:
- josephramsey
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSingleValue(double value) Constructs single value "distribution" using the given value. -
Method Summary
Modifier 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) The name of the index'th parameter, for display purposes.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()
-
Constructor Details
-
SingleValue
public SingleValue(double value) Constructs single value "distribution" using the given value.- Parameters:
value- A real number.
-
-
Method Details
-
serializableInstance
Generates a simple exemplar of this class to test serialization.- Returns:
- The exemplar.
-
setParameter
public void setParameter(int index, double value) Description copied from interface:DistributionSets the index'th parameter to the given value.- Specified by:
setParameterin interfaceDistribution- Parameters:
index- Ibid. Must be >= 0 and < # parameters.value- Ibid.
-
getParameter
public double getParameter(int index) Description copied from interface:DistributionReturns the index'th parameter.- Specified by:
getParameterin interfaceDistribution- Parameters:
index- Ibid. Muist be <= 0 and < # parameters.- Returns:
- The Ibid.
-
getParameterName
Description copied from interface:DistributionThe name of the index'th parameter, for display purposes.- Specified by:
getParameterNamein interfaceDistribution- Parameters:
index- Ibid. Must be >= 0 and < # parameters.- Returns:
- Ibid.
-
getNumParameters
public int getNumParameters()Description copied from interface:DistributionReturns the number of parameters in the distribution.- Specified by:
getNumParametersin interfaceDistribution- Returns:
- the number of parameters.
-
nextRandom
public double nextRandom()Description copied from interface:DistributionReturns the next random number from the distribution.- Specified by:
nextRandomin interfaceDistribution- Returns:
- the value that was set.
-
toString
-
getName
Description copied from interface:DistributionReturns the name of the distribution.- Specified by:
getNamein interfaceDistribution- Returns:
- the name.
-