@Test public void testStringValue() { stringPred.setOperator(SimpleSegmentPredicate.EQUAL); SimpleSegmentPredicate ssp = new SimpleSegmentPredicate(stringPred); String text = ssp.getPredicateRule(); assertNotNull(text); assertEquals("( mTF3 == false ) && ( vTF3 == \"optA\" )",text); predicate.setOperator(SimpleSegmentPredicate.EQUAL); ssp = new SimpleSegmentPredicate(predicate); text = ssp.getPredicateRule(); assertNotNull(text); assertEquals("( mTF2 == false ) && ( vTF2 == 123 )",text); }
@Override public String getPredicateRule() { StringBuilder bldr = new StringBuilder(); bldr.append("( ").append(this.getMissingFieldName()).append(" == false )") .append(" && ( ").append(this.getValueFieldName()); if (operator.equalsIgnoreCase(GREATER)) { bldr.append(" > ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER)) { bldr.append(" < ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(EQUAL)) { bldr.append(" == ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(NOT_EQUAL)) { bldr.append(" != ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(MISSING)) { return this.getMissingFieldName()+" == true"; } else if (operator.equalsIgnoreCase(NOT_MISSING)) { return this.getMissingFieldName()+" == false"; } else if (operator.equalsIgnoreCase(GREATER_EQUAL)) { bldr.append(" >= ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER_EQUAL)) { bldr.append(" <= ").append(getValue()).append(" )"); return bldr.toString(); } throw new IllegalStateException("PMML - SimplePredicate: Unknown operator ("+operator+")"); }
SimpleSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { StringBuilder bldr = new StringBuilder(); bldr.append("( ").append(this.getMissingFieldName()).append(" == false )") .append(" && ( ").append(this.getValueFieldName()); if (operator.equalsIgnoreCase(GREATER)) { bldr.append(" > ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER)) { bldr.append(" < ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(EQUAL)) { bldr.append(" == ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(NOT_EQUAL)) { bldr.append(" != ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(MISSING)) { return this.getMissingFieldName()+" == true"; } else if (operator.equalsIgnoreCase(NOT_MISSING)) { return this.getMissingFieldName()+" == false"; } else if (operator.equalsIgnoreCase(GREATER_EQUAL)) { bldr.append(" >= ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER_EQUAL)) { bldr.append(" <= ").append(getValue()).append(" )"); return bldr.toString(); } throw new IllegalStateException("PMML - SimplePredicate: Unknown operator ("+operator+")"); } }
SimpleSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { StringBuilder bldr = new StringBuilder(); bldr.append("( ").append(this.getMissingFieldName()).append(" == false )") .append(" && ( ").append(this.getValueFieldName()); if (operator.equalsIgnoreCase(GREATER)) { bldr.append(" > ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER)) { bldr.append(" < ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(EQUAL)) { bldr.append(" == ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(NOT_EQUAL)) { bldr.append(" != ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(MISSING)) { return this.getMissingFieldName()+" == true"; } else if (operator.equalsIgnoreCase(NOT_MISSING)) { return this.getMissingFieldName()+" == false"; } else if (operator.equalsIgnoreCase(GREATER_EQUAL)) { bldr.append(" >= ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER_EQUAL)) { bldr.append(" <= ").append(getValue()).append(" )"); return bldr.toString(); } throw new IllegalStateException("PMML - SimplePredicate: Unknown operator ("+operator+")"); } SimpleSegmentPredicate();  SimpleSegmentPredicate(SimplePredicate predicate); }
SimpleSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { StringBuilder bldr = new StringBuilder(); bldr.append("( ").append(this.getMissingFieldName()).append(" == false )") .append(" && ( ").append(this.getValueFieldName()); if (operator.equalsIgnoreCase(GREATER)) { bldr.append(" > ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER)) { bldr.append(" < ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(EQUAL)) { bldr.append(" == ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(NOT_EQUAL)) { bldr.append(" != ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(MISSING)) { return this.getMissingFieldName()+" == true"; } else if (operator.equalsIgnoreCase(NOT_MISSING)) { return this.getMissingFieldName()+" == false"; } else if (operator.equalsIgnoreCase(GREATER_EQUAL)) { bldr.append(" >= ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER_EQUAL)) { bldr.append(" <= ").append(getValue()).append(" )"); return bldr.toString(); } throw new IllegalStateException("PMML - SimplePredicate: Unknown operator ("+operator+")"); } SimpleSegmentPredicate();  SimpleSegmentPredicate(SimplePredicate predicate); String getBaseFieldName(); String getCapitalizedFieldName(); String getValueFieldName(); String getMissingFieldName(); @Override String getPredicateRule(); boolean isStringLiteralValue(); void setStringLiteralValue(boolean stringLiteralValue); @Override List<String> getPredicateFieldNames(); @Override List<String> getFieldMissingFieldNames(); @Override boolean isAlwaysTrue(); @Override boolean isAlwaysFalse(); }
SimpleSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { StringBuilder bldr = new StringBuilder(); bldr.append("( ").append(this.getMissingFieldName()).append(" == false )") .append(" && ( ").append(this.getValueFieldName()); if (operator.equalsIgnoreCase(GREATER)) { bldr.append(" > ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER)) { bldr.append(" < ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(EQUAL)) { bldr.append(" == ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(NOT_EQUAL)) { bldr.append(" != ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(MISSING)) { return this.getMissingFieldName()+" == true"; } else if (operator.equalsIgnoreCase(NOT_MISSING)) { return this.getMissingFieldName()+" == false"; } else if (operator.equalsIgnoreCase(GREATER_EQUAL)) { bldr.append(" >= ").append(getValue()).append(" )"); return bldr.toString(); } else if (operator.equalsIgnoreCase(LESSER_EQUAL)) { bldr.append(" <= ").append(getValue()).append(" )"); return bldr.toString(); } throw new IllegalStateException("PMML - SimplePredicate: Unknown operator ("+operator+")"); } SimpleSegmentPredicate();  SimpleSegmentPredicate(SimplePredicate predicate); String getBaseFieldName(); String getCapitalizedFieldName(); String getValueFieldName(); String getMissingFieldName(); @Override String getPredicateRule(); boolean isStringLiteralValue(); void setStringLiteralValue(boolean stringLiteralValue); @Override List<String> getPredicateFieldNames(); @Override List<String> getFieldMissingFieldNames(); @Override boolean isAlwaysTrue(); @Override boolean isAlwaysFalse(); static final String EQUAL; static final String NOT_EQUAL; static final String GREATER; static final String GREATER_EQUAL; static final String LESSER; static final String LESSER_EQUAL; static final String MISSING; static final String NOT_MISSING; }