Example usage for org.apache.commons.collections.functors OrPredicate getInstance

List of usage examples for org.apache.commons.collections.functors OrPredicate getInstance

Introduction

In this page you can find the example usage for org.apache.commons.collections.functors OrPredicate getInstance.

Prototype

public static Predicate getInstance(Predicate predicate1, Predicate predicate2) 

Source Link

Document

Factory to create the predicate.

Usage

From source file:org.springmodules.validation.valang.parser.ValangParser.java

final public Predicate predicates(Function fieldFunction) throws ParseException {
    Predicate predicate1 = null;//from w  ww . j av a2  s.c  om
    Predicate predicate2 = null;
    boolean andTest = false;
    boolean orTest = false;
    predicate1 = expression(fieldFunction);
    label_3: while (true) {
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case AND:
        case OR:
            ;
            break;
        default:
            jj_la1[4] = jj_gen;
            break label_3;
        }
        switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
        case AND:
            jj_consume_token(AND);
            andTest = true;
            break;
        case OR:
            jj_consume_token(OR);
            orTest = true;
            break;
        default:
            jj_la1[5] = jj_gen;
            jj_consume_token(-1);
            throw new ParseException();
        }
        predicate2 = expression(fieldFunction);
        if (andTest) {
            predicate1 = AndPredicate.getInstance(predicate1, predicate2);
            andTest = false;
        } else if (orTest) {
            predicate1 = OrPredicate.getInstance(predicate1, predicate2);
            orTest = false;
        }
    }
    {
        if (true)
            return predicate1;
    }
    throw new Error("Missing return statement in function");
}