1 19 20 package jxl.biff.formula; 21 22 import java.util.Locale ; 23 import java.util.ResourceBundle ; 24 import java.util.HashMap ; 25 26 import common.Logger; 27 28 33 public class FunctionNames 34 { 35 38 private static Logger logger = Logger.getLogger(FunctionNames.class); 39 40 44 private HashMap names; 45 46 50 private HashMap functions; 51 52 56 public FunctionNames(Locale l) 57 { 58 ResourceBundle rb = ResourceBundle.getBundle("functions", l); 59 names = new HashMap (Function.functions.length); 60 functions = new HashMap (Function.functions.length); 61 62 Function f = null; 64 String n = null; 65 String propname = null; 66 for (int i = 0; i < Function.functions.length ; i++) 67 { 68 f = Function.functions[i]; 69 propname = f.getPropertyName(); 70 71 n = propname.length() != 0 ? rb.getString(propname) : null; 72 73 if (n != null) 74 { 75 names.put(f, n); 76 functions.put(n, f); 77 } 78 } 79 } 80 81 84 Function getFunction(String s) 85 { 86 return (Function) functions.get(s); 87 } 88 89 92 String getName(Function f) 93 { 94 return (String ) names.get(f); 95 } 96 } 97 | Popular Tags |