public class SingleValueDistribution extends java.lang.Object implements IndependentDistribution
log
Constructor and Description |
---|
SingleValueDistribution(java.lang.String variable,
java.lang.String value)
Creates a new single-value distribution
|
SingleValueDistribution(java.lang.String variable,
Value value)
Creates a new single-value distribution
|
Modifier and Type | Method and Description |
---|---|
IndependentDistribution |
copy()
Copies the distribution
|
boolean |
equals(java.lang.Object o)
Returns true if the assignment is identical to the one in this distribution,
otherwise false
|
org.w3c.dom.Node |
generateXML(org.w3c.dom.Document document)
Returns the XML representation (as a categorical table)
|
Value |
getBest()
Returns the value
|
double |
getProb(Value value)
Returns 1.0 if the value is equal to the one in the distribution, and 0.0
otherwise.
|
java.util.Set<Value> |
getValues()
Returns a singleton set with the value.
|
java.lang.String |
getVariable()
Returns the variable label
|
int |
hashCode()
Returns the distribution's hashcode
|
void |
modifyVariableId(java.lang.String oldId,
java.lang.String newId)
Modifies the variable label
|
boolean |
pruneValues(double threshold)
Does nothing
|
Value |
sample()
Returns the value.
|
ContinuousDistribution |
toContinuous()
Returns a continuous representation of the distribution (if possible)
|
CategoricalTable |
toDiscrete()
Returns the categorical table corresponding to the distribution.
|
java.lang.String |
toString()
Returns the string representation for this distribution
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getInputVariables, getPosterior, getProb, getProb, getProb, getProb, getProb, getProbDistrib, sample
public SingleValueDistribution(java.lang.String variable, Value value)
variable
- the variable labelvalue
- the valuepublic SingleValueDistribution(java.lang.String variable, java.lang.String value)
variable
- the variable labelvalue
- the value (as a string)public java.lang.String getVariable()
getVariable
in interface ProbDistribution
public boolean pruneValues(double threshold)
pruneValues
in interface ProbDistribution
threshold
- the threshold to apply for the pruningpublic void modifyVariableId(java.lang.String oldId, java.lang.String newId)
modifyVariableId
in interface ProbDistribution
oldId
- the old identifier to replacenewId
- the new identifierpublic double getProb(Value value)
getProb
in interface IndependentDistribution
value
- the value for the random variablepublic Value sample()
sample
in interface IndependentDistribution
public java.util.Set<Value> getValues()
getValues
in interface IndependentDistribution
getValues
in interface ProbDistribution
public ContinuousDistribution toContinuous()
toContinuous
in interface IndependentDistribution
public CategoricalTable toDiscrete()
toDiscrete
in interface IndependentDistribution
public Value getBest()
getBest
in interface IndependentDistribution
public org.w3c.dom.Node generateXML(org.w3c.dom.Document document)
generateXML
in interface IndependentDistribution
document
- the XML node to which the node will be attachedpublic IndependentDistribution copy()
copy
in interface IndependentDistribution
copy
in interface ProbDistribution
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare