jxl.biff.formula
Class Attribute

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

class Attribute
extends Operator
implements ParsedThing

A special attribute control token - typically either a SUM function or an IF function


Field Summary
private static int gotoMask
           
private  VariableArgFunction ifConditions
          If this attribute is an IF functions, sets the associated if conditions
private static int ifMask
           
private  int options
          The options used by the attribute
private  WorkbookSettings settings
          The workbook settings
private static int sumMask
           
private  int word
          The word contained in this attribute
 
Fields inherited from class jxl.biff.formula.Operator
operands
 
Fields inherited from class jxl.biff.formula.ParseItem
parent
 
Constructor Summary
Attribute(StringFunction sf, WorkbookSettings ws)
          Constructor for use when this is called when parsing a string
Attribute(WorkbookSettings ws)
          Constructor
 
Method Summary
(package private)  byte[] getBytes()
          Gets the token representation of this item in RPN.
private  byte[] getIf()
          Gets the associated if conditions with this attribute
 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
 boolean isFunction()
          Queries whether this attribute is a function
 boolean isGoto()
          Queries whether this attribute is a goto
 boolean isIf()
          Queries whether this attribute is an IF
 boolean isSum()
          Queries whether this attribute is a sum
 int read(byte[] data, int pos)
          Reads the ptg data from the array starting at the specified position
(package private)  void setIfConditions(VariableArgFunction vaf)
          Sets the if conditions for this attribute, if it represents an IF function
 
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

options

private int options
The options used by the attribute

word

private int word
The word contained in this attribute

settings

private WorkbookSettings settings
The workbook settings

sumMask

private static final int sumMask

ifMask

private static final int ifMask

gotoMask

private static final int gotoMask

ifConditions

private VariableArgFunction ifConditions
If this attribute is an IF functions, sets the associated if conditions
Constructor Detail

Attribute

public Attribute(WorkbookSettings ws)
Constructor

Attribute

public Attribute(StringFunction sf,
                 WorkbookSettings ws)
Constructor for use when this is called when parsing a string
Parameters:
sf - the built in function
ws - the workbook settings
Method Detail

setIfConditions

void setIfConditions(VariableArgFunction vaf)
Sets the if conditions for this attribute, if it represents an IF function
Parameters:
vaf - a VariableArgFunction value

read

public int read(byte[] data,
                int pos)
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

isFunction

public boolean isFunction()
Queries whether this attribute is a function
Returns:
TRUE if this is a function, FALSE otherwise

isSum

public boolean isSum()
Queries whether this attribute is a sum
Returns:
TRUE if this is SUM, FALSE otherwise

isIf

public boolean isIf()
Queries whether this attribute is an IF
Returns:
TRUE if this is an IF, FALSE otherwise

isGoto

public boolean isGoto()
Queries whether this attribute is a goto
Returns:
TRUE if this is a goto, FALSE otherwise

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

getBytes

byte[] getBytes()
Gets the token representation of this item in RPN. The Attribute token is a special case, which overrides anything useful we could do in the base class
Overrides:
getBytes in class ParseItem
Returns:
the bytes applicable to this formula

getIf

private byte[] getIf()
Gets the associated if conditions with this attribute
Returns:
the associated if conditions

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