Package edu.cmu.tetrad.sem
Class SemProposition
java.lang.Object
edu.cmu.tetrad.sem.SemProposition
- All Implemented Interfaces:
TetradSerializable
,Serializable
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
ConstructorsConstructorDescriptionSemProposition
(SemIm semIm) Creates a new Proposition which allows all values.SemProposition
(SemProposition proposition) Creates a new SemProposition object by copying the values and semIm from the given proposition. -
Method Summary
Modifier and TypeMethodDescriptionboolean
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.getSemIm()
Retrieves the SemIm object associated with this SemProposition.double
getValue
(int i) Retrieves the value at the specified index.double
Retrieves the value associated with the given node.int
hashCode()
Calculates the hash code for this object.static SemProposition
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
Sets the value for a given node in the SemProposition object.static SemProposition
Creates a tautology by wrapping the given SemIm object.toString()
Returns a string representation of the object.
-
Constructor Details
-
SemProposition
-
SemProposition
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
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
Generates a simple exemplar of this class to test serialization.- Returns:
- a
SemProposition
object
-
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
Compares this SemProposition object with the specified object for equality.- Overrides:
equals
in classObject
- 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
-
toString
-
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 setvalue
- the value to set
-
getValue
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
Sets the value for a given node in the SemProposition object.- Parameters:
node
- the node for which the value is to be setvalue
- the value to be assigned to the node
-