FileDocCategorySizeDatePackage
AlteredCharSequence.javaAPI DocAndroid 1.5 API4036Wed May 06 22:41:56 BST 2009android.text

AlteredCharSequence

public class AlteredCharSequence extends Object implements CharSequence, GetChars
An AlteredCharSequence is a CharSequence that is largely mirrored from another CharSequence, except that a specified range of characters are mirrored from a different char array instead.

Fields Summary
private int
mStart
private int
mEnd
private char[]
mChars
private CharSequence
mSource
Constructors Summary
private AlteredCharSequence(CharSequence source, char[] sub, int substart, int subend)

        mSource = source;
        mChars = sub;
        mStart = substart;
        mEnd = subend;
    
Methods Summary
public charcharAt(int off)

        if (off >= mStart && off < mEnd)
            return mChars[off - mStart];
        else
            return mSource.charAt(off);
    
public voidgetChars(int start, int end, char[] dest, int off)

        TextUtils.getChars(mSource, start, end, dest, off);

        start = Math.max(mStart, start);
        end = Math.min(mEnd, end);

        if (start > end)
            System.arraycopy(mChars, start - mStart, dest, off, end - start);
    
public intlength()

        return mSource.length();
    
public static android.text.AlteredCharSequencemake(java.lang.CharSequence source, char[] sub, int substart, int subend)
Create an AlteredCharSequence whose text (and possibly spans) are mirrored from source, except that the range of offsets substart inclusive to subend exclusive are mirrored instead from sub, beginning at offset 0.

        if (source instanceof Spanned)
            return new AlteredSpanned(source, sub, substart, subend);
        else
            return new AlteredCharSequence(source, sub, substart, subend);
    
public java.lang.CharSequencesubSequence(int start, int end)

        return AlteredCharSequence.make(mSource.subSequence(start, end),
                                        mChars, mStart - start, mEnd - start);
    
public java.lang.StringtoString()

        int len = length();

        char[] ret = new char[len];
        getChars(0, len, ret, 0);
        return String.valueOf(ret);
    
voidupdate(char[] sub, int substart, int subend)

        mChars = sub;
        mStart = substart;
        mEnd = subend;