Package edu.cmu.tetrad.search.blocks
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 SummaryConstructorsConstructorDescriptionConstructs 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 SummaryModifier 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- 
BlockSpecConstructs 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 null
- blocks- a list of lists of integers representing the blocks; must not be null and must match the size of blockVariables
- blockVariables- 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 null
- IllegalArgumentException- if blocks or blockVariables are null, or if the sizes of blocks and blockVariables do not match
 
- 
BlockSpecpublic 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 null
- blocks- a list of lists of integers representing the blocks; must not be null, must match the size of blockVariables and ranks
- blockVariables- a list of Node objects corresponding to the block variables; must not be null and must match the size of blocks and ranks
- ranks- 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 null
- IllegalArgumentException- 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- 
dataSetReturns the data set associated with this block specification.- Returns:
- the DataSet object representing the data set associated with this BlockSpec instance
 
- 
blocksReturns the blocks associated with this BlockSpec instance.- Returns:
- a list of lists of integers, where each inner list represents a block
 
- 
blockVariablesReturns the list of block variables associated with this BlockSpec instance.- Returns:
- a list of Node objects representing the block variables
 
- 
ranksReturns the list of ranks associated with this BlockSpec instance.- Returns:
- a list of integers representing the ranks of the blocks
 
- 
toString
- 
equalsIndicates 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.
- 
hashCodepublic int hashCode()Computes the hash code for this object. The hash code is calculated based on the dataSet, blocks, blockVariables, and ranks fields of this instance.
 
-