SentenceSuggestionsInfopublic final class SentenceSuggestionsInfo extends Object implements android.os.ParcelableThis 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 | CREATORUsed to make this class parcelable. |
Constructors Summary |
---|
public SentenceSuggestionsInfo(SuggestionsInfo[] suggestionsInfos, int[] offsets, int[] lengths)Constructor.
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 int | describeContents()
return 0;
| public int | getLengthAt(int i)
if (i >= 0 && i < mLengths.length) {
return mLengths[i];
}
return -1;
| public int | getOffsetAt(int i)
if (i >= 0 && i < mOffsets.length) {
return mOffsets[i];
}
return -1;
| public int | getSuggestionsCount()
return mSuggestionsInfos.length;
| public SuggestionsInfo | getSuggestionsInfoAt(int i)
if (i >= 0 && i < mSuggestionsInfos.length) {
return mSuggestionsInfos[i];
}
return null;
| public void | writeToParcel(android.os.Parcel dest, int flags)Used to package this object into a {@link Parcel}.
final int infoSize = mSuggestionsInfos.length;
dest.writeInt(infoSize);
dest.writeTypedArray(mSuggestionsInfos, 0);
dest.writeIntArray(mOffsets);
dest.writeIntArray(mLengths);
|
|