View | Details | Raw Unified | Return to bug 8624
Collapse All | Expand All

(-)src/documentation/xdocs/who.xml (+1 lines)
Lines 50-55 Link Here
50
  </section>
50
  </section>
51
  <section title="Developers">
51
  <section title="Developers">
52
    <ul>
52
    <ul>
53
        <li>Avik Sengupta (avik at aviksengupta dot com)</li>
53
    </ul>
54
    </ul>
54
  </section>
55
  </section>
55
 </section>
56
 </section>
(-)src/java/org/apache/poi/hssf/record/formula/FormulaParser.java (-10 / +17 lines)
Lines 247-262 Link Here
247
            tokens.add(new FunctionPtg(name,(byte)numArgs));
247
            tokens.add(new FunctionPtg(name,(byte)numArgs));
248
        } else if (Look == ':') { // this is a AreaReference
248
        } else if (Look == ':') { // this is a AreaReference
249
            String first = name;
249
            String first = name;
250
            GetChar();
250
            Match(':');
251
            String second = GetName();
251
            String second = GetName();
252
                tokens.add(new AreaPtg(first+":"+second));
252
            tokens.add(new AreaPtg(first+":"+second));
253
            //String second = ;
254
        } else {
253
        } else {
255
            //this can be either a cell ref or a named range !!
254
            //this can be either a cell ref or a named range !!
256
            
257
            boolean cellRef = true ; //we should probably do it with reg exp??
255
            boolean cellRef = true ; //we should probably do it with reg exp??
258
            if (cellRef) {
256
            if (cellRef) {
259
                tokens.add(new ReferencePtg(name)); //TODO we need to pass in Name somewhere??
257
                tokens.add(new ReferencePtg(name)); 
260
            }else {
258
            }else {
261
                //handle after named range is integrated!!
259
                //handle after named range is integrated!!
262
            }
260
            }
Lines 270-276 Link Here
270
            numArgs++; 
268
            numArgs++; 
271
            Expression();
269
            Expression();
272
        }
270
        }
273
        while (Look == ',') {
271
        while (Look == ',') { //TODO handle EmptyArgs
274
            Match(',');
272
            Match(',');
275
            Expression();
273
            Expression();
276
            numArgs++;
274
            numArgs++;
Lines 289-298 Link Here
289
        } else if (IsAlpha(Look)){
287
        } else if (IsAlpha(Look)){
290
            Ident();
288
            Ident();
291
        }else{
289
        }else{
292
290
            String number = GetNum();
293
            IntPtg p = new IntPtg();
291
            if (Look=='.') { 
294
            p.setValue(Short.parseShort(GetNum()));
292
                Match('.');
295
            tokens.add(p);
293
                String decimalPart = null;
294
                if (IsDigit(Look)) number = number +"."+ GetNum(); //this also takes care of someone entering "1234."
295
                tokens.add(new NumberPtg(number));
296
            } else {
297
                //IntPtg p = new IntPtg(GetNum());   // removing since a ptg should be able to create itself from parser results. 
298
                //p.setValue(Short.parseShort(GetNum()));
299
                tokens.add(new IntPtg(number));  //TODO:what if the number is too big to be a short? ..add factory to return Int or Number!
300
            }
296
        }
301
        }
297
    }
302
    }
298
303
Lines 489-494 Link Here
489
        
494
        
490
        wb.write(out);
495
        wb.write(out);
491
        out.close();
496
        out.close();
497
        
498
        System.out.println(file.getCanonicalPath());
492
        } catch (java.io.IOException ioe) {
499
        } catch (java.io.IOException ioe) {
493
            ioe.printStackTrace();
500
            ioe.printStackTrace();
494
        }
501
        }
(-)src/java/org/apache/poi/hssf/record/formula/FunctionPtg.java (-8 / +1 lines)
Lines 1-16 Link Here
1
/*
2
 * DummyFunctionPtg.java
3
 *
4
 * 
5
 */
6
7
8
package org.apache.poi.hssf.record.formula;
1
package org.apache.poi.hssf.record.formula;
9
2
10
import java.util.List;
3
import java.util.List;
11
/**
4
/**
12
 * This class provides functions with variable arguments.  
5
 * This class provides functions with variable arguments.  
13
 * @author  aviks
6
 * @author  Avik Sengupta
14
 * @author Andrew C. Oliver (acoliver at apache dot org)
7
 * @author Andrew C. Oliver (acoliver at apache dot org)
15
 * @version 
8
 * @version 
16
 */
9
 */
(-)src/java/org/apache/poi/hssf/record/formula/IntPtg.java (+4 lines)
Lines 95-100 Link Here
95
        field_1_value = Short.parseShort(val);
95
        field_1_value = Short.parseShort(val);
96
    }
96
    }
97
    
97
    
98
    // IntPtg should be able to create itself, shouldnt have to call setValue
99
    protected IntPtg(String formulaToken) {
100
        setValue(Short.parseShort(formulaToken));
101
    }
98
102
99
    public void setValue(short value)
103
    public void setValue(short value)
100
    {
104
    {
(-)src/java/org/apache/poi/hssf/record/formula/Ptg.java (-19 / +8 lines)
Lines 71-86 Link Here
71
public abstract class Ptg
71
public abstract class Ptg
72
{
72
{
73
73
74
    /** Creates new Ptg */
74
        
75
    
76
    public Ptg()
77
    {
78
    }
79
    
80
    /** convert infix order ptg list to rpn order ptg list
75
    /** convert infix order ptg list to rpn order ptg list
81
     * @return List ptgs in RPN order
76
     * @return List ptgs in RPN order
82
     * @param infixPtgs List of ptgs in infix order
77
     * @param infixPtgs List of ptgs in infix order
83
     */
78
     */
79
    
80
    /* DO NOI REMOVE
81
     *we keep this method in case we wish to change the way we parse
82
     *It needs a getPrecedence in OperationsPtg
83
    
84
    public static List ptgsToRpn(List infixPtgs) {
84
    public static List ptgsToRpn(List infixPtgs) {
85
        java.util.Stack operands = new java.util.Stack();
85
        java.util.Stack operands = new java.util.Stack();
86
        java.util.List retval = new java.util.Stack();
86
        java.util.List retval = new java.util.Stack();
Lines 123-129 Link Here
123
        }
123
        }
124
        return retval;
124
        return retval;
125
    }
125
    }
126
    
126
    */
127
127
128
    
128
    
129
    
129
    
Lines 284-301 Link Here
284
    public abstract void writeBytes(byte [] array, int offset);
284
    public abstract void writeBytes(byte [] array, int offset);
285
285
286
    public abstract String toFormulaString();
286
    public abstract String toFormulaString();
287
    
287
       
288
    /**
289
     * Ptg's should override this
290
     */
291
//    public boolean isNextStringToken(String formula, int pos) {
292
//        return false;
293
//    }
294
    
295
    public int getPrecedence() {
296
        return 100;
297
    }
298
    
299
    public int getStringLength() {
288
    public int getStringLength() {
300
        return 0;
289
        return 0;
301
    }
290
    }

Return to bug 8624