mondrian.olap.fun
Class AggregateFunDef.AggregateCalc

java.lang.Object
  extended by mondrian.calc.impl.AbstractCalc
      extended by mondrian.calc.impl.AbstractDoubleCalc
          extended by mondrian.olap.fun.AggregateFunDef.AggregateCalc
All Implemented Interfaces:
Calc, DoubleCalc
Enclosing class:
AggregateFunDef

public static class AggregateFunDef.AggregateCalc
extends AbstractDoubleCalc

 

Field Summary
 
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type
 
Constructor Summary
AggregateFunDef.AggregateCalc(Exp exp, ListCalc listCalc, Calc calc)
           
 
Method Summary
 boolean dependsOn(Dimension dimension)
          Returns whether this expression depends upon a given dimension.
 double evaluateDouble(Evaluator evaluator)
          Evaluates this expression to yield a double value.
 Calc[] getCalcs()
          Returns this expression's child expressions.
static boolean isSuperSet(Member[] tuple1, Member[] tuple2)
          Returns whether tuple1 is a superset of tuple2
static List<Member[]> makeTupleList(List<Member> list)
          Forms a list tuples from a list of members
static Map<Member,Integer>[] membersVersusOccurencesInTuple(List<Member[]> tuples)
          Finds member occurrences in tuple and generates a map of Members versus their occurrences in tuples.
static List<Member[]> optimizeChildren(List<Member[]> tuples, SchemaReader reader, Cube baseCubeForMeasure)
          In distinct Count aggregation, if tuple list is a result m.children * n.children then it can be optimized to m * n
static List<Member[]> removeOverlappingTupleEntries(List<Member[]> list)
          In case of distinct count aggregation if a tuple which is a super set of other tuples in the set exists then the child tuples can be ignored.
 
Methods inherited from class mondrian.calc.impl.AbstractDoubleCalc
evaluate
 
Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, getArguments, getName, getResultStyle, getType, simplifyEvaluator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface mondrian.calc.Calc
accept, getResultStyle, getType
 

Constructor Detail

AggregateFunDef.AggregateCalc

public AggregateFunDef.AggregateCalc(Exp exp,
                                     ListCalc listCalc,
                                     Calc calc)
Method Detail

evaluateDouble

public double evaluateDouble(Evaluator evaluator)
Description copied from interface: DoubleCalc
Evaluates this expression to yield a double value. If the result is null, returns the special FunUtil.DoubleNull value.

Parameters:
evaluator - Evaluation context
Returns:
evaluation result

removeOverlappingTupleEntries

public static List<Member[]> removeOverlappingTupleEntries(List<Member[]> list)
In case of distinct count aggregation if a tuple which is a super set of other tuples in the set exists then the child tuples can be ignored.

E.g. List consists of: (Gender.[All Gender], [Product].[All Products]), (Gender.[All Gender].[F], [Product].[All Products].[Drink]), (Gender.[All Gender].[M], [Product].[All Products].[Food]) Can be optimized to: (Gender.[All Gender], [Product].[All Products])

Parameters:
list -

isSuperSet

public static boolean isSuperSet(Member[] tuple1,
                                 Member[] tuple2)
Returns whether tuple1 is a superset of tuple2

Parameters:
tuple1 -
tuple2 -
Returns:
boolean

makeTupleList

public static List<Member[]> makeTupleList(List<Member> list)
Forms a list tuples from a list of members

Parameters:
list - of members
Returns:
list of tuples

getCalcs

public Calc[] getCalcs()
Description copied from class: AbstractCalc
Returns this expression's child expressions.

Overrides:
getCalcs in class AbstractDoubleCalc

dependsOn

public boolean dependsOn(Dimension dimension)
Description copied from interface: Calc
Returns whether this expression depends upon a given dimension.

If it does not depend on the dimension, then re-evaluating the expression with a different member of this context must produce the same answer.

Some examples:

Specified by:
dependsOn in interface Calc
Overrides:
dependsOn in class AbstractCalc
Parameters:
dimension - Dimension
Returns:
Whether this expression's result depends upon the current member of the dimension

optimizeChildren

public static List<Member[]> optimizeChildren(List<Member[]> tuples,
                                              SchemaReader reader,
                                              Cube baseCubeForMeasure)
In distinct Count aggregation, if tuple list is a result m.children * n.children then it can be optimized to m * n

E.g. List consist of: (Gender.[All Gender].[F], [Store].[All Stores].[USA]), (Gender.[All Gender].[F], [Store].[All Stores].[USA].[OR]), (Gender.[All Gender].[F], [Store].[All Stores].[USA].[CA]), (Gender.[All Gender].[F], [Store].[All Stores].[USA].[WA]), (Gender.[All Gender].[F], [Store].[All Stores].[CANADA]) (Gender.[All Gender].[M], [Store].[All Stores].[USA]), (Gender.[All Gender].[M], [Store].[All Stores].[USA].[OR]), (Gender.[All Gender].[M], [Store].[All Stores].[USA].[CA]), (Gender.[All Gender].[M], [Store].[All Stores].[USA].[WA]), (Gender.[All Gender].[M], [Store].[All Stores].[CANADA]) Can be optimized to: (Gender.[All Gender], [Store].[All Stores].[USA]) (Gender.[All Gender], [Store].[All Stores].[CANADA])

Parameters:
tuples - Tuples
reader - Schema reader
baseCubeForMeasure - Cube
Returns:
xxxx

membersVersusOccurencesInTuple

public static Map<Member,Integer>[] membersVersusOccurencesInTuple(List<Member[]> tuples)
Finds member occurrences in tuple and generates a map of Members versus their occurrences in tuples.

Parameters:
tuples - List of tuples
Returns:
Map of the number of occurrences of each member in a tuple

SourceForge.net_Logo