From ad78058a93492d4f114c6a6eb56177be9231a9eb Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Wed, 8 Jan 2014 14:11:56 +0900 Subject: [PATCH] Rename InputPointers.addPointer and ResizableIntArray.add Change-Id: I5580250c91b29f93ed886b080ce33845b3b67ace --- .../internal/GestureStrokeDrawingPoints.java | 16 ++++++++-------- .../android/inputmethod/latin/InputPointers.java | 11 +++++------ .../android/inputmethod/latin/WordComposer.java | 2 +- .../latin/utils/ResizableIntArray.java | 3 +-- .../inputmethod/latin/InputPointersTests.java | 2 +- .../latin/utils/ResizableIntArrayTests.java | 6 +++--- 6 files changed, 19 insertions(+), 21 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/internal/GestureStrokeDrawingPoints.java b/java/src/com/android/inputmethod/keyboard/internal/GestureStrokeDrawingPoints.java index 7618682da..7d09e9d2f 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/GestureStrokeDrawingPoints.java +++ b/java/src/com/android/inputmethod/keyboard/internal/GestureStrokeDrawingPoints.java @@ -157,19 +157,19 @@ public final class GestureStrokeDrawingPoints { for (int i = 1; i < segments; i++) { final float t = i / (float)segments; mInterpolator.interpolate(t); - eventTimes.add(d1, (int)(dt * t) + t1); - xCoords.add(d1, (int)mInterpolator.mInterpolatedX); - yCoords.add(d1, (int)mInterpolator.mInterpolatedY); + eventTimes.addAt(d1, (int)(dt * t) + t1); + xCoords.addAt(d1, (int)mInterpolator.mInterpolatedX); + yCoords.addAt(d1, (int)mInterpolator.mInterpolatedY); if (GestureTrailDrawingPoints.DEBUG_SHOW_POINTS) { - types.add(d1, GestureTrailDrawingPoints.POINT_TYPE_INTERPOLATED); + types.addAt(d1, GestureTrailDrawingPoints.POINT_TYPE_INTERPOLATED); } d1++; } - eventTimes.add(d1, pt[p2]); - xCoords.add(d1, px[p2]); - yCoords.add(d1, py[p2]); + eventTimes.addAt(d1, pt[p2]); + xCoords.addAt(d1, px[p2]); + yCoords.addAt(d1, py[p2]); if (GestureTrailDrawingPoints.DEBUG_SHOW_POINTS) { - types.add(d1, GestureTrailDrawingPoints.POINT_TYPE_SAMPLED); + types.addAt(d1, GestureTrailDrawingPoints.POINT_TYPE_SAMPLED); } } return lastInterpolatedDrawIndex; diff --git a/java/src/com/android/inputmethod/latin/InputPointers.java b/java/src/com/android/inputmethod/latin/InputPointers.java index 6b489da30..c3bcf3785 100644 --- a/java/src/com/android/inputmethod/latin/InputPointers.java +++ b/java/src/com/android/inputmethod/latin/InputPointers.java @@ -55,15 +55,14 @@ public final class InputPointers { mTimes.fill(lastTime, fromIndex, fillLength); } - // TODO: Rename this method to addPointerAt - public void addPointer(int index, int x, int y, int pointerId, int time) { - mXCoordinates.add(index, x); - mYCoordinates.add(index, y); - mPointerIds.add(index, pointerId); + public void addPointerAt(int index, int x, int y, int pointerId, int time) { + mXCoordinates.addAt(index, x); + mYCoordinates.addAt(index, y); + mPointerIds.addAt(index, pointerId); if (LatinImeLogger.sDBG || DEBUG_TIME) { fillWithLastTimeUntil(index); } - mTimes.add(index, time); + mTimes.addAt(index, time); } @UsedForTesting diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java index f078c7346..b4f2d1a58 100644 --- a/java/src/com/android/inputmethod/latin/WordComposer.java +++ b/java/src/com/android/inputmethod/latin/WordComposer.java @@ -186,7 +186,7 @@ public final class WordComposer { // (See {@link #setBatchInputWord}). if (!mIsBatchMode) { // TODO: Set correct pointer id and time - mInputPointers.addPointer(newIndex, keyX, keyY, 0, 0); + mInputPointers.addPointerAt(newIndex, keyX, keyY, 0, 0); } } mIsFirstCharCapitalized = isFirstCharCapitalized( diff --git a/java/src/com/android/inputmethod/latin/utils/ResizableIntArray.java b/java/src/com/android/inputmethod/latin/utils/ResizableIntArray.java index 1811bcc03..64c9e2cff 100644 --- a/java/src/com/android/inputmethod/latin/utils/ResizableIntArray.java +++ b/java/src/com/android/inputmethod/latin/utils/ResizableIntArray.java @@ -34,8 +34,7 @@ public final class ResizableIntArray { throw new ArrayIndexOutOfBoundsException("length=" + mLength + "; index=" + index); } - // TODO: Rename this method to addAt. - public void add(final int index, final int val) { + public void addAt(final int index, final int val) { if (index < mLength) { mArray[index] = val; } else { diff --git a/tests/src/com/android/inputmethod/latin/InputPointersTests.java b/tests/src/com/android/inputmethod/latin/InputPointersTests.java index 4c67d1927..1a47cddf4 100644 --- a/tests/src/com/android/inputmethod/latin/InputPointersTests.java +++ b/tests/src/com/android/inputmethod/latin/InputPointersTests.java @@ -82,7 +82,7 @@ public class InputPointersTests extends AndroidTestCase { final int y = i * 2; final int pointerId = i * 3; final int time = i * 4; - src.addPointer(i, x, y, pointerId, time); + src.addPointerAt(i, x, y, pointerId, time); assertEquals("size after add at " + i, i + 1, src.getPointerSize()); } for (int i = 0; i < limit; i += step) { diff --git a/tests/src/com/android/inputmethod/latin/utils/ResizableIntArrayTests.java b/tests/src/com/android/inputmethod/latin/utils/ResizableIntArrayTests.java index 3efb70ac0..8f58e6873 100644 --- a/tests/src/com/android/inputmethod/latin/utils/ResizableIntArrayTests.java +++ b/tests/src/com/android/inputmethod/latin/utils/ResizableIntArrayTests.java @@ -67,7 +67,7 @@ public class ResizableIntArrayTests extends AndroidTestCase { final int limit = DEFAULT_CAPACITY * 10, step = DEFAULT_CAPACITY * 2; for (int i = 0; i < limit; i += step) { final int value = i; - src.add(i, value); + src.addAt(i, value); assertEquals("length after add at " + i, i + 1, src.getLength()); } for (int i = 0; i < limit; i += step) { @@ -93,7 +93,7 @@ public class ResizableIntArrayTests extends AndroidTestCase { final int index = DEFAULT_CAPACITY / 2; final int valueAddAt = 100; - src.add(index, valueAddAt); + src.addAt(index, valueAddAt); assertEquals("legth after add at " + index, index + 1, src.getLength()); assertEquals("value after add at " + index, valueAddAt, src.get(index)); assertEquals("value after add at 0", 0, src.get(0)); @@ -365,7 +365,7 @@ public class ResizableIntArrayTests extends AndroidTestCase { final int shiftAmount = 20; for (int i = 0; i < limit; ++i) { final int value = i; - src.add(i, value); + src.addAt(i, value); assertEquals("length after add at " + i, i + 1, src.getLength()); } src.shift(shiftAmount);