KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > biff > formula > Parser


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.biff.formula;
21
22 /**
23  * Interface used by the two different types of formula parser
24  */

25 interface Parser
26 {
27   /**
28    * Parses the formula
29    *
30    * @exception FormulaException if an error occurs
31    */

32   public void parse() throws FormulaException;
33
34   /**
35    * Gets the string version of the formula
36    *
37    * @return the formula as a string
38    */

39   public String JavaDoc getFormula();
40
41   /**
42    * Gets the bytes for the formula. This takes into account any
43    * token mapping necessary because of shared formulas
44    *
45    * @return the bytes in RPN
46    */

47   public byte[] getBytes();
48
49   /**
50    * Adjusts all the relative cell references in this formula by the
51    * amount specified.
52    *
53    * @param colAdjust
54    * @param rowAdjust
55    */

56   public void adjustRelativeCellReferences(int colAdjust, int rowAdjust);
57
58
59   /**
60    * Called when a column is inserted on the specified sheet. Tells
61    * the formula parser to update all of its cell references beyond this
62    * column
63    *
64    * @param sheetIndex the sheet on which the column was inserted
65    * @param col the column number which was inserted
66    * @param currentSheet TRUE if this formula is on the sheet in which the
67    * column was inserted, FALSE otherwise
68    */

69   public void columnInserted(int sheetIndex, int col, boolean currentSheet);
70
71   /**
72    * Called when a column is inserted on the specified sheet. Tells
73    * the formula parser to update all of its cell references beyond this
74    * column
75    *
76    * @param sheetIndex the sheet on which the column was removed
77    * @param col the column number which was removed
78    * @param currentSheet TRUE if this formula is on the sheet in which the
79    * column was inserted, FALSE otherwise
80    */

81   public void columnRemoved(int sheetIndex, int col, boolean currentSheet);
82
83   /**
84    * Called when a column is inserted on the specified sheet. Tells
85    * the formula parser to update all of its cell references beyond this
86    * column
87    *
88    * @param sheetIndex the sheet on which the column was inserted
89    * @param row the column number which was inserted
90    * @param currentSheet TRUE if this formula is on the sheet in which the
91    * column was inserted, FALSE otherwise
92    */

93   public void rowInserted(int sheetIndex, int row, boolean currentSheet);
94
95   /**
96    * Called when a column is inserted on the specified sheet. Tells
97    * the formula parser to update all of its cell references beyond this
98    * column
99    *
100    * @param sheetIndex the sheet on which the column was removed
101    * @param row the column number which was removed
102    * @param currentSheet TRUE if this formula is on the sheet in which the
103    * column was inserted, FALSE otherwise
104    */

105   public void rowRemoved(int sheetIndex, int row, boolean currentSheet);
106 }
107
Popular Tags