Java 类java.lang.CharSequence 实例源码

项目:talkback    文件:CollectionStateTest.java   
private void assertGrid(@CollectionState.CollectionTransition int collectionTransition,
        CharSequence gridName,
        boolean rowChanged,
        boolean colChanged,
        int itemRow,
        int itemCol,
        CharSequence rowName,
        CharSequence colName,
        @CollectionState.TableHeadingType int headingType) {
    assertEquals(Role.ROLE_GRID, mCollectionState.getCollectionRole());

    assertEquals(collectionTransition, mCollectionState.getCollectionTransition());
    assertCharSequenceEquals(gridName, mCollectionState.getCollectionName());
    assertEquals(rowChanged,
            (mCollectionState.getRowColumnTransition() & CollectionState.TYPE_ROW) != 0);
    assertEquals(colChanged,
            (mCollectionState.getRowColumnTransition() & CollectionState.TYPE_COLUMN) != 0);

    CollectionState.TableItemState itemState = mCollectionState.getTableItemState();
    assertEquals(itemRow, itemState.getRowIndex());
    assertEquals(itemCol, itemState.getColumnIndex());
    assertCharSequenceEquals(rowName, itemState.getRowName());
    assertCharSequenceEquals(colName, itemState.getColumnName());
    assertEquals(headingType, itemState.getHeadingType());
}
项目:VarJ    文件:UnitFormat.java   
private long readLong (CharSequence csq, ParsePosition pos) {
    final int length = csq.length();
    int result = 0;
    boolean isNegative = false;
    while (pos.getIndex() < length) {
        char c = csq.charAt(pos.getIndex());
        if (c == '-') {
            isNegative = true;
        } else if ((c >= '0') && (c <= '9')) {
            result = result * 10 + (c - '0');
        } else {
            break;
        }
        pos.setIndex(pos.getIndex()+1);
    }
    return isNegative ? -result : result;
}
项目:VarJ    文件:UnitFormat.java   
private void append(Appendable appendable, CharSequence symbol,
        int pow, int root) throws IOException {
    appendable.append(symbol);
    if ((pow != 1) || (root != 1)) {
        // Write exponent.
        if ((pow == 2) && (root == 1)) {
            appendable.append('²'); // Square
        } else if ((pow == 3) && (root == 1)) {
            appendable.append('³'); // Cubic
        } else {
            // Use general exponent form.
            appendable.append('^');
            appendable.append(String.valueOf(pow));
            if (root != 1) {
                appendable.append(':');
                appendable.append(String.valueOf(root));
            }
        }
    }
}
项目:auto-value-bundle    文件:AutoValue_TestClassBundled.java   
AutoValue_TestClassBundled(Bundle bundle, byte someByte, boolean someBoolean, short someShort,
        int someInt, long someLong, char someChar, float someFloat, double someDouble,
        String someString, CharSequence someCharSequence, Parcelable someParcelable,
        ArrayList<Parcelable> someParcelableArrayList,
        SparseArray<Parcelable> someParcelableSparseArray, Serializable someSerializable,
        ArrayList<Integer> someIntegerArrayList, ArrayList<String> someStringArrayList,
        ArrayList<CharSequence> someCharSequenceArrayList, byte[] someByteArray,
        short[] someShortArray, char[] someCharArray, float[] someFloatArray,
        UnknownObject someUnknownObject, ArrayList<UnknownObject> someUnknownObjectList,
        TestEnum testEnum) {
    super(bundle,
            someByte,
            someBoolean,
            someShort,
            someInt,
            someLong,
            someChar,
            someFloat,
            someDouble,
            someString,
            someCharSequence,
            someParcelable,
            someParcelableArrayList,
            someParcelableSparseArray,
            someSerializable,
            someIntegerArrayList,
            someStringArrayList,
            someCharSequenceArrayList,
            someByteArray,
            someShortArray,
            someCharArray,
            someFloatArray,
            someUnknownObject,
            someUnknownObjectList,
            testEnum);
}
项目:auto-value-bundle    文件:AutoValue_TestClassBundledGCM.java   
AutoValue_TestClassBundledGCM(Bundle bundle, byte someByte, boolean someBoolean, short someShort,
        int someInt, long someLong, char someChar, float someFloat, double someDouble,
        String someString, CharSequence someCharSequence, Parcelable someParcelable,
        ArrayList<Parcelable> someParcelableArrayList,
        SparseArray<Parcelable> someParcelableSparseArray, Serializable someSerializable,
        ArrayList<Integer> someIntegerArrayList, ArrayList<String> someStringArrayList,
        ArrayList<CharSequence> someCharSequenceArrayList, byte[] someByteArray,
        short[] someShortArray, char[] someCharArray, float[] someFloatArray,
        UnknownObject someUnknownObject, ArrayList<UnknownObject> someUnknownObjectList,
        TestEnum testEnum) {
    super(bundle,
            someByte,
            someBoolean,
            someShort,
            someInt,
            someLong,
            someChar,
            someFloat,
            someDouble,
            someString,
            someCharSequence,
            someParcelable,
            someParcelableArrayList,
            someParcelableSparseArray,
            someSerializable,
            someIntegerArrayList,
            someStringArrayList,
            someCharSequenceArrayList,
            someByteArray,
            someShortArray,
            someCharArray,
            someFloatArray,
            someUnknownObject,
            someUnknownObjectList,
            testEnum);
}
项目:auto-value-bundle    文件:AutoValue_TestClassBundledGCM.java   
public static TestClassBundledGCM unbundle(Bundle bundle, Gson gson) {
    return new AutoValue_TestClassBundledGCM(
            bundle,
            Byte.parseByte(bundle.getString("some_byte")),
            Boolean.parseBoolean(bundle.getString("some_boolean")),
            Short.parseShort(bundle.getString("some_short")),
            Integer.parseInt(bundle.getString("some_int")),
            Long.parseLong(bundle.getString("some_long")),
            bundle.getString("some_char").charAt(0),
            Float.parseFloat(bundle.getString("some_float")),
            Double.parseDouble(bundle.getString("some_double")),
            bundle.getString("some_string"),
            bundle.getString("some_char_sequence"),
            gson.fromJson(bundle.getString("some_parcelable"), Parcelable.class),
            gson.fromJson(bundle.getString("some_parcelable_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Parcelable>>(){}.getType()),
            gson.fromJson(bundle.getString("some_parcelable_sparse_array"), new com.google.common.reflect.TypeToken<android.util.SparseArray<Parcelable>>(){}.getType()),
            gson.fromJson(bundle.getString("some_serializable"), Serializable.class),
            gson.fromJson(bundle.getString("some_integer_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<Integer>>(){}.getType()),
            gson.fromJson(bundle.getString("some_string_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<String>>(){}.getType()),
            gson.fromJson(bundle.getString("some_char_sequence_array_list"), new com.google.common.reflect.TypeToken<java.util.ArrayList<CharSequence>>(){}.getType()),
            toPrimitive(gson.fromJson(bundle.getString("some_byte_array"), Byte[].class)),
            toPrimitive(gson.fromJson(bundle.getString("some_short_array"), Short[].class)),
            toPrimitive(gson.fromJson(bundle.getString("some_char_array"), Character[].class)),
            toPrimitive(gson.fromJson(bundle.getString("some_float_array"), Float[].class)),
            gson.fromJson(bundle.getString("some_unknown_object"), new com.google.common.reflect.TypeToken<UnknownObject>(){}.getType()),
            gson.fromJson(bundle.getString("some_unknown_object_list"), new com.google.common.reflect.TypeToken<ArrayList<UnknownObject>>(){}.getType()),
            gson.fromJson(bundle.getString("test_enum"), new com.google.common.reflect.TypeToken<TestEnum>(){}.getType()));
}
项目:nix-idea    文件:NixParserUtil.java   
public static int indentationLevel(CharSequence c) {
    int i = 0;
    while(i < c.length() && c.charAt(i) == ' ') {
        i++;
    }
    return i;
}
项目:grenade    文件:Detail3ActivityNavigator.java   
/**
 * Constructor with required params */
public Detail3ActivityNavigator(String arg1, int arg2, long arg3, short arg4, float arg5, double arg6, boolean arg7, Parcelable arg8, Bundle arg9, CharSequence arg10, char arg11, byte arg12, int[] arg13, long[] arg14, short[] arg15, float[] arg16, double[] arg17, boolean[] arg18, char[] arg19, byte[] arg20, String[] arg21, Parcelable[] arg22, CharSequence[] arg23, Serializable arg24, ArrayList<String> arg25, ArrayList<CharSequence> arg26, ArrayList<Integer> arg27, ArrayList<Parcelable> arg28) {
  this.arg1 = arg1;
  this.arg2 = arg2;
  this.arg3 = arg3;
  this.arg4 = arg4;
  this.arg5 = arg5;
  this.arg6 = arg6;
  this.arg7 = arg7;
  this.arg8 = arg8;
  this.arg9 = arg9;
  this.arg10 = arg10;
  this.arg11 = arg11;
  this.arg12 = arg12;
  this.arg13 = arg13;
  this.arg14 = arg14;
  this.arg15 = arg15;
  this.arg16 = arg16;
  this.arg17 = arg17;
  this.arg18 = arg18;
  this.arg19 = arg19;
  this.arg20 = arg20;
  this.arg21 = arg21;
  this.arg22 = arg22;
  this.arg23 = arg23;
  this.arg24 = arg24;
  this.arg25 = arg25;
  this.arg26 = arg26;
  this.arg27 = arg27;
  this.arg28 = arg28;
}
项目:AndroidAutoTourGuide    文件:MessageReplyBroadcastReceiver.java   
@Override
public void onReceive(Context context, Intent intent) {
    Log.d ( TAG, "onReceive()..." + new Date() ) ;

    String voiceReplyContent = "No reply";

    Bundle remoteInputBundle = RemoteInput.getResultsFromIntent(intent);
    Log.d ( TAG, "onReceive() remoteInputBundle=" + remoteInputBundle ) ;
    if (remoteInputBundle != null) {
         CharSequence charSequence = remoteInputBundle.getCharSequence(EXTRA_VOICE_REPLY) ;
        voiceReplyContent = charSequence.toString() ;
    }

    Log.d ( TAG, "onReceive()... voiceReplyContent=" + voiceReplyContent ) ;

    // originate notification that will end up showing on the handheld
    Notification notification = new Notification.Builder(context)
            .setSmallIcon(R.drawable.alarm36)
            .setContentTitle("From Head unit")
            .setContentText( voiceReplyContent )
            .setColor( context.getResources().getColor(R.color.colorPrimary)).build() ;

    NotificationManager notificationManager =
            (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.notify( 7200, notification );

}
项目:aidl2    文件:ConcreteListMethodTypeParam$$AidlClientImpl.java   
@Override
public <T extends CharSequence> Stack<T> methodWithVectorParamAndStackReturn(Vector<Parcelable> objectList) throws RemoteException {
    Parcel data = Parcel.obtain();
    Parcel reply = Parcel.obtain();
    try {
        data.writeInterfaceToken(ConcreteListMethodTypeParam$$AidlServerImpl.DESCRIPTOR);

        if (objectList == null) {
            data.writeInt(-1);
        } else {
            data.writeInt(objectList.size());
            for (Parcelable objectListElement : objectList) {
                data.writeParcelable(objectListElement, 0);
            }
        }

        delegate.transact(ConcreteListMethodTypeParam$$AidlServerImpl.TRANSACT_methodWithVectorParamAndStackReturn, data, reply, 0);
        reply.readException();

        final Stack<CharSequence> returnValueCollection;
        final int returnValueSize = reply.readInt();
        if (returnValueSize < 0) {
            returnValueCollection = null;
        } else {
            returnValueCollection = new Stack<>();
            for (int j = 0; j < returnValueSize; j++) {
                returnValueCollection.add(TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(reply));
            }
        }
        return (Stack) returnValueCollection;
    } finally {
        data.recycle();
        reply.recycle();
    }
}
项目:aidl2    文件:ConcreteListMethodTypeParam$$AidlServerImpl.java   
@Override
protected boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
    switch(code) {
        case TRANSACT_methodWithVectorParamAndStackReturn: {
            data.enforceInterface(this.getInterfaceDescriptor());

            final Vector<Parcelable> objectListCollection;
            final int objectListSize = data.readInt();
            if (objectListSize < 0) {
                objectListCollection = null;
            } else {
                objectListCollection = new Vector<>(objectListSize);
                for (int j = 0; j < objectListSize; j++) {
                    objectListCollection.add(data.readParcelable(getClass().getClassLoader()));
                }
            }

            final Collection<? extends CharSequence> returnValue = delegate.methodWithVectorParamAndStackReturn(objectListCollection);
            reply.writeNoException();

            if (returnValue == null) {
                reply.writeInt(-1);
            } else {
                reply.writeInt(returnValue.size());
                for (CharSequence returnValueElement : returnValue) {
                    TextUtils.writeToParcel(returnValueElement, reply, Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
                }
            }

            return true;
        }
    }
    return super.onTransact(code, data, reply, flags);
}
项目:NucleosomePatternClassifier    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:nixitch    文件:NixParserUtil.java   
public static int indentationLevel(CharSequence c) {
    int i = 0;
    while(i < c.length() && c.charAt(i) == ' ') {
        i++;
    }
    return i;
}
项目:ActivityScreens    文件:ListsActivityScreen.java   
public ListsActivityScreen(ArrayList<String> list1, ArrayList<Integer> list2, ArrayList<CharSequence> list3, ArrayList<Parcelable> list4, ArrayList<ParcelableClass> list5, SparseArray<Parcelable> list6, SparseArray<ParcelableClass> list7) {
    this.list1 = list1;
    this.list2 = list2;
    this.list3 = list3;
    this.list4 = list4;
    this.list5 = list5;
    this.list6 = list6;
    this.list7 = list7;
}
项目:ActivityScreens    文件:ClassesActivityScreen.java   
public ClassesActivityScreen(String field1, CharSequence field2, CharSequence[] field3, Bundle field4, Parcelable field5, Parcelable[] field6, ParcelableClass field7, String[] field8, ParcelableClass[] field9, Serializable field91, SerializableClass field92) {
    this.field1 = field1;
    this.field2 = field2;
    this.field3 = field3;
    this.field4 = field4;
    this.field5 = field5;
    this.field6 = field6;
    this.field7 = field7;
    this.field8 = field8;
    this.field9 = field9;
    this.field91 = field91;
    this.field92 = field92;
}
项目:talkback    文件:TextFormattersTest.java   
private void internalTestChangedTextFormatter_deleteCharacter(String text) throws Exception {
    if (text.length() < 1) {
        throw new IllegalArgumentException("This test case can only handle non-empty strings");
    }

    // Set up the test.
    setContentView(R.layout.text_activity);
    getViewForId(R.id.username).requestFocus();
    mInstrumentation.waitForIdleSync();
    mInstrumentation.sendStringSync(text);
    waitForAccessibilityIdleSync();

    // Delete the last character.
    startRecordingUtterances();
    mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_DEL);
    waitForAccessibilityIdleSync();

    final CharSequence lastChar = text.substring(text.length() - 1);
    final CharSequence expectedSpeech = SpeechCleanupUtils.cleanUp(mAppCtx, lastChar) + " "
            + mAppCtx.getString(R.string.value_text_removed);
    final CharSequenceFilter textFilter = new CharSequenceFilter().addContainsIgnoreCase(
            expectedSpeech);
    final UtteranceFilter utteranceFilter = new UtteranceFilter().addTextFilter(textFilter);
    final Utterance utterance = stopRecordingUtterancesAfterMatch(utteranceFilter);

    assertNotNull("Saw matching utterance", utterance);
}
项目:talkback    文件:CollectionStateTest.java   
private void assertList(@CollectionState.CollectionTransition int collectionTransition,
        CharSequence listName,
        boolean rowChanged) {
    assertEquals(Role.ROLE_LIST, mCollectionState.getCollectionRole());

    assertEquals(collectionTransition, mCollectionState.getCollectionTransition());
    assertCharSequenceEquals(listName, mCollectionState.getCollectionName());
    assertEquals(rowChanged,
            (mCollectionState.getRowColumnTransition() & CollectionState.TYPE_ROW) != 0);
}
项目:talkback    文件:CollectionStateTest.java   
private void assertList(@CollectionState.CollectionTransition int collectionTransition,
        CharSequence listName,
        boolean rowChanged,
        int itemIndex,
        int totalItems,
        boolean isItemHeader) {
    assertList(collectionTransition, listName, rowChanged);

    CollectionState.ListItemState itemState = mCollectionState.getListItemState();
    assertEquals(itemIndex, itemState.getIndex());
    assertEquals(totalItems, mCollectionState.getCollectionRowCount());
    assertEquals(isItemHeader, itemState.isHeading());
}
项目:talkback    文件:CollectionStateTest.java   
private void assertCharSequenceEquals(CharSequence a, CharSequence b) {
    if (a == null) {
        assertNull(b);
    } else if (b == null) {
        assertNull(a);
    } else {
        assertTrue(a.toString().equals(b.toString()));
    }
}
项目:VarJ    文件:UnitFormat.java   
@SuppressWarnings("unchecked")
public Unit<? extends Quantity> parseSingleUnit(CharSequence csq, ParsePosition pos) 
        throws ParseException {
    int startIndex = pos.getIndex();
    String name = readIdentifier(csq, pos);
    Unit unit = unitFor(name);
    check(unit != null, name + " not recognized", csq, startIndex);
    return unit;            
}
项目:VarJ    文件:UnitFormat.java   
private int nextToken(CharSequence csq, ParsePosition pos) {
    final int length = csq.length();
    while (pos.getIndex() < length) {
        char c = csq.charAt(pos.getIndex());
        if (isUnitIdentifierPart(c)) {
            return IDENTIFIER;
        } else if (c == '(') {
            return OPEN_PAREN;
        } else if (c == ')') {
            return CLOSE_PAREN;
        } else if ((c == '^') || (c == '¹') || (c == '²') || (c == '³')) {
            return EXPONENT;
        } else if (c == '*') {
            char c2 = csq.charAt(pos.getIndex() + 1);
            if (c2 == '*') {
                return EXPONENT;
            } else {
                return MULTIPLY;
            }
        } else if (c == '·') {
            return MULTIPLY;
        } else if (c == '/') {
            return DIVIDE;
        } else if (c == '+') {
            return PLUS;
        } else if ((c == '-') || Character.isDigit(c)) {
            int index = pos.getIndex()+1;
            while ((index < length) && 
                   (Character.isDigit(c) || (c == '-') || (c == '.') || (c == 'E'))) {
                c = csq.charAt(index++);
                if (c == '.') {
                    return FLOAT;
                }
            }
            return INTEGER;
        }
        pos.setIndex(pos.getIndex() + 1);
    }
    return EOF;
}
项目:VarJ    文件:UnitFormat.java   
private void check(boolean expr, String message, CharSequence csq,
        int index) throws ParseException {
    if (!expr) {
        throw new ParseException(message + " (in " + csq
                + " at index " + index + ")", index);
    }
}
项目:VarJ    文件:UnitFormat.java   
private double readDouble (CharSequence csq, ParsePosition pos) {
    final int length = csq.length();
    int start = pos.getIndex();
    int end = start+1;
    while (end < length) {
        if ("012356789+-.E".indexOf(csq.charAt(end)) < 0) {
            break;
        }
        end += 1;
    }
    pos.setIndex(end+1);
    return Double.parseDouble(csq.subSequence(start,end).toString());
}
项目:VarJ    文件:UnitFormat.java   
private String readIdentifier(CharSequence csq, ParsePosition pos) {
    final int length = csq.length();
    int start = pos.getIndex();
    int i = start;
    while ((++i < length) && isUnitIdentifierPart(csq.charAt(i))) { }
    pos.setIndex(i);
    return csq.subSequence(start, i).toString();
}
项目:wikit    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:tctm    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:mallet    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:charity-android    文件:RoundedBackgroundSpan.java   
@Override
public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint)
{
    RectF rect = new RectF(x, top, x + (int) measureText(paint, text, start, end), bottom);
    paint.setColor(backgroundColor);
    canvas.drawRoundRect(rect, 5, 5, paint);
    paint.setColor(foregroundColor);
    canvas.drawText(text, start, end, x, y, paint);
}
项目:reach-banner    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:Mallet    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:LDA-studies    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:MixLDA    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:org.openntf.domino    文件:QName.java   
/**
 * Returns the qualified name corresponding to the specified namespace URI 
 * and local name.
 * 
 * @param namespaceURI the URI reference or <code>null</code> if none.
 * @param localName the local name.
 * @see #toString()
 */
public static QName valueOf(CharSequence namespaceURI,
        CharSequence localName) {
    if (namespaceURI == null)
        return QName.valueOf(localName);
    TextBuilder tmp = new TextBuilder();
    tmp.append('{');
    tmp.append(namespaceURI);
    tmp.append('}');
    tmp.append(localName);
    return QName.valueOf(tmp);
}
项目:MALLET    文件:CharSequenceLexer.java   
public void setCharSequence (CharSequence input)
{
    this.input = input;
    this.matchText = null;
    this.matchTextFresh = false;
    if (input != null)
        this.matcher = regex.matcher(input);
}
项目:NucleosomePatternClassifier    文件:CharSequenceLexer.java   
public CharSequenceLexer (CharSequence input, Pattern regex)
{
    this (regex);
    setCharSequence (input);
}
项目:NucleosomePatternClassifier    文件:CharSequenceLexer.java   
public CharSequenceLexer (CharSequence input, String regex)
{
    this (input, Pattern.compile (regex));
}
项目:NucleosomePatternClassifier    文件:CharSequenceLexer.java   
public CharSequence getCharSequence()
{
    return input;
}
项目:intellij-ce-playground    文件:MainActivity.java   
public static Iterable<String> split(String on, CharSequence target) {
    return Splitter.on("-").split(target);
}
项目:talkback    文件:TextFormattersTest.java   
@MediumTest
public void testSelectedTextFormatter_volumeButtonFeedbackNotDuplicated() {
    setContentView(R.layout.text_activity);
    getViewForId(R.id.username).requestFocus();
    mInstrumentation.waitForIdleSync();
    mInstrumentation.sendStringSync("abc");
    waitForAccessibilityIdleSync();

    mTalkBack.getCursorController().setCursor(getNodeForId(R.id.username));
    waitForAccessibilityIdleSync(); // Wait after the ["Edit text", "abc"] feedback.

    startRecordingUtterances();
    sendVolumeKey(KeyEvent.KEYCODE_VOLUME_DOWN);
    mInstrumentation.waitForIdleSync();
    waitForAccessibilityIdleSync();

    sendVolumeKey(KeyEvent.KEYCODE_VOLUME_DOWN);
    mInstrumentation.waitForIdleSync();
    waitForAccessibilityIdleSync();

    sendVolumeKey(KeyEvent.KEYCODE_VOLUME_DOWN);
    mInstrumentation.waitForIdleSync();
    waitForAccessibilityIdleSync();

    CharSequenceFilter textFilter = new CharSequenceFilter().addContainsIgnoreCase("a");
    UtteranceFilter utteranceFilter = new UtteranceFilter().addTextFilter(textFilter);
    stopRecordingUtterancesAfterMatch(utteranceFilter);

    List<Utterance> utteranceHistory = getUtteranceHistory();
    int countB = 0;
    int countC = 0;
    for (Utterance utterance : utteranceHistory) {
        for (CharSequence spoken : utterance.getSpoken()) {
            if (spoken.toString().contains("b")) {
                countB++;
            }
            if (spoken.toString().contains("c")) {
                countC++;
            }
        }
    }

    assertEquals(1, countB);
    assertEquals(1, countC);
}
项目:VarJ    文件:UnitFormat.java   
private Exponent readExponent (CharSequence csq, ParsePosition pos) {
    char c = csq.charAt(pos.getIndex());
    if (c == '^') {
        pos.setIndex(pos.getIndex()+1);
    } else if (c == '*') {
        pos.setIndex(pos.getIndex()+2);
    }
    final int length = csq.length();
    int pow = 0;
    boolean isPowNegative = false;
    int root = 0;
    boolean isRootNegative = false;
    boolean isRoot = false;
    while (pos.getIndex() < length) {
        c = csq.charAt(pos.getIndex());
        if (c == '¹') {
            if (isRoot) {
                root = root * 10 + 1;
            } else {
                pow = pow * 10 + 1;
            }
        } else if (c == '²') {
            if (isRoot) {
                root = root * 10 + 2;
            } else {
                pow = pow * 10 + 2;
            }
        } else if (c == '³') {
            if (isRoot) {
                root = root * 10 + 3;
            } else {
                pow = pow * 10 + 3;
            }
        } else if (c == '-') {
            if (isRoot) {
                isRootNegative = true;
            } else {
                isPowNegative = true;
            }
        } else if ((c >= '0') && (c <= '9')) {
            if (isRoot) {
                root = root * 10 + (c - '0');
            } else {
                pow = pow * 10 + (c - '0');
            }
        } else if (c == ':') {
            isRoot = true;
        } else {
            break;
        }
        pos.setIndex(pos.getIndex()+1);
    }
    if (pow == 0) pow = 1;
    if (root == 0) root = 1;
    return new Exponent(isPowNegative ? -pow : pow, 
                      isRootNegative ? -root : root);
}