Examples of PathRestriction


Examples of org.apache.jackrabbit.oak.query.index.Filter.PathRestriction

        }
        Random r = new Random(1);
        for (int i = 0; i < 10000; i++) {
            String p1 = paths.get(r.nextInt(paths.size()));
            String p2 = paths.get(r.nextInt(paths.size()));
            PathRestriction r1 = PathRestriction.values()[r.nextInt(PathRestriction.values().length)];
            PathRestriction r2 = PathRestriction.values()[r.nextInt(PathRestriction.values().length)];
            Filter f1 = new Filter(null);
            f1.restrictPath(p1, r1);
            Filter f2 = new Filter(null);
            f2.restrictPath(p2, r2);
            Filter fc = new Filter(null);
            fc.restrictPath(p1, r1);
            fc.restrictPath(p2, r2);
            int tooMany = 0;
            for (String p : paths) {
                boolean expected = f1.testPath(p) && f2.testPath(p);
                boolean got = fc.testPath(p);
                if (expected == got) {
                    // good
                } else if (expected && !got) {
                    fc = new Filter(null);
                    fc.restrictPath(p1, r1);
                    fc.restrictPath(p2, r2);
                    fail("not matched: " + p1 + "/" + r1.name() + " && " + p2 + "/" + r2.name());
                } else {
                    // not great, but not a problem
                    tooMany++;
                }
            }
            if (tooMany > 3) {
                fail("too many matches: " + p1 + "/" + r1.name() + " && " + p2 + "/" + r2.name() + " superfluous: " + tooMany);
            }
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

                    if (NodeStateUtils.isHidden(name)) {
                        continue;
                    }
                    currentPath = PathUtils.concat(parentPath, name);

                    PathRestriction r = filter.getPathRestriction();
                    if (r == PathRestriction.ALL_CHILDREN ||
                            r == PathRestriction.NO_RESTRICTION) {
                        nodeIterators.addLast(node.getChildNodeEntries().iterator());
                        parentPath = currentPath;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

        }
        double nodeCount = 10000000;
        // if the path is from a join, then the depth is not correct
        // (the path might be the root node), but that's OK
        String path = filter.getPath();
        PathRestriction restriction = filter.getPathRestriction();
        switch (restriction) {
        case NO_RESTRICTION:
            break;
        case EXACT:
            nodeCount = 1;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

        if (filter.isAlwaysFalse()) {
            return 0;
        }
        double nodeCount = 10000000;
        String path = filter.getPath();
        PathRestriction restriction = filter.getPathRestriction();
        switch (restriction) {
        case NO_RESTRICTION:
            break;
        case EXACT:
            nodeCount = 1;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

                    // nothing can match this filter, leave nodes empty
                    return;
                }
            }
        }
        PathRestriction restriciton = filter.getPathRestriction();
        switch (restriciton) {
        case EXACT:
        case ALL_CHILDREN:
            nodeIterators.add(Iterators.singletonIterator(
                    new MemoryChildNodeEntry(currentPath, node)));
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

                    if (NodeStateUtils.isHidden(name)) {
                        continue;
                    }
                    currentPath = PathUtils.concat(parentPath, name);

                    PathRestriction r = filter.getPathRestriction();
                    if (r == PathRestriction.ALL_CHILDREN ||
                            r == PathRestriction.NO_RESTRICTION) {
                        nodeIterators.addLast(node.getChildNodeEntries().iterator());
                        parentPath = currentPath;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

                    if (NodeStateUtils.isHidden(name)) {
                        continue;
                    }
                    currentPath = PathUtils.concat(parentPath, name);

                    PathRestriction r = filter.getPathRestriction();
                    if (r == PathRestriction.ALL_CHILDREN ||
                            r == PathRestriction.NO_RESTRICTION) {
                        nodeIterators.addLast(node.getChildNodeEntries().iterator());
                        parentPath = currentPath;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

        double nodeCountChildren = 100000;
       
        // if the path is from a join, then the depth is not correct
        // (the path might be the root node), but that's OK
        String path = filter.getPath();
        PathRestriction restriction = filter.getPathRestriction();
        switch (restriction) {
        case NO_RESTRICTION:
            break;
        case EXACT:
            nodeCount = 1;
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

                    if (NodeStateUtils.isHidden(name)) {
                        continue;
                    }
                    currentPath = PathUtils.concat(parentPath, name);

                    PathRestriction r = filter.getPathRestriction();
                    if (r == PathRestriction.ALL_CHILDREN ||
                            r == PathRestriction.NO_RESTRICTION) {
                        nodeIterators.addLast(node.getChildNodeEntries().iterator());
                        parentPath = currentPath;
                    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.spi.query.Filter.PathRestriction

        }
        double nodeCount = 10000000;
        // if the path is from a join, then the depth is not correct
        // (the path might be the root node), but that's OK
        String path = filter.getPath();
        PathRestriction restriction = filter.getPathRestriction();
        switch (restriction) {
        case NO_RESTRICTION:
            break;
        case EXACT:
            nodeCount = 1;
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.