summaryrefslogtreecommitdiffstats
path: root/src/org
diff options
context:
space:
mode:
authorDavid A. Madore <david+git@madore.org>2010-04-29 01:03:38 +0200
committerDavid A. Madore <david+git@madore.org>2010-04-29 01:03:38 +0200
commit5f2628201cd1ad8d9129011d923f2923b8b4b3b9 (patch)
tree8e3923442a6631468f7d4a208d75e2cbdca695cf /src/org
parentc01f6ce7f6c70b72ceef439996c146f7b4744f98 (diff)
downloadUnicodeMap-5f2628201cd1ad8d9129011d923f2923b8b4b3b9.tar.gz
UnicodeMap-5f2628201cd1ad8d9129011d923f2923b8b4b3b9.tar.bz2
UnicodeMap-5f2628201cd1ad8d9129011d923f2923b8b4b3b9.zip
This is Java: we have the Math.min and Math.max functions!
Diffstat (limited to 'src/org')
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeCharacter.java6
-rw-r--r--src/org/madore/android/unicodeMap/UnicodeDatabase.java4
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 )