com.businessobjects.rebean.wi
Interface BlockCalculation


public interface BlockCalculation

Warning: This interface is no longer functional from the SAP BusinessObjects 4.0 release onwards.

The BlockCalculation is a collection of horizontal or vertical calculations.


Method Summary
 CalculationElement createCalculationElement(ReportExpression expr, Calculation calculation)
           Creates a calculation on a report expression.
 boolean equals(java.lang.Object o)
          Compares the specified Object with this BlockCalculation for equality.
 CalculationElement[] findCalculations(ReportExpression expr)
          Looks for any calculation elements for a given expression.
 CalculationElement getCalculationElement(int index)
          Returns the calculation element at the specified position.
 int getCount()
          Gets the number of calculations in this axis.
 void removeAll()
          Removes any calculations in this axis.
 void removeCalculation(CalculationElement calc)
           Removes a given calculation element.
 void removeCalculation(int index)
          Remove a calculation element at a given index.
 

Method Detail

createCalculationElement

CalculationElement createCalculationElement(ReportExpression expr,
                                            Calculation calculation)
                                            throws REException

Creates a calculation on a report expression. When there already is a calculation of the specified type on that expression, the old calculation element is replaced by the new one.

When calling this method on a BlockCalculation obtained from either BlockAxis.getHBlockCalculation() or BlockAxis.getVBlockCalculation(), expr has to be on the axis, otherwise a ReportException is thrown. Passing a null value for expr in this case will result in a NullPointerException. When expr exists several times on the BlockAxis, the first occurrence is used as the base position for the calculation.

When calling this method on a BlockCalculation obtained from either Table.getHBlockCalculation(TableCell) or Table.getVBlockCalculation(TableCell), expr should be null.

Parameters:
expr - the expression to create a calculation on, or null when creating a calculation for a specific cell
calculation - the calculation to create
Returns:
the calculation element describing the new calculation
Throws:
ReportException - when expr is not in the axis or in the table cell
java.lang.NullPointerException - when expr is null and this BlockCalculation has been obtained from a BlockAxis
REException

removeCalculation

void removeCalculation(CalculationElement calc)

Removes a given calculation element.

When this BlockCalculation has been obtained from a BlockAxis, all calculations of type calc.getType() will be removed, for all occurrences of calc.getExpression() on the block axis.

When this BlockCalculation has been obtained from a TableCell, only the calculations of type calc.getType() will be removed for the cell specified in the call to Table.getHBlockCalculation(TableCell) or Table.getVBlockCalculation(TableCell).

Parameters:
calc - the calculation element to remove

removeCalculation

void removeCalculation(int index)
Remove a calculation element at a given index.

Parameters:
index - the index at which to remove the calculation
Throws:
java.lang.ArrayIndexOutOfBoundsException - when index is out of range (index < 0 || index >= getCount())

removeAll

void removeAll()
Removes any calculations in this axis.


getCount

int getCount()
Gets the number of calculations in this axis.

Returns:
the number of calculations

getCalculationElement

CalculationElement getCalculationElement(int index)
Returns the calculation element at the specified position.

Parameters:
index - the index of the calculation element to return (0 based)
Returns:
the calculation element at the specified index
Throws:
java.lang.ArrayIndexOutOfBoundsException - if index is out of range (index < 0 || index >= getCount())

findCalculations

CalculationElement[] findCalculations(ReportExpression expr)
Looks for any calculation elements for a given expression.

Parameters:
expr - The expression to look for. When this block calculation has been obtained from either Table.getHBlockCalculation(TableCell) or Table.getVBlockCalculation(TableCell), it is safe to pass null.
Returns:
an array of calculation elements where CalculationElement.getExpression().equals(expr)

equals

boolean equals(java.lang.Object o)
Compares the specified Object with this BlockCalculation for equality. Returns true if and only if the specified Object is also a BlockCalculation and has the same CalculationElements, in the same order.

Overrides:
equals in class java.lang.Object
Parameters:
o - the Object to be compared for equality with this BlockCalculation
Returns:
true if the specified Object is equal to this BlockCalculation