Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.table.aggregator
Class Functions.WeightedAverageFunction

java.lang.Object
  extended by com.citra.pivot.table.aggregator.Functions.WeightedAverageFunction
All Implemented Interfaces:
Functions.Function
Enclosing class:
Functions

public static class Functions.WeightedAverageFunction
extends Object
implements Functions.Function

The weighted average function.


Field Summary
protected  boolean countNulls
          boolean indicating whether nulls should be included in the evaluation
protected  List weights
          the weights
 
Constructor Summary
Functions.WeightedAverageFunction()
          Constructs a WeightedAverageFunction.
Functions.WeightedAverageFunction(boolean countNulls)
          Constructs a WeightedAverageFunction.
Functions.WeightedAverageFunction(List weights)
          Constructs a WeightedAverageFunction.
Functions.WeightedAverageFunction(List weights, boolean countNulls)
          Constructs a WeightedAverageFunction.
 
Method Summary
 Object evaluate(List values, OlapType type)
          Produces an aggregate from a list of values.
 List getWeights()
          Retrieves the weights.
 void setWeights(List weights)
          Assigns a new set of weights.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

weights

protected List weights
the weights


countNulls

protected boolean countNulls
boolean indicating whether nulls should be included in the evaluation

Constructor Detail

Functions.WeightedAverageFunction

public Functions.WeightedAverageFunction()
Constructs a WeightedAverageFunction.


Functions.WeightedAverageFunction

public Functions.WeightedAverageFunction(boolean countNulls)
Constructs a WeightedAverageFunction.


Functions.WeightedAverageFunction

public Functions.WeightedAverageFunction(List weights)
Constructs a WeightedAverageFunction.


Functions.WeightedAverageFunction

public Functions.WeightedAverageFunction(List weights,
                                         boolean countNulls)
Constructs a WeightedAverageFunction.

Method Detail

setWeights

public void setWeights(List weights)
Assigns a new set of weights.

Parameters:
weights - the weights to assign

getWeights

public List getWeights()
Retrieves the weights.

Returns:
the weights

evaluate

public Object evaluate(List values,
                       OlapType type)
Produces an aggregate from a list of values.

Specified by:
evaluate in interface Functions.Function
Parameters:
values - the list of values
type - the data type the evaluation will be based on
Returns:
the aggregate value

Copyright © 2011 Citra Technologies. All Rights Reserved.