Package com.googlecode.gaal.suffix.api.IntervalTree

Examples of com.googlecode.gaal.suffix.api.IntervalTree.Interval.label()


    private Interval findInterval(IntervalTree<? extends Interval> tree, String label) {
        Iterator<? extends Interval> iterator = tree.preorderIterator();
        while (iterator.hasNext()) {
            Interval interval = iterator.next();
            if (corpus.toString(interval.label(), "").equals(label)) {
                return interval;
            }
        }
        return null;
    }
View Full Code Here


    public void testSearch() {
        IntSequence pattern;
        Interval interval;
        pattern = new ArraySequence(new int[] { 3, 4 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 2, 1 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
View Full Code Here

        IntSequence pattern;
        Interval interval;
        pattern = new ArraySequence(new int[] { 3, 4 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 2, 1 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 1 });
View Full Code Here

        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 2, 1 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 1 });
        interval = lst.search(pattern);
        assertNull(interval);
    }
View Full Code Here

        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 2, 1 });
        interval = lst.search(pattern);
        System.out.printf("%s\t->%s\n", interval, interval.label());
        assertTrue(seqEquals(interval.label(), pattern));
        pattern = new ArraySequence(new int[] { 3, 4, 1 });
        interval = lst.search(pattern);
        assertNull(interval);
    }
   
View Full Code Here

        IntSequence pattern = new ArraySequence(patternToFind);
        IntSequence expected = new ArraySequence(expectedArray);
        System.out.println("Looking for : " + pattern);
        System.out.println("Expected: " + expected);
        Interval result = lst.longestSearch(pattern);
        System.out.println("Longest found: " + result.label());
        assertEquals(expected, result.label());
    }

    private boolean seqEquals(IntSequence sequence, IntSequence other) {
        if (sequence.size() != other.size())
View Full Code Here

        IntSequence expected = new ArraySequence(expectedArray);
        System.out.println("Looking for : " + pattern);
        System.out.println("Expected: " + expected);
        Interval result = lst.longestSearch(pattern);
        System.out.println("Longest found: " + result.label());
        assertEquals(expected, result.label());
    }

    private boolean seqEquals(IntSequence sequence, IntSequence other) {
        if (sequence.size() != other.size())
            return false;
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.