Examples of subpath()


Examples of org.apache.jackrabbit.spi.Path.subPath()

        for (int i = 0; i < tests.length; i++) {
            if (tests[i].isValid() && tests[i].isNormalized()) {
                Path p = resolver.getQPath(tests[i].path);

                // subpath between 0 and length -> equal path
                assertEquals(p, p.subPath(0, p.getLength()));

                // subpath a single element
                if (p.getLength() > 2) {
                    Path expected = factory.create(new Path.Element[] {p.getElements()[1]});
                    assertEquals(expected, p.subPath(1,2));

Examples of org.apache.jackrabbit.spi.Path.subPath()

    public void testSubPathInvalid() throws RepositoryException {
        Path p = resolver.getQPath("/a/b/c/d/e");

        try {
            p.subPath(2,2);
            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

Examples of org.apache.jackrabbit.spi.Path.subPath()

            fail("Path.subPath with identical from/to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(3,2);
            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

Examples of org.apache.jackrabbit.spi.Path.subPath()

            fail("Path.subPath with from > to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(-1, 2);
            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {

Examples of org.apache.jackrabbit.spi.Path.subPath()

            fail("Path.subPath with from == -1 to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
        try {
            p.subPath(1, p.getLength()+1);
            fail("Path.subPath with to > length to must throw IllegalArumentException");
        } catch (IllegalArgumentException e) {
            // ok
        }
    }

Examples of org.apache.jackrabbit.spi.Path.subPath()

        JcrPath[] tests = JcrPath.getTests();
        for (int i = 0; i < tests.length; i++) {
            if (tests[i].isValid() && !tests[i].isNormalized()) {
                Path p = resolver.getQPath(tests[i].path);
                try {
                    p.subPath(0, p.getLength());
                    fail("Path.subPath on a non-normalized path to must throw IllegalArumentException");
                } catch (RepositoryException e) {
                    // ok
                }
            }

Examples of org.apache.lucene.facet.taxonomy.CategoryPath.subpath()

              parentNode.label = parent;
              parentNode.subResults = new ArrayList<FacetResultNode>();
              parentNode.subResults.add(childNode);
              mergedNodes.put(parent, parentNode);
              childNode = parentNode;
              parent = parent.subpath(parent.length - 1);
            }

            // at least one parent was added, so link the final (existing)
            // parent with the child
            if (parent.length > 0) {

Examples of org.apache.lucene.facet.taxonomy.CategoryPath.subpath()

        CategoryPath cp = cats[i];
        int numres = numResults == null ? 2 : numResults[i];
        // for each drill-down, add itself as well as its parent as requests, so
        // we get the drill-sideways
        facetRequests.add(new CountFacetRequest(cp, numres));
        CountFacetRequest parent = new CountFacetRequest(cp.subpath(cp.length - 1), numres);
        if (!facetRequests.contains(parent) && parent.categoryPath.length > 0) {
          facetRequests.add(parent);
        }
      }
    }

Examples of org.apache.lucene.facet.taxonomy.CategoryPath.subpath()

                CategoryPath cp = newCategory();
                cats.add(cp);
                // add all prefixes to values
                int level = cp.length;
                while (level > 0) {
                  String s = cp.subpath(level).toString('/');
                  values.put(s, s);
                  --level;
                }
              }
              facetFields.addFields(doc, cats);

Examples of org.apache.lucene.facet.taxonomy.CategoryPath.subpath()

              int value = random.nextInt(range);
              CategoryPath cp = new CategoryPath(Integer.toString(value / 1000), Integer.toString(value / 10000),
                  Integer.toString(value / 100000), Integer.toString(value));
              int ord = tw.addCategory(cp);
              assertTrue("invalid parent for ordinal " + ord + ", category " + cp, tw.getParent(ord) != -1);
              String l1 = cp.subpath(1).toString('/');
              String l2 = cp.subpath(2).toString('/');
              String l3 = cp.subpath(3).toString('/');
              String l4 = cp.subpath(4).toString('/');
              values.put(l1, l1);
              values.put(l2, l2);
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.