Style Intelligence v12.0

inetsoft.uql.asset
Class AggregateFormula

java.lang.Object
  extended by inetsoft.uql.asset.AggregateFormula
All Implemented Interfaces:
Serializable, Cloneable

public abstract class AggregateFormula
extends Object
implements Serializable, Cloneable

Aggregate formula represents an aggregate formula in SQL.

See Also:
Serialized Form

Field Summary
static AggregateFormula AGGREGATE
          Aggregate formula for cube.
static AggregateFormula AVG
          AVG formula.
static AggregateFormula CORRELATION
          Correlation formula.
static AggregateFormula COUNT_ALL
          Count all formula.
static AggregateFormula COUNT_DISTINCT
          Count distinct formula.
static AggregateFormula COVARIANCE
          Covariance formula.
static AggregateFormula FIRST
          Sum formula.
static AggregateFormula LAST
          Sum formula.
static AggregateFormula MAX
          Max formula.
static AggregateFormula MEDIAN
          Median formula.
static AggregateFormula MIN
          Min formula.
static AggregateFormula MODE
          Mode formula.
static AggregateFormula NONE
          None formula.
static AggregateFormula POPULATION_STANDARD_DEVIATION
          Population standard deviation formula.
static AggregateFormula POPULATION_VARIANCE
          Population Variance formula.
static AggregateFormula STANDARD_DEVIATION
          Standard deviation formula.
static AggregateFormula SUM
          Sum formula.
static AggregateFormula SUMSQ
          Sum of square.
static AggregateFormula SUMWT
          Weighted sum.
static AggregateFormula VARIANCE
          Variance formula.
static AggregateFormula WEIGHTED_AVG
          Weighted average formula.
 
Constructor Summary
AggregateFormula()
           
 
Method Summary
 Object clone()
           
 boolean equals(Object obj)
          Check if equals another object.
 String getCubeExpression(String set, String measure)
          Get the expression of the formula used for mdx.
 String getCubeFormulaName()
          Get formula name used for mdx.
 String getDataType()
          Get the type of the formula result.
static AggregateFormula getDefaultFormula(String type)
          Get the default formula for the data ref.
abstract  String getExpression(String column, String col2, AggregateHelper helper)
          Get the SQL expression of the formula.
abstract  String getExpressionSub(String column, String col2, AggregateHelper helper)
          Get the SQL expression using sub-aggregates.
static AggregateFormula getFormula(String name)
          Get the aggregate formula.
abstract  String getFormulaName()
          Get a formula that can be used to create a formula calculation object.
static AggregateFormula[] getFormulas()
          Get all the available formulas.
static String getIdentifier(AggregateFormula formula)
          Get the identifier.
static String[] getIdentifiers(boolean none)
          Get all the available identifiers.
 String getLabel()
          Get the label of the agggregate formula.
abstract  String getName()
          Get the display name.
 AggregateFormula getParentFormula()
          Get the parent formula.
 String getUID(String column, String col2)
          Get an unique id for the formula that can be used to identify an aggregate column.
 String getUID(String column, String col2, String formula)
          Get an unique id for the formula that can be used to identify an aggregate column.
protected  String getUIDName(DataRef ref)
          Get the uid name of a data ref.
 int hashCode()
          Get the hash code.
 boolean isCombinable()
          Check if this formula can be calculated from the result of sub-groups, or the sub aggregate of the sub-groups.
 boolean isComposite()
          Check if this is a composite formula.
 boolean isTwoColumns()
          Check if the formula requires two columns.
 void setComposite(boolean composite)
          Set whether the calculation should be done by composing results from sub-aggregates.
 String toString()
          Get string representation.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NONE

public static final AggregateFormula NONE
None formula.


AVG

public static final AggregateFormula AVG
AVG formula.


COUNT_ALL

public static final AggregateFormula COUNT_ALL
Count all formula.


COUNT_DISTINCT

public static final AggregateFormula COUNT_DISTINCT
Count distinct formula.


MAX

public static final AggregateFormula MAX
Max formula.


MIN

public static final AggregateFormula MIN
Min formula.


SUM

public static final AggregateFormula SUM
Sum formula.


FIRST

public static final AggregateFormula FIRST
Sum formula.


LAST

public static final AggregateFormula LAST
Sum formula.


MEDIAN

public static final AggregateFormula MEDIAN
Median formula.


MODE

public static final AggregateFormula MODE
Mode formula.


CORRELATION

public static final AggregateFormula CORRELATION
Correlation formula.


COVARIANCE

public static final AggregateFormula COVARIANCE
Covariance formula.


VARIANCE

public static final AggregateFormula VARIANCE
Variance formula.


