jxl.biff.formula
Class VariableArgFunction

java.lang.Object
  |
  +--jxl.biff.formula.ParseItem
        |
        +--jxl.biff.formula.Operator
              |
              +--jxl.biff.formula.VariableArgFunction
All Implemented Interfaces:
ParsedThing

class VariableArgFunction
extends Operator
implements ParsedThing

A built in function in a formula. These functions take a variable number of arguments, such as a range (eg. SUM etc)


Field Summary
private  int arguments
          The number of arguments
private  Function function
          The function
private  boolean readFromSheet
          Flag which indicates whether this was initialized from the client api or from an excel sheet
private  WorkbookSettings settings
          The workbooks settings
 
Fields inherited from class jxl.biff.formula.Operator
operands
 
Fields inherited from class jxl.biff.formula.ParseItem
parent
 
Constructor Summary
VariableArgFunction(Function f, int a, WorkbookSettings ws)
          Constructor used when parsing a function from a string
VariableArgFunction(WorkbookSettings ws)
          Constructor
 
Method Summary
(package private)  byte[] getBytes()
          Gets the token representation of this item in RPN
(package private)  Function getFunction()
          Gets the underlying function
 void getOperands(java.util.Stack s)
          Gets the operands for this operator from the stack
(package private)  int getPrecedence()
          Gets the precedence for this operator.
 void getString(java.lang.StringBuffer buf)
          Gets the string representation of this item
 int read(byte[] data, int pos)
          Reads the ptg data from the array starting at the specified position
 
Methods inherited from class jxl.biff.formula.Operator
add, getOperands
 
Methods inherited from class jxl.biff.formula.ParseItem
setParent
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

function

private Function function
The function

arguments

private int arguments
The number of arguments

readFromSheet

private boolean readFromSheet
Flag which indicates whether this was initialized from the client api or from an excel sheet

settings

private WorkbookSettings settings
The workbooks settings
Constructor Detail

VariableArgFunction

public VariableArgFunction(WorkbookSettings ws)
Constructor

VariableArgFunction

public VariableArgFunction(Function f,
                           int a,
                           WorkbookSettings ws)
Constructor used when parsing a function from a string
Parameters:
f - the function
a - the number of arguments
Method Detail

read

public int read(byte[] data,
                int pos)
         throws FormulaException
Reads the ptg data from the array starting at the specified position
Specified by:
read in interface ParsedThing
Parameters:
data - the RPN array
pos - the current position in the array, excluding the ptg identifier
Returns:
the number of bytes read
Throws:
FormulaException -  

getOperands

public void getOperands(java.util.Stack s)
Gets the operands for this operator from the stack
Overrides:
getOperands in class Operator

getString

public void getString(java.lang.StringBuffer buf)
Description copied from class: ParseItem
Gets the string representation of this item
Overrides:
getString in class ParseItem
Following copied from class: jxl.biff.formula.ParseItem
Parameters:
ws - the workbook settings

getFunction

Function getFunction()
Gets the underlying function

getBytes

byte[] getBytes()
Gets the token representation of this item in RPN
Overrides:
getBytes in class ParseItem
Returns:
the bytes applicable to this formula

getPrecedence

int getPrecedence()
Gets the precedence for this operator. Operator precedents run from 1 to 5, one being the highest, 5 being the lowest
Overrides:
getPrecedence in class Operator
Returns:
the operator precedence