// static initialization static { sbmlUnitNames = new HashMap<Integer, String>(); sbmlUnitKinds = new HashMap<String, Integer>(); for (int i = 0; i < SBML_UNIT_NAMES.length; i++) { String name = SBML_UNIT_NAMES[i]; Integer code = new Integer(SBML_UNIT_KINDS[i]); sbmlUnitNames.put(code, name); sbmlUnitKinds.put(name, code); } }
public static int stringToKind(String name) { Integer kind = sbmlUnitKinds.get(name); return (kind == null) ? libsbmlConstants.UNIT_KIND_INVALID : kind.intValue(); }
// SBML kind/String lookups public static String kindToString(int kind) { return sbmlUnitNames.get(new Integer(kind)); }