@Override
    public int following(int offset) {
        CharacterIterator text = getText();

        // if we have no cached break positions, or if "offset" is outside the
        // range covered by the cache, then dump the cache and call our
        // inherited following() method.  This will call other methods in this
        // class that may refresh the cache.
        if (fCachedBreakPositions == null || offset < fCachedBreakPositions[0] ||
                offset >= fCachedBreakPositions[fCachedBreakPositions.length - 1]) {
            fCachedBreakPositions = null;
            return rulesFollowing(offset);
        }

        // on the other hand, if "offset" is within the range covered by the
        // cache, then just search the cache for the first break position
        // after "offset"
        else {
            fPositionInCache = 0;
            while (fPositionInCache < fCachedBreakPositions.length
                   && offset >= fCachedBreakPositions[fPositionInCache])
                ++fPositionInCache;
            text.setIndex(fCachedBreakPositions[fPositionInCache]);
            return text.getIndex();
        }
    }
@ Override public int following ( int offset ) { CharacterIterator text = getText ( ) ; if ( fCachedBreakPositions == null || offset < fCachedBreakPositions [ 0 ] || offset >= fCachedBreakPositions [ fCachedBreakPositions . length - 1 ] ) { fCachedBreakPositions = null ; return rulesFollowing ( offset ) ; } else { fPositionInCache = 0 ; while ( fPositionInCache < fCachedBreakPositions . length && offset >= fCachedBreakPositions [ fPositionInCache ] ) ++ fPositionInCache ; text . setIndex ( fCachedBreakPositions [ fPositionInCache ] ) ; return text . getIndex ( ) ; } }
Sets the iterator to refer to the first boundary position following
the specified position.
@param offset The position from which to begin searching for a break position.
@return The position of the first break after the current position.