Class SemProposition

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

public final class SemProposition extends Object implements TetradSerializable
Represents propositions over the variables of a particular BayesIm describing and event of a fairly general sort--namely, conjunctions of propositions that particular variables take on values from a particular disjunctive list of categories. For example, X1 = 1 or 2 and X2 = 3 and X3 = 1 or 3 and X4 = 2 or 3 or 5. The proposition is created by allowing or disallowing particular categories. Notice that "knowing nothing" about a variable is the same as saying that all categories for that variable are allowed, so the proposition by default allows all categories for all variables--i.e. it is a tautology.
Version:
$Id: $Id
Author:
josephramsey
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Proposition which allows all values.
    Creates a new SemProposition object by copying the values and semIm from the given proposition.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Compares this SemProposition object with the specified object for equality.
    int
    Returns the index of the node.
    int
    Returns the number of variables in the current object.
    Retrieves the SemIm object associated with this SemProposition.
    double
    getValue(int i)
    Retrieves the value at the specified index.
    double
    getValue(Node node)
    Retrieves the value associated with the given node.
    int
    Calculates the hash code for this object.
    Generates a simple exemplar of this class to test serialization.
    void
    setValue(int i, double value)
    Sets the value at the specified index in the array of values.
    void
    setValue(Node node, double value)
    Sets the value for a given node in the SemProposition object.
    Creates a tautology by wrapping the given SemIm object.
    Returns a string representation of the object.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • SemProposition

      public SemProposition(SemIm semIm)
      Creates a new Proposition which allows all values.
      Parameters:
      semIm - a SemIm object
    • SemProposition

      public SemProposition(SemProposition proposition)
      Creates a new SemProposition object by copying the values and semIm from the given proposition.
      Parameters:
      proposition - the SemProposition object to be copied
  • Method Details

    • tautology

      public static SemProposition tautology(SemIm semIm)
      Creates a tautology by wrapping the given SemIm object.
      Parameters:
      semIm - the SemIm object to be wrapped
      Returns:
      a SemProposition object representing the tautology
    • serializableInstance

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

      public SemIm getSemIm()
      Retrieves the SemIm object associated with this SemProposition.
      Returns:
      the SemIm object
    • getNumVariables

      public int getNumVariables()
      Returns the number of variables in the current object.
      Returns:
      the number of variables
    • getNodeIndex

      public int getNodeIndex()
      Returns the index of the node.
      Returns:
      the index of the node
    • equals

      public boolean equals(Object o)
      Compares this SemProposition object with the specified object for equality.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to be compared with this SemProposition
      Returns:
      true if the given object is equal to this SemProposition, false otherwise
      Throws:
      IllegalArgumentException - if the given object is not an instance of SemProposition
    • hashCode

      public int hashCode()
      Calculates the hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this object
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object
    • getValue

      public double getValue(int i)
      Retrieves the value at the specified index.
      Parameters:
      i - the index of the value to retrieve
      Returns:
      the value at the specified index
    • setValue

      public void setValue(int i, double value)
      Sets the value at the specified index in the array of values.
      Parameters:
      i - the index of the value to set
      value - the value to set
    • getValue

      public double getValue(Node node)
      Retrieves the value associated with the given node.
      Parameters:
      node - the node for which the value is retrieved
      Returns:
      the value associated with the given node
    • setValue

      public void setValue(Node node, double value)
      Sets the value for a given node in the SemProposition object.
      Parameters:
      node - the node for which the value is to be set
      value - the value to be assigned to the node