@yellicode/elements
Version:
The meta model API for Yellicode - an extensible code generator.
736 lines (735 loc) • 27.4 kB
JavaScript
/*
* Copyright (c) 2020 Yellicode
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/**
* This code was generated by a tool.
*
* Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
*/
import * as elements from './interfaces';
var ElementTypeUtility = /** @class */ (function () {
function ElementTypeUtility() {
}
/**
* Returns true if the elementType is a NamedElement or one of its descendants.
*/
ElementTypeUtility.isNamedElement = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.enumerationLiteral: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.literalBoolean: return true;
case elements.ElementType.literalInteger: return true;
case elements.ElementType.literalNull: return true;
case elements.ElementType.literalReal: return true;
case elements.ElementType.literalString: return true;
case elements.ElementType.literalUnlimitedNatural: return true;
case elements.ElementType.model: return true;
case elements.ElementType.operation: return true;
case elements.ElementType.package: return true;
case elements.ElementType.parameter: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.profile: return true;
case elements.ElementType.property: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a TypedElement or one of its descendants.
*/
ElementTypeUtility.isTypedElement = function (elementType) {
switch (elementType) {
case elements.ElementType.literalBoolean: return true;
case elements.ElementType.literalInteger: return true;
case elements.ElementType.literalNull: return true;
case elements.ElementType.literalReal: return true;
case elements.ElementType.literalString: return true;
case elements.ElementType.literalUnlimitedNatural: return true;
case elements.ElementType.parameter: return true;
case elements.ElementType.property: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a ValueSpecification or one of its descendants.
*/
ElementTypeUtility.isValueSpecification = function (elementType) {
switch (elementType) {
case elements.ElementType.literalBoolean: return true;
case elements.ElementType.literalInteger: return true;
case elements.ElementType.literalNull: return true;
case elements.ElementType.literalReal: return true;
case elements.ElementType.literalString: return true;
case elements.ElementType.literalUnlimitedNatural: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a PackageableElement or one of its descendants.
*/
ElementTypeUtility.isPackageableElement = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.model: return true;
case elements.ElementType.package: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.profile: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Type or one of its descendants.
*/
ElementTypeUtility.isType = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a RedefinableElement or one of its descendants.
*/
ElementTypeUtility.isRedefinableElement = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.operation: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.property: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Classifier or one of its descendants.
*/
ElementTypeUtility.isClassifier = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a StructuredClassifier or one of its descendants.
*/
ElementTypeUtility.isStructuredClassifier = function (elementType) {
switch (elementType) {
case elements.ElementType.class: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a MultiplicityElement or one of its descendants.
*/
ElementTypeUtility.isMultiplicityElement = function (elementType) {
switch (elementType) {
case elements.ElementType.parameter: return true;
case elements.ElementType.property: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a OrderedElement or one of its descendants.
*/
ElementTypeUtility.isOrderedElement = function (elementType) {
switch (elementType) {
case elements.ElementType.enumerationLiteral: return true;
case elements.ElementType.operation: return true;
case elements.ElementType.parameter: return true;
case elements.ElementType.property: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Feature or one of its descendants.
*/
ElementTypeUtility.isFeature = function (elementType) {
switch (elementType) {
case elements.ElementType.operation: return true;
case elements.ElementType.property: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a StructuralFeature or one of its descendants.
*/
ElementTypeUtility.isStructuralFeature = function (elementType) {
return elementType === elements.ElementType.property;
};
/**
* Returns true if the elementType is a MemberedClassifier or one of its descendants.
*/
ElementTypeUtility.isMemberedClassifier = function (elementType) {
switch (elementType) {
case elements.ElementType.class: return true;
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.interface: return true;
case elements.ElementType.primitiveType: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a BehavioredClassifier or one of its descendants.
*/
ElementTypeUtility.isBehavioredClassifier = function (elementType) {
switch (elementType) {
case elements.ElementType.class: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Class or one of its descendants.
*/
ElementTypeUtility.isClass = function (elementType) {
switch (elementType) {
case elements.ElementType.class: return true;
case elements.ElementType.stereotype: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Stereotype or one of its descendants.
*/
ElementTypeUtility.isStereotype = function (elementType) {
return elementType === elements.ElementType.stereotype;
};
/**
* Returns true if the elementType is a Relationship or one of its descendants.
*/
ElementTypeUtility.isRelationship = function (elementType) {
switch (elementType) {
case elements.ElementType.association: return true;
case elements.ElementType.generalization: return true;
case elements.ElementType.interfaceRealization: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Property or one of its descendants.
*/
ElementTypeUtility.isProperty = function (elementType) {
return elementType === elements.ElementType.property;
};
/**
* Returns true if the elementType is a Package or one of its descendants.
*/
ElementTypeUtility.isPackage = function (elementType) {
switch (elementType) {
case elements.ElementType.package: return true;
case elements.ElementType.model: return true;
case elements.ElementType.profile: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a Profile or one of its descendants.
*/
ElementTypeUtility.isProfile = function (elementType) {
return elementType === elements.ElementType.profile;
};
/**
* Returns true if the elementType is a DataType or one of its descendants.
*/
ElementTypeUtility.isDataType = function (elementType) {
switch (elementType) {
case elements.ElementType.dataType: return true;
case elements.ElementType.enumeration: return true;
case elements.ElementType.primitiveType: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a PrimitiveType or one of its descendants.
*/
ElementTypeUtility.isPrimitiveType = function (elementType) {
return elementType === elements.ElementType.primitiveType;
};
/**
* Returns true if the elementType is a Parameter or one of its descendants.
*/
ElementTypeUtility.isParameter = function (elementType) {
return elementType === elements.ElementType.parameter;
};
/**
* Returns true if the elementType is a BehavioralFeature or one of its descendants.
*/
ElementTypeUtility.isBehavioralFeature = function (elementType) {
return elementType === elements.ElementType.operation;
};
/**
* Returns true if the elementType is a Operation or one of its descendants.
*/
ElementTypeUtility.isOperation = function (elementType) {
return elementType === elements.ElementType.operation;
};
/**
* Returns true if the elementType is a Model or one of its descendants.
*/
ElementTypeUtility.isModel = function (elementType) {
return elementType === elements.ElementType.model;
};
/**
* Returns true if the elementType is a LiteralSpecification or one of its descendants.
*/
ElementTypeUtility.isLiteralSpecification = function (elementType) {
switch (elementType) {
case elements.ElementType.literalBoolean: return true;
case elements.ElementType.literalInteger: return true;
case elements.ElementType.literalNull: return true;
case elements.ElementType.literalReal: return true;
case elements.ElementType.literalString: return true;
case elements.ElementType.literalUnlimitedNatural: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a LiteralUnlimitedNatural or one of its descendants.
*/
ElementTypeUtility.isLiteralUnlimitedNatural = function (elementType) {
return elementType === elements.ElementType.literalUnlimitedNatural;
};
/**
* Returns true if the elementType is a LiteralString or one of its descendants.
*/
ElementTypeUtility.isLiteralString = function (elementType) {
return elementType === elements.ElementType.literalString;
};
/**
* Returns true if the elementType is a LiteralReal or one of its descendants.
*/
ElementTypeUtility.isLiteralReal = function (elementType) {
return elementType === elements.ElementType.literalReal;
};
/**
* Returns true if the elementType is a LiteralNull or one of its descendants.
*/
ElementTypeUtility.isLiteralNull = function (elementType) {
return elementType === elements.ElementType.literalNull;
};
/**
* Returns true if the elementType is a LiteralInteger or one of its descendants.
*/
ElementTypeUtility.isLiteralInteger = function (elementType) {
return elementType === elements.ElementType.literalInteger;
};
/**
* Returns true if the elementType is a LiteralBoolean or one of its descendants.
*/
ElementTypeUtility.isLiteralBoolean = function (elementType) {
return elementType === elements.ElementType.literalBoolean;
};
/**
* Returns true if the elementType is a DirectedRelationship or one of its descendants.
*/
ElementTypeUtility.isDirectedRelationship = function (elementType) {
switch (elementType) {
case elements.ElementType.generalization: return true;
case elements.ElementType.interfaceRealization: return true;
default: return false;
}
};
/**
* Returns true if the elementType is a InterfaceRealization or one of its descendants.
*/
ElementTypeUtility.isInterfaceRealization = function (elementType) {
return elementType === elements.ElementType.interfaceRealization;
};
/**
* Returns true if the elementType is a Interface or one of its descendants.
*/
ElementTypeUtility.isInterface = function (elementType) {
return elementType === elements.ElementType.interface;
};
/**
* Returns true if the elementType is a Generalization or one of its descendants.
*/
ElementTypeUtility.isGeneralization = function (elementType) {
return elementType === elements.ElementType.generalization;
};
/**
* Returns true if the elementType is a EnumerationLiteral or one of its descendants.
*/
ElementTypeUtility.isEnumerationLiteral = function (elementType) {
return elementType === elements.ElementType.enumerationLiteral;
};
/**
* Returns true if the elementType is a Enumeration or one of its descendants.
*/
ElementTypeUtility.isEnumeration = function (elementType) {
return elementType === elements.ElementType.enumeration;
};
/**
* Returns true if the elementType is a Comment or one of its descendants.
*/
ElementTypeUtility.isComment = function (elementType) {
return elementType === elements.ElementType.comment;
};
/**
* Returns true if the elementType is a Association or one of its descendants.
*/
ElementTypeUtility.isAssociation = function (elementType) {
return elementType === elements.ElementType.association;
};
return ElementTypeUtility;
}());
export { ElementTypeUtility };
/**
* Asserts that the element is a NamedElement or one of its descendants.
*/
export function isNamedElement(element) {
if (!element)
return false;
return ElementTypeUtility.isNamedElement(element.elementType);
}
/**
* Asserts that the element is a TypedElement or one of its descendants.
*/
export function isTypedElement(element) {
if (!element)
return false;
return ElementTypeUtility.isTypedElement(element.elementType);
}
/**
* Asserts that the element is a ValueSpecification or one of its descendants.
*/
export function isValueSpecification(element) {
if (!element)
return false;
return ElementTypeUtility.isValueSpecification(element.elementType);
}
/**
* Asserts that the element is a PackageableElement or one of its descendants.
*/
export function isPackageableElement(element) {
if (!element)
return false;
return ElementTypeUtility.isPackageableElement(element.elementType);
}
/**
* Asserts that the element is a Type or one of its descendants.
*/
export function isType(element) {
if (!element)
return false;
return ElementTypeUtility.isType(element.elementType);
}
/**
* Asserts that the element is a RedefinableElement or one of its descendants.
*/
export function isRedefinableElement(element) {
if (!element)
return false;
return ElementTypeUtility.isRedefinableElement(element.elementType);
}
/**
* Asserts that the element is a Classifier or one of its descendants.
*/
export function isClassifier(element) {
if (!element)
return false;
return ElementTypeUtility.isClassifier(element.elementType);
}
/**
* Asserts that the element is a StructuredClassifier or one of its descendants.
*/
export function isStructuredClassifier(element) {
if (!element)
return false;
return ElementTypeUtility.isStructuredClassifier(element.elementType);
}
/**
* Asserts that the element is a MultiplicityElement or one of its descendants.
*/
export function isMultiplicityElement(element) {
if (!element)
return false;
return ElementTypeUtility.isMultiplicityElement(element.elementType);
}
/**
* Asserts that the element is a OrderedElement or one of its descendants.
*/
export function isOrderedElement(element) {
if (!element)
return false;
return ElementTypeUtility.isOrderedElement(element.elementType);
}
/**
* Asserts that the element is a Feature or one of its descendants.
*/
export function isFeature(element) {
if (!element)
return false;
return ElementTypeUtility.isFeature(element.elementType);
}
/**
* Asserts that the element is a StructuralFeature or one of its descendants.
*/
export function isStructuralFeature(element) {
if (!element)
return false;
return ElementTypeUtility.isStructuralFeature(element.elementType);
}
/**
* Asserts that the element is a MemberedClassifier or one of its descendants.
*/
export function isMemberedClassifier(element) {
if (!element)
return false;
return ElementTypeUtility.isMemberedClassifier(element.elementType);
}
/**
* Asserts that the element is a BehavioredClassifier or one of its descendants.
*/
export function isBehavioredClassifier(element) {
if (!element)
return false;
return ElementTypeUtility.isBehavioredClassifier(element.elementType);
}
/**
* Asserts that the element is a Class or one of its descendants.
*/
export function isClass(element) {
if (!element)
return false;
return ElementTypeUtility.isClass(element.elementType);
}
/**
* Asserts that the element is a Stereotype or one of its descendants.
*/
export function isStereotype(element) {
if (!element)
return false;
return ElementTypeUtility.isStereotype(element.elementType);
}
/**
* Asserts that the element is a Relationship or one of its descendants.
*/
export function isRelationship(element) {
if (!element)
return false;
return ElementTypeUtility.isRelationship(element.elementType);
}
/**
* Asserts that the element is a Property or one of its descendants.
*/
export function isProperty(element) {
if (!element)
return false;
return ElementTypeUtility.isProperty(element.elementType);
}
/**
* Asserts that the element is a Package or one of its descendants.
*/
export function isPackage(element) {
if (!element)
return false;
return ElementTypeUtility.isPackage(element.elementType);
}
/**
* Asserts that the element is a Profile or one of its descendants.
*/
export function isProfile(element) {
if (!element)
return false;
return ElementTypeUtility.isProfile(element.elementType);
}
/**
* Asserts that the element is a DataType or one of its descendants.
*/
export function isDataType(element) {
if (!element)
return false;
return ElementTypeUtility.isDataType(element.elementType);
}
/**
* Asserts that the element is a PrimitiveType or one of its descendants.
*/
export function isPrimitiveType(element) {
if (!element)
return false;
return ElementTypeUtility.isPrimitiveType(element.elementType);
}
/**
* Asserts that the element is a Parameter or one of its descendants.
*/
export function isParameter(element) {
if (!element)
return false;
return ElementTypeUtility.isParameter(element.elementType);
}
/**
* Asserts that the element is a BehavioralFeature or one of its descendants.
*/
export function isBehavioralFeature(element) {
if (!element)
return false;
return ElementTypeUtility.isBehavioralFeature(element.elementType);
}
/**
* Asserts that the element is a Operation or one of its descendants.
*/
export function isOperation(element) {
if (!element)
return false;
return ElementTypeUtility.isOperation(element.elementType);
}
/**
* Asserts that the element is a Model or one of its descendants.
*/
export function isModel(element) {
if (!element)
return false;
return ElementTypeUtility.isModel(element.elementType);
}
/**
* Asserts that the element is a LiteralSpecification or one of its descendants.
*/
export function isLiteralSpecification(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralSpecification(element.elementType);
}
/**
* Asserts that the element is a LiteralUnlimitedNatural or one of its descendants.
*/
export function isLiteralUnlimitedNatural(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralUnlimitedNatural(element.elementType);
}
/**
* Asserts that the element is a LiteralString or one of its descendants.
*/
export function isLiteralString(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralString(element.elementType);
}
/**
* Asserts that the element is a LiteralReal or one of its descendants.
*/
export function isLiteralReal(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralReal(element.elementType);
}
/**
* Asserts that the element is a LiteralNull or one of its descendants.
*/
export function isLiteralNull(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralNull(element.elementType);
}
/**
* Asserts that the element is a LiteralInteger or one of its descendants.
*/
export function isLiteralInteger(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralInteger(element.elementType);
}
/**
* Asserts that the element is a LiteralBoolean or one of its descendants.
*/
export function isLiteralBoolean(element) {
if (!element)
return false;
return ElementTypeUtility.isLiteralBoolean(element.elementType);
}
/**
* Asserts that the element is a DirectedRelationship or one of its descendants.
*/
export function isDirectedRelationship(element) {
if (!element)
return false;
return ElementTypeUtility.isDirectedRelationship(element.elementType);
}
/**
* Asserts that the element is a InterfaceRealization or one of its descendants.
*/
export function isInterfaceRealization(element) {
if (!element)
return false;
return ElementTypeUtility.isInterfaceRealization(element.elementType);
}
/**
* Asserts that the element is a Interface or one of its descendants.
*/
export function isInterface(element) {
if (!element)
return false;
return ElementTypeUtility.isInterface(element.elementType);
}
/**
* Asserts that the element is a Generalization or one of its descendants.
*/
export function isGeneralization(element) {
if (!element)
return false;
return ElementTypeUtility.isGeneralization(element.elementType);
}
/**
* Asserts that the element is a EnumerationLiteral or one of its descendants.
*/
export function isEnumerationLiteral(element) {
if (!element)
return false;
return ElementTypeUtility.isEnumerationLiteral(element.elementType);
}
/**
* Asserts that the element is a Enumeration or one of its descendants.
*/
export function isEnumeration(element) {
if (!element)
return false;
return ElementTypeUtility.isEnumeration(element.elementType);
}
/**
* Asserts that the element is a Comment or one of its descendants.
*/
export function isComment(element) {
if (!element)
return false;
return ElementTypeUtility.isComment(element.elementType);
}
/**
* Asserts that the element is a Association or one of its descendants.
*/
export function isAssociation(element) {
if (!element)
return false;
return ElementTypeUtility.isAssociation(element.elementType);
}