Exemplo n.º 1
0
 private Predicate pSimpleSetPredicate(HashMap<String, String> attrs) {
   expect('>');
   IsIn in = IsIn.make(attrs.get("field"), BooleanOperators.valueOf(attrs.get("booleanOperator")));
   in._values = skipWS().expect('<').pArray();
   skipWS().expect("</SimpleSetPredicate>");
   return in;
 }
Exemplo n.º 2
0
 // Any number of attributes, or '/' or '>'
 public HashMap<String, String> attrs() {
   HashMap<String, String> attrs = null;
   while (true) {
     int b = skipWS().peek();
     if (b == '/' || b == '>') return attrs;
     if (attrs == null) attrs = new HashMap();
     String attr = token();
     String val = skipWS().expect('=').str();
     attrs.put(attr, val);
   }
 }
Exemplo n.º 3
0
 // Read a single field name & type, plus any enum/factor/level info
 private PMMLParser pDataField() {
   HashMap<String, String> attrs = expect("DataField").attrs();
   String name = attrs.get("name");
   _types.put(name, DataTypes.parse(attrs.get("dataType")));
   if (peek() == '/') return expect("/>");
   expect('>');
   ArrayList<String> str = new ArrayList();
   while (skipWS().expect('<').peek() != '/') str.add(pDataFieldValue());
   String[] ss = str.toArray(new String[0]);
   Arrays.sort(ss, null);
   _enums.put(name, ss);
   return expect("/DataField>");
 }
Exemplo n.º 4
0
 private String[] pArray() {
   HashMap<String, String> attrs = expect("Array").attrs();
   expect('>');
   int len = Integer.parseInt(attrs.get("n"));
   assert attrs.get("type").equals("string");
   String[] ss = new String[len];
   for (int i = 0; i < len; i++) {
     int b = skipWS().peek();
     // Allow both quoted and unquoted tokens
     ss[i] = (b == '&' || b == '"') ? str() : token();
   }
   skipWS().expect("</Array>");
   return ss;
 }
Exemplo n.º 5
0
 private Predicate pCompoundPredicate(HashMap<String, String> attrs) {
   expect(">");
   CompoundPredicate cp =
       CompoundPredicate.make(BooleanOperators.valueOf(attrs.get("booleanOperator")));
   cp._l = skipWS().expect('<').pPredicate();
   cp._r = skipWS().expect('<').pPredicate();
   skipWS().expect("</CompoundPredicate>");
   return cp;
 }
Exemplo n.º 6
0
 public static String getString(HashMap<String, Comparable> row, String s) {
   return getString(row.get(s));
 }
Exemplo n.º 7
0
 public static double getBoolean(HashMap<String, Comparable> row, String s) {
   return getBoolean(row.get(s));
 }
Exemplo n.º 8
0
 // Happy Helper Methods for the generated code
 public static double getNumber(HashMap<String, Comparable> row, String s) {
   return getNumber(row.get(s));
 }
Exemplo n.º 9
0
 private Predicate pSimplePredicate(HashMap<String, String> attrs) {
   expect("/>");
   return Comparison.makeSimple(
       attrs.get("field"), Operators.valueOf(attrs.get("operator")), attrs.get("value"));
 }