diff options
author | Hans Boehm <hboehm@google.com> | 2015-10-10 00:18:41 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-10-10 00:18:41 +0000 |
commit | 1a78db27efd1814e00b3a1af620a3a6900f60287 (patch) | |
tree | fdf85a6f1f752d07ccdd822d9fb32fc584d5f04e /src/com/android/calculator2/CalculatorResult.java | |
parent | 0f3d460e948ba8fce7a72c74ee05458bb431ee68 (diff) | |
parent | 492d496dc01b452973b05ffd3c11a33d2e86bd5b (diff) | |
download | android_packages_apps_ExactCalculator-1a78db27efd1814e00b3a1af620a3a6900f60287.tar.gz android_packages_apps_ExactCalculator-1a78db27efd1814e00b3a1af620a3a6900f60287.tar.bz2 android_packages_apps_ExactCalculator-1a78db27efd1814e00b3a1af620a3a6900f60287.zip |
am 492d496d: am b13daf10: Evaluator.java and CalculatorExpr.java cleanup
* commit '492d496dc01b452973b05ffd3c11a33d2e86bd5b':
Evaluator.java and CalculatorExpr.java cleanup
Diffstat (limited to 'src/com/android/calculator2/CalculatorResult.java')
-rw-r--r-- | src/com/android/calculator2/CalculatorResult.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/calculator2/CalculatorResult.java b/src/com/android/calculator2/CalculatorResult.java index 1efa67b..289e13d 100644 --- a/src/com/android/calculator2/CalculatorResult.java +++ b/src/com/android/calculator2/CalculatorResult.java @@ -335,9 +335,9 @@ public class CalculatorResult extends AlignedTextView { /* * Return the most significant digit position in the given string or Evaluator.INVALID_MSD. - * Unlike Evaluator.getMsdPos, we treat a final 1 as significant. + * Unlike Evaluator.getMsdIndexOf, we treat a final 1 as significant. */ - public static int getNaiveMsdIndex(String s) { + public static int getNaiveMsdIndexOf(String s) { int len = s.length(); for (int i = 0; i < len; ++i) { char c = s.charAt(i); @@ -349,14 +349,14 @@ public class CalculatorResult extends AlignedTextView { } // Format a result returned by Evaluator.getString() into a single line containing ellipses - // (if appropriate) and an exponent (if appropriate). prec is the value that was passed to - // getString and thus identifies the significance of the rightmost digit. + // (if appropriate) and an exponent (if appropriate). precOffset is the value that was passed + // to getString and thus identifies the significance of the rightmost digit. // A value of 1 means the rightmost digits corresponds to tenths. // maxDigs is the maximum number of characters in the result. // We set lastDisplayedOffset[0] to the offset of the last digit actually appearing in // the display. // If forcePrecision is true, we make sure that the last displayed digit corresponds to - // prec, and allow maxDigs to be exceeded in assing the exponent. + // precOffset, and allow maxDigs to be exceeded in assing the exponent. // We add two distinct kinds of exponents: // (1) If the final result contains the leading digit we use standard scientific notation. // (2) If not, we add an exponent corresponding to an interpretation of the final result as @@ -369,7 +369,7 @@ public class CalculatorResult extends AlignedTextView { public String formatResult(String in, int precOffset, int maxDigs, boolean truncated, boolean negative, int lastDisplayedOffset[], boolean forcePrecision) { final int minusSpace = negative ? 1 : 0; - final int msdIndex = truncated ? -1 : getNaiveMsdIndex(in); // INVALID_MSD is OK. + final int msdIndex = truncated ? -1 : getNaiveMsdIndexOf(in); // INVALID_MSD is OK. final int decIndex = in.indexOf('.'); String result = in; lastDisplayedOffset[0] = precOffset; |