From ce81716cc02421be19643eb1475021a5e8276cfc Mon Sep 17 00:00:00 2001 From: Sergey Solovyev Date: Wed, 5 Dec 2012 22:32:56 +0400 Subject: [PATCH] User exception fix --- .../android/calculator/math/MathType.java | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java index 4d5049e7..3a39d422 100644 --- a/core/src/main/java/org/solovyev/android/calculator/math/MathType.java +++ b/core/src/main/java/org/solovyev/android/calculator/math/MathType.java @@ -10,10 +10,9 @@ import jscl.NumeralBase; import jscl.math.function.Constants; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.android.calculator.Locator; import org.solovyev.common.JPredicate; -import org.solovyev.common.StartsWithFinder; -import org.solovyev.android.calculator.CalculatorParseException; import org.solovyev.common.collections.CollectionsUtils; import java.util.*; @@ -442,4 +441,26 @@ public enum MathType { this.i = i; } } + + private static class StartsWithFinder implements JPredicate { + + private int i; + + @NotNull + private final String targetString; + + public StartsWithFinder(@NotNull String targetString, int i) { + this.targetString = targetString; + this.i = i; + } + + @Override + public boolean apply(@Nullable String s) { + return s != null && targetString.startsWith(s, i); + } + + public void setI(int i) { + this.i = i; + } + } }