grails.doc.dropdown.Snapshot.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grails-docs Show documentation
Show all versions of grails-docs Show documentation
Grails Web Application Framework
package grails.doc.dropdown
class Snapshot implements Comparable {
private String text
int getMilestoneVersion() {
text.replace("M", "").toInteger()
}
int getReleaseCandidateVersion() {
text.replace("RC", "").toInteger()
}
boolean isBuildSnapshot() {
text.endsWith("BUILD-SNAPSHOT")
}
boolean isReleaseCandidate() {
text.startsWith("RC")
}
boolean isMilestone() {
text.startsWith("M")
}
Snapshot(String text) {
this.text = text
}
@Override
int compareTo(Snapshot o) {
if (this.buildSnapshot && !o.buildSnapshot) {
return 1
} else if (!this.buildSnapshot && o.buildSnapshot) {
return -1
} else if (this.buildSnapshot && o.buildSnapshot) {
return 0
}
if (this.releaseCandidate && !o.releaseCandidate) {
return 1
} else if (!this.releaseCandidate && o.releaseCandidate) {
return -1
} else if (this.releaseCandidate && o.releaseCandidate) {
return this.releaseCandidateVersion <=> o.releaseCandidateVersion
}
if (this.milestone && !o.milestone) {
return 1
} else if (!this.milestone && o.milestone) {
return -1
} else if (this.milestone && o.milestone) {
return this.milestoneVersion <=> o.milestoneVersion
}
return 0
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy