TissueInfo API 20091124110011

edu.mssm.crover.tables.treatments
Class Aggregation

java.lang.Object
  extended by edu.mssm.crover.tables.treatments.Aggregation

public class Aggregation
extends Object

Aggregation operation on tables, similar to Mineset aggregation. Just a little bit more flexible about the aggregation operations (Mineset proposes: Sum, Average, Count, Min, Max); This class supports any operation that accept a set of instances from the source table and computes an object or a primitive type.


Nested Class Summary
protected  class Aggregation.Aggregate
           
 
Field Summary
protected  Object parameter
           
 
Constructor Summary
Aggregation()
           
Aggregation(Object parameter)
          Variant useful for customization.
 
Method Summary
 void aggregate(String columnIdentifier)
           
 Table aggregate(Table source)
          Performs the aggregation operation on source, returns the new table.
protected  void begin(Table source, Table dest)
          Override to add the aggregation columns to the destination table.
 void doNotAggregate(String columnIdentifier)
           
 void doNotGroupBy(String columnIdentifier)
           
 void doNotRemove(String columnIdentifier)
           
protected  void end(Table source, Table dest)
          Invoked after every row has been processed.
 Object getParameter()
          Returns the parameter passed at construction time.
 void groupBy(String columnIdentifier)
           
 boolean isAggregateColumn(String columnIdentifier)
           
 boolean isGroupByColumn(String columnIdentifier)
           
protected  boolean isInGroup(String element, String[] group)
           
 boolean isRemoveColumn(String columnIdentifier)
           
static void main(String[] args)
          Example and test of use for this class.
 void remove(String columnIdentifier)
           
protected  void treatAggregate(Table source, Table.RowIterator[] aggregate, Table dest)
          Called for each aggregat of the source table.
 void treatInstance(Table dest, Table.RowIterator ri)
           
protected  int whereInGroup(String element, String[] group)
          Returns the index of the element in the group.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameter

protected Object parameter
Constructor Detail

Aggregation

public Aggregation(Object parameter)
Variant useful for customization. Pass whatever parameter you will need during the aggregation, and retrieve it latter through getParameter()

See Also:
getParameter()

Aggregation

public Aggregation()
Method Detail

getParameter

public Object getParameter()
Returns the parameter passed at construction time.


groupBy

public void groupBy(String columnIdentifier)

doNotGroupBy

public void doNotGroupBy(String columnIdentifier)

isGroupByColumn

public boolean isGroupByColumn(String columnIdentifier)

isRemoveColumn

public boolean isRemoveColumn(String columnIdentifier)

isAggregateColumn

public boolean isAggregateColumn(String columnIdentifier)

isInGroup

protected boolean isInGroup(String element,
                            String[] group)

remove

public void remove(String columnIdentifier)

doNotRemove

public void doNotRemove(String columnIdentifier)

aggregate

public void aggregate(String columnIdentifier)

doNotAggregate

public void doNotAggregate(String columnIdentifier)

whereInGroup

protected int whereInGroup(String element,
                           String[] group)
Returns the index of the element in the group.

Returns:
-1 when the element is not part of the group.

aggregate

public Table aggregate(Table source)
                throws TreatmentInterrupted
Performs the aggregation operation on source, returns the new table. When no groupBy table is specified, the aggregation typically creates only one aggregate that contains all the instances of the source table.

Throws:
TreatmentInterrupted

treatInstance

public void treatInstance(Table dest,
                          Table.RowIterator ri)

begin

protected void begin(Table source,
                     Table dest)
              throws Exception
Override to add the aggregation columns to the destination table. Invoked before any row has had a chance to be processed.

Throws:
Exception

end

protected void end(Table source,
                   Table dest)
Invoked after every row has been processed.


treatAggregate

protected void treatAggregate(Table source,
                              Table.RowIterator[] aggregate,
                              Table dest)
                       throws Exception
Called for each aggregat of the source table. An aggregat is the set of row iterators of the source table that have the same values of the n-uplet (c1, ... cn), ci being a column of the source table. An aggregation can be seen as a projection, from the space of the complete source table columns to the space of the aggregated columns.

Throws:
Exception

main

public static void main(String[] args)
Example and test of use for this class. TODO: Convert to junit test


TissueInfo API 20091124110011

Copyright © 2001-2009 Institute for Computational Biomedicine, All Rights Reserved.