FileDocCategorySizeDatePackage
SentenceSuggestionsInfo.javaAPI DocAndroid 5.1 API4915Thu Mar 12 22:22:10 GMT 2015android.view.textservice

SentenceSuggestionsInfo

public final class SentenceSuggestionsInfo extends Object implements android.os.Parcelable
This class contains a metadata of suggestions returned from a text service (e.g. {@link android.service.textservice.SpellCheckerService}). The text service uses this class to return the suggestions for a sentence. See {@link SuggestionsInfo} which is used for suggestions for a word. This class extends the functionality of {@link SuggestionsInfo} as far as this class enables you to put multiple {@link SuggestionsInfo}s on a sentence with the offsets and the lengths of all {@link SuggestionsInfo}s.

Fields Summary
private final SuggestionsInfo[]
mSuggestionsInfos
private final int[]
mOffsets
private final int[]
mLengths
public static final Parcelable.Creator
CREATOR
Used to make this class parcelable.
Constructors Summary
public SentenceSuggestionsInfo(SuggestionsInfo[] suggestionsInfos, int[] offsets, int[] lengths)
Constructor.

param
suggestionsInfos from the text service
param
offsets the array of offsets of suggestions
param
lengths the array of lengths of suggestions

        if (suggestionsInfos == null || offsets == null || lengths == null) {
            throw new NullPointerException();
        }
        if (suggestionsInfos.length != offsets.length || offsets.length != lengths.length) {
            throw new IllegalArgumentException();
        }
        final int infoSize = suggestionsInfos.length;
        mSuggestionsInfos = Arrays.copyOf(suggestionsInfos, infoSize);
        mOffsets = Arrays.copyOf(offsets, infoSize);
        mLengths = Arrays.copyOf(lengths, infoSize);
    
public SentenceSuggestionsInfo(android.os.Parcel source)

        final int infoSize = source.readInt();
        mSuggestionsInfos = new SuggestionsInfo[infoSize];
        source.readTypedArray(mSuggestionsInfos, SuggestionsInfo.CREATOR);
        mOffsets = new int[mSuggestionsInfos.length];
        source.readIntArray(mOffsets);
        mLengths = new int[mSuggestionsInfos.length];
        source.readIntArray(mLengths);
    
Methods Summary
public intdescribeContents()

        return 0;
    
public intgetLengthAt(int i)

param
i the id of {@link SuggestionsInfo}s this instance holds
return
the length of the specified {@link SuggestionsInfo}

        if (i >= 0 && i < mLengths.length) {
            return mLengths[i];
        }
        return -1;
    
public intgetOffsetAt(int i)

param
i the id of {@link SuggestionsInfo}s this instance holds
return
the offset of the specified {@link SuggestionsInfo}

        if (i >= 0 && i < mOffsets.length) {
            return mOffsets[i];
        }
        return -1;
    
public intgetSuggestionsCount()

return
the count of {@link SuggestionsInfo}s this instance holds.

        return mSuggestionsInfos.length;
    
public SuggestionsInfogetSuggestionsInfoAt(int i)

param
i the id of {@link SuggestionsInfo}s this instance holds.
return
a {@link SuggestionsInfo} at the specified id

        if (i >= 0 && i < mSuggestionsInfos.length) {
            return mSuggestionsInfos[i];
        }
        return null;
    
public voidwriteToParcel(android.os.Parcel dest, int flags)
Used to package this object into a {@link Parcel}.

param
dest The {@link Parcel} to be written.
param
flags The flags used for parceling.

        final int infoSize = mSuggestionsInfos.length;
        dest.writeInt(infoSize);
        dest.writeTypedArray(mSuggestionsInfos, 0);
        dest.writeIntArray(mOffsets);
        dest.writeIntArray(mLengths);