10 package com.generalrobotix.ui.view.graph;
27 private static final String
SEP =
".";
29 private static final String
UNIT =
"unit";
30 private static final String
BASE =
"base";
31 private static final String
EXTENT =
"extent";
32 private static final String
FACTOR =
"factor";
50 URL url = this.getClass().getResource(GRAPH_PROPERTIES);
53 prop.load(url.openStream());
54 }
catch (IOException ex) {
60 dataKindMap_ =
new HashMap<String, DataKind>();
61 StringTokenizer dkNames =
62 new StringTokenizer(prop.getProperty(DATA_KIND_NAMES),
",");
63 while (dkNames.hasMoreTokens()) {
64 String dkName = dkNames.nextToken();
65 String
unit = prop.getProperty(dkName + SEP + UNIT);
66 double base = Double.parseDouble(prop.getProperty(dkName + SEP + BASE));
67 double extent = Double.parseDouble(prop.getProperty(dkName + SEP + EXTENT));
69 (prop.containsKey(dkName + SEP + FACTOR))
70 ? Double.parseDouble((String)prop.getProperty(dkName + SEP + FACTOR))
74 dataKindMap_.put(dkName, dk);
78 attributeMap_ =
new HashMap<String, DataKind>();
80 int postfixlen = postfix.length();
81 Enumeration elm = prop.propertyNames();
82 while (elm.hasMoreElements()) {
83 String pname = (String)elm.nextElement();
84 if (pname.endsWith(postfix)) {
85 String aname = pname.substring(
86 0, pname.length() - postfixlen
88 attributeMap_.put(aname, dataKindMap_.get(prop.getProperty(pname)));
106 return (
DataKind)dataKindMap_.get(dataKindName);
120 return (
DataKind)attributeMap_.get(attribute);
#define null
our own NULL pointer
static final String DATA_KIND_NAMES
static final String FACTOR
static HashMap< String, DataKind > dataKindMap_
static GraphProperties this_
static HashMap< String, DataKind > attributeMap_
static DataKind getDataKindFromName(String dataKindName)
static final String EXTENT
static final String GRAPH_PROPERTIES
static final String DATA_KIND
static DataKind getDataKindFromAttr(String attribute)