1 | public boolean isGreaterThan(final DeweyDecimal other) {↵ | | 1 | public boolean isGreaterThanOrEqual(final DeweyDecimal other) {↵
|
2 | final int max = Math.max(other.components.length, components.length);↵ | | 2 | final int max = Math.max(other.components.length, components.length);↵
|
|
3 | for (int i = 0; i < max; i++) {↵ | | 3 | for (int i = 0; i < max; i++) {↵
|
4 | final int component1 = (i < components.length) ? components[ i ] : 0;↵ | | 4 | final int component1 = (i < components.length) ? components[ i ] : 0;↵
|
5 | final int component2 = (i < other.components.length) ? other.components[ i ] : 0;↵ | | 5 | final int component2 = (i < other.components.length) ? other.components[ i ] : 0;↵
|
|
6 | if (component2 > component1) {↵ | | 6 | if (component2 > component1) {↵
|
7 | return false;↵ | | 7 | return false;↵
|
8 | }↵ | | 8 | }↵
|
9 | if (component2 < component1) {↵ | | 9 | if (component2 < component1) {↵
|
10 | return true;↵ | | 10 | return true;↵
|
11 | }↵ | | 11 | }↵
|
12 | }↵ | | 12 | }↵
|
|
13 | return false; // Exact match↵ | | 13 | return true; // Exact match↵
|
14 | | | 14 |
|