Package java.text

Examples of java.text.BreakIterator.first()


            StringBuffer sb = new StringBuffer(stringLength +
                    ((stringLength / wrapLength) * 2 * lineSeparator.length()));
            BreakIterator lineIterator = BreakIterator.getLineInstance();
            lineIterator.setText(string);
            int start = lineIterator.first();
            int lineStart = start;

            for (int end = lineIterator.next(); end != BreakIterator.DONE;
                        start = end, end = lineIterator.next())
            {
View Full Code Here


                    line = BreakIterator.getLineInstance(c.getLocale());
                } else {
                    line = BreakIterator.getLineInstance();
                }
                line.setText(segment);
                int start = line.first();
                for (int end = line.next();
                     end != BreakIterator.DONE;
                     start = end, end = line.next()) {
                    if (end > start) {
                        span = Math.max(span,
View Full Code Here

        // assume @tag signifies end of sentence
        text = text.replaceFirst("(?ms)\\n\\s*@(see|param|throws|return|author|since|exception|version|deprecated|todo)\\s.*", "").trim();
        // Comment Summary using first sentence (Locale sensitive)
        BreakIterator boundary = BreakIterator.getSentenceInstance(Locale.getDefault()); // todo - allow locale to be passed in
        boundary.setText(text);
        int start = boundary.first();
        int end = boundary.next();
        if (start > -1 && end > -1) {
            // need to abbreviate this comment for the summary
            text = text.substring(start, end);
        }
View Full Code Here

    boundary.setText(text);

    StringBuffer trial = new StringBuffer();
    StringBuffer real = new StringBuffer("<html><center>");

    int start = boundary.first();
    for (int end=boundary.next(); end!=BreakIterator.DONE; start=end, end=boundary.next()) {
      String word = text.substring(start, end);
      trial.append(word);
      int trialWidth = SwingUtilities.computeStringWidth(fm, trial.toString());
      if (trialWidth > containerWidth) {
View Full Code Here

        }
        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

        try {
            bi.setText(ad.getText(0, ad.getLength()));
        } catch (BadLocationException e) {
        }
        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 {
View Full Code Here

        int length = ad.getLength();
        try {
            bi.setText(ad.getText(0, length));
        } catch (BadLocationException e) {
        }
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesWordEnd = 0;
            int iteratorWordEnd = bi.following(i);
            try {
                utilitiesWordEnd = Utilities.getWordEnd(c, i);
View Full Code Here

            content = ad.getText(0, ad.getLength());
            bi.setText(content);
        } catch (BadLocationException e) {
        }
        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
View Full Code Here

            content = ad.getText(0, ad.getLength());
            bi.setText(content);
        } catch (BadLocationException e) {
        }
        assertNotNull(content);
        bi.first();
        for (int i = 0; i < length; i++) {
            int utilitiesNextWord = 0;
            int iteratorNextWord = bi.following(i);
            while (iteratorNextWord < length
                    && ((content.charAt(iteratorNextWord) == ' ' || content
View Full Code Here

        for(j = i + 1; j < s.length() && Character.isWhitespace(s.charAt(j)); j++) { }
        if(j < s.length())
        {
            BreakIterator breakiterator = BreakIterator.getLineInstance();
            breakiterator.setText(s.substring(j, s.length()));
            int k = breakiterator.first();
            k = breakiterator.next();
            if(k != -1)
            {
                if(s.charAt((k + j) - 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.