Examples of preceding()


Examples of com.ibm.icu.text.RuleBasedBreakIterator.preceding()

        doTest(testString, 40, q, 31, "Thankyou.");
        q = lineIter1.preceding(25);
        doTest(testString, 25, q, 20, "I'am ");
        lineIter1.first();
        p = lineIter1.previous();
        q = lineIter1.preceding(sentIter1.first());
        if (p != BreakIterator.DONE || q != BreakIterator.DONE)
            errln("ERROR: previous()/preceding() at starting position returned #"
                    + p + " and " + q + " instead of 0\n");
    }
   
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()

          measuredState.textSuffix = truncateSuffx;
          done = true;
        }
        else
        {
          linePosition = breakIterator.preceding(linePosition);
          if (linePosition == BreakIterator.DONE)
          {
            //if the text suffix did not fit the line, only the part of it that fits will show

            //truncate the suffix
View Full Code Here

Examples of java.text.BreakIterator.preceding()

            // it could be that we have to add more than 1 line.
            int toAdd = (int) (Math.ceil((double) stringWidth / (double) maxWidth) - 1);
            lineCount+= toAdd;
            // we need to advance the startOffset so
            // we can start to search for a new line
            startOffset = bi.preceding(endOffset);
            bi.next();
          }
        } while((endOffset = bi.next()) != BreakIterator.DONE);
        // ensure that the rest of a line also gets a line
        lineCount++;
View Full Code Here

Examples of java.text.BreakIterator.preceding()

            return bi.last() - offset;
        }
        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()

        int iteratorWordStart = 0;
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesWordStart = 0;
            if (i < length - 1) {
                iteratorWordStart = bi.preceding(i + 1);
            } else {
                bi.last();
                iteratorWordStart = bi.previous();
            }
            try {
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        }
        assertNotNull(content);
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesPrevWord = 0;
            int iteratorPrevWord = bi.preceding(i);
            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(i);
            while (iteratorPrevWord > 0
                    && ((content.charAt(iteratorPrevWord) == ' ' || content
                            .charAt(iteratorPrevWord) == '\n') || content
                            .charAt(iteratorPrevWord) == '\t')) {
                iteratorPrevWord = bi.preceding(iteratorPrevWord);
            }
            try {
                utilitiesPrevWord = Utilities.getPreviousWord(c, i);
            } catch (BadLocationException e) {
            }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

    private String getLine(int index) {
        String result = null;
        BreakIterator bi = BreakIterator.getSentenceInstance();
        bi.setText(getText());
        int end = bi.following(index);
        int start = bi.preceding(end - 1);
        try {
            result = document.getText(start, end - start);
        } catch (BadLocationException e) {
            e.printStackTrace();
        }
View Full Code Here

Examples of java.text.BreakIterator.preceding()

        String content = null;
        content = document.getText(0, length);
        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
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.