Rename InputPointers.addPointer and ResizableIntArray.add

Change-Id: I5580250c91b29f93ed886b080ce33845b3b67ace
main
Tadashi G. Takaoka 2014-01-08 14:11:56 +09:00
parent e13cc9d7e5
commit ad78058a93
6 changed files with 19 additions and 21 deletions

View File

@ -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;

View File

@ -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

View File

@ -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(

View File

@ -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 {

View File

@ -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) {

View File

@ -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);