public abstract class AbstractCalc extends Object implements Calc
Calc interface.| Modifier | Constructor and Description | 
|---|---|
| protected  | AbstractCalc(Exp exp,
            Calc[] calcs)Creates an AbstractCalc. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | accept(CalcWriter calcWriter)Prints this expression, by accepting a visiting  CalcWriter. | 
| static boolean | anyDepends(Calc[] calcs,
          Hierarchy hierarchy)Returns true if one of the calcs depends on the given dimension. | 
| static boolean | anyDependsButFirst(Calc[] calcs,
                  Hierarchy hierarchy)Returns true if calc[0] depends on dimension,
 else false if calc[0] returns dimension,
 else true if any of the other calcs depend on dimension. | 
| static boolean | butDepends(Calc[] calcs,
          Hierarchy hierarchy)Returns true if any of the calcs depend on dimension,
 else false if any of the calcs return dimension,
 else true. | 
| protected void | collectArguments(Map<String,Object> arguments)Collects any other arguments to this calc. | 
| boolean | dependsOn(Hierarchy hierarchy)Returns whether this expression depends upon a given hierarchy. | 
| protected Map<String,Object> | getArguments()Returns any other arguments to this calc. | 
| Calc[] | getCalcs()Returns this expression's child expressions. | 
| protected String | getName()Returns the name of this expression type, used when serializing an
 expression to a string. | 
| ResultStyle | getResultStyle()Returns style in which the result of evaluating this expression is
 returned. | 
| Type | getType()Returns the type of this expression. | 
| boolean | isWrapperFor(Class<?> iface)
 Default implementation just does 'instanceof TargetClass'. | 
| static Evaluator | simplifyEvaluator(Calc calc,
                 Evaluator evaluator)Returns a simplified evalator whose context is the same for every
 dimension which an expression depends on, and the default member for
 every dimension which it does not depend on. | 
| <T> T | unwrap(Class<T> iface)
 Default implementation just casts to TargetClass. | 
public Type getType()
Calcpublic boolean isWrapperFor(Class<?> iface)
isWrapperFor in interface Calcpublic <T> T unwrap(Class<T> iface)
public void accept(CalcWriter calcWriter)
CalcCalcWriter.protected String getName()
The default implementation tries to extract a name from a function call, if any, then prints the last part of the class name.
public Calc[] getCalcs()
public boolean dependsOn(Hierarchy hierarchy)
CalcIf it does not depend on the hierarchy, then re-evaluating the expression with a different member of this context must produce the same answer.
Some examples:[Measures].[Unit Sales][Measures].
 ([Measures].[Unit Sales],
 [Time].[1997]) > 1000Filter([Store].[USA].Children,
 [Measures].[Unit Sales] < 50)Filter function sets the [Store]
 context before evaluating the scalar expression, so it is not inherited
 from the surrounding context.
 public static boolean anyDepends(Calc[] calcs, Hierarchy hierarchy)
public static boolean anyDependsButFirst(Calc[] calcs, Hierarchy hierarchy)
Typical application: Aggregate({Set}, {Value Expression})
 depends upon everything {Value Expression} depends upon, except the
 dimensions of {Set}.
public static boolean butDepends(Calc[] calcs, Hierarchy hierarchy)
protected final Map<String,Object> getArguments()
protected void collectArguments(Map<String,Object> arguments)
The default implementation returns name, class, type, resultStyle. A subclass must call super, but may add other arguments.
arguments - Collection of name/value pairs, represented as a mappublic static Evaluator simplifyEvaluator(Calc calc, Evaluator evaluator)
The default member is often the 'all' member, so this evaluator is usually the most efficient context in which to evaluate the expression.
calc - evaluator - public ResultStyle getResultStyle()
CalcOne application of this method is for the compiler to figure out whether the compiled expression is returning a mutable list. If a mutable list is required, the compiler can create a mutable copy.
getResultStyle in interface CalcExpCompiler.compileList(mondrian.olap.Exp, boolean)Copyright © 2019 Hitachi Vantara. All rights reserved.