Class DataBlockGroup
- Namespace
- Datafication.Core.Data
- Assembly
- Datafication.Core.dll
Represents a group of data blocks, providing functionality to manage and manipulate a collection of data blocks.
public class DataBlockGroup : IDataBlockGroup
- Inheritance
-
objectDataBlockGroup
- Implements
Constructors
DataBlockGroup()
Initializes a new instance of the DataBlockGroup class.
public DataBlockGroup()
DataBlockGroup(List<DataBlock>, List<object>)
Initializes a new instance of the DataBlockGroup class with a predefined list of groups and their corresponding keys.
public DataBlockGroup(List<DataBlock> groups, List<object> groupKeys)
Parameters
groupsList<DataBlock>The list of data blocks representing the groups.
groupKeysList<object>The list of keys corresponding to each group.
Properties
Count
Gets the number of data blocks in the group.
public int Count { get; }
Property Value
- int
Methods
AddDataBlock(DataBlock, object)
Adds a data block and its corresponding key to the group.
public void AddDataBlock(DataBlock dataBlock, object key)
Parameters
dataBlockDataBlockThe data block to add.
keyobjectThe key corresponding to the data block.
Clear()
Clears all data blocks and their keys from the group.
public void Clear()
FilterGroups(IDataFilter)
Filters groups based on the specified data filter.
public DataBlockGroup FilterGroups(IDataFilter filter)
Parameters
filterIDataFilterThe data filter to apply.
Returns
- DataBlockGroup
A new IDataBlockGroup that contains the filtered groups.
FindDataBlock(Func<DataBlock, bool>)
Finds a data block by a specific predicate.
public DataBlock FindDataBlock(Func<DataBlock, bool> predicate)
Parameters
predicateFunc<DataBlock, bool>The predicate to match the data block.
Returns
- DataBlock
The first data block that matches the predicate.
GetDataBlock(int)
Gets a data block by its index.
public DataBlock GetDataBlock(int index)
Parameters
indexintThe index of the data block to retrieve.
Returns
- DataBlock
The data block at the specified index.
GetDataBlocks()
Gets all data blocks in the group.
public IEnumerable<DataBlock> GetDataBlocks()
Returns
- IEnumerable<DataBlock>
An enumeration of data blocks.
GetGroup(int)
Gets the group at the specified index.
public DataBlock GetGroup(int index)
Parameters
indexintThe index of the group to retrieve.
Returns
- DataBlock
The group at the specified index.
GetGroup(string)
Gets a data block based on the specified group key.
public DataBlock GetGroup(string groupKey)
Parameters
groupKeystringThe key of the group.
Returns
- DataBlock
The data block associated with the specified key.
Exceptions
- KeyNotFoundException
Thrown if the groupKey does not exist.
GetGroupKey(int)
Gets the key for the group at the specified index.
public object GetGroupKey(int index)
Parameters
indexintThe index of the group.
Returns
- object
The key for the group at the specified index.
GetGroups()
Gets all groups in the data block group.
public IEnumerable<DataBlock> GetGroups()
Returns
- IEnumerable<DataBlock>
A list of data blocks representing the groups.
Info()
Generates a summary DataBlock containing the group keys and their corresponding row counts.
public DataBlock Info()
Returns
- DataBlock
A DataBlock with two columns: Group and Count, representing the group key and the number of rows in each group.
RemoveDataBlock(DataBlock)
Removes a data block and its corresponding key from the group.
public void RemoveDataBlock(DataBlock dataBlock)
Parameters
dataBlockDataBlockThe data block to remove.