A built in function in a formula
| Method from jxl.biff.formula.BuiltInFunction Detail: |
public void adjustRelativeCellReferences(int colAdjust,
int rowAdjust) {
ParseItem[] operands = getOperands();
for (int i = 0; i < operands.length; i++)
{
operands[i].adjustRelativeCellReferences(colAdjust, rowAdjust);
}
}
Adjusts all the relative cell references in this formula by the
amount specified. Used when copying formulas |
void columnInserted(int sheetIndex,
int col,
boolean currentSheet) {
ParseItem[] operands = getOperands();
for (int i = 0; i < operands.length; i++)
{
operands[i].columnInserted(sheetIndex, col, currentSheet);
}
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
void columnRemoved(int sheetIndex,
int col,
boolean currentSheet) {
ParseItem[] operands = getOperands();
for (int i = 0; i < operands.length; i++)
{
operands[i].columnRemoved(sheetIndex, col, currentSheet);
}
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
byte[] getBytes() {
// Get the data for the operands
ParseItem[] operands = getOperands();
byte[] data = new byte[0];
for (int i = 0; i < operands.length; i++)
{
byte[] opdata = operands[i].getBytes();
// Grow the array
byte[] newdata = new byte[data.length + opdata.length];
System.arraycopy(data, 0, newdata, 0, data.length);
System.arraycopy(opdata, 0, newdata, data.length, opdata.length);
data = newdata;
}
// Add on the operator byte
byte[] newdata = new byte[data.length + 3];
System.arraycopy(data, 0, newdata, 0, data.length);
newdata[data.length] = !useAlternateCode() ? Token.FUNCTION.getCode() :
Token.FUNCTION.getCode2();
IntegerHelper.getTwoBytes(function.getCode(), newdata, data.length + 1);
return newdata;
}
Gets the token representation of this item in RPN |
public void getOperands(Stack s) {
// parameters are in the correct order, god damn them
ParseItem[] items = new ParseItem[function.getNumArgs()];
// modified in 2.4.3
for (int i = function.getNumArgs() - 1; i >= 0; i--)
{
ParseItem pi = (ParseItem) s.pop();
items[i] = pi;
}
for (int i = 0; i < function.getNumArgs(); i++)
{
add(items[i]);
}
}
Gets the operands for this operator from the stack |
int getPrecedence() {
return 3;
}
Gets the precedence for this operator. Operator precedents run from
1 to 5, one being the highest, 5 being the lowest |
public void getString(StringBuffer buf) {
buf.append(function.getName(settings));
buf.append('(");
int numArgs = function.getNumArgs();
if (numArgs > 0)
{
ParseItem[] operands = getOperands();
// arguments are in the same order they were specified
operands[0].getString(buf);
for (int i = 1; i < numArgs; i++)
{
buf.append(',");
operands[i].getString(buf);
}
}
buf.append(')");
}
Gets the string for this functions |
void handleImportedCellReferences() {
ParseItem[] operands = getOperands();
for (int i = 0 ; i < operands.length ; i++)
{
operands[i].handleImportedCellReferences();
}
}
If this formula was on an imported sheet, check that
cell references to another sheet are warned appropriately
Does nothing, as operators don't have cell references |
public int read(byte[] data,
int pos) {
int index = IntegerHelper.getInt(data[pos], data[pos + 1]);
function = Function.getFunction(index);
Assert.verify(function != Function.UNKNOWN, "function code " + index);
return 2;
}
Reads the ptg data from the array starting at the specified position |
void rowInserted(int sheetIndex,
int row,
boolean currentSheet) {
ParseItem[] operands = getOperands();
for (int i = 0; i < operands.length; i++)
{
operands[i].rowInserted(sheetIndex, row, currentSheet);
}
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |
void rowRemoved(int sheetIndex,
int row,
boolean currentSheet) {
ParseItem[] operands = getOperands();
for (int i = 0; i < operands.length; i++)
{
operands[i].rowRemoved(sheetIndex, row, currentSheet);
}
}
Called when a column is inserted on the specified sheet. Tells
the formula parser to update all of its cell references beyond this
column |