Class TableAccumulator
java.lang.Object
com.scivicslab.pojoactor.core.accumulator.TableAccumulator
- All Implemented Interfaces:
Accumulator
An accumulator that formats results as a table.
This accumulator organizes results into a table format where rows are sources and columns are result types. This is useful for comparing results across multiple nodes.
Example Output
Node | cpu | gpu | memory ---------------------------------------------------------------------------------------------------- node-web-01 | Intel Xeon E5-2680 v4 | No NVIDIA GPU | 64Gi node-web-02 | Intel Xeon E5-2680 v4 | No NVIDIA GPU | 64Gi node-db-01 | AMD EPYC 7542 | NVIDIA A100 | 256Gi
- Since:
- 2.8.0
- Author:
- devteam@scivics-lab.com
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a TableAccumulator with default column width of 30 characters.TableAccumulator(int columnWidth) Constructs a TableAccumulator with custom column width. -
Method Summary
-
Constructor Details
-
TableAccumulator
public TableAccumulator()Constructs a TableAccumulator with default column width of 30 characters. -
TableAccumulator
public TableAccumulator(int columnWidth) Constructs a TableAccumulator with custom column width.- Parameters:
columnWidth- the width of each column in characters
-
-
Method Details
-
add
Description copied from interface:AccumulatorAdds a result to this accumulator.- Specified by:
addin interfaceAccumulator- Parameters:
source- the source identifier (e.g., actor name like "node-localhost")type- the type of result (e.g., "cpu", "memory", "error")data- the result data as a string
-
getSummary
Description copied from interface:AccumulatorReturns a formatted summary of all accumulated results.The format of the summary depends on the implementation. For example,
StreamingAccumulatorreturns a simple count, whileBufferedAccumulatorreturns all results grouped by source.- Specified by:
getSummaryin interfaceAccumulator- Returns:
- the formatted summary string
-
getCount
public int getCount()Description copied from interface:AccumulatorReturns the number of results that have been added.- Specified by:
getCountin interfaceAccumulator- Returns:
- the count of added results
-
clear
public void clear()Description copied from interface:AccumulatorClears all accumulated results.After calling this method, the accumulator should be in its initial state, as if no results had been added.
- Specified by:
clearin interfaceAccumulator
-