use of org.eclipse.n4js.semver.SemverUtils.VersionNumberDescriptor in project n4js by eclipse.
the class SemverConverter method simplifyHyphenRange.
private static List<SimpleVersion> simplifyHyphenRange(HyphenVersionRange hvr) {
VersionNumberDescriptor vndFrom = SemverUtils.getVersionNumberDescriptor(hvr.getFrom());
VersionNumberDescriptor vndTo = SemverUtils.getVersionNumberDescriptor(hvr.getTo());
VersionComparator toComparator = VersionComparator.SMALLER_EQUALS;
if (vndTo.minor == null || vndTo.patch == null) {
toComparator = VersionComparator.SMALLER;
}
return packRange(vndFrom, VersionComparator.GREATER_EQUALS, vndTo, toComparator);
}
use of org.eclipse.n4js.semver.SemverUtils.VersionNumberDescriptor in project n4js by eclipse.
the class SemverConverter method simplifyTilde.
private static List<SimpleVersion> simplifyTilde(SimpleVersion sv) {
VersionNumber caretVN = sv.getNumber();
VersionNumberDescriptor vnd = SemverUtils.getVersionNumberDescriptor(caretVN);
VersionNumberDescriptor vndTildeUpper = vnd.getTildeUpperBound();
return packRange(vnd, VersionComparator.GREATER_EQUALS, vndTildeUpper, VersionComparator.SMALLER);
}
use of org.eclipse.n4js.semver.SemverUtils.VersionNumberDescriptor in project n4js by eclipse.
the class SemverConverter method simplifySpecific.
private static List<SimpleVersion> simplifySpecific(SimpleVersion sv) {
if (sv == null || sv.getNumber() == null) {
return Collections.emptyList();
}
VersionNumber vn = sv.getNumber();
if (vn.getMajor().isWildcard()) {
VersionNumberDescriptor vnDescr = new VersionNumberDescriptor(0, 0, 0, null, null);
return pack(vnDescr, VersionComparator.GREATER_EQUALS);
}
int major = vn.getMajor().getNumber();
if (vn.getMinor() == null || vn.getMinor().isWildcard()) {
VersionNumberDescriptor fromVND = new VersionNumberDescriptor(major, 0, 0, null, null);
VersionNumberDescriptor toVND = new VersionNumberDescriptor(major + 1, 0, 0, null, null);
return packRange(fromVND, VersionComparator.GREATER_EQUALS, toVND, VersionComparator.SMALLER);
}
int minor = vn.getMinor().getNumber();
if (vn.getPatch() == null || vn.getPatch().isWildcard()) {
VersionNumberDescriptor fromVND = new VersionNumberDescriptor(major, minor, 0, null, null);
VersionNumberDescriptor toVND = new VersionNumberDescriptor(major, minor + 1, 0, null, null);
return packRange(fromVND, VersionComparator.GREATER_EQUALS, toVND, VersionComparator.SMALLER);
}
VersionNumberDescriptor vnDescriptor = SemverUtils.getVersionNumberDescriptor(vn);
return packRange(vnDescriptor, vnDescriptor);
}
use of org.eclipse.n4js.semver.SemverUtils.VersionNumberDescriptor in project n4js by eclipse.
the class SemverConverter method copyAndPack.
private static List<SimpleVersion> copyAndPack(SimpleVersion sv) {
VersionNumberDescriptor verDescr = SemverUtils.getVersionNumberDescriptor(sv.getNumber());
EList<VersionComparator> vComps = sv.getComparators();
return pack(verDescr, vComps.toArray(new VersionComparator[vComps.size()]));
}
use of org.eclipse.n4js.semver.SemverUtils.VersionNumberDescriptor in project n4js by eclipse.
the class SemverConverter method simplifyCaret.
private static List<SimpleVersion> simplifyCaret(SimpleVersion sv) {
VersionNumber caretVN = sv.getNumber();
VersionNumberDescriptor vnd = SemverUtils.getVersionNumberDescriptor(caretVN);
VersionNumberDescriptor vndCaretUpper = vnd.getCaretUpperBound();
return packRange(vnd, VersionComparator.GREATER_EQUALS, vndCaretUpper, VersionComparator.SMALLER);
}
Aggregations