Synch up.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352474 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
532added9f
commit
756c1f0a55
@ -60,14 +60,15 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class AddPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static int SIZE = 1;
|
||||
public final static byte sid = 0x03;
|
||||
@ -147,4 +148,10 @@ public class AddPtg
|
||||
public int getStringLength() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
standardBinaryManipulation(source,results,pos);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ package org.apache.poi.hssf.record.formula;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
import org.apache.poi.util.BitField;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* "Special Attributes"
|
||||
* This seems to be a Misc Stuff and Junk record. One function it serves is
|
||||
@ -71,8 +73,7 @@ import org.apache.poi.util.BitField;
|
||||
*/
|
||||
|
||||
public class AttrPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static short sid = 0x19;
|
||||
private final static int SIZE = 4;
|
||||
@ -205,4 +206,9 @@ public class AttrPtg
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,14 +60,15 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class DividePtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static int SIZE = 1;
|
||||
public final static byte sid = 0x06;
|
||||
@ -118,4 +119,8 @@ public class DividePtg
|
||||
buffer.append(operands[ 1 ].toFormulaString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,18 +60,21 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class MultiplyPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static int SIZE = 1;
|
||||
public final static byte sid = 0x05;
|
||||
|
||||
private final static String MULTIPLY="*";
|
||||
|
||||
/** Creates new AddPtg */
|
||||
|
||||
public MultiplyPtg()
|
||||
@ -84,6 +87,11 @@ public class MultiplyPtg
|
||||
// doesn't need anything
|
||||
}
|
||||
|
||||
protected MultiplyPtg(String formula, int offset) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void writeBytes(byte [] array, int offset)
|
||||
{
|
||||
array[ offset + 0 ] = sid;
|
||||
@ -104,6 +112,11 @@ public class MultiplyPtg
|
||||
return 2;
|
||||
}
|
||||
|
||||
public int getStringLength() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
public String toFormulaString()
|
||||
{
|
||||
return "*";
|
||||
@ -118,4 +131,28 @@ public class MultiplyPtg
|
||||
buffer.append(operands[ 1 ].toFormulaString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
standardBinaryManipulation(source, results, pos);
|
||||
}
|
||||
|
||||
public int getPrecedence() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static boolean isNextStringToken(String formula, int pos) {
|
||||
boolean retval = false;
|
||||
while (pos < formula.length() && Character.isWhitespace(formula.charAt(pos))) {
|
||||
pos++;
|
||||
}
|
||||
|
||||
if (pos < formula.length()) {
|
||||
if (formula.charAt(pos) == MULTIPLY.toCharArray()[0]) {
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -60,20 +60,31 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* defines a Ptg that is an operation instead of an operand
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public interface OperationPtg
|
||||
public abstract class OperationPtg extends Ptg
|
||||
{
|
||||
public final static int TYPE_UNARY = 0;
|
||||
public final static int TYPE_BINARY = 1;
|
||||
public final static int TYPE_FUNCTION = 2;
|
||||
|
||||
public int getType();
|
||||
public abstract int getType();
|
||||
|
||||
public int getNumberOfOperands();
|
||||
public abstract int getNumberOfOperands();
|
||||
|
||||
public String toFormulaString(Ptg [] operands);
|
||||
/**
|
||||
* manipulate the list, moving the arguments for this function to the source list
|
||||
* followed by the operator.
|
||||
*/
|
||||
public abstract void manipulate(List source, List results, int pos);
|
||||
|
||||
public abstract String toFormulaString(Ptg [] operands);
|
||||
|
||||
protected void standardBinaryManipulation(List source,List results, int pos) {
|
||||
}
|
||||
}
|
||||
|
@ -55,16 +55,18 @@
|
||||
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Dummy class, we want it only for for the parsing process
|
||||
* does not actually get into the file -- note by andy...there is a parenthesis PTG
|
||||
* that can be written and is sometimes!
|
||||
*
|
||||
* Avik Sengupta <lists@aviksengupta.com>
|
||||
* Andrew C. Oliver (acoliver at apache dot org)
|
||||
*/
|
||||
public class ParenthesisPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
|
||||
|
||||
@ -99,5 +101,9 @@ public class ParenthesisPtg
|
||||
{
|
||||
return "(";
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -60,14 +60,15 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class PowerPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static int SIZE = 1;
|
||||
public final static byte sid = 0x07;
|
||||
@ -118,4 +119,8 @@ public class PowerPtg
|
||||
buffer.append(operands[ 0 ].toFormulaString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -60,14 +60,15 @@
|
||||
*/
|
||||
package org.apache.poi.hssf.record.formula;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class SubtractPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static int SIZE = 1;
|
||||
public final static byte sid = 0x04;
|
||||
@ -118,4 +119,9 @@ public class SubtractPtg
|
||||
buffer.append(operands[ 1 ].toFormulaString());
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -63,14 +63,15 @@ package org.apache.poi.hssf.record.formula;
|
||||
import org.apache.poi.util.BitField;
|
||||
import org.apache.poi.util.LittleEndian;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* An excel function with variable number of value arguments.
|
||||
* @author andy
|
||||
*/
|
||||
|
||||
public class ValueVariableFunctionPtg
|
||||
extends Ptg
|
||||
implements OperationPtg
|
||||
extends OperationPtg
|
||||
{
|
||||
public final static short sid = 0x42;
|
||||
private final static short SIZE = 4;
|
||||
@ -127,4 +128,8 @@ public class ValueVariableFunctionPtg
|
||||
{
|
||||
return toFormulaString();
|
||||
}
|
||||
|
||||
public void manipulate(List source, List results, int pos) {
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user