Search in sources :

Example 1 with Qualifier

use of org.eclipse.n4js.semver.Semver.Qualifier in project n4js by eclipse.

the class QualifierImpl method equals.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public boolean equals(final Object obj) {
    if ((!(obj instanceof Qualifier))) {
        return false;
    }
    final Qualifier q = ((Qualifier) obj);
    QualifierTag _preRelease = this.getPreRelease();
    boolean _tripleEquals = (_preRelease == null);
    QualifierTag _preRelease_1 = q.getPreRelease();
    boolean _tripleEquals_1 = (_preRelease_1 == null);
    boolean equals = (Boolean.valueOf(_tripleEquals) == Boolean.valueOf(_tripleEquals_1));
    equals = ((equals && (this.getPreRelease() == null)) || this.getPreRelease().equals(q.getPreRelease()));
    equals = (equals && (Boolean.valueOf((this.getBuildMetadata() == null)) == Boolean.valueOf((q.getBuildMetadata() == null))));
    equals = ((equals && (this.getBuildMetadata() == null)) || this.getBuildMetadata().equals(q.getBuildMetadata()));
    return equals;
}
Also used : QualifierTag(org.eclipse.n4js.semver.Semver.QualifierTag) Qualifier(org.eclipse.n4js.semver.Semver.Qualifier)

Example 2 with Qualifier

use of org.eclipse.n4js.semver.Semver.Qualifier 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));
}
Also used : URLSemver(org.eclipse.n4js.semver.Semver.URLSemver) ParserRule(org.eclipse.xtext.ParserRule) GitHubVersionRequirement(org.eclipse.n4js.semver.Semver.GitHubVersionRequirement) Action(org.eclipse.xtext.Action) URLCommitISH(org.eclipse.n4js.semver.Semver.URLCommitISH) QualifierTag(org.eclipse.n4js.semver.Semver.QualifierTag) VersionRangeSetRequirement(org.eclipse.n4js.semver.Semver.VersionRangeSetRequirement) URLVersionRequirement(org.eclipse.n4js.semver.Semver.URLVersionRequirement) TagVersionRequirement(org.eclipse.n4js.semver.Semver.TagVersionRequirement) VersionNumber(org.eclipse.n4js.semver.Semver.VersionNumber) EPackage(org.eclipse.emf.ecore.EPackage) VersionPart(org.eclipse.n4js.semver.Semver.VersionPart) VersionRangeConstraint(org.eclipse.n4js.semver.Semver.VersionRangeConstraint) HyphenVersionRange(org.eclipse.n4js.semver.Semver.HyphenVersionRange) Parameter(org.eclipse.xtext.Parameter) Qualifier(org.eclipse.n4js.semver.Semver.Qualifier) SimpleVersion(org.eclipse.n4js.semver.Semver.SimpleVersion) LocalPathVersionRequirement(org.eclipse.n4js.semver.Semver.LocalPathVersionRequirement)

Example 3 with Qualifier

use of org.eclipse.n4js.semver.Semver.Qualifier in project n4js by eclipse.

the class VersionNumberImpl method basicSetQualifier.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public NotificationChain basicSetQualifier(Qualifier newQualifier, NotificationChain msgs) {
    Qualifier oldQualifier = qualifier;
    qualifier = newQualifier;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SemverPackage.VERSION_NUMBER__QUALIFIER, oldQualifier, newQualifier);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) Qualifier(org.eclipse.n4js.semver.Semver.Qualifier)

Example 4 with Qualifier

use of org.eclipse.n4js.semver.Semver.Qualifier in project n4js by eclipse.

the class SemverUtils method getVersionNumberDescriptor.

static VersionNumberDescriptor getVersionNumberDescriptor(VersionNumber vn) {
    String[] preReleaseParts = null;
    String[] buildMetadataParts = null;
    Qualifier svQualifier = vn.getQualifier();
    if (svQualifier != null && svQualifier.getPreRelease() != null) {
        EList<String> prParts = svQualifier.getPreRelease().getParts();
        preReleaseParts = prParts.toArray(new String[prParts.size()]);
    }
    if (svQualifier != null && svQualifier.getBuildMetadata() != null) {
        EList<String> bmParts = svQualifier.getBuildMetadata().getParts();
        buildMetadataParts = bmParts.toArray(new String[bmParts.size()]);
    }
    VersionPart major = vn.getMajor();
    VersionPart minor = vn.getMinor();
    VersionPart patch = vn.getPatch();
    return new VersionNumberDescriptor(major, minor, patch, preReleaseParts, buildMetadataParts);
}
Also used : VersionPart(org.eclipse.n4js.semver.Semver.VersionPart) Qualifier(org.eclipse.n4js.semver.Semver.Qualifier)

