package polarDust.calculator; /* * Copyright (c) 1996 Sorin Lazareanu, All Rights Reserved. * * Permission to use, copy, modify, and distribute this software * and its documentation for NON-COMMERCIAL purposes and without * fee is hereby granted provided that this copyright notice * appears in all copies. * */ import java.util.*; import java.lang.*; /** * CalcHashtable is a colection of associations between a key integer code and * a String value. * *

* The source code. * * @version 0.9, 1996.06.04 * @author Sorin Lazareanu */ public final class CalcHashtable implements CalcConstants { static Hashtable calcHashtable = new Hashtable(); public CalcHashtable() { calcHashtable.put(new Integer(NUL), STR_NUL); calcHashtable.put(new Integer(ZERO), STR_0); calcHashtable.put(new Integer(ONE), STR_1); calcHashtable.put(new Integer(TWO), STR_2); calcHashtable.put(new Integer(THREE), STR_3); calcHashtable.put(new Integer(FOUR), STR_4); calcHashtable.put(new Integer(FIVE), STR_5); calcHashtable.put(new Integer(SIX), STR_6); calcHashtable.put(new Integer(SEVEN), STR_7); calcHashtable.put(new Integer(EIGHT), STR_8); calcHashtable.put(new Integer(NINE), STR_9); calcHashtable.put(new Integer(DOT), STR_DOT); calcHashtable.put(new Integer(ADD), STR_ADD); calcHashtable.put(new Integer(SUB), STR_SUB); calcHashtable.put(new Integer(MUL), STR_MUL); calcHashtable.put(new Integer(DIV), STR_DIV); calcHashtable.put(new Integer(EQU), STR_EQU); calcHashtable.put(new Integer(PRC), STR_PRC); calcHashtable.put(new Integer(CLR), STR_CLR); calcHashtable.put(new Integer(CE), STR_CE); calcHashtable.put(new Integer(MR), STR_MR); calcHashtable.put(new Integer(MC), STR_MC); calcHashtable.put(new Integer(MADD), STR_MADD); calcHashtable.put(new Integer(MSUB), STR_MSUB); calcHashtable.put(new Integer(SWAP), STR_SWAP); calcHashtable.put(new Integer(SQR), STR_SQR); calcHashtable.put(new Integer(SQRT), STR_SQRT); calcHashtable.put(new Integer(VPI), STR_VPI); calcHashtable.put(new Integer(LN), STR_LN); calcHashtable.put(new Integer(LOG), STR_LOG); calcHashtable.put(new Integer(EXP), STR_EXP); calcHashtable.put(new Integer(SIN), STR_SIN); calcHashtable.put(new Integer(ASIN), STR_ASIN); calcHashtable.put(new Integer(COS), STR_COS); calcHashtable.put(new Integer(ACOS), STR_ACOS); calcHashtable.put(new Integer(TAN), STR_TAN); calcHashtable.put(new Integer(ATAN), STR_ATAN); calcHashtable.put(new Integer(POW), STR_POW); calcHashtable.put(new Integer(INV), STR_INV); calcHashtable.put(new Integer(SGN), STR_SGN); calcHashtable.put(new Integer(VE), STR_VE); } /** * @param aValue a value to be searched for. * @return the value is in CalcHashtable. */ public static boolean contains(Object aValue) { return calcHashtable.contains(aValue); } /** * @param aKey a key to be searched for. * @return the key is in CalcHashtable. */ public static boolean containsKey(Object aKey) { return calcHashtable.containsKey(aKey); } /** * @param aKey a key to be searched for. * @return the value associated with the key in CalcHashtable */ public static Object get(Object aKey) { return calcHashtable.get(aKey); } /** * @return an enumeration of the CalcHashtable's elements. */ public static Enumeration elements() { return calcHashtable.elements(); } /** * @return an enumeration of the CalcHashtable's keys. */ public static Enumeration keys() { return calcHashtable.keys(); } /** * @return the number of elements contained in the CalcHashtable. */ public static int size() { return calcHashtable.size(); } public String toString() { return "CalcHashtable"; } }