Package org.htmlparser.lexer

Examples of org.htmlparser.lexer.PageIndex


        super (name);
    }

    public void testAppend1 ()
    {
        PageIndex index;
        int pos;
        int[] list;

        index = new PageIndex (null);

        for (int i = 0; i < 10000; i++)
        {
            pos = index.row (i);
            assertTrue ("append not at end", pos == i);
            assertTrue ("wrong position", pos == index.add (i));
        }

        list = index.get ();
        for (int i = 0; i < 10000; i++)
            assertTrue ("wrong value", list[i] == i);
    }
View Full Code Here


            assertTrue ("wrong value", list[i] == i);
    }

    public void testAppend2 ()
    {
        PageIndex index;
        int pos;
        int[] list;

        index = new PageIndex (null);

        for (int i = 0; i < 10000; i++)
        {
            pos = index.row (i + 42);
            assertTrue ("append not at end", pos == i);
            assertTrue ("wrong position", pos == index.add (i + 42));
        }

        list = index.get ();
        for (int i = 0; i < 10000; i++)
            assertTrue ("wrong value", list[i] == i + 42);
    }
View Full Code Here

            assertTrue ("wrong value", list[i] == i + 42);
    }

    public void testAppend3 ()
    {
        PageIndex index;
        int pos;
        int[] list;

        index = new PageIndex (null);

        for (int i = 0; i < 10000; i++)
        {
            pos = index.row (i * 42);
            assertTrue ("append not at end", pos == i);
            assertTrue ("wrong position", pos == index.add (i * 42));
        }

        list = index.get ();
        for (int i = 0; i < 10000; i++)
            assertTrue ("wrong value", list[i] == i * 42);
    }
View Full Code Here

            assertTrue ("wrong value", list[i] == i * 42);
    }

    public void testInsert ()
    {
        PageIndex index;
        double d;
        int n;
        int pos;
        int[] list;

        index = new PageIndex (null);

        for (int i = 0; i < 10000; i++)
        {
            d = Math.random ();
            d -= 0.5;
            n = (int)(d * 100838);
            pos = index.row (n);

            // test for correct position
            if (0 <= pos - 1)
                assertTrue ("search error less " + pos + " " + index.elementAt (pos - 1) + " " + n, index.elementAt (pos - 1) <= n);
            if (pos + 1 < index.size ())
                assertTrue ("search error greater " + pos + " " + index.elementAt (pos + 1) + " " + n, index.elementAt (pos + 1) > n);
        }

        list = index.get ();
        n = Integer.MIN_VALUE;
        for (int i = 0; i < list.length; i++)
        {
            assertTrue ("wrong order", list[i] > n);
            n = list[i];
View Full Code Here

TOP

Related Classes of org.htmlparser.lexer.PageIndex

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.