1 19 20 package jxl.biff.formula; 21 22 import java.util.HashMap ; 23 24 28 class Token 29 { 30 33 public final int[] value; 34 35 38 private static HashMap tokens = new HashMap (20); 39 40 46 private Token(int v) 47 { 48 value = new int[] {v}; 49 50 tokens.put(new Integer (v), this); 51 } 52 53 59 private Token(int v1, int v2) 60 { 61 value = new int[] {v1, v2}; 62 63 tokens.put(new Integer (v1), this); 64 tokens.put(new Integer (v2), this); 65 } 66 67 73 private Token(int v1, int v2, int v3) 74 { 75 value = new int[] {v1, v2, v3}; 76 77 tokens.put(new Integer (v1), this); 78 tokens.put(new Integer (v2), this); 79 tokens.put(new Integer (v3), this); 80 } 81 82 88 private Token(int v1, int v2, int v3, int v4) 89 { 90 value = new int[] {v1, v2, v3, v4}; 91 92 tokens.put(new Integer (v1), this); 93 tokens.put(new Integer (v2), this); 94 tokens.put(new Integer (v3), this); 95 tokens.put(new Integer (v4), this); 96 } 97 98 104 private Token(int v1, int v2, int v3, int v4, int v5) 105 { 106 value = new int[] {v1, v2, v3, v4, v5}; 107 108 tokens.put(new Integer (v1), this); 109 tokens.put(new Integer (v2), this); 110 tokens.put(new Integer (v3), this); 111 tokens.put(new Integer (v4), this); 112 tokens.put(new Integer (v5), this); 113 } 114 115 120 public byte getCode() 121 { 122 return (byte) value[0]; 123 } 124 125 131 public byte getCode2() 132 { 133 return (byte) (value.length > 0 ? value[1] : value[0]); 134 } 135 136 139 public static Token getToken(int v) 140 { 141 Token t = (Token) tokens.get(new Integer (v)); 142 143 return t != null ? t : UNKNOWN; 144 } 145 146 public static final Token REF = new Token(0x44, 0x24, 0x64); 148 public static final Token REF3D = new Token(0x5a, 0x3a, 0x7a); 149 public static final Token MISSING_ARG = new Token(0x16); 150 public static final Token STRING = new Token(0x17); 151 public static final Token BOOL = new Token(0x1d); 152 public static final Token INTEGER = new Token(0x1e); 153 public static final Token DOUBLE = new Token(0x1f); 154 public static final Token REFV = new Token(0x2c, 0x4c); 155 public static final Token AREAV = new Token(0x2d, 0x4d, 0x6d); 156 public static final Token AREA = new Token(0x25, 0x65, 0x45); 157 public static final Token NAMED_RANGE = new Token(0x43, 0x23); 158 public static final Token NAME = new Token(0x39); 159 public static final Token AREA3D = new Token(0x3b); 160 161 public static final Token UNARY_PLUS = new Token(0x12); 163 public static final Token UNARY_MINUS = new Token(0x13); 164 public static final Token PERCENT = new Token(0x14); 165 public static final Token PARENTHESIS = new Token(0x15); 166 167 public static final Token ADD = new Token(0x3); 169 public static final Token SUBTRACT = new Token(0x4); 170 public static final Token MULTIPLY = new Token(0x5); 171 public static final Token DIVIDE = new Token(0x6); 172 public static final Token POWER = new Token(0x7); 173 public static final Token CONCAT = new Token(0x8); 174 public static final Token LESS_THAN = new Token(0x9); 175 public static final Token LESS_EQUAL = new Token(0xa); 176 public static final Token EQUAL = new Token(0xb); 177 public static final Token GREATER_EQUAL = new Token(0xc); 178 public static final Token GREATER_THAN = new Token(0xd); 179 public static final Token NOT_EQUAL = new Token(0xe); 180 public static final Token RANGE = new Token(0x11); 181 182 public static final Token FUNCTION = new Token(0x41, 0x21, 0x61); 184 public static final Token FUNCTIONVARARG = new Token(0x42, 0x22, 0x62); 185 186 public static final Token ATTRIBUTE = new Token(0x19); 188 public static final Token MEM_FUNC = new Token(0x29, 0x49, 0x69); 189 190 public static final Token UNKNOWN = new Token(0xffff); 192 } 193 194 | Popular Tags |