Examples of preceding()


Examples of java.text.BreakIterator.preceding()

                    }
                    return (offset < 0) ? null : getWord(offset);
                case AccessibleText.SENTENCE:
                    BreakIterator bi = BreakIterator.getSentenceInstance();
                    bi.setText(getText());
                    offset = bi.preceding(index);
                    offset = bi.previous() + 1;
                    return (offset < 0) ? null : getLine(offset);
                default:
                    return null;
            }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        String content = null;

        content = doc.getText(0, doc.getLength());
        bi.setText(content);

        int iteratorPrevWord = bi.preceding(pos);
        while (iteratorPrevWord > 0
                && ((content.charAt(iteratorPrevWord) == ' '
                    || content.charAt(iteratorPrevWord) == '\n')
                    || content.charAt(iteratorPrevWord) == '\t')) {
            iteratorPrevWord = bi.preceding(iteratorPrevWord);
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        int iteratorPrevWord = bi.preceding(pos);
        while (iteratorPrevWord > 0
                && ((content.charAt(iteratorPrevWord) == ' '
                    || content.charAt(iteratorPrevWord) == '\n')
                    || content.charAt(iteratorPrevWord) == '\t')) {
            iteratorPrevWord = bi.preceding(iteratorPrevWord);
        }
        return iteratorPrevWord == -1 ? 0 : iteratorPrevWord;
    }

    public static final boolean isBidirectional(final Document document) {
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        }
        if (bi.isBoundary(fullIndex)) {
            return Character.isWhitespace(s.array[fullIndex])
                   ? index + 1 : index;
        }
        int prev = bi.preceding(fullIndex);
        if (prev == bi.first()) {
            return index;
        }
        return prev - offset;
    }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        content = doc.getText(0, doc.getLength());
        bi.setText(content);
        int iteratorWordStart = pos;
        if (pos < length - 1) {
            iteratorWordStart = bi.preceding(pos + 1);
        } else {
             bi.last();
             iteratorWordStart = bi.previous();
        }
        return iteratorWordStart;
View Full Code Here

Examples of java.text.BreakIterator.preceding()

            breaker.setText(s);

            // Backward search should start from end+1 unless there's NO end+1
            int startFrom = end + (pend > end ? 1 : 0);
            for (;;) {
                startFrom = breaker.preceding(s.offset + (startFrom - pstart))
                          + (pstart - s.offset);
                if (startFrom > start) {
                    // The break spot is within the view
                    bs[ix++] = startFrom;
                } else {
View Full Code Here

Examples of java.text.BreakIterator.preceding()

                    words.setText(s);
                    int end = findWordLimit(index, words, PREVIOUS, s);
                    if (end == BreakIterator.DONE) {
                        return null;
                    }
                    int start = words.preceding(end);
                    if (start == BreakIterator.DONE) {
                        return null;
                    }
                    return s.substring(start, end);
                }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        }
        else if (p1 + 1 == parent1) {
            // assert(s.count > 1)
            breakPoint = breaker.following(s.offset + s.count - 2);
            if (breakPoint >= s.count + s.offset) {
                breakPoint = breaker.preceding(s.offset + s.count - 1);
            }
        }
        else {
            breakPoint = breaker.preceding(p1 - parent0 + s.offset + 1);
        }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

            if (breakPoint >= s.count + s.offset) {
                breakPoint = breaker.preceding(s.offset + s.count - 1);
            }
        }
        else {
            breakPoint = breaker.preceding(p1 - parent0 + s.offset + 1);
        }

        int retValue = -1;

        if (breakPoint != BreakIterator.DONE) {
View Full Code Here

Examples of java.text.BreakIterator.preceding()

                    // if the last character in the search string isn't a space,
                    // we can't split on it (looks bad). Search for a previous
                    // break character
                    if (end == limit + 1) {
                        if (!Character.isWhitespace(buf.charAt(lineStart + end))) {
                            end = breaks.preceding(end - 1);
                        }
                    }

                    // if the last character is a space, replace it with a \n
                    if (end != BreakIterator.DONE && end == limit + 1) {
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.