Beispiel #1
0
 public StringBuilder makeStr(StringBuilder sb, String jname, String rel) {
   sb.append("(");
   _l.toJavaStr(sb, jname);
   sb.append(" ").append(rel).append(" ");
   _r.toJavaStr(sb, jname);
   sb.append(")");
   return sb;
 }
Beispiel #2
0
 // Read from stream a "string".  Skips the trailing close-quote
 private String str() {
   int q = skipWS().qget();
   if (q != '"' && q != '\'')
     throw new ParseException("Expected one of ' or \" but found '" + (char) q + "'");
   StringBuilder sb = new StringBuilder();
   int b = get();
   while (b != q) {
     sb.append((char) b);
     b = qget();
   }
   return sb.toString();
 }
Beispiel #3
0
 // Read from stream a valid PMML token
 public String token() {
   int b = get();
   if (!Character.isJavaIdentifierStart(b))
     throw new ParseException("Expected token start but found '" + (char) b + "'");
   StringBuilder sb = new StringBuilder();
   sb.append((char) b);
   b = get();
   while (Character.isJavaIdentifierPart(b) || b == ':') {
     sb.append((char) b);
     b = get();
   }
   push(b);
   return sb.toString();
 }
Beispiel #4
0
 public PMMLParser barf(char tok, char c) {
   StringBuilder sb = new StringBuilder();
   sb.append("Expected '").append(tok).append("' but found '").append(c).append("'");
   int line = 0;
   for (int i = 0; i < 512; i++) {
     try {
       c = (char) get();
     } catch (ParseException ioe) {
       break;
     }
     sb.append(c);
     if (c == '\n' && line++ > 2) break;
   }
   throw new ParseException(sb.toString());
 }
Beispiel #5
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append("true");
 }
Beispiel #6
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   sb.append("!(");
   super.toJavaStr(sb, jname);
   return sb.append(")");
 }
Beispiel #7
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   for (String s : _values)
     sb.append("\"").append(s).append("\".equals(").append(jname).append(") || ");
   return sb.append("false");
 }
Beispiel #8
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append("\"").append(_str).append("\".equals(").append(jname).append(")");
 }
Beispiel #9
0
 @Override
 public StringBuilder toJavaBool(StringBuilder sb, String jname) {
   return sb.append(jname).append("==").append(_bool);
 }
Beispiel #10
0
 @Override
 public StringBuilder toJavaNum(StringBuilder sb, String jname) {
   return sb.append(jname).append("==").append(_num);
 }
Beispiel #11
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append(jname).append("==null");
 }
Beispiel #12
0
 @Override
 public StringBuilder toJavaBool(StringBuilder sb, String jname) {
   return sb.append("Double.isNaN(" + jname + ")");
 }