diff options
author | Andrew C. Oliver <acoliver@apache.org> | 2002-04-30 23:22:27 +0000 |
---|---|---|
committer | Andrew C. Oliver <acoliver@apache.org> | 2002-04-30 23:22:27 +0000 |
commit | a4e8ddc09d62e7a101b2ca071150b06f7c21a6fe (patch) | |
tree | 616f32099e7e8c9d0fc044b2c6ebdba40a4a154a /src | |
parent | 6b1772a0a6741c13e540aaa5f5862179e41dd83f (diff) | |
download | poi-a4e8ddc09d62e7a101b2ca071150b06f7c21a6fe.tar.gz poi-a4e8ddc09d62e7a101b2ca071150b06f7c21a6fe.zip |
Avik's patches http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8665
PR:
Obtained from:
Submitted by:
Reviewed by:
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352571 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
21 files changed, 104 insertions, 275 deletions
diff --git a/src/java/org/apache/poi/hssf/dev/FormulaViewer.java b/src/java/org/apache/poi/hssf/dev/FormulaViewer.java index 15f363bd18..e01ede0fa2 100644 --- a/src/java/org/apache/poi/hssf/dev/FormulaViewer.java +++ b/src/java/org/apache/poi/hssf/dev/FormulaViewer.java @@ -82,6 +82,7 @@ import org.apache.poi.hssf.usermodel.*; * FormulaViewer - finds formulas in a BIFF8 file and attempts to read them/display * data from them. Only works if Formulas are enabled in "RecordFactory" * @author andy + * @author Avik */ public class FormulaViewer @@ -132,40 +133,34 @@ public class FormulaViewer public void parseFormulaRecord(FormulaRecord record) { - System.out.println("In ParseFormula Record"); - System.out.println("row = " + record.getRow()); - System.out.println("col = " + record.getColumn()); + System.out.println("=============================="); + System.out.print("row = " + record.getRow()); + System.out.println(", col = " + record.getColumn()); System.out.println("value = " + record.getValue()); - System.out.println("xf = " + record.getXFIndex()); - System.out.println("number of ptgs = " + System.out.print("xf = " + record.getXFIndex()); + System.out.print(", number of ptgs = " + record.getNumberOfExpressionTokens()); - System.out.println("options = " + record.getOptions()); - System.out.println(composeForumla(record)); + System.out.println(", options = " + record.getOptions()); + System.out.println("RPN List = "+formulaString(record)); + System.out.println("Formula text = "+ composeForumla(record)); } - public String composeForumla(FormulaRecord record) - { + private String formulaString(FormulaRecord record) { StringBuffer formula = new StringBuffer("="); int numptgs = record.getNumberOfExpressionTokens(); - List ptgs = record.getParsedExpression(); - - for (int ptgnum = numptgs - 1; ptgnum > (-1); ptgnum--) - { - Ptg ptg = ( Ptg ) ptgs.get(ptgnum); - OperationPtg optg = ( OperationPtg ) ptg; - int numops = optg.getNumberOfOperands(); - Ptg[] ops = new Ptg[ numops ]; - int opoffset = 1; - - for (int opnum = ops.length - 1; opnum > -1; opnum--) - { - ops[ opnum ] = ( Ptg ) ptgs.get(ptgnum - opoffset); - opoffset++; - } - formula.append(optg.toFormulaString(ops)); - ptgnum -= ops.length; - } - return formula.toString(); + List tokens = record.getParsedExpression(); + StringBuffer buf = new StringBuffer(); + for (int i=0;i<numptgs;i++) { + buf.append( ( (Ptg)tokens.get(i)).toFormulaString()); + buf.append(' '); + } + return buf.toString(); + } + + + private String composeForumla(FormulaRecord record) + { + return FormulaParser.toFormulaString(record.getParsedExpression()); } /** diff --git a/src/java/org/apache/poi/hssf/model/Sheet.java b/src/java/org/apache/poi/hssf/model/Sheet.java index 59498b9694..e4c04baea4 100644 --- a/src/java/org/apache/poi/hssf/model/Sheet.java +++ b/src/java/org/apache/poi/hssf/model/Sheet.java @@ -64,7 +64,7 @@ import java.util.Iterator; import org.apache.poi.util.POILogFactory; import org.apache.poi.hssf .record.*; // normally I don't do this, buy we literally mean ALL -import org.apache.poi.hssf.record.formula.FormulaUtil; +import org.apache.poi.hssf.record.formula.FormulaParser; import org.apache.poi.hssf.record.formula.Ptg; import org.apache.poi.util.IntList; import org.apache.poi.util.POILogger; @@ -706,7 +706,9 @@ public class Sheet rec.setOptions(( short ) 2); rec.setValue(0); rec.setXFIndex(( short ) 0x0f); - Ptg[] ptg = FormulaUtil.parseFormula(formula); + FormulaParser fp = new FormulaParser(formula); + fp.parse(); + Ptg[] ptg = fp.getRPNPtg(); int size = 0; for (int k = 0; k < ptg.length; k++) diff --git a/src/java/org/apache/poi/hssf/record/formula/AddPtg.java b/src/java/org/apache/poi/hssf/record/formula/AddPtg.java index 9e44e726b2..f25f2b0751 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AddPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AddPtg.java @@ -78,7 +78,7 @@ public class AddPtg /** Creates new AddPtg */ - public AddPtg() + protected AddPtg() { } @@ -88,10 +88,7 @@ public class AddPtg // doesn't need anything } - protected AddPtg(String formula, int offset) { - - } - + public void writeBytes(byte [] array, int offset) { array[ offset + 0 ] = sid; @@ -111,32 +108,19 @@ public class AddPtg { return 2; } - + + /** Implementation of method from Ptg */ public String toFormulaString() { return "+"; } - public String toFormulaString(Ptg [] operands) - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(operands[ 0 ].toFormulaString()); - buffer.append("+"); - buffer.append(operands[ 1 ].toFormulaString()); - return buffer.toString(); - } - - public int getStringLength() { - return 1; - } - - + /** implementation of method from OperationsPtg*/ public String toFormulaString(String[] operands) { StringBuffer buffer = new StringBuffer(); buffer.append(operands[ 0 ]); - buffer.append("+"); + buffer.append(toFormulaString()); buffer.append(operands[ 1 ]); return buffer.toString(); } diff --git a/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java b/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java index 05e721d97b..40aadc5245 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AreaPtg.java @@ -85,13 +85,8 @@ public class AreaPtg private BitField column = new BitField(0x3FFF); - /** Creates new AreaPtg */ - - public AreaPtg() - { - } - - public AreaPtg(String arearef) { + + protected AreaPtg(String arearef) { int[] xyxy = ReferenceUtil.getXYXYFromAreaRef(arearef); setFirstRow((short)xyxy[0]); setFirstColumn((short)xyxy[1]); diff --git a/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java b/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java index 1bd1b68c29..27fd4a0bda 100644 --- a/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/AttrPtg.java @@ -87,12 +87,9 @@ public class AttrPtg private BitField baxcel = new BitField(0x20); private BitField space = new BitField(0x40); - /** Creates new AttrPtg */ - - public AttrPtg() - { + public AttrPtg() { } - + public AttrPtg(byte [] data, int offset) { offset++; // adjust past id @@ -199,11 +196,6 @@ public class AttrPtg return "SUM()"; } - public String toFormulaString(Ptg [] operands) - { - return "SUM(" + operands[ 0 ].toFormulaString() + ")"; - } - public int getNumberOfOperands() { return 1; @@ -218,8 +210,6 @@ public class AttrPtg return "SUM(" + operands[ 0 ] + ")"; } - public int getPrecedence() { - return 1; - } + } diff --git a/src/java/org/apache/poi/hssf/record/formula/ConcatPtg.java b/src/java/org/apache/poi/hssf/record/formula/ConcatPtg.java index 52ebce2f46..5cdf7fd27a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ConcatPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ConcatPtg.java @@ -75,19 +75,13 @@ public class ConcatPtg private final static String CONCAT = "&"; - /** Creates new ConcatPtg */ - - public ConcatPtg() - { - } - public ConcatPtg(byte [] data, int offset) { // doesn't need anything } - protected ConcatPtg(String formula, int offset) { + protected ConcatPtg() { } @@ -116,21 +110,7 @@ public class ConcatPtg return CONCAT; } - public String toFormulaString(Ptg [] operands) - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(operands[ 0 ].toFormulaString()); - buffer.append(CONCAT); - buffer.append(operands[ 1 ].toFormulaString()); - return buffer.toString(); - } - - public int getStringLength() { - return 1; - } - - + public String toFormulaString(String[] operands) { StringBuffer buffer = new StringBuffer(); diff --git a/src/java/org/apache/poi/hssf/record/formula/DividePtg.java b/src/java/org/apache/poi/hssf/record/formula/DividePtg.java index d910092c66..06efe05343 100644 --- a/src/java/org/apache/poi/hssf/record/formula/DividePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/DividePtg.java @@ -75,7 +75,7 @@ public class DividePtg /** Creates new AddPtg */ - public DividePtg() + protected DividePtg() { } @@ -110,25 +110,11 @@ public class DividePtg return "/"; } - public String toFormulaString(Ptg [] operands) - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(operands[ 0 ].toFormulaString()); - buffer.append("/"); - buffer.append(operands[ 1 ].toFormulaString()); - return buffer.toString(); - } - - public int getStringLength() { - return 1; - } - - public String toFormulaString(String[] operands) { + public String toFormulaString(String[] operands) { StringBuffer buffer = new StringBuffer(); buffer.append(operands[ 0 ]); - buffer.append("/"); + buffer.append(toFormulaString()); buffer.append(operands[ 1 ]); return buffer.toString(); } diff --git a/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java b/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java index 19320f7aea..6ec0916c34 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ExpPtg.java @@ -73,7 +73,7 @@ public class ExpPtg /** Creates new ExpPtg */ - public ExpPtg() + protected ExpPtg() { } diff --git a/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java b/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java index 90f19e2bc8..d18a64d49f 100644 --- a/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/record/formula/FormulaParser.java @@ -310,8 +310,6 @@ public class FormulaParser { if (IsDigit(Look)) number = number +"."+ GetNum(); //this also takes care of someone entering "1234." tokens.add(new NumberPtg(number)); } else { - //IntPtg p = new IntPtg(GetNum()); // removing since a ptg should be able to create itself from parser results. - //p.setValue(Short.parseShort(GetNum())); tokens.add(new IntPtg(number)); //TODO:what if the number is too big to be a short? ..add factory to return Int or Number! } } @@ -450,7 +448,6 @@ end; /** Static method to convert an array of Ptgs in RPN order * to a human readable string format in infix mode - * TODO - extra brackets might appear, but string will be semantically correct. */ public static String toFormulaString(Ptg[] ptgs) { java.util.Stack stack = new java.util.Stack(); @@ -468,7 +465,6 @@ end; } String result = o.toFormulaString(operands); - //if (! (o instanceof DummyFunctionPtg) ) result = "("+result+")" ; stack.push(result); } else { stack.push(ptgs[i].toFormulaString()); @@ -477,6 +473,9 @@ end; return (String) stack.pop(); //TODO: catch stack underflow and throw parse exception. } + /** toString on the parser instance returns the RPN ordered list of tokens + * Useful for testing + */ public String toString() { StringBuffer buf = new StringBuffer(); for (int i=0;i<tokens.size();i++) { diff --git a/src/java/org/apache/poi/hssf/record/formula/FunctionPtg.java b/src/java/org/apache/poi/hssf/record/formula/FunctionPtg.java index 6157e495e6..3b557f0dfa 100644 --- a/src/java/org/apache/poi/hssf/record/formula/FunctionPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/FunctionPtg.java @@ -16,12 +16,10 @@ public class FunctionPtg extends OperationPtg { private byte field_1_num_args; private short field_2_fnc_index; - //private String name; - //private int numOperands; - /** Creates new DummyFunctionPtg */ - public FunctionPtg() { - } - + + /**Creates new function pointer from a byte array + * usually called while reading an excel file. + */ public FunctionPtg(byte[] data, int offset) { offset++; field_1_num_args = data[ offset + 0 ]; @@ -29,8 +27,10 @@ public class FunctionPtg extends OperationPtg { } - - public FunctionPtg(String pName, byte pNumOperands) { + /** + * Create a function ptg from a string tokenised by the parser + */ + protected FunctionPtg(String pName, byte pNumOperands) { field_1_num_args = pNumOperands; field_2_fnc_index = lookupIndex(pName); @@ -64,20 +64,10 @@ public class FunctionPtg extends OperationPtg { } public String toFormulaString() { - return getName()+getNumberOfOperands(); - } - - public String toFormulaString(Ptg[] operands) { - StringBuffer buf = new StringBuffer(); - buf.append(getName()+"("); - for (int i=0;i<operands.length;i++) { - buf.append(operands[i].toFormulaString()).append(','); - } - buf.append(")"); - return buf.toString(); + return getName(); } - public String toFormulaString(String[] operands) { + public String toFormulaString(String[] operands) { StringBuffer buf = new StringBuffer(); buf.append(getName()+"("); if (operands.length >0) { diff --git a/src/java/org/apache/poi/hssf/record/formula/IntPtg.java b/src/java/org/apache/poi/hssf/record/formula/IntPtg.java index f673ec2935..e23ef4f7e4 100644 --- a/src/java/org/apache/poi/hssf/record/formula/IntPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/IntPtg.java @@ -77,23 +77,12 @@ public class IntPtg private String val; private int strlen = 0; - /** Creates new IntPtg */ - - public IntPtg() - { - } - + public IntPtg(byte [] data, int offset) { setValue(LittleEndian.getShort(data, offset + 1)); } - protected IntPtg(String formula, int offset) { - val = parseString(formula, offset); - if (val == null) throw new RuntimeException("WHOOAA there...thats got no int!"); - strlen=val.length(); - field_1_value = Short.parseShort(val); - } // IntPtg should be able to create itself, shouldnt have to call setValue protected IntPtg(String formulaToken) { @@ -126,37 +115,4 @@ public class IntPtg return "" + getValue(); } - private static String parseString(String formula, int pos) { - String retval = null; - while (pos < formula.length() && Character.isWhitespace(formula.charAt(pos))) { - pos++; - } - - if (pos < formula.length()) { - if (Character.isDigit(formula.charAt(pos)) ) { - int numpos = pos; - - while (numpos < formula.length() && Character.isDigit(formula.charAt(numpos))){ - numpos++; - } - - if (numpos == formula.length() || formula.charAt(numpos) != '.') { - String numberstr = formula.substring(pos,numpos); - try { - int number = Short.parseShort(numberstr); - retval = numberstr; - } catch (NumberFormatException e) { - retval = null; - } - } - } - } - return retval; - - } - - - public int getStringLength() { - return strlen; - } } diff --git a/src/java/org/apache/poi/hssf/record/formula/MultiplyPtg.java b/src/java/org/apache/poi/hssf/record/formula/MultiplyPtg.java index 32be31d7f2..9120b1244a 100644 --- a/src/java/org/apache/poi/hssf/record/formula/MultiplyPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/MultiplyPtg.java @@ -77,7 +77,7 @@ public class MultiplyPtg /** Creates new AddPtg */ - public MultiplyPtg() + protected MultiplyPtg() { } @@ -87,11 +87,6 @@ public class MultiplyPtg // doesn't need anything } - protected MultiplyPtg(String formula, int offset) { - - } - - public void writeBytes(byte [] array, int offset) { array[ offset + 0 ] = sid; @@ -136,7 +131,7 @@ public class MultiplyPtg StringBuffer buffer = new StringBuffer(); buffer.append(operands[ 0 ]); - buffer.append("*"); + buffer.append(toFormulaString()); buffer.append(operands[ 1 ]); return buffer.toString(); } diff --git a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java index fd6a1c9228..727c9cc277 100644 --- a/src/java/org/apache/poi/hssf/record/formula/NamePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/NamePtg.java @@ -78,8 +78,9 @@ public class NamePtg /** Creates new NamePtg */ - public NamePtg() + protected NamePtg(String name) { + //TODO } /** Creates new NamePtg */ diff --git a/src/java/org/apache/poi/hssf/record/formula/NumberPtg.java b/src/java/org/apache/poi/hssf/record/formula/NumberPtg.java index 6d20d90d47..d790f22d3e 100644 --- a/src/java/org/apache/poi/hssf/record/formula/NumberPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/NumberPtg.java @@ -57,8 +57,9 @@ package org.apache.poi.hssf.record.formula; import org.apache.poi.util.LittleEndian; /** - * Integer (short intger) - * Stores a (java) short value in a formula + * Number + * Stores a floating point value in a formula + * value stored in a 8 byte field using IEEE notation * @author Avik Sengupta */ @@ -69,25 +70,29 @@ public class NumberPtg public final static byte sid = 0x1f; private double field_1_value; - /** Creates new NumberPtg */ - - public NumberPtg() - { - } - + + /** Create a NumberPtg from a byte array read from disk */ public NumberPtg(byte [] data, int offset) { setValue(LittleEndian.getDouble(data, offset + 1)); } + /** Create a NumberPtg from a string representation of the number + * Number format is not checked, it is expected to be validated in the parser + * that calls this method. + * @param value : String representation of a floating point number + */ protected NumberPtg(String value) { setValue(Double.parseDouble(value)); } + + public void setValue(double value) { field_1_value = value; } - + + public double getValue() { return field_1_value; @@ -108,11 +113,6 @@ public class NumberPtg { return "" + getValue(); } - - - //TODO: do we really need this method?? - public int getStringLength() { - return 1; - } + } diff --git a/src/java/org/apache/poi/hssf/record/formula/OperationPtg.java b/src/java/org/apache/poi/hssf/record/formula/OperationPtg.java index 294d5d10f1..ac9a615563 100644 --- a/src/java/org/apache/poi/hssf/record/formula/OperationPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/OperationPtg.java @@ -75,11 +75,17 @@ public abstract class OperationPtg extends Ptg public abstract int getType(); + /** + * returns a string representation of the operations + * the length of the input array should equal the number returned by + * @see getNumberOfOperands + * + */ public abstract String toFormulaString(String[] operands); + /** + * The number of operands expected by the operations + */ public abstract int getNumberOfOperands(); - - public abstract String toFormulaString(Ptg [] operands); - } diff --git a/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java b/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java index cc32670b8f..0e9f901f46 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ParenthesisPtg.java @@ -72,7 +72,7 @@ public class ParenthesisPtg private final static int SIZE = 1; public final static byte sid = 0x15; - public ParenthesisPtg() + protected ParenthesisPtg() { } @@ -82,10 +82,7 @@ public class ParenthesisPtg // doesn't need anything } - protected ParenthesisPtg(String formula, int offset) { - - } - + public void writeBytes(byte [] array, int offset) { @@ -112,11 +109,7 @@ public class ParenthesisPtg return "()"; } - public String toFormulaString(Ptg [] operands) - { - return ""; - } - + public String toFormulaString(String[] operands) { return "("+operands[0]+")"; } diff --git a/src/java/org/apache/poi/hssf/record/formula/PowerPtg.java b/src/java/org/apache/poi/hssf/record/formula/PowerPtg.java index 99660175fd..e853b1c49d 100644 --- a/src/java/org/apache/poi/hssf/record/formula/PowerPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/PowerPtg.java @@ -75,7 +75,7 @@ public class PowerPtg /** Creates new AddPtg */ - public PowerPtg() + protected PowerPtg() { } @@ -110,24 +110,14 @@ public class PowerPtg return "^"; } - public String toFormulaString(Ptg [] operands) - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(operands[ 0 ].toFormulaString()); - buffer.append("^"); - buffer.append(operands[ 1 ].toFormulaString()); - - return buffer.toString(); - } - + public String toFormulaString(String[] operands) { StringBuffer buffer = new StringBuffer(); buffer.append(operands[ 0 ]); - buffer.append("^"); + buffer.append(toFormulaString()); buffer.append(operands[ 1 ]); return buffer.toString(); } diff --git a/src/java/org/apache/poi/hssf/record/formula/Ptg.java b/src/java/org/apache/poi/hssf/record/formula/Ptg.java index 330b228a22..66a58e1fbf 100644 --- a/src/java/org/apache/poi/hssf/record/formula/Ptg.java +++ b/src/java/org/apache/poi/hssf/record/formula/Ptg.java @@ -77,7 +77,7 @@ public abstract class Ptg * @param infixPtgs List of ptgs in infix order */ - /* DO NOI REMOVE + /* DO NOT REMOVE *we keep this method in case we wish to change the way we parse *It needs a getPrecedence in OperationsPtg @@ -287,16 +287,14 @@ public abstract class Ptg writeBytes(bytes, 0); return bytes; } - + /** write this Ptg to a byte array*/ public abstract void writeBytes(byte [] array, int offset); - - public abstract String toFormulaString(); - - public int getStringLength() { - return 0; - } /** + * return a string representation of this token alone + */ + public abstract String toFormulaString(); + /** * dump a debug representation (hexdump) to a strnig */ public String toDebugString() { diff --git a/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java b/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java index 47c353c735..4a154bae72 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ReferencePtg.java @@ -82,17 +82,13 @@ public class ReferencePtg extends Ptg private BitField rowRelative = new BitField(0x8000); private BitField colRelative = new BitField(0x4000); - /** Creates new ValueReferencePtg */ - - public ReferencePtg() - { - } + /** * Takes in a String represnetation of a cell reference and fills out the * numeric fields. */ - public ReferencePtg(String cellref) { + protected ReferencePtg(String cellref) { int[] xy = ReferenceUtil.getXYFromReference(cellref); setRow((short)xy[0]); setColumn((short)xy[1]); diff --git a/src/java/org/apache/poi/hssf/record/formula/SubtractPtg.java b/src/java/org/apache/poi/hssf/record/formula/SubtractPtg.java index 0053da25e8..0d1f819218 100644 --- a/src/java/org/apache/poi/hssf/record/formula/SubtractPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/SubtractPtg.java @@ -73,9 +73,7 @@ public class SubtractPtg public final static int SIZE = 1; public final static byte sid = 0x04; - /** Creates new AddPtg */ - - public SubtractPtg() + protected SubtractPtg() { } @@ -110,21 +108,7 @@ public class SubtractPtg return "-"; } - public String toFormulaString(Ptg [] operands) - { - StringBuffer buffer = new StringBuffer(); - - buffer.append(operands[ 0 ].toFormulaString()); - buffer.append("-"); - buffer.append(operands[ 1 ].toFormulaString()); - return buffer.toString(); - } - - - public int getStringLength() { - return 1; - } - + public String toFormulaString(String[] operands) { StringBuffer buffer = new StringBuffer(); diff --git a/src/java/org/apache/poi/hssf/record/formula/ValueVariableFunctionPtg.java b/src/java/org/apache/poi/hssf/record/formula/ValueVariableFunctionPtg.java index fae7990d17..f652485ef8 100644 --- a/src/java/org/apache/poi/hssf/record/formula/ValueVariableFunctionPtg.java +++ b/src/java/org/apache/poi/hssf/record/formula/ValueVariableFunctionPtg.java @@ -124,24 +124,13 @@ public class ValueVariableFunctionPtg return "NO IDEA YET VALUE VARIABLE"; } - public String toFormulaString(Ptg [] operands) - { - return toFormulaString(); - } - - + public String toFormulaString(String[] operands) { return toFormulaString(); } - public void manipulate(List source, List results, int pos) { - } - - public int getPrecedence() { - return 1; - } - + } |