From 8d4a16efe6748118895e7c410469051f093df031 Mon Sep 17 00:00:00 2001 From: serso Date: Fri, 4 Mar 2016 22:33:10 +0100 Subject: [PATCH] Code reformat --- .../calculator/ToJsclTextProcessor.java | 2 +- .../common/search/StartsWithFinder.java | 45 +++++++++---------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java b/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java index 1a165def..9ea5744c 100644 --- a/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java +++ b/app/src/main/java/org/solovyev/android/calculator/ToJsclTextProcessor.java @@ -107,7 +107,7 @@ public class ToJsclTextProcessor implements TextProcessor { - private int i; + @Nonnull + private final String string; + private int offset; - @Nonnull - private final String targetString; + private StartsWithFinder(@Nonnull String string, int offset) { + this.string = string; + this.offset = offset; + } - private StartsWithFinder(@Nonnull String targetString, int i) { - this.targetString = targetString; - this.i = i; - } + @Nonnull + public static StartsWithFinder newFrom(@Nonnull String targetString, int i) { + return new StartsWithFinder(targetString, i); + } - @Nonnull - public static StartsWithFinder newFrom(@Nonnull String targetString, int i) { - return new StartsWithFinder(targetString, i); - } + @Nonnull + public static StartsWithFinder newInstance(@Nonnull String targetString) { + return newFrom(targetString, 0); + } - @Nonnull - public static StartsWithFinder newInstance(@Nonnull String targetString) { - return newFrom(targetString, 0); - } + @Override + public boolean apply(@Nullable String prefix) { + return prefix != null && string.startsWith(prefix, offset); + } - @Override - public boolean apply(@Nullable String s) { - return s != null && targetString.startsWith(s, i); - } - - public void setI(int i) { - this.i = i; - } + public void setOffset(int offset) { + this.offset = offset; + } }