prematurely checking in to avoid compilation errors for others
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f3a963cdfd
commit
bca318f1fc
@ -244,7 +244,7 @@ public class FormulaParser {
|
|||||||
int numArgs = Arguments();
|
int numArgs = Arguments();
|
||||||
Match(')');
|
Match(')');
|
||||||
//this is the end of the function
|
//this is the end of the function
|
||||||
tokens.add(new DummyFunctionPtg(name,numArgs));
|
tokens.add(new FunctionPtg(name,(byte)numArgs));
|
||||||
} else if (Look == ':') { // this is a AreaReference
|
} else if (Look == ':') { // this is a AreaReference
|
||||||
String first = name;
|
String first = name;
|
||||||
GetChar();
|
GetChar();
|
||||||
|
@ -9,22 +9,28 @@ package org.apache.poi.hssf.record.formula;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
/**
|
/**
|
||||||
* DUMMY DUMMY DUMMY
|
* This class provides functions with variable arguments.
|
||||||
* This class exists only becoz i dont know how to handle functions in formula's properly
|
|
||||||
* to be used only for testing my parser.
|
|
||||||
* @author aviks
|
* @author aviks
|
||||||
|
* @author Andrew C. Oliver (acoliver at apache dot org)
|
||||||
* @version
|
* @version
|
||||||
*/
|
*/
|
||||||
public class FunctionPtg extends OperationPtg {
|
public class FunctionPtg extends OperationPtg {
|
||||||
private String name;
|
public final static short sid = 0x22;
|
||||||
private int numOperands;
|
private final static int SIZE = 2;
|
||||||
|
|
||||||
|
private byte field_1_num_args;
|
||||||
|
private byte field_2_fnc_index;
|
||||||
|
|
||||||
|
//private String name;
|
||||||
|
//private int numOperands;
|
||||||
/** Creates new DummyFunctionPtg */
|
/** Creates new DummyFunctionPtg */
|
||||||
public FunctionPtg() {
|
public FunctionPtg() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public FunctionPtg(String pName, int pNumOperands) {
|
public FunctionPtg(String pName, byte pNumOperands) {
|
||||||
name=pName;
|
field_1_num_args = pNumOperands;
|
||||||
numOperands = pNumOperands;
|
field_2_fnc_index = lookupIndex(pName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getType() {
|
public int getType() {
|
||||||
@ -32,10 +38,15 @@ public class FunctionPtg extends OperationPtg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int getNumberOfOperands() {
|
public int getNumberOfOperands() {
|
||||||
return numOperands;
|
return field_1_num_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getFunctionIndex() {
|
||||||
|
return field_2_fnc_index;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return lookupName(field_2_fnc_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toFormulaString() {
|
public String toFormulaString() {
|
||||||
@ -46,7 +57,7 @@ public class FunctionPtg extends OperationPtg {
|
|||||||
StringBuffer buf = new StringBuffer();
|
StringBuffer buf = new StringBuffer();
|
||||||
buf.append(getName()+"(");
|
buf.append(getName()+"(");
|
||||||
for (int i=0;i<operands.length;i++) {
|
for (int i=0;i<operands.length;i++) {
|
||||||
buf.append(operands[i].toFormulaString());
|
buf.append(operands[i].toFormulaString()).append(',');
|
||||||
}
|
}
|
||||||
buf.append(")");
|
buf.append(")");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
@ -68,13 +79,21 @@ public class FunctionPtg extends OperationPtg {
|
|||||||
|
|
||||||
|
|
||||||
public void writeBytes(byte[] array, int offset) {
|
public void writeBytes(byte[] array, int offset) {
|
||||||
|
array[offset]=field_1_num_args;
|
||||||
|
array[offset]=field_2_fnc_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return 0;
|
return SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void manipulate(List source, List results, int pos) {
|
private String lookupName(byte index) {
|
||||||
|
return "SUM"; //for now always return "SUM"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private byte lookupIndex(String name) {
|
||||||
|
return 4; //for now just return SUM everytime...
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user