STANDARD_DEVIATION

public static final AggregateFormula STANDARD_DEVIATION
Standard deviation formula.


POPULATION_VARIANCE

public static final AggregateFormula POPULATION_VARIANCE
Population Variance formula.


POPULATION_STANDARD_DEVIATION

public static final AggregateFormula POPULATION_STANDARD_DEVIATION
Population standard deviation formula.


WEIGHTED_AVG

public static final AggregateFormula WEIGHTED_AVG
Weighted average formula.


SUMSQ

public static final AggregateFormula SUMSQ
Sum of square.


SUMWT

public static final AggregateFormula SUMWT
Weighted sum.


AGGREGATE

public static final AggregateFormula AGGREGATE
Aggregate formula for cube.

Constructor Detail

AggregateFormula

public AggregateFormula()
Method Detail

getFormulas

public static AggregateFormula[] getFormulas()
Get all the available formulas.

Returns:
all the available formulas.

getIdentifiers

public static String[] getIdentifiers(boolean none)
Get all the available identifiers.

Parameters:
none - true to include none, false otherwise.

getIdentifier

public static String getIdentifier(AggregateFormula formula)
Get the identifier.

Parameters:
formula - the specified aggregate formula.
Returns:
the identifier of the aggregate formula.

getFormula

public static AggregateFormula getFormula(String name)
Get the aggregate formula.

Parameters:
name - the specified formula name or identifier.
Returns:
the aggregate formula of the name, null if not found.

getDefaultFormula

public static AggregateFormula getDefaultFormula(String type)
Get the default formula for the data ref.

Parameters:
data - type.

getName

public abstract String getName()
Get the display name.

Returns:
the name of the aggregate formula.

getExpression

public abstract String getExpression(String column,
                                     String col2,
                                     AggregateHelper helper)
Get the SQL expression of the formula.

Parameters:
column - the specified column used in the expression.
col2 - the secondary column for formulas that perform calculation on two columns, such as correlation and weighted average. This parameter is ignored for formulas that don't require a secondary column.
helper - the helper for the target database.
Returns:
the expression of the formula.

getExpressionSub

public abstract String getExpressionSub(String column,
                                        String col2,
                                        AggregateHelper helper)
Get the SQL expression using sub-aggregates. The sub-aggregates should be columns that's on the same table. The sub-aggregate column can be looked up using the submap from the UID to the aggregate ref. This method needs to aggregate the sub-aggregates.

Parameters:
column - the specified column used in the expression.
col2 - the secondary column for formulas that perform calculation on two columns, such as correlation and weighted average. This parameter is ignored for formulas that don't require a secondary column.
helper - the helper for the target database.
Returns:
the expression of the formula.

getFormulaName

public abstract String getFormulaName()
Get a formula that can be used to create a formula calculation object. This is an internal method used during runtime for post processing.


getCubeFormulaName

public String getCubeFormulaName()
Get formula name used for mdx.


getCubeExpression

public String getCubeExpression(String set,
                                String measure)
Get the expression of the formula used for mdx.


isCombinable

public boolean isCombinable()
Check if this formula can be calculated from the result of sub-groups, or the sub aggregate of the sub-groups.


setComposite

public void setComposite(boolean composite)
Set whether the calculation should be done by composing results from sub-aggregates.


isComposite

public boolean isComposite()
Check if this is a composite formula.


getUID

public String getUID(String column,
                     String col2)
Get an unique id for the formula that can be used to identify an aggregate column.


getUIDName

protected String getUIDName(DataRef ref)
Get the uid name of a data ref.

Parameters:
ref - the specified data ref.

getUID

public String getUID(String column,
                     String col2,
                     String formula)
Get an unique id for the formula that can be used to identify an aggregate column.


getDataType

public String getDataType()
Get the type of the formula result. Returns null if the result is the same as the input data.

Returns:
a type defined in XSchema.

isTwoColumns

public boolean isTwoColumns()
Check if the formula requires two columns.


getLabel

public String getLabel()
Get the label of the agggregate formula.


toString

public String toString()
Get string representation.

Overrides:
toString in class Object

hashCode

public int hashCode()
Get the hash code.

Overrides:
hashCode in class Object
Returns:
the hash code of the aggregate formula.

equals

public boolean equals(Object obj)
Check if equals another object.

Overrides:
equals in class Object
Returns:
true if yes, false otherwise.

getParentFormula

public AggregateFormula getParentFormula()
Get the parent formula.

Returns:
the parent formula if this aggregate supports aggregate on aggregate, null otherwise.

clone

public Object clone()
Overrides:
clone in class Object

Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.