1 19 20 package jxl.biff.formula; 21 22 import java.util.Stack ; 23 24 import jxl.Sheet; 25 import jxl.biff.IntegerHelper; 26 27 30 class Parenthesis extends Operator implements ParsedThing 31 { 32 35 public Parenthesis() 36 { 37 } 38 39 46 public int read(byte[] data, int pos) 47 { 48 return 0; 49 } 50 51 54 public void getOperands(Stack s) 55 { 56 ParseItem pi = (ParseItem) s.pop(); 57 58 add(pi); 59 } 60 61 public void getString(StringBuffer buf) 62 { 63 ParseItem[] operands = getOperands(); 64 buf.append('('); 65 operands[0].getString(buf); 66 buf.append(')'); 67 } 68 69 76 public void adjustRelativeCellReferences(int colAdjust, int rowAdjust) 77 { 78 ParseItem[] operands = getOperands(); 79 operands[0].adjustRelativeCellReferences(colAdjust, rowAdjust); 80 } 81 82 92 void columnInserted(int sheetIndex, int col, boolean currentSheet) 93 { 94 ParseItem[] operands = getOperands(); 95 operands[0].columnInserted(sheetIndex, col, currentSheet); 96 } 97 98 108 void columnRemoved(int sheetIndex, int col, boolean currentSheet) 109 { 110 ParseItem[] operands = getOperands(); 111 operands[0].columnRemoved(sheetIndex, col, currentSheet); 112 } 113 114 124 void rowInserted(int sheetIndex, int row, boolean currentSheet) 125 { 126 ParseItem[] operands = getOperands(); 127 operands[0].rowInserted(sheetIndex, row, currentSheet); 128 } 129 130 140 void rowRemoved(int sheetIndex, int row, boolean currentSheet) 141 { 142 ParseItem[] operands = getOperands(); 143 operands[0].rowRemoved(sheetIndex, row, currentSheet); 144 } 145 146 151 Token getToken() 152 { 153 return Token.PARENTHESIS; 154 } 155 156 161 byte[] getBytes() 162 { 163 ParseItem[] operands = getOperands(); 165 byte[] data = operands[0].getBytes(); 166 167 byte[] newdata = new byte[data.length + 1]; 169 System.arraycopy(data, 0, newdata, 0, data.length); 170 newdata[data.length] = getToken().getCode(); 171 172 return newdata; 173 } 174 175 181 int getPrecedence() 182 { 183 return 4; 184 } 185 } 186 | Popular Tags |