Class SemEvidence

java.lang.Object
edu.cmu.tetrad.sem.SemEvidence
All Implemented Interfaces:
TetradSerializable, Serializable

public final class SemEvidence extends Object implements TetradSerializable
Stores information for a SemIm about evidence we have for each variable as well as whether each variable has been manipulated.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Details

    • SemEvidence

      public SemEvidence(SemIm semIm)
      Constructs a container for evidence for the given Bayes IM.
      Parameters:
      semIm - a SemIm object
    • SemEvidence

      public SemEvidence(SemEvidence evidence)

      Constructor for SemEvidence.

      Parameters:
      evidence - a SemEvidence object
  • Method Details

    • serializableInstance

      public static SemEvidence serializableInstance()
      Generates a simple exemplar of this class to test serialization.
      Returns:
      a SemEvidence object
    • getSemIm

      public SemIm getSemIm()

      Getter for the field semIm.

      Returns:
      the Bayes IM that this is evidence for.
    • getNodeIndex

      public int getNodeIndex(String nodeName)

      getNodeIndex.

      Parameters:
      nodeName - a String object
      Returns:
      a int
    • getNodeIndex

      public int getNodeIndex(Node node)

      getNodeIndex.

      Parameters:
      node - a Node object
      Returns:
      a int
    • getNumNodes

      public int getNumNodes()

      getNumNodes.

      Returns:
      a int
    • getNode

      public Node getNode(int nodeIndex)

      getNode.

      Parameters:
      nodeIndex - a int
      Returns:
      a Node object
    • getProposition

      public SemProposition getProposition()

      Getter for the field proposition.

      Returns:
      a SemProposition object
    • isManipulated

      public boolean isManipulated(int nodeIndex)

      isManipulated.

      Parameters:
      nodeIndex - a int
      Returns:
      a boolean
    • setManipulated

      public void setManipulated(int nodeIndex, boolean manipulated)

      setManipulated.

      Parameters:
      nodeIndex - a int
      manipulated - a boolean
    • toString

      public String toString()

      toString.

      Overrides:
      toString in class Object
      Returns:
      a String object
    • getNodesInEvidence

      public List<Node> getNodesInEvidence()

      getNodesInEvidence.

      Returns:
      the variable for which there is evidence.
    • equals

      public boolean equals(Object o)
      This method checks if the given object is equal to the current instance of SemEvidence. Two SemEvidence objects are considered equal if they have the same semIm, proposition, and manipulation.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to be compared with the current instance of SemEvidence
      Returns:
      true if the given object is equal to the current instance of SemEvidence, false otherwise
      Throws:
      IllegalArgumentException - if the given object is not an instance of SemEvidence
    • hashCode

      public int hashCode()

      hashCode.

      Overrides:
      hashCode in class Object
      Returns:
      a int