Fixed compareTo
This commit is contained in:
parent
71ad29c9ce
commit
b36310c650
|
@ -117,6 +117,11 @@ public final class LinkedEntityImpl extends PropertyElementImpl implements Linke
|
|||
Objects.equals(description, other.description);
|
||||
}
|
||||
|
||||
protected int compareIntegers(Integer thisInt, Integer otherInt) {
|
||||
Integer thisInteger = thisInt == null ? Integer.MAX_VALUE : thisInt;
|
||||
Integer otherInteger = otherInt == null ? Integer.MAX_VALUE : otherInt;
|
||||
return thisInteger.compareTo(otherInteger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(LinkedEntity other) {
|
||||
|
@ -148,12 +153,12 @@ public final class LinkedEntityImpl extends PropertyElementImpl implements Linke
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = max.compareTo(o.max);
|
||||
ret = compareIntegers(max, o.max);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = min.compareTo(o.min);
|
||||
ret = compareIntegers(min, o.min);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -206,6 +206,12 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
|
|||
Objects.equals(propertyTypeName.toString(), other.propertyTypeName.toString());
|
||||
}
|
||||
|
||||
protected int compareIntegers(Integer thisInt, Integer otherInt) {
|
||||
Integer thisInteger = thisInt == null ? Integer.MAX_VALUE : thisInt;
|
||||
Integer otherInteger = otherInt == null ? Integer.MAX_VALUE : otherInt;
|
||||
return thisInteger.compareTo(otherInteger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PropertyDefinition other) {
|
||||
if (this == other) {
|
||||
|
@ -246,12 +252,12 @@ public final class PropertyDefinitionImpl implements PropertyDefinition {
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = max.compareTo(o.max);
|
||||
ret = compareIntegers(max, o.max);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = min.compareTo(o.min);
|
||||
ret = compareIntegers(min, o.min);
|
||||
if(ret != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue