diff options
author | linyuh <linyuh@google.com> | 2017-12-27 17:02:37 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2017-12-27 17:03:47 -0800 |
commit | 183cb71663320f16149d83eeebaff7795a4b55f2 (patch) | |
tree | bc8bfcce809257b3ddbb423a9808082292b9f6a3 /java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java | |
parent | fc81a030a7b4f6d4a497f71aed593d398795e7da (diff) |
Remove field prefixes.
Test: Existing tests
PiperOrigin-RevId: 180230450
Change-Id: I0b2589cfeeaef81e42a04efa48af24b4e4d0e95f
Diffstat (limited to 'java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java')
-rw-r--r-- | java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java index 3f302c65f..c0256a5d8 100644 --- a/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java +++ b/java/com/android/incallui/answer/impl/classifier/HistoryEvaluator.java @@ -17,7 +17,6 @@ package com.android.incallui.answer.impl.classifier; import android.os.SystemClock; - import java.util.ArrayList; /** @@ -28,27 +27,27 @@ class HistoryEvaluator { private static final float HISTORY_FACTOR = 0.9f; private static final float EPSILON = 1e-5f; - private final ArrayList<Data> mStrokes = new ArrayList<>(); - private final ArrayList<Data> mGestureWeights = new ArrayList<>(); - private long mLastUpdate; + private final ArrayList<Data> strokes = new ArrayList<>(); + private final ArrayList<Data> gestureWeights = new ArrayList<>(); + private long lastUpdate; public HistoryEvaluator() { - mLastUpdate = SystemClock.elapsedRealtime(); + lastUpdate = SystemClock.elapsedRealtime(); } public void addStroke(float evaluation) { decayValue(); - mStrokes.add(new Data(evaluation)); + strokes.add(new Data(evaluation)); } public void addGesture(float evaluation) { decayValue(); - mGestureWeights.add(new Data(evaluation)); + gestureWeights.add(new Data(evaluation)); } /** Calculates the weighted average of strokes and adds to it the weighted average of gestures */ public float getEvaluation() { - return weightedAverage(mStrokes) + weightedAverage(mGestureWeights); + return weightedAverage(strokes) + weightedAverage(gestureWeights); } private float weightedAverage(ArrayList<Data> list) { @@ -71,16 +70,16 @@ class HistoryEvaluator { private void decayValue() { long time = SystemClock.elapsedRealtime(); - if (time <= mLastUpdate) { + if (time <= lastUpdate) { return; } // All weights are multiplied by HISTORY_FACTOR after each INTERVAL milliseconds. - float factor = (float) Math.pow(HISTORY_FACTOR, (time - mLastUpdate) / INTERVAL); + float factor = (float) Math.pow(HISTORY_FACTOR, (time - lastUpdate) / INTERVAL); - decayValue(mStrokes, factor); - decayValue(mGestureWeights, factor); - mLastUpdate = time; + decayValue(strokes, factor); + decayValue(gestureWeights, factor); + lastUpdate = time; } private void decayValue(ArrayList<Data> list, float factor) { |