Class BlockSpec
java.lang.Object
edu.cmu.tetrad.search.blocks.BlockSpec
- All Implemented Interfaces:
TetradSerializable, Serializable
Represents a block specification that organizes data into blocks, each associated with a variable and a rank. The
class is designed for immutability and serialization.
A block specification consists of: - A dataset (DataSet). - A list of blocks, where each block is a list of
indices. - A list of variables (Node) corresponding to each block. - A list of ranks, corresponding to each
block and variable, where each rank is an integer greater than or equal to 1.
Constructor validation ensures the integrity of the input, including size consistency between blocks, variables, and ranks, as well as ensuring non-null and well-formed inputs.
This class satisfies the TetradSerializable interface, adhering to restrictions on serializable fields.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an instance of BlockSpec with the specified data set, blocks, and block variables.BlockSpec(DataSet dataSet, List<List<Integer>> blocks, List<Node> blockVariables, List<Integer> ranks) Constructs an instance of BlockSpec with the specified data set, blocks, block variables, and their corresponding ranks. -
Method Summary
Modifier and TypeMethodDescriptionblocks()Returns the blocks associated with this BlockSpec instance.Returns the list of block variables associated with this BlockSpec instance.dataSet()Returns the data set associated with this block specification.booleanIndicates whether some other object is "equal to" this one.inthashCode()Computes the hash code for this object.ranks()Returns the list of ranks associated with this BlockSpec instance.@NotNull StringtoString()
-
Constructor Details
-
BlockSpec
Constructs an instance of BlockSpec with the specified data set, blocks, and block variables. Validates input parameters to ensure they are non-null, and the sizes of blocks and block variables are equal.- Parameters:
dataSet- the data set associated with this block specification; must not be nullblocks- a list of lists of integers representing the blocks; must not be null and must match the size of blockVariablesblockVariables- a list of Node objects corresponding to the block variables; must not be null and must match the size of blocks- Throws:
NullPointerException- if the data set is nullIllegalArgumentException- if blocks or blockVariables are null, or if the sizes of blocks and blockVariables do not match
-
BlockSpec
public BlockSpec(DataSet dataSet, List<List<Integer>> blocks, List<Node> blockVariables, List<Integer> ranks) Constructs an instance of BlockSpec with the specified data set, blocks, block variables, and their corresponding ranks. Validates the input parameters to ensure they are non-null, and that the sizes of the blocks, block variables, and ranks are consistent. Ensures all rank values are greater than or equal to 1.- Parameters:
dataSet- the data set associated with this block specification; must not be nullblocks- a list of lists of integers representing the blocks; must not be null, must match the size of blockVariables and ranksblockVariables- a list of Node objects corresponding to the block variables; must not be null and must match the size of blocks and ranksranks- a list of integers representing the rank of each block; must not be null and all values must be >= 1- Throws:
NullPointerException- if the dataSet is nullIllegalArgumentException- if blocks, blockVariables, or ranks are null, the sizes of blocks, blockVariables, and ranks do not match, or if any rank is less than 1
-
-
Method Details
-
dataSet
Returns the data set associated with this block specification.- Returns:
- the DataSet object representing the data set associated with this BlockSpec instance
-
blocks
-
blockVariables
-
ranks
-
toString
-
equals
Indicates whether some other object is "equal to" this one. Two BlockSpec instances are considered equal if their respective dataSet, blocks, blockVariables, and ranks fields are equal. -
hashCode
-