Copyright © 2011 Citra Technologies. All Rights Reserved.

com.citra.pivot.table.aggregator
Class Functions

java.lang.Object
  extended by com.citra.pivot.table.aggregator.Functions

public class Functions
extends Object

Utility class that contains common functions singletons and function calls for aggregating data.


Nested Class Summary
static class Functions.AverageFunction
          The average function.
static class Functions.CountFunction
          The count function.
static class Functions.FirstFunction
          The first function.
static interface Functions.Function
          Function defines a method for evaluating an aggregate given a list of values.
static class Functions.LastFunction
          This is the last function.
static class Functions.MaxFunction
          The max function.
static class Functions.MinFunction
          The min function.
static class Functions.ScaledSumFunction
          The scaled sum function.
static class Functions.SumFunction
          The sum function.
static class Functions.WeightedAverageFunction
          The weighted average function.
static class Functions.WeightedSumFunction
          The weighted sum function.
 
Method Summary
static Number getAverage(List values, OlapType type, boolean countNulls)
          Evaluates an average for a list of numbers.
static Functions.AverageFunction getAverageFunction()
          Returns the average function singleton.
static Number getCount(List values, OlapType type, boolean countNulls)
          Counts a list of numbers.
static Functions.CountFunction getCountFunction()
          Returns the count function singleton.
static Object getFirst(List values, boolean countNulls)
          Selects the first value in a list.
static Functions.FirstFunction getFirstFunction()
          Returns the first function singleton.
static Object getLast(List values, boolean countNulls)
          Selects the last value in a list.
static Functions.LastFunction getLastFunction()
          Returns the last function singleton.
static Number getMax(List values, OlapType type)
          Evaluates the maximum number from a list of numbers.
static Functions.MaxFunction getMaxFunction()
          Returns the max function singleton.
static Number getMin(List values, OlapType type)
          Evaluates the minimum number from a list of numbers.
static Functions.MinFunction getMinFunction()
          Returns the min function singleton.
static Number getScaledSum(List values, List weights, OlapType type)
          Evaluates the scaled sum from a list of numbers and their weights.
static Number getSum(List values, OlapType type)
          Evaluates the sum of a list of numbers.
static Functions.SumFunction getSumFunction()
          Returns the sum function singleton.
static Number getWeightedAverage(List values, List weights, OlapType type, boolean countNulls)
          Evaluates the weighted average from a list of numbers and their weights.
static Number getWeightedSum(List values, List weights, OlapType type)
          Evaluates the weighted sum for a list of numbers and their weights.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAverage

public static Number getAverage(List values,
                                OlapType type,
                                boolean countNulls)
Evaluates an average for a list of numbers.

Parameters:
values - the list of numbers
type - the data type the evaluation will be based on
countNulls - true if the average will include null values, false otherwise
Returns:
the aggregate

getAverageFunction

public static Functions.AverageFunction getAverageFunction()
Returns the average function singleton.

Returns:
the average function singleton

getCount

public static Number getCount(List values,
                              OlapType type,
                              boolean countNulls)
Counts a list of numbers.

Parameters:
values - the list of numbers
type - the data type the evaluation will be based on
countNulls - true if the counting will include null values, false otherwise
Returns:
the aggregate

getCountFunction

public static Functions.CountFunction getCountFunction()
Returns the count function singleton.

Returns:
the count function singleton

getFirst

public static Object getFirst(List values,
                              boolean countNulls)
Selects the first value in a list.

Parameters:
values - the list of numbers
countNulls - true if the counting will include null values, false otherwise
Returns:
the aggregate

getFirstFunction

public static Functions.FirstFunction getFirstFunction()
Returns the first function singleton.

Returns:
the first function singleton

getLast

public static Object getLast(List values,
                             boolean countNulls)
Selects the last value in a list.

Parameters:
values - the list of numbers
countNulls - true if the counting will include null values, false otherwise
Returns:
the aggregate

getLastFunction

public static Functions.LastFunction getLastFunction()
Returns the last function singleton.

Returns:
the last function singleton

getMax

public static Number getMax(List values,
                            OlapType type)
Evaluates the maximum number from a list of numbers.

Parameters:
values - the list of numbers
type - the data type the evaluation will be based on
Returns:
the aggregate

getMaxFunction

public static Functions.MaxFunction getMaxFunction()
Returns the max function singleton.

Returns:
the max function singleton

getMin

public static Number getMin(List values,
                            OlapType type)
Evaluates the minimum number from a list of numbers.

Parameters:
values - the list of numbers
type - the data type the evaluation will be based on
Returns:
the aggregate

getMinFunction

public static Functions.MinFunction getMinFunction()
Returns the min function singleton.

Returns:
the min function singleton

getScaledSum

public static Number getScaledSum(List values,
                                  List weights,
                                  OlapType type)
Evaluates the scaled sum from a list of numbers and their weights.

Parameters:
values - the list of numbers
weights - the numbers' weights
type - the data type the evaluation will be based on
Returns:
the aggregate

getSum

public static Number getSum(List values,
                            OlapType type)
Evaluates the sum of a list of numbers.

Parameters:
values - the list of numbers
type - the data type the evaluation will be based on
Returns:
the aggregate

getSumFunction

public static Functions.SumFunction getSumFunction()
Returns the sum function singleton.

Returns:
the sum function singleton

getWeightedAverage

public static Number getWeightedAverage(List values,
                                        List weights,
                                        OlapType type,
                                        boolean countNulls)
Evaluates the weighted average from a list of numbers and their weights.

Parameters:
values - the list of numbers
weights - the numbers' weights
type - the data type the evaluation will be based on
countNulls - true if the weighted average will include null values, false otherwise
Returns:
the aggregate

getWeightedSum

public static Number getWeightedSum(List values,
                                    List weights,
                                    OlapType type)
Evaluates the weighted sum for a list of numbers and their weights.

Parameters:
values - the list of numbers
weights - the numbers' weights
type - the data type the evaluation will be based on
Returns:
the aggregate

Copyright © 2011 Citra Technologies. All Rights Reserved.