Package com.ctc.wstx.util

Examples of com.ctc.wstx.util.WordResolver


        TreeSet<String> set = new TreeSet<String>();
        for (int i = 0, len = words.length; i < len; ++i) {
            set.add(words[i]);
        }

        WordResolver wr = WordResolver.constructInstance(set);

        assertEquals(wr.size(), set.size());

        Iterator<String> it = set.iterator();

        // Let's first check if words that should be there, are:
        while (it.hasNext()) {
            String str = it.next();

            assertEquals(str, wr.find(str));
            // And then, let's make sure intern()ing isn't needed:
            assertEquals(str, wr.find(""+str));

            char[] strArr = str.toCharArray();
            char[] strArr2 = new char[strArr.length + 4];
            System.arraycopy(strArr, 0, strArr2, 3, strArr.length);
            assertEquals(str, wr.find(strArr, 0, str.length()));
            assertEquals(str, wr.find(strArr2, 3, str.length() + 3));
        }

        // And then that ones shouldn't be there aren't:
        for (int i = 0, len = missingWords.length; i < len; ++i) {
            checkNotFind(wr, missingWords[i]);
View Full Code Here


        TreeSet set = new TreeSet();
        for (int i = 0, len = words.length; i < len; ++i) {
            set.add(words[i]);
        }

        WordResolver wr = WordResolver.constructInstance(set);

        assertEquals(wr.size(), set.size());

        Iterator it = set.iterator();

        // Let's first check if words that should be there, are:
        while (it.hasNext()) {
            String str = (String) it.next();

            assertEquals(str, wr.find(str));
            // And then, let's make sure intern()ing isn't needed:
            assertEquals(str, wr.find(""+str));

            char[] strArr = str.toCharArray();
            char[] strArr2 = new char[strArr.length + 4];
            System.arraycopy(strArr, 0, strArr2, 3, strArr.length);
            assertEquals(str, wr.find(strArr, 0, str.length()));
            assertEquals(str, wr.find(strArr2, 3, str.length() + 3));
        }

        // And then that ones shouldn't be there aren't:
        for (int i = 0, len = missingWords.length; i < len; ++i) {
            checkNotFind(wr, missingWords[i]);
View Full Code Here

TOP

Related Classes of com.ctc.wstx.util.WordResolver

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.