diff options
Diffstat (limited to 'src/org/madore')
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeCharacter.java | 6 | ||||
-rw-r--r-- | src/org/madore/android/unicodeMap/UnicodeDatabase.java | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/org/madore/android/unicodeMap/UnicodeCharacter.java b/src/org/madore/android/unicodeMap/UnicodeCharacter.java index f3ff6d1..f399d2b 100644 --- a/src/org/madore/android/unicodeMap/UnicodeCharacter.java +++ b/src/org/madore/android/unicodeMap/UnicodeCharacter.java @@ -266,9 +266,9 @@ public class UnicodeCharacter implements UnicodeDisplayable { return ( codePoint>=this.from && codePoint<this.to ); } public int interCount(int from, int to) { - int from0 = (from<this.from)?this.from:from; - int to0 = (to>this.to)?this.to:to; - return (to0-from0>0) ? to0-from0 : 0; + int from0 = Math.max(this.from, from); + int to0 = Math.min(this.to, to); + return Math.max(to0-from0, 0); } public boolean inside(int from, int to) { return ( from >= this.from && to <= this.to ); diff --git a/src/org/madore/android/unicodeMap/UnicodeDatabase.java b/src/org/madore/android/unicodeMap/UnicodeDatabase.java index efdf5eb..d95501d 100644 --- a/src/org/madore/android/unicodeMap/UnicodeDatabase.java +++ b/src/org/madore/android/unicodeMap/UnicodeDatabase.java @@ -267,8 +267,8 @@ public class UnicodeDatabase { = new ArrayList<UnicodeCharacter>(rng.interCount(from, to)); else muchAnnoyance = true; - int from0 = (from<rng.getFrom())?rng.getFrom():from; - int to0 = (to>rng.getTo())?rng.getTo():to; + int from0 = Math.max(rng.getFrom(), from); + int to0 = Math.min(rng.getTo(), to); Iterable<UnicodeCharacter> rangeIt = new SpecialRangeIterable(rng, from0, to0); for ( UnicodeCharacter ch : rangeIt ) |