Package org.apache.commons.jxpath.ri.model

Examples of org.apache.commons.jxpath.ri.model.NodePointer


                InfoSetUtil.stringValue(getArg3().computeValue(context));
            symbols =
                context.getJXPathContext().getDecimalFormatSymbols(symbolsName);
        }
        else {
            NodePointer pointer = context.getCurrentNodePointer();
            Locale locale;
            if (pointer != null) {
                locale = pointer.getLocale();
            }
            else {
                locale = context.getJXPathContext().getLocale();
            }
            symbols = new DecimalFormatSymbols(locale);
View Full Code Here


        JXPathContext context,
        String path1,
        String path2,
        int expected)
    {
        NodePointer np1 = (NodePointer) context.getPointer(path1);
        NodePointer np2 = (NodePointer) context.getPointer(path2);
        int res = np1.compareTo(np2);
        if (res < 0) {
            res = -1;
        }
        else if (res > 0) {
View Full Code Here

    private boolean constructIterator() {
        HashSet set = new HashSet();
        ArrayList list = new ArrayList();
        while (nextSet()) {
            while (nextNode()) {
                NodePointer pointer = getCurrentNodePointer();
                if (!set.contains(pointer)) {
                    Pointer cln = (Pointer) pointer.clone();
                    set.add(cln);
                    list.add(cln);
                }
            }
        }
View Full Code Here

    /**
     * Tests comparing child node pointers for child nodes.
     */
    public void testCompareChildNodePointersChildren()
    {
        NodePointer p1 = new ConfigurationNodePointer(pointer, root.getChild(1));
        NodePointer p2 = new ConfigurationNodePointer(pointer, root.getChild(3));
        assertEquals("Incorrect order", -1, pointer.compareChildNodePointers(
                p1, p2));
        assertEquals("Incorrect symmetric order", 1, pointer
                .compareChildNodePointers(p2, p1));
    }
View Full Code Here

     */
    public void testCompareChildNodePointersAttributes()
    {
        root.addAttribute(new DefaultConfigurationNode("attr1", "test1"));
        root.addAttribute(new DefaultConfigurationNode("attr2", "test2"));
        NodePointer p1 = new ConfigurationNodePointer(pointer, root
                .getAttribute(0));
        NodePointer p2 = new ConfigurationNodePointer(pointer, root
                .getAttribute(1));
        assertEquals("Incorrect order", -1, pointer.compareChildNodePointers(
                p1, p2));
        assertEquals("Incorrect symmetric order", 1, pointer
                .compareChildNodePointers(p2, p1));
View Full Code Here

     * tests comparing child node pointers for both child and attribute nodes.
     */
    public void testCompareChildNodePointersChildAndAttribute()
    {
        root.addAttribute(new DefaultConfigurationNode("attr1", "test1"));
        NodePointer p1 = new ConfigurationNodePointer(pointer, root.getChild(2));
        NodePointer p2 = new ConfigurationNodePointer(pointer, root
                .getAttribute(0));
        assertEquals("Incorrect order for attributes", 1, pointer
                .compareChildNodePointers(p1, p2));
        assertEquals("Incorrect symmetric order for attributes", -1, pointer
                .compareChildNodePointers(p2, p1));
View Full Code Here

     * the parent node.
     */
    public void testCompareChildNodePointersInvalidChildren()
    {
        ConfigurationNode node = root.getChild(1);
        NodePointer p1 = new ConfigurationNodePointer(pointer, node.getChild(1));
        NodePointer p2 = new ConfigurationNodePointer(pointer, node.getChild(3));
        assertEquals("Non child nodes could be sorted", 0, pointer
                .compareChildNodePointers(p1, p2));
        assertEquals("Non child nodes could be sorted symmetrically", 0,
                pointer.compareChildNodePointers(p2, p1));
    }
View Full Code Here

     * Tests the attribute flag.
     */
    public void testIsAttribute()
    {
        ConfigurationNode node = new DefaultConfigurationNode("test", "testval");
        NodePointer p = new ConfigurationNodePointer(pointer, node);
        assertFalse("Node is an attribute", p.isAttribute());
        node.setAttribute(true);
        assertTrue("Node is no attribute", p.isAttribute());
    }
View Full Code Here

     */
    public void testIsLeave()
    {
        assertFalse("Root node is leaf", pointer.isLeaf());

        NodePointer p = pointer;
        while (!p.isLeaf())
        {
            ConfigurationNode node = (ConfigurationNode) p.getNode();
            assertTrue("Node has no children", node.getChildrenCount() > 0);
            p = new ConfigurationNodePointer(p, node.getChild(0));
        }
        assertTrue("Node has children", ((ConfigurationNode) p.getNode())
                .getChildrenCount() == 0);
    }
View Full Code Here

        assertEquals("Iterator count differs from children count", node
                .getChildrenCount(), iteratorSize(it));

        for (int index = 1; it.setPosition(index); index++)
        {
            NodePointer pchild = it.getNodePointer();
            assertEquals("Wrong child", node.getChild(index - 1), pchild
                    .getNode());
            checkIterators(pchild);
        }

        it = p.attributeIterator(new QName(null, "*"));
        assertEquals("Iterator count differs from attribute count", node
                .getAttributeCount(), iteratorSize(it));
        for (int index = 1; it.setPosition(index); index++)
        {
            NodePointer pattr = it.getNodePointer();
            assertTrue("Node pointer is no attribute", pattr.isAttribute());
            assertEquals("Wrong attribute", node.getAttribute(index - 1), pattr
                    .getNode());
            checkIterators(pattr);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.jxpath.ri.model.NodePointer

Copyright © 2018 www.massapicom. 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.