Refactor previous commit; remove duplications
This commit is contained in:
parent
e0bca455ae
commit
7b4e653723
|
@ -173,40 +173,31 @@ public class Version implements Comparable<Version> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int comparePreReleaseVersions(Version other) {
|
private int comparePreReleaseVersions(Version other) {
|
||||||
int result;
|
if (preReleaseVersion == null ^ other.getPreReleaseVersion() == null) {
|
||||||
if (preReleaseVersion == null &&
|
return preReleaseVersion == null ? 1 : -1;
|
||||||
other.getPreReleaseVersion() == null) {
|
|
||||||
result = 0;
|
|
||||||
} else if (preReleaseVersion == null ||
|
|
||||||
other.getPreReleaseVersion() == null) {
|
|
||||||
result = preReleaseVersion == null ? 1 : -1;
|
|
||||||
} else {
|
} else {
|
||||||
result = compareAlphaNumericVersions(
|
return compareAlphaNumericVersions(
|
||||||
preReleaseVersion,
|
preReleaseVersion,
|
||||||
other.getPreReleaseVersion()
|
other.getPreReleaseVersion()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compareBuildVersions(Version other) {
|
private int compareBuildVersions(Version other) {
|
||||||
int result;
|
if (buildVersion == null ^ other.getBuildVersion() == null) {
|
||||||
if (buildVersion == null &&
|
return buildVersion == null ? -1 : 1;
|
||||||
other.getBuildVersion()== null) {
|
|
||||||
result = 0;
|
|
||||||
} else if (buildVersion == null ||
|
|
||||||
other.getBuildVersion()== null) {
|
|
||||||
result = buildVersion == null ? -1 : 1;
|
|
||||||
} else {
|
} else {
|
||||||
result = compareAlphaNumericVersions(
|
return compareAlphaNumericVersions(
|
||||||
buildVersion,
|
buildVersion,
|
||||||
other.getBuildVersion()
|
other.getBuildVersion()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int compareAlphaNumericVersions(String thisOp, String otherOp) {
|
private int compareAlphaNumericVersions(String thisOp, String otherOp) {
|
||||||
|
if (thisOp == null && otherOp == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
String[] thisIdents = thisOp.split("\\.");
|
String[] thisIdents = thisOp.split("\\.");
|
||||||
String[] otherIdents = otherOp.split("\\.");
|
String[] otherIdents = otherOp.split("\\.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user