Exemple #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;
 }
Exemple #2
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();
 }
Exemple #3
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());
 }
Exemple #4
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();
 }
Exemple #5
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append("true");
 }
Exemple #6
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   sb.append("!(");
   super.toJavaStr(sb, jname);
   return sb.append(")");
 }
Exemple #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");
 }
Exemple #8
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append("\"").append(_str).append("\".equals(").append(jname).append(")");
 }
Exemple #9
0
 @Override
 public StringBuilder toJavaBool(StringBuilder sb, String jname) {
   return sb.append(jname).append("==").append(_bool);
 }
Exemple #10
0
 @Override
 public StringBuilder toJavaNum(StringBuilder sb, String jname) {
   return sb.append(jname).append("==").append(_num);
 }
Exemple #11
0
 @Override
 public StringBuilder toJavaStr(StringBuilder sb, String jname) {
   return sb.append(jname).append("==null");
 }
Exemple #12
0
 @Override
 public StringBuilder toJavaBool(StringBuilder sb, String jname) {
   return sb.append("Double.isNaN(" + jname + ")");
 }