@Test public void testCompoundWithCompound() { CompoundPredicate outerPredicate = new CompoundPredicate(); outerPredicate.setBooleanOperator("or"); setupSimplePredicate(0,"TF1",SimpleSegmentPredicate.LESSER_EQUAL,"150"); outerPredicate.getSimplePredicatesAndCompoundPredicatesAndSimpleSetPredicates().add(simplePredicate[0]); CompoundPredicate innerPredicate = new CompoundPredicate(); innerPredicate.setBooleanOperator("and"); setupSimplePredicate(1, "TF1", SimpleSegmentPredicate.GREATER, "150"); Array valueSet = getNewArray("string", new BigInteger("3"), "red", "white", "blue"); setupSimpleSetPredicate(0, "TF2", "isIn", valueSet); innerPredicate.getSimplePredicatesAndCompoundPredicatesAndSimpleSetPredicates().add(simplePredicate[1]); innerPredicate.getSimplePredicatesAndCompoundPredicatesAndSimpleSetPredicates().add(simpleSetPredicate[0]); outerPredicate.getSimplePredicatesAndCompoundPredicatesAndSimpleSetPredicates().add(innerPredicate); CompoundSegmentPredicate testPredicate = new CompoundSegmentPredicate(outerPredicate); String text = testPredicate.getPredicateRule(); assertNotNull(text); StringBuilder bldr = new StringBuilder("("); bldr.append("(( mTF1 == false ) && ( vTF1 <= 150 )) || (("); bldr.append("(( mTF1 == false ) && ( vTF1 > 150 )) && "); bldr.append("(( mTF2 == false ) && ( vTF2 in ( \"red\" , \"white\" , \"blue\" ) )))"); bldr.append("))"); assertEquals(bldr.toString(),text); }
@Override public String getPredicateRule() { if (booleanOperator.equalsIgnoreCase("and")) { return buildAndPredicate(); } else if (booleanOperator.equalsIgnoreCase("or")) { return buildOrPredicate(); } else if (booleanOperator.equalsIgnoreCase("xor")) { return buildXorPredicate(); } else if (hasSurrogation()) { return buildSurrogationPredicate(); } return null; }
CompoundSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { if (booleanOperator.equalsIgnoreCase("and")) { return buildAndPredicate(); } else if (booleanOperator.equalsIgnoreCase("or")) { return buildOrPredicate(); } else if (booleanOperator.equalsIgnoreCase("xor")) { return buildXorPredicate(); } else if (hasSurrogation()) { return buildSurrogationPredicate(); } return null; } }
CompoundSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { if (booleanOperator.equalsIgnoreCase("and")) { return buildAndPredicate(); } else if (booleanOperator.equalsIgnoreCase("or")) { return buildOrPredicate(); } else if (booleanOperator.equalsIgnoreCase("xor")) { return buildXorPredicate(); } else if (hasSurrogation()) { return buildSurrogationPredicate(); } return null; } CompoundSegmentPredicate();  CompoundSegmentPredicate(CompoundPredicate predicate); }
CompoundSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { if (booleanOperator.equalsIgnoreCase("and")) { return buildAndPredicate(); } else if (booleanOperator.equalsIgnoreCase("or")) { return buildOrPredicate(); } else if (booleanOperator.equalsIgnoreCase("xor")) { return buildXorPredicate(); } else if (hasSurrogation()) { return buildSurrogationPredicate(); } return null; } CompoundSegmentPredicate();  CompoundSegmentPredicate(CompoundPredicate predicate); List<String> getPredicateFieldNames(); List<String> getFieldMissingFieldNames(); String getPrimaryPredicateRule(); String getNextPredicateRule(int lastPredicate); int getSubpredicateCount(); boolean hasSurrogation(); @Override String getPredicateRule(); @Override boolean isAlwaysTrue(); @Override boolean isAlwaysFalse(); }
CompoundSegmentPredicate implements PredicateRuleProducer { @Override public String getPredicateRule() { if (booleanOperator.equalsIgnoreCase("and")) { return buildAndPredicate(); } else if (booleanOperator.equalsIgnoreCase("or")) { return buildOrPredicate(); } else if (booleanOperator.equalsIgnoreCase("xor")) { return buildXorPredicate(); } else if (hasSurrogation()) { return buildSurrogationPredicate(); } return null; } CompoundSegmentPredicate();  CompoundSegmentPredicate(CompoundPredicate predicate); List<String> getPredicateFieldNames(); List<String> getFieldMissingFieldNames(); String getPrimaryPredicateRule(); String getNextPredicateRule(int lastPredicate); int getSubpredicateCount(); boolean hasSurrogation(); @Override String getPredicateRule(); @Override boolean isAlwaysTrue(); @Override boolean isAlwaysFalse();  }