use of org.eclipse.n4js.semver.Semver.VersionNumber in project n4js by eclipse.
the class VersionTest method testCompareWithQualifier.
@Test
public void testCompareWithQualifier() {
VersionNumber lower = version(1, 2, 3, "alpha", null);
VersionNumber greater = version(1, 2, 3, "beta", null);
VersionNumber greatest = version(1, 2, 3);
RelationKind relationKind = RelationKind.SemverMatchAllowPrereleaseTags;
Assert.assertEquals(VersionNumberRelation.Equal, SemverMatcher.relation(lower, lower, relationKind));
Assert.assertEquals(VersionNumberRelation.Smaller, SemverMatcher.relation(lower, greater, relationKind));
Assert.assertEquals(VersionNumberRelation.Smaller, SemverMatcher.relation(lower, greatest, relationKind));
Assert.assertEquals(VersionNumberRelation.Greater, SemverMatcher.relation(greater, lower, relationKind));
Assert.assertEquals(VersionNumberRelation.Equal, SemverMatcher.relation(greater, greater, relationKind));
Assert.assertEquals(VersionNumberRelation.Smaller, SemverMatcher.relation(greater, greatest, relationKind));
Assert.assertEquals(VersionNumberRelation.Greater, SemverMatcher.relation(greatest, lower, relationKind));
Assert.assertEquals(VersionNumberRelation.Greater, SemverMatcher.relation(greatest, greater, relationKind));
Assert.assertEquals(VersionNumberRelation.Equal, SemverMatcher.relation(greatest, greatest, relationKind));
}
use of org.eclipse.n4js.semver.Semver.VersionNumber in project n4js by eclipse.
the class HyphenVersionRangeImpl method basicSetTo.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTo(VersionNumber newTo, NotificationChain msgs) {
VersionNumber oldTo = to;
to = newTo;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SemverPackage.HYPHEN_VERSION_RANGE__TO, oldTo, newTo);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.semver.Semver.VersionNumber in project n4js by eclipse.
the class VersionNumberImpl method equals.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean equals(final Object obj) {
if ((!(obj instanceof VersionNumber))) {
return false;
}
final VersionNumber vn = ((VersionNumber) obj);
boolean equals = true;
int _length = this.length();
int _length_1 = vn.length();
boolean _equals = (_length == _length_1);
equals = _equals;
for (int i = 0; (i < this.length()); i++) {
equals = (equals && this.getPart(i).equals(vn.getPart(i)));
}
equals = (equals && (Boolean.valueOf((this.getQualifier() == null)) == Boolean.valueOf((vn.getQualifier() == null))));
equals = (equals && ((this.getQualifier() == null) || this.getQualifier().equals(vn.getQualifier())));
return equals;
}
use of org.eclipse.n4js.semver.Semver.VersionNumber 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);
}
use of org.eclipse.n4js.semver.Semver.VersionNumber in project n4js by eclipse.
the class SemverConverter method packRange.
private static List<SimpleVersion> packRange(VersionNumberDescriptor vndFrom, VersionComparator vcFrom, VersionNumberDescriptor vndTo, VersionComparator vcTo) {
VersionNumber vnFrom = SemverUtils.createVersionNumber(vndFrom);
VersionNumber vnTo = SemverUtils.createVersionNumber(vndTo);
SimpleVersion svFrom = SemverFactory.eINSTANCE.createSimpleVersion();
SimpleVersion svTo = SemverFactory.eINSTANCE.createSimpleVersion();
svFrom.getComparators().add(vcFrom);
svTo.getComparators().add(vcTo);
svFrom.setNumber(vnFrom);
svTo.setNumber(vnTo);
return Lists.newArrayList(svFrom, svTo);
}
Aggregations