use of org.eclipse.n4js.semver.Semver.SimpleVersion in project n4js by eclipse.
the class URLSemverImpl method basicSetSimpleVersion.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSimpleVersion(SimpleVersion newSimpleVersion, NotificationChain msgs) {
SimpleVersion oldSimpleVersion = simpleVersion;
simpleVersion = newSimpleVersion;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SemverPackage.URL_SEMVER__SIMPLE_VERSION, oldSimpleVersion, newSimpleVersion);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.eclipse.n4js.semver.Semver.SimpleVersion in project n4js by eclipse.
the class SemverSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == SemverPackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case SemverPackage.GIT_HUB_VERSION_REQUIREMENT:
sequence_GitHubVersionRequirement(context, (GitHubVersionRequirement) semanticObject);
return;
case SemverPackage.HYPHEN_VERSION_RANGE:
sequence_HyphenVersionRange(context, (HyphenVersionRange) semanticObject);
return;
case SemverPackage.LOCAL_PATH_VERSION_REQUIREMENT:
sequence_LocalPathVersionRequirement(context, (LocalPathVersionRequirement) semanticObject);
return;
case SemverPackage.QUALIFIER:
sequence_Qualifier(context, (Qualifier) semanticObject);
return;
case SemverPackage.QUALIFIER_TAG:
sequence_QualifierTag(context, (QualifierTag) semanticObject);
return;
case SemverPackage.SIMPLE_VERSION:
sequence_SimpleVersion(context, (SimpleVersion) semanticObject);
return;
case SemverPackage.TAG_VERSION_REQUIREMENT:
sequence_TagVersionRequirement(context, (TagVersionRequirement) semanticObject);
return;
case SemverPackage.URL_COMMIT_ISH:
sequence_URLVersionSpecifier(context, (URLCommitISH) semanticObject);
return;
case SemverPackage.URL_SEMVER:
sequence_URLSemver(context, (URLSemver) semanticObject);
return;
case SemverPackage.URL_VERSION_REQUIREMENT:
sequence_URLVersionRequirement(context, (URLVersionRequirement) semanticObject);
return;
case SemverPackage.VERSION_NUMBER:
sequence_VersionNumber(context, (VersionNumber) semanticObject);
return;
case SemverPackage.VERSION_PART:
sequence_VersionPart(context, (VersionPart) semanticObject);
return;
case SemverPackage.VERSION_RANGE_CONSTRAINT:
sequence_VersionRangeContraint(context, (VersionRangeConstraint) semanticObject);
return;
case SemverPackage.VERSION_RANGE_SET_REQUIREMENT:
sequence_VersionRangeSetRequirement(context, (VersionRangeSetRequirement) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.eclipse.n4js.semver.Semver.SimpleVersion in project n4js by eclipse.
the class SemverConverter method pack.
private static List<SimpleVersion> pack(VersionNumberDescriptor verDescr, VersionComparator... vc) {
VersionNumber vnCopy = SemverUtils.createVersionNumber(verDescr);
SimpleVersion svCopy = SemverFactory.eINSTANCE.createSimpleVersion();
svCopy.getComparators().addAll(Arrays.asList(vc));
svCopy.setNumber(vnCopy);
return Lists.newArrayList(svCopy);
}
use of org.eclipse.n4js.semver.Semver.SimpleVersion in project n4js by eclipse.
the class SemverConverter method simplify.
static List<SimpleVersion> simplify(VersionRange vr) {
List<SimpleVersion> constraints = new LinkedList<>();
if (vr instanceof HyphenVersionRange) {
HyphenVersionRange hvr = (HyphenVersionRange) vr;
constraints.addAll(simplify(hvr));
}
if (vr instanceof VersionRangeConstraint) {
VersionRangeConstraint vrc = (VersionRangeConstraint) vr;
for (SimpleVersion sv : vrc.getVersionConstraints()) {
constraints.addAll(simplify(sv));
}
}
return constraints;
}
use of org.eclipse.n4js.semver.Semver.SimpleVersion in project n4js by eclipse.
the class SemverMatcher method isWildcard.
/**
* The matching of wildcards is specified different on <a href="https://docs.npmjs.com/misc/semver">npmjs.com<a>
* than it is behaving using npm with regard to the handling of pre-release tagged versions. Namely, npmjs.com says
* {@code "" (empty string) := * := >=0.0.0} which is not true for npm. Therefore, this matching method will mimic
* the npm behavior e.g. when executing 'npm install package@*' and match any version for {@code @*} including
* pre-release tagged ones.
*
* @return true iff the given constraint consists of one wildcard only
*/
private static boolean isWildcard(VersionRangeSetRequirement constraint) {
if (constraint.getRanges().size() != 1) {
return false;
}
VersionRange versionRange = constraint.getRanges().get(0);
if (!(versionRange instanceof VersionRangeConstraint)) {
return false;
}
VersionRangeConstraint vrc = (VersionRangeConstraint) versionRange;
if (vrc.getVersionConstraints().size() != 1) {
return false;
}
SimpleVersion simpleVersion = vrc.getVersionConstraints().get(0);
return simpleVersion.isWildcard();
}
Aggregations