Class PercentageExpression
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.function.AbstractExpression
-
- org.pentaho.reporting.engine.classic.core.function.PercentageExpression
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Expression
- Direct Known Subclasses:
ItemColumnQuotientExpression
public class PercentageExpression extends AbstractExpression
Deprecated.The same can be achieved using a simple ValueExpression.Computes the percentage for a column in relation to a base column. The function undestands two parameters. Thedividend
parameter is required and denotes the name of an ItemBand-field which is used as dividend. Thedivisor
parameter is required and denotes the name of an ItemBand-field which is uses as divisor. If either the divident or the divisor are not numeric, the expression will returnnull
. The formula used is as follows:Percent := divident / divisor
If the flaguseDifference
is set, the difference between base and subject is used instead.Percent := (divisor - divident) / divisor
- Author:
- Heiko Evermann, Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PercentageExpression()
Deprecated.Constructs a new function.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getDividend()
Deprecated.Returns the field used as dividend by the function.String
getDivisor()
Deprecated.Returns the field used as divisor by the function.int
getRoundingMode()
Deprecated.Returns the defined rounding mode.int
getScale()
Deprecated.Returns the scale for the divide-operation.Object
getValue()
Deprecated.Return the current function value.boolean
isUseDifference()
Deprecated.Returns whether the difference between divident and divisor should be used as real divisor.void
setDividend(String dividend)
Deprecated.Sets the field name to be used as dividend for the function.void
setDivisor(String divisor)
Deprecated.Sets the field name to be used as divisor for the function.void
setRoundingMode(int roundingMode)
Deprecated.Defines the rounding mode.void
setScale(int scale)
Deprecated.Defines the scale for the divide-operation.void
setUseDifference(boolean useDifference)
Deprecated.Defines whether the difference between divident and divisor should be used as real divisor.-
Methods inherited from class org.pentaho.reporting.engine.classic.core.function.AbstractExpression
clone, getDataRow, getDependencyLevel, getInstance, getName, getReportConfiguration, getResourceBundleFactory, getRuntime, isActive, isDeepTraversing, isPreserve, setActive, setDependencyLevel, setName, setPreserve, setRuntime
-
-
-
-
Method Detail
-
isUseDifference
public boolean isUseDifference()
Deprecated.Returns whether the difference between divident and divisor should be used as real divisor.- Returns:
- true, if the difference is used, false if the divident is used directly.
-
setUseDifference
public void setUseDifference(boolean useDifference)
Deprecated.Defines whether the difference between divident and divisor should be used as real divisor.- Parameters:
useDifference
- true, if the difference is used, false if the divident is used directly.
-
getRoundingMode
public int getRoundingMode()
Deprecated.Returns the defined rounding mode. This influences the precision of the divide-operation.- Returns:
- the rounding mode.
- See Also:
BigDecimal.divide(java.math.BigDecimal, int)
-
setRoundingMode
public void setRoundingMode(int roundingMode)
Deprecated.Defines the rounding mode. This influences the precision of the divide-operation.- Parameters:
roundingMode
- the rounding mode.- See Also:
BigDecimal.divide(java.math.BigDecimal, int)
-
getScale
public int getScale()
Deprecated.Returns the scale for the divide-operation. The scale influences the precision of the division.- Returns:
- the scale.
-
setScale
public void setScale(int scale)
Deprecated.Defines the scale for the divide-operation. The scale influences the precision of the division.- Parameters:
scale
- the scale.
-
getDividend
public String getDividend()
Deprecated.Returns the field used as dividend by the function.The field name corresponds to a column name in the report's data-row.
- Returns:
- The field name.
-
getDivisor
public String getDivisor()
Deprecated.Returns the field used as divisor by the function.The field name corresponds to a column name in the report's data-row.
- Returns:
- The field name.
-
setDividend
public void setDividend(String dividend)
Deprecated.Sets the field name to be used as dividend for the function.The field name corresponds to a column name in the report's data-row.
- Parameters:
dividend
- the field name.
-
setDivisor
public void setDivisor(String divisor)
Deprecated.Sets the field name to be used as divisor for the function.The field name corresponds to a column name in the report's data-row.
- Parameters:
divisor
- the field name.
-
getValue
public Object getValue()
Deprecated.Return the current function value.The value is calculated as the quotient of two columns: the dividend column and the divisor column. If the divisor is zero, the return value is "n/a";
- Returns:
- The quotient
-
-