com.bigdata.counters.query
Class PivotTable

java.lang.Object
  extended by com.bigdata.counters.query.PivotTable

public class PivotTable
extends Object

Aggregates data from a table by grouping the cells in the table into sets (CSets) of category columns. The values for cells belonging to the same CSet are aggregated for each distinct ICounterNode.getName().


Field Summary
 ICounter[] a
          The selected counters (redundant reference to HistoryTable.a.
 String[] cnames
          An array of category column names.
 List<CSet> csets
          Aggregation of the selected counters (a) into sets sharing the same category values.
 HistoryTable src
          The HistoryTable (converts counter hierarchy into regular table).
 LinkedHashSet<String> vcols
          The ordered set of distinct counter names.
 
Constructor Summary
PivotTable(Pattern pattern, String[] category, HistoryTable t)
           
 
Method Summary
protected static List<CSet> getCategoryValueSets(Pattern pattern, ICounter[] a, AtomicInteger ngroups)
          The set of distinct ordered matched sets of category values in the current row of the history table paired with the ICounters matched up on those category values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

src

public final HistoryTable src
The HistoryTable (converts counter hierarchy into regular table).


a

public final ICounter[] a
The selected counters (redundant reference to HistoryTable.a.


vcols

public final LinkedHashSet<String> vcols
The ordered set of distinct counter names. The order of the selected counters is preserved here (minus duplicate counter names) due to the virtues of the linked hash set.


csets

public final List<CSet> csets
Aggregation of the selected counters (a) into sets sharing the same category values.


cnames

public final String[] cnames
An array of category column names. The names can be specified using URL query parameters. When they are not specified or when there are not enough specified parameters then we use some generated names.

See Also:
URLQueryModel.CATEGORY
Constructor Detail

PivotTable

public PivotTable(Pattern pattern,
                  String[] category,
                  HistoryTable t)
Parameters:
pattern - The pattern used to specify the counters of interest and the capturing groups which determined how the counters will be aggregated.

If a capturing group is used for the counter name then that capturing group will be ignored. This makes it easier switch back and forth between a PivotTable and a HistoryTable. If the counter name was in fact treated as a capturing group for the purposes of determining the category columns, then that would give you a distinct row for every sample and blanks in the other value columns.

category - The ordered labels to be assigned to the category columns (optional). When given, the order of the category names parameters MUST correspond with the order of the capturing groups in the pattern.
t - The source data.
Method Detail

getCategoryValueSets

protected static List<CSet> getCategoryValueSets(Pattern pattern,
                                                 ICounter[] a,
                                                 AtomicInteger ngroups)
The set of distinct ordered matched sets of category values in the current row of the history table paired with the ICounters matched up on those category values.

Note: This automatically detects if the last capturing group captures the counter name and then drop that from the set of category columns. This makes it much easier to switch between a correlated view and a pivot view since you often want the counter name to be a capturing group for the correlated view.

Parameters:
ngroups - The #of capturing groups which were actually used (by side-effect). This is either the #of capturing groups which were specified in the pattern -or- one less than that value iff the last capturing group captures the counter name.


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.