Skip to content

Commit

Permalink
fixed files form Time #1
Browse files Browse the repository at this point in the history
  • Loading branch information
tdurieux committed Mar 7, 2017
1 parent 6c5b00c commit 4c83b05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 10 additions & 1 deletion projects/Time/1/org/joda/time/Partial.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,20 @@ public Partial(DateTimeFieldType[] types, int[] values, Chronology chronology) {
DateTimeFieldType loopType = types[i];
DurationField loopUnitField = loopType.getDurationType().getField(iChronology);
if (i > 0) {
if (loopUnitField.isSupported() == false) {
if (lastUnitField.isSupported()) {
throw new IllegalArgumentException("Types array must be in order largest-smallest: " +
types[i - 1].getName() + " < " + loopType.getName());
} else {
throw new IllegalArgumentException("Types array must not contain duplicate unsupported: " +
types[i - 1].getName() + " and " + loopType.getName());
}
}
int compare = lastUnitField.compareTo(loopUnitField);
if (compare < 0) {
throw new IllegalArgumentException("Types array must be in order largest-smallest: " +
types[i - 1].getName() + " < " + loopType.getName());
} else if (compare == 0) {
} else if (compare == 0 && lastUnitField.equals(loopUnitField)) {
if (types[i - 1].getRangeDurationType() == null) {
if (loopType.getRangeDurationType() == null) {
throw new IllegalArgumentException("Types array must not contain duplicate: " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,6 @@ public long getUnitMillis() {
* @return zero always
*/
public int compareTo(DurationField durationField) {
if (durationField.isSupported()) {
return 1;
}
return 0;
}

Expand Down

0 comments on commit 4c83b05

Please sign in to comment.