Style Intelligence v12.0

inetsoft.report.filter
Class CalcFieldFormula

java.lang.Object
  extended by inetsoft.report.filter.CalcFieldFormula
All Implemented Interfaces:
Formula, Formula2, PercentageFormula, Serializable, Cloneable

public class CalcFieldFormula
extends Object
implements PercentageFormula, Formula2

This calc field formula to encapsulate many formula with script.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface inetsoft.report.filter.Formula
__NULL__
 
Constructor Summary
CalcFieldFormula(String expression, String[] aggs, Formula[] sub, int[] secondColumns, inetsoft.util.script.ScriptEnv senv, org.mozilla.javascript.Scriptable scope)
          Create a CalcFieldFormula instance.
 
Method Summary
 void addValue(double v)
          Add a double value to the formula.
 void addValue(double[] v)
          Add double values to the formula.
 void addValue(float v)
          Add a float value to the formula.
 void addValue(int v)
          Add an int value to the formula.
 void addValue(long v)
          Add a long value to the formula.
 void addValue(Object v)
          Add a value to the formula.
 void addValue(short v)
          Add a short value to the formula.
 Object clone()
          Clone this formula.
 String getDisplayName()
          Get formula display name.
 double getDoubleResult()
          Get the formula double result.
 String getExpression()
          Get the expression.
 String getName()
          Get formula name.
 Object getOriginalResult()
          Get the original formula result without percentage.
 int getPercentageType()
          Get percentage type.
 Object getResult()
          Get the formula result.
 int[] getSecondaryColumns()
          (non-Javadoc)
 boolean isDefaultResult()
          Get the default result option of this formula.
 void reset()
          Reset the formula to start over.
 void setDefaultResult(boolean def)
          Set the default result option of this formula.
 void setPercentageType(int percentageType)
          Set percentage type.
 void setTotal(Object total)
          Set the total used to calculate percentage.
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CalcFieldFormula

public CalcFieldFormula(String expression,
                        String[] aggs,
                        Formula[] sub,
                        int[] secondColumns,
                        inetsoft.util.script.ScriptEnv senv,
                        org.mozilla.javascript.Scriptable scope)
Create a CalcFieldFormula instance.

Method Detail

reset

public void reset()
Reset the formula to start over.

Specified by:
reset in interface Formula

addValue

public void addValue(Object v)
Add a value to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(double v)
Add a double value to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(double[] v)
Add double values to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(float v)
Add a float value to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(long v)
Add a long value to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(int v)
Add an int value to the formula.

Specified by:
addValue in interface Formula

addValue

public void addValue(short v)
Add a short value to the formula.

Specified by:
addValue in interface Formula

setDefaultResult

public void setDefaultResult(boolean def)
Set the default result option of this formula.

Specified by:
setDefaultResult in interface Formula
Parameters:
def - true to use the default value of a formula if no result, false to just return null.

isDefaultResult

public boolean isDefaultResult()
Get the default result option of this formula.

Specified by:
isDefaultResult in interface Formula
Returns:
true to use the default value of a formula if no result, false to just return null.

getResult

public Object getResult()
Get the formula result.

Specified by:
getResult in interface Formula

getDoubleResult

public double getDoubleResult()
Get the formula double result.

Specified by:
getDoubleResult in interface Formula

clone

public Object clone()
Description copied from interface: Formula
Clone this formula. This may or may not copy the values from this formula.

Specified by:
clone in interface Formula
Overrides:
clone in class Object

getPercentageType

public int getPercentageType()
Get percentage type.

Specified by:
getPercentageType in interface PercentageFormula

setPercentageType

public void setPercentageType(int percentageType)
Set percentage type. three types: StyleConstants.PERCENTAGE_NONE, StyleConstants.PERCENTAGE_OF_GROUP, StyleConstants.PERCENTAGE_OF_GRANDTOTAL.

Specified by:
setPercentageType in interface PercentageFormula

setTotal

public void setTotal(Object total)
Set the total used to calculate percentage. if percentage type is PERCENTAGE_NONE, it is ineffective to invoke the method.

Specified by:
setTotal in interface PercentageFormula

getOriginalResult

public Object getOriginalResult()
Get the original formula result without percentage.

Specified by:
getOriginalResult in interface PercentageFormula

getDisplayName

public String getDisplayName()
Get formula display name.

Specified by:
getDisplayName in interface Formula

getName

public String getName()
Get formula name.

Specified by:
getName in interface Formula

getSecondaryColumns

public int[] getSecondaryColumns()
(non-Javadoc)

Specified by:
getSecondaryColumns in interface Formula2
See Also:
Formula2.getSecondaryColumns()

getExpression

public String getExpression()
Get the expression.


toString

public String toString()
Overrides:
toString in class Object

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