edu.ucla.belief
Class EvidenceController

Object
  extended by EvidenceController
All Implemented Interfaces:
Cloneable

public class EvidenceController
extends Object
implements Cloneable

Since:
20020719
Author:
keith cascio

Field Summary
static boolean FLAG_DEBUG
           
static String STR_ERR_MSG_FROZEN
           
 
Constructor Summary
EvidenceController(BeliefNetwork bn)
           
 
Method Summary
 void addEvidenceChangeListener(EvidenceChangeListener ecl)
           
 void addPriorityEvidenceChangeListener(EvidenceChangeListener ecl)
           
 Object clone()
           
 Map evidence()
          Returns the set of variable to value instantiations.
 Set evidenceVariables()
           
 BeliefNetwork getBeliefNetwork()
           
 List getPriorityEvidenceChangeListeners(List ret)
           
 Object getValue(Variable observed)
           
 boolean isEmpty()
           
 boolean isFrozen()
           
 int notifyNonPriorityListeners()
          Fire evidenceChanged() event when evidence has not actually changed, usually when the computed query answer has changed for some other reason, and you want registered listeners to know about it.
 int observe(FiniteVariable var, Object value)
          Add var=value to the list of observations.
 int observe(Map evidence)
          Adds the observations listed to the set of current observations
 int observeNotifyOnlyPriorityListeners(FiniteVariable var, Object value)
           
 boolean removeEvidenceChangeListener(EvidenceChangeListener ecl)
           
 boolean removePriorityEvidenceChangeListener(EvidenceChangeListener ecl)
           
 Object removeVariable(Variable var)
           
 int replaceVariables(Map mapVariablesOldToNew)
           
 int resetEvidence()
          Restores the evidence to the state of no observations.
 void setBeliefNetwork(BeliefNetwork bn)
           
 void setFrozen(boolean frozen)
          Freeze evidence.
 void setNotifyEnabled(boolean enabled)
           Use this method to disable/re-enable evidence change events.
 int setObservations(Map evidence)
          This differs from observe(Map evidence) in that the old observations are completely removed, and replaced by the current evidence.
 int size()
           
 int unobserve(FiniteVariable var)
          Sets the state of the variable to unobserved.
 int unobserveNotifyOnlyPriorityListeners(FiniteVariable var)
           
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FLAG_DEBUG

public static boolean FLAG_DEBUG

STR_ERR_MSG_FROZEN

public static final String STR_ERR_MSG_FROZEN
See Also:
Constant Field Values
Constructor Detail

EvidenceController

public EvidenceController(BeliefNetwork bn)
Method Detail

setFrozen

public void setFrozen(boolean frozen)
Freeze evidence.

Since:
20051006

isFrozen

public boolean isFrozen()
Since:
20051006

setNotifyEnabled

public void setNotifyEnabled(boolean enabled)

Use this method to disable/re-enable evidence change events.

If you disable evidence change events, you must remember to re-enable them before other evidence change listeners make changes.

Since:
20020805

removeVariable

public Object removeVariable(Variable var)

getValue

public Object getValue(Variable observed)

getPriorityEvidenceChangeListeners

public List getPriorityEvidenceChangeListeners(List ret)
Since:
20060320

addPriorityEvidenceChangeListener

public void addPriorityEvidenceChangeListener(EvidenceChangeListener ecl)

removePriorityEvidenceChangeListener

public boolean removePriorityEvidenceChangeListener(EvidenceChangeListener ecl)
Since:
20030117

addEvidenceChangeListener

public void addEvidenceChangeListener(EvidenceChangeListener ecl)

removeEvidenceChangeListener

public boolean removeEvidenceChangeListener(EvidenceChangeListener ecl)

notifyNonPriorityListeners

public int notifyNonPriorityListeners()
Fire evidenceChanged() event when evidence has not actually changed, usually when the computed query answer has changed for some other reason, and you want registered listeners to know about it.

Returns:
The number of non-priority listeners notified.
Since:
20080227

observe

public int observe(FiniteVariable var,
                   Object value)
            throws StateNotFoundException
Add var=value to the list of observations. Observations accumulate, but conflicting assignments are replaced. For example if the current evidence is {X=a,Y=b}, calling observe(Z,c) would produce {X=a,Y=b,Z=c}. Subsequently calling observe(Y,d) would produce {X=a,Y=d,Z=c}

Returns:
number of changes
Throws:
StateNotFoundException

observeNotifyOnlyPriorityListeners

public int observeNotifyOnlyPriorityListeners(FiniteVariable var,
                                              Object value)
                                       throws StateNotFoundException
Returns:
number of changes
Throws:
StateNotFoundException
Since:
20020814

observe

public int observe(Map evidence)
            throws StateNotFoundException
Adds the observations listed to the set of current observations

Parameters:
evidence - A mapping from FiniteVariables to the value they take on.
Returns:
count modified observations
Throws:
StateNotFoundException

setObservations

public int setObservations(Map evidence)
                    throws StateNotFoundException
This differs from observe(Map evidence) in that the old observations are completely removed, and replaced by the current evidence. For example, if the old evidence state was {X=a,Y=b}, calling setObservations({Y=c,Z=d}) would produce the observation set {Y=c,Z=d}.

Returns:
count modified observations
Throws:
StateNotFoundException

unobserve

public int unobserve(FiniteVariable var)
Sets the state of the variable to unobserved. In otherwords, that variable is removed from the set of observations.

Returns:
number of changes

unobserveNotifyOnlyPriorityListeners

public int unobserveNotifyOnlyPriorityListeners(FiniteVariable var)
Returns:
number of changes
Since:
20020814

resetEvidence

public int resetEvidence()
Restores the evidence to the state of no observations.

Returns:
previous size of evidence

evidence

public Map evidence()
Returns the set of variable to value instantiations.


size

public int size()
Since:
20070319

evidenceVariables

public Set evidenceVariables()
Since:
20051006

isEmpty

public boolean isEmpty()
Since:
20021029

replaceVariables

public int replaceVariables(Map mapVariablesOldToNew)
Returns:
number replaced
Since:
20021004

clone

public Object clone()
Overrides:
clone in class Object
Since:
20021004

setBeliefNetwork

public void setBeliefNetwork(BeliefNetwork bn)
Since:
20021004

getBeliefNetwork

public BeliefNetwork getBeliefNetwork()
Since:
20081110


Copyright 2010 UCLA Automated Reasoning Group