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