Examples of HFilter


Examples of org.haystack.HFilter

        verifyParse("(a) and (b)", HFilter.has("a").and(HFilter.has("b")));
        verifyParse("( a )  and  ( b ) ", HFilter.has("a").and(HFilter.has("b")));
        verifyParse("(a or b) or (c == 3)", HFilter.has("a").or(HFilter.has("b")).or(HFilter.eq("c", n(3))));

        // combo
        HFilter isA = HFilter.has("a");
        HFilter isB = HFilter.has("b");
        HFilter isC = HFilter.has("c");
        HFilter isD = HFilter.has("d");
        verifyParse("a and b or c", (isA.and(isB)).or(isC));
        verifyParse("a or b and c", isA.or(isB.and(isC)));
        verifyParse("a and b or c and d", (isA.and(isB)).or(isC.and(isD)));
        verifyParse("(a and (b or c)) and d", isA.and(isB.or(isC)).and(isD));
        verifyParse("(a or (b and c)) or d", isA.or(isB.and(isC)).or(isD));
View Full Code Here

Examples of org.haystack.HFilter

        verifyParse("(a and (b or c)) and d", isA.and(isB.or(isC)).and(isD));
        verifyParse("(a or (b and c)) or d", isA.or(isB.and(isC)).or(isD));
    }

    void verifyParse(String s, HFilter expected) {
        HFilter actual = HFilter.make(s);
        verifyEq(actual, expected);
    }
View Full Code Here

Examples of org.haystack.HFilter

            public HDict find(String id) {
                return map.get(id);
            }
        };

        HFilter q = HFilter.make(query);

        String actual = "";
        for (int c = 'a'; c <= 'c'; ++c) {
            String id = "" + (char) c;
            if (q.include(db.find(id), db))
                actual += actual.length() > 0 ? "," + id : id;
        }
        verifyEq(expected, actual);
    }
View Full Code Here

Examples of org.haystack.HFilter

    /**
     * Default implementation scans all records using "iterator"
     */
    @Override
    protected HGrid onReadAll(String filter, int limit) {
        HFilter f = HFilter.make(filter);
        List<HDict> acc = new ArrayList<HDict>();
        for (Iterator<HDict> it = iterator(); it.hasNext();) {
            HDict rec = it.next();
            if (f.include(rec, filterPather)) {
                acc.add(rec);
                if (acc.size() >= limit)
                    break;
            }
        }
View Full Code Here

Examples of org.haystack.HFilter

        skipSpace();

        if (cur == -1)
            return HFilter.all();

        HFilter q = readFilterOr();
        skipSpace();
        if (cur >= 0)
            throw errChar("Expected end of stream");
        return q;
    }
View Full Code Here

Examples of org.haystack.HFilter

            throw errChar("Expected end of stream");
        return q;
    }

    private HFilter readFilterOr() {
        HFilter q = readFilterAnd();
        skipSpace();
        if (cur != 'o')
            return q;
        if (!readId().equals("or"))
            throw err("Expecting 'or' keyword");
        skipSpace();
        return q.or(readFilterOr());
    }
View Full Code Here

Examples of org.haystack.HFilter

        skipSpace();
        return q.or(readFilterOr());
    }

    private HFilter readFilterAnd() {
        HFilter q = readFilterAtomic();
        skipSpace();
        if (cur != 'a')
            return q;
        if (!readId().equals("and"))
            throw err("Expecting 'and' keyword");
        skipSpace();
        return q.and(readFilterAnd());
    }
View Full Code Here

Examples of org.haystack.HFilter

    }

    private HFilter readFilterParens() {
        consume();
        skipSpace();
        HFilter q = readFilterOr();
        if (cur != ')')
            throw err("Expecting ')'");
        consume();
        return q;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.