GridAbstractCalculationEngine

Inheritance: java.lang.Object

public abstract class GridAbstractCalculationEngine

Represents user’s custom calculation engine to extend the default calculation engine of Aspose.Cells.

Remarks

User should not modify any part of the Workbook directly in this implementation(except the calculated result of the custom function, which can be set by GridCalculationData.CalculatedValue property). Otherwise unexpected result or Exception may be caused. If user needs to change other data than calculated result in the implementation for some custom functions, For example, change cell’s formula, style, …etc., user should gather those data in this implementation and change them out of the scope of formula calculation.

Example

          class MyEngine extends GridAbstractCalculationEngine
         {
             public /*override*/ void calculate(GridCalculationData data)
             {
                 String funcName = data.getFunctionName().toUpperCase();
                 if ("MYFUNC".equals(funcName))
                 {   
                     //do calculation for MYFUNC here
                     int count = data.getParamCount();
                     Object res = null;
                     for (int i = 0; i <count; i++)
                     {
                         Object pv = data.getParamValue(i);
                         if (pv instanceof GridReferredArea)
                         {
                             GridReferredArea ra = (GridReferredArea)pv;
                             pv = ra.getValue(0, 0);
                         }
                         //process the parameter here
                         //res = ...;
                     }
                     data.setCalculatedValue(res);
                 }
             }
         }

Constructors

ConstructorDescription
GridAbstractCalculationEngine()

Methods

MethodDescription
calculate(GridCalculationData data)Calculates one function with given data.
equals(Object arg0)
getClass()
hashCode()
notify()
notifyAll()
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

GridAbstractCalculationEngine()

public GridAbstractCalculationEngine()

calculate(GridCalculationData data)

public abstract void calculate(GridCalculationData data)

Calculates one function with given data.

Remarks

User should set the calculated value for given data for all functions(including excel native functions) that he wants to calculate by himself in this implementation.

Parameters:

ParameterTypeDescription
dataGridCalculationDataThe required data to calculate function such as function name, parameters, …etc.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

hashCode()

public native int hashCode()

Returns: int

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int