removes parts of my former stuff in favor of aviks and adds concat operator
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352527 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf24bbd7c6
commit
7aa28a6d00
@ -115,22 +115,7 @@ public class AddPtg
|
|||||||
{
|
{
|
||||||
return "+";
|
return "+";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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) == ADD.toCharArray()[0]) {
|
|
||||||
retval = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toFormulaString(Ptg [] operands)
|
public String toFormulaString(Ptg [] operands)
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
@ -310,11 +310,12 @@ public class FormulaParser {
|
|||||||
/** Parse and Translate a Math Term */
|
/** Parse and Translate a Math Term */
|
||||||
private void Term(){
|
private void Term(){
|
||||||
Factor();
|
Factor();
|
||||||
while (Look == '*' || Look == '/' || Look == '^') {
|
while (Look == '*' || Look == '/' || Look == '^' || Look == '&') {
|
||||||
///TODO do we need to do anything here??
|
///TODO do we need to do anything here??
|
||||||
if (Look == '*') Multiply();
|
if (Look == '*') Multiply();
|
||||||
if (Look == '/') Divide();
|
if (Look == '/') Divide();
|
||||||
if (Look == '^') Power();
|
if (Look == '^') Power();
|
||||||
|
if (Look == '&') Concat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +326,14 @@ public class FormulaParser {
|
|||||||
tokens.add(new AddPtg());
|
tokens.add(new AddPtg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Recognize and Translate an Add */
|
||||||
|
private void Concat() {
|
||||||
|
Match('&');
|
||||||
|
Term();
|
||||||
|
tokens.add(new ConcatPtg());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** Recognize and Translate a Subtract */
|
/** Recognize and Translate a Subtract */
|
||||||
private void Subtract() {
|
private void Subtract() {
|
||||||
|
@ -151,9 +151,6 @@ public class IntPtg
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNextStringToken(String formula, int pos) {
|
|
||||||
return (parseString(formula,pos) != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getStringLength() {
|
public int getStringLength() {
|
||||||
return strlen;
|
return strlen;
|
||||||
|
@ -139,23 +139,5 @@ public class MultiplyPtg
|
|||||||
buffer.append("*");
|
buffer.append("*");
|
||||||
buffer.append(operands[ 1 ]);
|
buffer.append(operands[ 1 ]);
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -188,6 +188,11 @@ public abstract class Ptg
|
|||||||
case PowerPtg.sid :
|
case PowerPtg.sid :
|
||||||
retval = new PowerPtg(data, offset);
|
retval = new PowerPtg(data, offset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ConcatPtg.sid :
|
||||||
|
retval = new ConcatPtg(data, offset);
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
case AreaPtg.sid :
|
case AreaPtg.sid :
|
||||||
retval = new AreaPtg(data, offset);
|
retval = new AreaPtg(data, offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user