1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge.converter.xml.sxc.pexcel.records.formula; 25 26 import java.util.HashMap; 27 28 /** 29 * A lookup table containing information about operators 30 */ 31 public class OperatorLookup extends SymbolLookup { 32 33 /** 34 * The default constructor - invokes {@link #initialize() initialize()} 35 */ OperatorLookup()36 public OperatorLookup() { 37 initialize(); 38 } 39 40 /** 41 * Initialize the lookup table for operators 42 */ initialize()43 public void initialize() { 44 if ((stringToID != null) || (idToString != null)) { 45 return; 46 } 47 stringToID = new HashMap(); 48 idToString = new HashMap(); 49 addEntry("UNARY_PLUS", TokenConstants.TUPLUS); 50 addEntry("UNARY_MINUS", TokenConstants.TUMINUS); 51 addEntry("%", TokenConstants.TPERCENT); 52 addEntry("+", TokenConstants.TADD); 53 addEntry("-", TokenConstants.TSUB); 54 addEntry("*", TokenConstants.TMUL); 55 addEntry("/", TokenConstants.TDIV); 56 addEntry(",", TokenConstants.TARGSEP); 57 addEntry("^", TokenConstants.TPOWER); 58 addEntry("&", TokenConstants.TCONCAT); 59 addEntry("(", TokenConstants.TPAREN); 60 addEntry(")", TokenConstants.TCLOSEPAREN); 61 addEntry("<", TokenConstants.TLESS); 62 addEntry(">", TokenConstants.TGREATER); 63 addEntry(">=", TokenConstants.TGTEQUALS); 64 addEntry("<=", TokenConstants.TLESSEQUALS); 65 addEntry("=", TokenConstants.TEQUALS); 66 addEntry("<>", TokenConstants.TNEQUALS); 67 } 68 69 } 70