Save This Page
Home » jexcelapi_2_6_8 » jxl.biff.formula » [javadoc | source]
    1   /*********************************************************************
    2   *
    3   *      Copyright (C) 2003 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   import java.util.Stack;
   23   
   24   import common.Assert;
   25   
   26   /**
   27    * Ambiguously defined operator, used as a place holder when parsing
   28    * string formulas.  At this stage it could be either
   29    * a unary or binary operator - the string parser will deduce which and
   30    * create the appropriate type
   31    */
   32   abstract class StringOperator extends Operator
   33   {
   34     /**
   35      * Constructor
   36      */
   37     protected StringOperator()
   38     {
   39       super();
   40     }
   41   
   42     /** 
   43      * Gets the operands for this operator from the stack.  Does nothing
   44      * here
   45      */
   46     public void getOperands(Stack s)
   47     {
   48       Assert.verify(false);
   49     }
   50   
   51     /**
   52      * Gets the precedence for this operator.  Does nothing here
   53      *
   54      * @return the operator precedence
   55      */
   56     int getPrecedence()
   57     {
   58       Assert.verify(false);
   59       return 0;
   60     }
   61   
   62     /**
   63      * Gets the token representation of this item in RPN.  Does nothing here
   64      *
   65      * @return the bytes applicable to this formula
   66      */
   67     byte[] getBytes()
   68     {
   69       Assert.verify(false);
   70       return null;
   71     }
   72     
   73     /**
   74      * Gets the string representation of this item
   75      */
   76     void getString(StringBuffer buf)
   77     {
   78       Assert.verify(false);
   79     }
   80   
   81     /**
   82      * Default behaviour is to do nothing
   83      *
   84      * @param colAdjust the amount to add on to each relative cell reference
   85      * @param rowAdjust the amount to add on to each relative row reference
   86      */
   87     public void adjustRelativeCellReferences(int colAdjust, int rowAdjust)
   88     {
   89       Assert.verify(false);
   90     }
   91   
   92   
   93     /**
   94      * Default behaviour is to do nothing
   95      *
   96      * @param sheetIndex the sheet on which the column was inserted
   97      * @param col the column number which was inserted
   98      * @param currentSheet TRUE if this formula is on the sheet in which the
   99      * column was inserted, FALSE otherwise
  100      */
  101     void columnInserted(int sheetIndex, int col, boolean currentSheet)
  102     {
  103       Assert.verify(false);
  104     }
  105   
  106     /**
  107      * Called when a column is inserted on the specified sheet.  Tells
  108      * the formula  parser to update all of its cell references beyond this
  109      * column
  110      *
  111      * @param sheetIndex the sheet on which the column was removed
  112      * @param col the column number which was removed
  113      * @param currentSheet TRUE if this formula is on the sheet in which the
  114      * column was inserted, FALSE otherwise
  115      */
  116     void columnRemoved(int sheetIndex, int col, boolean currentSheet)
  117     {
  118       Assert.verify(false);
  119     }
  120   
  121     /**
  122      * Called when a column is inserted on the specified sheet.  Tells
  123      * the formula  parser to update all of its cell references beyond this
  124      * column
  125      *
  126      * @param sheetIndex the sheet on which the row was inserted
  127      * @param row the row number which was inserted
  128      * @param currentSheet TRUE if this formula is on the sheet in which the
  129      * column was inserted, FALSE otherwise
  130      */
  131     void rowInserted(int sheetIndex, int row, boolean currentSheet)
  132     {
  133       Assert.verify(false);
  134     }
  135   
  136     /**
  137      * Called when a column is inserted on the specified sheet.  Tells
  138      * the formula  parser to update all of its cell references beyond this
  139      * column
  140      *
  141      * @param sheetIndex the sheet on which the row was removed
  142      * @param row the row number which was removed
  143      * @param currentSheet TRUE if this formula is on the sheet in which the
  144      * column was inserted, FALSE otherwise
  145      */
  146     void rowRemoved(int sheetIndex, int row, boolean currentSheet)
  147     {
  148       Assert.verify(false);
  149     }
  150   
  151     /**
  152      * Abstract method which gets the binary version of this operator
  153      */
  154     abstract Operator getBinaryOperator();
  155   
  156     /**
  157      * Abstract method which gets the unary version of this operator
  158      */
  159     abstract Operator getUnaryOperator();
  160   }

Save This Page
Home » jexcelapi_2_6_8 » jxl.biff.formula » [javadoc | source]