Example 5 with Qualifier

use of org.eclipse.n4js.semver.Semver.Qualifier in project n4js by eclipse.

the class SemverUtils method createVersionNumber.

static VersionNumber createVersionNumber(VersionNumberDescriptor descriptor) {
    VersionNumber versNumber = SemverFactory.eINSTANCE.createVersionNumber();
    VersionPart fromMajor = SemverFactory.eINSTANCE.createVersionPart();
    fromMajor.setNumberRaw(descriptor.major);
    versNumber.setMajor(fromMajor);
    if (descriptor.minor != null) {
        VersionPart fromMinor = SemverFactory.eINSTANCE.createVersionPart();
        fromMinor.setNumberRaw(descriptor.minor);
        versNumber.setMinor(fromMinor);
    }
    if (descriptor.patch != null) {
        VersionPart fromPatch = SemverFactory.eINSTANCE.createVersionPart();
        fromPatch.setNumberRaw(descriptor.patch);
        versNumber.setPatch(fromPatch);
    }
    if (descriptor.preReleaseParts != null || descriptor.buildMetadataParts != null) {
        Qualifier qualifier = SemverFactory.eINSTANCE.createQualifier();
        versNumber.setQualifier(qualifier);
        if (descriptor.preReleaseParts != null) {
            QualifierTag prQualifierTag = SemverFactory.eINSTANCE.createQualifierTag();
            prQualifierTag.getParts().addAll(Arrays.asList(descriptor.preReleaseParts));
            qualifier.setPreRelease(prQualifierTag);
        }
        if (descriptor.buildMetadataParts != null) {
            QualifierTag bmQualifierTag = SemverFactory.eINSTANCE.createQualifierTag();
            bmQualifierTag.getParts().addAll(Arrays.asList(descriptor.buildMetadataParts));
            qualifier.setBuildMetadata(bmQualifierTag);
        }
    }
    return versNumber;
}
Also used : VersionPart(org.eclipse.n4js.semver.Semver.VersionPart) QualifierTag(org.eclipse.n4js.semver.Semver.QualifierTag) Qualifier(org.eclipse.n4js.semver.Semver.Qualifier) VersionNumber(org.eclipse.n4js.semver.Semver.VersionNumber)

Aggregations

Qualifier (org.eclipse.n4js.semver.Semver.Qualifier)5 QualifierTag (org.eclipse.n4js.semver.Semver.QualifierTag)3 VersionPart (org.eclipse.n4js.semver.Semver.VersionPart)3 VersionNumber (org.eclipse.n4js.semver.Semver.VersionNumber)2 EPackage (org.eclipse.emf.ecore.EPackage)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 GitHubVersionRequirement (org.eclipse.n4js.semver.Semver.GitHubVersionRequirement)1 HyphenVersionRange (org.eclipse.n4js.semver.Semver.HyphenVersionRange)1 LocalPathVersionRequirement (org.eclipse.n4js.semver.Semver.LocalPathVersionRequirement)1 SimpleVersion (org.eclipse.n4js.semver.Semver.SimpleVersion)1 TagVersionRequirement (org.eclipse.n4js.semver.Semver.TagVersionRequirement)1 URLCommitISH (org.eclipse.n4js.semver.Semver.URLCommitISH)1 URLSemver (org.eclipse.n4js.semver.Semver.URLSemver)1 URLVersionRequirement (org.eclipse.n4js.semver.Semver.URLVersionRequirement)1 VersionRangeConstraint (org.eclipse.n4js.semver.Semver.VersionRangeConstraint)1 VersionRangeSetRequirement (org.eclipse.n4js.semver.Semver.VersionRangeSetRequirement)1 Action (org.eclipse.xtext.Action)1 Parameter (org.eclipse.xtext.Parameter)1 ParserRule (org.eclipse.xtext.ParserRule)1