UNPKG

@yellicode/elements

Version:

The meta model API for Yellicode - an extensible code generator.

1,199 lines 120 kB
/* * 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/. */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); /** * 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'; function removeFromArray(array, item) { var index = array.indexOf(item); if (index >= 0) array.splice(index, 1); } var Element = /** @class */ (function () { function Element(modelDelegate, owner) { this.modelDelegate = modelDelegate; this.appliedStereotypes = []; this.id = ''; this.ownedComments = []; this.owner = null; this.taggedValues = []; this.owner = owner; } Element.prototype.isOrphaned = function () { var e = this; do { if (e.isDeleted) return true; // the element or an ancestor was deleted e = e.owner; } while (e); return false; }; /** * Gets the text contents of the first comment in the element's owned comments, or an empty string if * the element has no comments. * @returns {string} The body string of the first comment. If the element has no comments, an empty * string is returned. */ Element.prototype.getFirstCommentBody = function () { return this.modelDelegate.getFirstCommentBody(this); }; return Element; }()); export { Element }; var TaggedValueSpecification = /** @class */ (function () { function TaggedValueSpecification() { } return TaggedValueSpecification; }()); export { TaggedValueSpecification }; var StereotypeExtension = /** @class */ (function () { function StereotypeExtension() { this.isRequired = false; } return StereotypeExtension; }()); export { StereotypeExtension }; var Class = /** @class */ (function (_super) { __extends(Class, _super); function Class(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.class; _this.appliedStereotypes = []; _this.generalizations = []; _this.interfaceRealizations = []; _this.isAbstract = false; _this.isActive = false; _this.isDeprecated = false; _this.isFinalSpecialization = false; _this.isInferred = false; _this.isLeaf = false; _this.name = ''; _this.ownedAttributes = []; _this.ownedOperations = []; _this.taggedValues = []; _this.visibility = null; return _this; } Object.defineProperty(Class.prototype, "package", { get: function () { return this.modelDelegate.getPackage(this); }, enumerable: false, configurable: true }); /** * Returns both inherited and owned attributes. * @returns {elements.Property[]} */ Class.prototype.getAllAttributes = function () { return this.modelDelegate.getAllAttributes(this); }; /** * Returns both inherited and owned operations. Any inherited operation that has the same signature * (having the same name and parameter type order) in an inheriting type is not included. * @returns {elements.Operation[]} */ Class.prototype.getAllOperations = function () { return this.modelDelegate.getAllOperations(this); }; /** * Returns all of the direct and indirect ancestors of a generalized Classifier, working outwards: more * specific classifiers will appear before more general classifiers. * @returns {elements.Classifier[]} */ Class.prototype.getAllParents = function () { return this.modelDelegate.getAllParents(this); }; /** * Gets all classifiers of which this element is a direct or indirect general. * @returns {elements.Classifier[]} */ Class.prototype.getAllSpecializations = function () { return this.modelDelegate.getAllSpecializations(this); }; /** * Gets the first direct generalization relationship of the element. * @returns {elements.Generalization} */ Class.prototype.getFirstGeneralization = function () { return this.modelDelegate.getFirstGeneralization(this); }; /** * Gets the first classifier that is an immediate general of the current element. * @returns {elements.Classifier} */ Class.prototype.getFirstParent = function () { return this.modelDelegate.getFirstParent(this); }; /** * Constructs a name from the names of the nesting packages. The name is constructed working inwards * from the package that is defined as namespace root up to but not including the PackageableElement * itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Class.prototype.getNamespaceName = function (separator) { return this.modelDelegate.getNamespaceName(this, separator); }; /** * Gets all packages that contain this Package, working inwards from the top Package to the owning * package. * @returns {elements.Package[]} A collection of Packages. */ Class.prototype.getNestingPackages = function () { return this.modelDelegate.getNestingPackages(this); }; /** * Gives all of the immediate ancestors of a generalized Classifier. * @returns {elements.Classifier[]} */ Class.prototype.getParents = function () { return this.modelDelegate.getParents(this); }; /** * Constructs a name from the PackageableElement and the names of the nesting packages. The name is * constructed working inwards from the package that is defined as namespace root up to and including * the PackageableElement itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Class.prototype.getQualifiedName = function (separator) { return this.modelDelegate.getQualifiedName(this, separator); }; /** * Gets all classifiers of which this classifier is a direct general. * @returns {elements.Classifier[]} */ Class.prototype.getSpecializations = function () { return this.modelDelegate.getSpecializations(this); }; /** * Gets the super types of this type, derived from its Generalizations. * @returns {this[]} */ Class.prototype.getSuperTypes = function () { return this.modelDelegate.getSuperTypes(this); }; Class.prototype.addAppliedStereotype = function (stereotype) { this.appliedStereotypes.push(stereotype); this.modelDelegate.onElementAdded(this, stereotype); return this; }; Class.prototype.removeAppliedStereotype = function (stereotype) { removeFromArray(this.appliedStereotypes, stereotype); this.modelDelegate.onElementDeleted(this, stereotype); return this; }; Class.prototype.addOwnedComment = function (properties) { var e = this.modelDelegate.createElement('comment', this, properties, null); this.ownedComments.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Class.prototype.deleteOwnedComment = function (comment) { removeFromArray(this.ownedComments, comment); comment.isDeleted = true; this.modelDelegate.onElementDeleted(this, comment); return this; }; Class.prototype.addGeneralization = function (properties, initFn) { var e = this.modelDelegate.createElement('generalization', this, properties, initFn || null); this.generalizations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Class.prototype.deleteGeneralization = function (generalization) { removeFromArray(this.generalizations, generalization); generalization.isDeleted = true; this.modelDelegate.onElementDeleted(this, generalization); return this; }; Class.prototype.addInterfaceRealization = function (properties, initFn) { var e = this.modelDelegate.createElement('interfaceRealization', this, properties, initFn || null); this.interfaceRealizations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Class.prototype.deleteInterfaceRealization = function (interfaceRealization) { removeFromArray(this.interfaceRealizations, interfaceRealization); interfaceRealization.isDeleted = true; this.modelDelegate.onElementDeleted(this, interfaceRealization); return this; }; Class.prototype.addOwnedAttribute = function (properties, initFn) { var e = this.modelDelegate.createElement('property', this, properties, initFn || null); this.ownedAttributes.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Class.prototype.deleteOwnedAttribute = function (property) { removeFromArray(this.ownedAttributes, property); property.isDeleted = true; this.modelDelegate.onElementDeleted(this, property); return this; }; Class.prototype.addOwnedOperation = function (properties, initFn) { var e = this.modelDelegate.createElement('operation', this, properties, initFn || null); this.ownedOperations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Class.prototype.deleteOwnedOperation = function (operation) { removeFromArray(this.ownedOperations, operation); operation.isDeleted = true; this.modelDelegate.onElementDeleted(this, operation); return this; }; return Class; }(Element)); export { Class }; var Stereotype = /** @class */ (function (_super) { __extends(Stereotype, _super); function Stereotype(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.stereotype; _this.appliedStereotypes = []; _this.extends = []; _this.generalizations = []; _this.interfaceRealizations = []; _this.isAbstract = false; _this.isActive = false; _this.isDeprecated = false; _this.isFinalSpecialization = false; _this.isInferred = false; _this.isLeaf = false; _this.name = ''; _this.ownedAttributes = []; _this.ownedOperations = []; _this.safeName = ''; _this.taggedValues = []; _this.visibility = null; return _this; } Object.defineProperty(Stereotype.prototype, "package", { get: function () { return this.modelDelegate.getPackage(this); }, enumerable: false, configurable: true }); /** * Returns both inherited and owned attributes. * @returns {elements.Property[]} */ Stereotype.prototype.getAllAttributes = function () { return this.modelDelegate.getAllAttributes(this); }; /** * Returns both inherited and owned operations. Any inherited operation that has the same signature * (having the same name and parameter type order) in an inheriting type is not included. * @returns {elements.Operation[]} */ Stereotype.prototype.getAllOperations = function () { return this.modelDelegate.getAllOperations(this); }; /** * Returns all of the direct and indirect ancestors of a generalized Classifier, working outwards: more * specific classifiers will appear before more general classifiers. * @returns {elements.Classifier[]} */ Stereotype.prototype.getAllParents = function () { return this.modelDelegate.getAllParents(this); }; /** * Gets all classifiers of which this element is a direct or indirect general. * @returns {elements.Classifier[]} */ Stereotype.prototype.getAllSpecializations = function () { return this.modelDelegate.getAllSpecializations(this); }; /** * Gets the first direct generalization relationship of the element. * @returns {elements.Generalization} */ Stereotype.prototype.getFirstGeneralization = function () { return this.modelDelegate.getFirstGeneralization(this); }; /** * Gets the first classifier that is an immediate general of the current element. * @returns {elements.Classifier} */ Stereotype.prototype.getFirstParent = function () { return this.modelDelegate.getFirstParent(this); }; /** * Constructs a name from the names of the nesting packages. The name is constructed working inwards * from the package that is defined as namespace root up to but not including the PackageableElement * itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Stereotype.prototype.getNamespaceName = function (separator) { return this.modelDelegate.getNamespaceName(this, separator); }; /** * Gets all packages that contain this Package, working inwards from the top Package to the owning * package. * @returns {elements.Package[]} A collection of Packages. */ Stereotype.prototype.getNestingPackages = function () { return this.modelDelegate.getNestingPackages(this); }; /** * Gives all of the immediate ancestors of a generalized Classifier. * @returns {elements.Classifier[]} */ Stereotype.prototype.getParents = function () { return this.modelDelegate.getParents(this); }; /** * Constructs a name from the PackageableElement and the names of the nesting packages. The name is * constructed working inwards from the package that is defined as namespace root up to and including * the PackageableElement itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Stereotype.prototype.getQualifiedName = function (separator) { return this.modelDelegate.getQualifiedName(this, separator); }; /** * Gets all classifiers of which this classifier is a direct general. * @returns {elements.Classifier[]} */ Stereotype.prototype.getSpecializations = function () { return this.modelDelegate.getSpecializations(this); }; /** * Gets the super types of this type, derived from its Generalizations. * @returns {this[]} */ Stereotype.prototype.getSuperTypes = function () { return this.modelDelegate.getSuperTypes(this); }; Stereotype.prototype.addAppliedStereotype = function (stereotype) { this.appliedStereotypes.push(stereotype); this.modelDelegate.onElementAdded(this, stereotype); return this; }; Stereotype.prototype.removeAppliedStereotype = function (stereotype) { removeFromArray(this.appliedStereotypes, stereotype); this.modelDelegate.onElementDeleted(this, stereotype); return this; }; Stereotype.prototype.addOwnedComment = function (properties) { var e = this.modelDelegate.createElement('comment', this, properties, null); this.ownedComments.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Stereotype.prototype.deleteOwnedComment = function (comment) { removeFromArray(this.ownedComments, comment); comment.isDeleted = true; this.modelDelegate.onElementDeleted(this, comment); return this; }; Stereotype.prototype.addGeneralization = function (properties, initFn) { var e = this.modelDelegate.createElement('generalization', this, properties, initFn || null); this.generalizations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Stereotype.prototype.deleteGeneralization = function (generalization) { removeFromArray(this.generalizations, generalization); generalization.isDeleted = true; this.modelDelegate.onElementDeleted(this, generalization); return this; }; Stereotype.prototype.addInterfaceRealization = function (properties, initFn) { var e = this.modelDelegate.createElement('interfaceRealization', this, properties, initFn || null); this.interfaceRealizations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Stereotype.prototype.deleteInterfaceRealization = function (interfaceRealization) { removeFromArray(this.interfaceRealizations, interfaceRealization); interfaceRealization.isDeleted = true; this.modelDelegate.onElementDeleted(this, interfaceRealization); return this; }; Stereotype.prototype.addOwnedAttribute = function (properties, initFn) { var e = this.modelDelegate.createElement('property', this, properties, initFn || null); this.ownedAttributes.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Stereotype.prototype.deleteOwnedAttribute = function (property) { removeFromArray(this.ownedAttributes, property); property.isDeleted = true; this.modelDelegate.onElementDeleted(this, property); return this; }; Stereotype.prototype.addOwnedOperation = function (properties, initFn) { var e = this.modelDelegate.createElement('operation', this, properties, initFn || null); this.ownedOperations.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Stereotype.prototype.deleteOwnedOperation = function (operation) { removeFromArray(this.ownedOperations, operation); operation.isDeleted = true; this.modelDelegate.onElementDeleted(this, operation); return this; }; return Stereotype; }(Element)); export { Stereotype }; var Property = /** @class */ (function (_super) { __extends(Property, _super); function Property(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.property; _this.aggregation = elements.AggregationKind.none; _this.appliedStereotypes = []; _this.defaultValue = null; _this.isDeprecated = false; _this.isDerived = false; _this.isDerivedUnion = false; _this.isID = false; _this.isLeaf = false; _this.isNavigable = false; _this.isOrdered = false; _this.isReadOnly = false; _this.isStatic = false; _this.isUnique = false; _this.lowerValue = null; _this.name = ''; _this.order = 0; _this.taggedValues = []; _this.type = null; _this.upperValue = null; _this.visibility = null; return _this; } Object.defineProperty(Property.prototype, "association", { get: function () { return this.modelDelegate.getAssociation(this); }, enumerable: false, configurable: true }); Object.defineProperty(Property.prototype, "lower", { get: function () { return this.modelDelegate.getLower(this); }, enumerable: false, configurable: true }); Object.defineProperty(Property.prototype, "upper", { get: function () { return this.modelDelegate.getUpper(this); }, enumerable: false, configurable: true }); /** * Gets the value of the DefaultValue property. * @returns {any} The default value (the type depending on the type of value), or null if no default * value can be determined. */ Property.prototype.getDefault = function () { return this.modelDelegate.getDefault(this); }; /** * The query lowerBound() returns the lower bound of the multiplicity as an integer, which is the * integerValue of lowerValue, if this is given, and 1 otherwise. * @returns {number} */ Property.prototype.getLowerBound = function () { return this.modelDelegate.getLowerBound(this); }; /** * Gets the name of the typed element's type. * @returns {string} The type name, or an empty string if the element has no type. */ Property.prototype.getTypeName = function () { return this.modelDelegate.getTypeName(this); }; /** * The query upperBound() returns the upper bound of the multiplicity for a bounded multiplicity as an * unlimited natural, which is the unlimitedNaturalValue of upperValue, if given, and 1, otherwise. * @returns {elements.UnlimitedNatural} */ Property.prototype.getUpperBound = function () { return this.modelDelegate.getUpperBound(this); }; /** * The query isMultivalued() checks whether this multiplicity has an upper bound greater than one. * @returns {boolean} */ Property.prototype.isMultivalued = function () { return this.modelDelegate.isMultivalued(this); }; /** * The query isOptional checks whether this multiplicity has a lower bound of 0 (0..n). * @returns {boolean} */ Property.prototype.isOptional = function () { return this.modelDelegate.isOptional(this); }; /** * The query isOptionalAndSingleValued checks whether this multiplicity has a lower bound of 0 and an * upper bound of 1 (0..1). * @returns {boolean} */ Property.prototype.isOptionalAndSinglevalued = function () { return this.modelDelegate.isOptionalAndSinglevalued(this); }; /** * The query isRequiredAndSinglevalued checks whether this multiplicity has a lower bound of 1 and an * upper bound of 1 (1..1). * @returns {boolean} */ Property.prototype.isRequiredAndSinglevalued = function () { return this.modelDelegate.isRequiredAndSinglevalued(this); }; Property.prototype.addAppliedStereotype = function (stereotype) { this.appliedStereotypes.push(stereotype); this.modelDelegate.onElementAdded(this, stereotype); return this; }; Property.prototype.removeAppliedStereotype = function (stereotype) { removeFromArray(this.appliedStereotypes, stereotype); this.modelDelegate.onElementDeleted(this, stereotype); return this; }; Property.prototype.addOwnedComment = function (properties) { var e = this.modelDelegate.createElement('comment', this, properties, null); this.ownedComments.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Property.prototype.deleteOwnedComment = function (comment) { removeFromArray(this.ownedComments, comment); comment.isDeleted = true; this.modelDelegate.onElementDeleted(this, comment); return this; }; Property.prototype.setLowerValueUnlimited = function () { this.modelDelegate.setLowerValueUnlimited(this); return this; }; Property.prototype.setLowerValue = function (value) { this.modelDelegate.setLowerValue(this, value); return this; }; Property.prototype.setUpperValueUnlimited = function () { this.modelDelegate.setUpperValueUnlimited(this); return this; }; Property.prototype.setUpperValue = function (value) { this.modelDelegate.setUpperValue(this, value); return this; }; Property.prototype.setDefaultValueNull = function () { this.modelDelegate.setDefaultValueNull(this); return this; }; Property.prototype.setDefaultValue = function (value) { this.modelDelegate.setDefaultValue(this, value); return this; }; return Property; }(Element)); export { Property }; var Package = /** @class */ (function (_super) { __extends(Package, _super); function Package(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.package; _this.appliedProfiles = []; _this.appliedStereotypes = []; _this.isDeprecated = false; _this.isNamespaceRoot = false; _this.name = ''; _this.packagedElements = []; _this.taggedValues = []; _this.visibility = null; return _this; } Object.defineProperty(Package.prototype, "package", { get: function () { return this.modelDelegate.getPackage(this); }, enumerable: false, configurable: true }); /** * Gets all classes that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Class[]} */ Package.prototype.getAllClasses = function () { return this.modelDelegate.getAllClasses(this); }; /** * Gets all data types that are owned by this Package, including the ones owned by nested packages. * @returns {elements.DataType[]} */ Package.prototype.getAllDataTypes = function () { return this.modelDelegate.getAllDataTypes(this); }; /** * Gets all enumerations that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Enumeration[]} */ Package.prototype.getAllEnumerations = function () { return this.modelDelegate.getAllEnumerations(this); }; /** * Gets all interfaces that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Interface[]} */ Package.prototype.getAllInterfaces = function () { return this.modelDelegate.getAllInterfaces(this); }; /** * Gets all types that are owned by this Package, including the ones owned by nested packages. This * includes the following types of elements: Class, Interface, DataType, PrimitiveType and Enumeration. * @returns {elements.Classifier[]} A subset of PackagedElements. */ Package.prototype.getAllTypes = function () { return this.modelDelegate.getAllTypes(this); }; /** * Gets all classes that are owned by this Package. * @returns {elements.Class[]} A subset of PackagedElements. */ Package.prototype.getClasses = function () { return this.modelDelegate.getClasses(this); }; /** * Gets all data types that are owned by this Package. * @returns {elements.DataType[]} A subset of PackagedElements. */ Package.prototype.getDataTypes = function () { return this.modelDelegate.getDataTypes(this); }; /** * Gets all enumerations that are owned by this Package. * @returns {elements.Enumeration[]} A subset of PackagedElements. */ Package.prototype.getEnumerations = function () { return this.modelDelegate.getEnumerations(this); }; /** * Gets all interfaces that are owned by this Package. * @returns {elements.Interface[]} A subset of PackagedElements. */ Package.prototype.getInterfaces = function () { return this.modelDelegate.getInterfaces(this); }; /** * Constructs a name from the names of the nesting packages. The name is constructed working inwards * from the package that is defined as namespace root up to but not including the PackageableElement * itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Package.prototype.getNamespaceName = function (separator) { return this.modelDelegate.getNamespaceName(this, separator); }; /** * Gets all packages that are owned by this Package. * @returns {elements.Package[]} A subset of PackagedElements. */ Package.prototype.getNestedPackages = function () { return this.modelDelegate.getNestedPackages(this); }; /** * Gets all packages that contain this Package, working inwards from the top Package to the owning * package. * @returns {elements.Package[]} A collection of Packages. */ Package.prototype.getNestingPackages = function () { return this.modelDelegate.getNestingPackages(this); }; /** * Constructs a name from the PackageableElement and the names of the nesting packages. The name is * constructed working inwards from the package that is defined as namespace root up to and including * the PackageableElement itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Package.prototype.getQualifiedName = function (separator) { return this.modelDelegate.getQualifiedName(this, separator); }; /** * Gets all types that are owned by this Package. This includes the following types of elements: Class, * Interface, DataType, PrimitiveType and Enumeration. * @returns {elements.Classifier[]} A subset of PackagedElements. */ Package.prototype.getTypes = function () { return this.modelDelegate.getTypes(this); }; Package.prototype.addAppliedStereotype = function (stereotype) { this.appliedStereotypes.push(stereotype); this.modelDelegate.onElementAdded(this, stereotype); return this; }; Package.prototype.removeAppliedStereotype = function (stereotype) { removeFromArray(this.appliedStereotypes, stereotype); this.modelDelegate.onElementDeleted(this, stereotype); return this; }; Package.prototype.addOwnedComment = function (properties) { var e = this.modelDelegate.createElement('comment', this, properties, null); this.ownedComments.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.deleteOwnedComment = function (comment) { removeFromArray(this.ownedComments, comment); comment.isDeleted = true; this.modelDelegate.onElementDeleted(this, comment); return this; }; Package.prototype.addAppliedProfile = function (profile) { this.appliedProfiles.push(profile); this.modelDelegate.onElementAdded(this, profile); return this; }; Package.prototype.removeAppliedProfile = function (profile) { removeFromArray(this.appliedProfiles, profile); this.modelDelegate.onElementDeleted(this, profile); return this; }; Package.prototype.addPackage = function (properties, initFn) { var e = this.modelDelegate.createElement('package', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addProfile = function (properties, initFn) { var e = this.modelDelegate.createElement('profile', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addAssociation = function (properties, initFn) { var e = this.modelDelegate.createElement('association', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addClass = function (properties, initFn) { var e = this.modelDelegate.createElement('class', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addStereotype = function (properties, initFn) { var e = this.modelDelegate.createElement('stereotype', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addDataType = function (properties, initFn) { var e = this.modelDelegate.createElement('dataType', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addEnumeration = function (properties, initFn) { var e = this.modelDelegate.createElement('enumeration', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addPrimitiveType = function (properties, initFn) { var e = this.modelDelegate.createElement('primitiveType', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.addInterface = function (properties, initFn) { var e = this.modelDelegate.createElement('interface', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Package.prototype.deletePackagedElement = function (packageableElement) { packageableElement.isDeleted = true; removeFromArray(this.packagedElements, packageableElement); this.modelDelegate.onElementDeleted(this, packageableElement); return this; }; return Package; }(Element)); export { Package }; var Profile = /** @class */ (function (_super) { __extends(Profile, _super); function Profile(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.profile; _this.appliedProfiles = []; _this.appliedStereotypes = []; _this.isDeprecated = false; _this.isNamespaceRoot = false; _this.name = ''; _this.packagedElements = []; _this.safeName = ''; _this.taggedValues = []; _this.visibility = null; return _this; } Object.defineProperty(Profile.prototype, "package", { get: function () { return this.modelDelegate.getPackage(this); }, enumerable: false, configurable: true }); /** * Gets all classes that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Class[]} */ Profile.prototype.getAllClasses = function () { return this.modelDelegate.getAllClasses(this); }; /** * Gets all data types that are owned by this Package, including the ones owned by nested packages. * @returns {elements.DataType[]} */ Profile.prototype.getAllDataTypes = function () { return this.modelDelegate.getAllDataTypes(this); }; /** * Gets all enumerations that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Enumeration[]} */ Profile.prototype.getAllEnumerations = function () { return this.modelDelegate.getAllEnumerations(this); }; /** * Gets all interfaces that are owned by this Package, including the ones owned by nested packages. * @returns {elements.Interface[]} */ Profile.prototype.getAllInterfaces = function () { return this.modelDelegate.getAllInterfaces(this); }; /** * Gets all types that are owned by this Package, including the ones owned by nested packages. This * includes the following types of elements: Class, Interface, DataType, PrimitiveType and Enumeration. * @returns {elements.Classifier[]} A subset of PackagedElements. */ Profile.prototype.getAllTypes = function () { return this.modelDelegate.getAllTypes(this); }; /** * Gets all classes that are owned by this Package. * @returns {elements.Class[]} A subset of PackagedElements. */ Profile.prototype.getClasses = function () { return this.modelDelegate.getClasses(this); }; /** * Gets all data types that are owned by this Package. * @returns {elements.DataType[]} A subset of PackagedElements. */ Profile.prototype.getDataTypes = function () { return this.modelDelegate.getDataTypes(this); }; /** * Gets all enumerations that are owned by this Package. * @returns {elements.Enumeration[]} A subset of PackagedElements. */ Profile.prototype.getEnumerations = function () { return this.modelDelegate.getEnumerations(this); }; /** * Gets all interfaces that are owned by this Package. * @returns {elements.Interface[]} A subset of PackagedElements. */ Profile.prototype.getInterfaces = function () { return this.modelDelegate.getInterfaces(this); }; /** * Constructs a name from the names of the nesting packages. The name is constructed working inwards * from the package that is defined as namespace root up to but not including the PackageableElement * itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Profile.prototype.getNamespaceName = function (separator) { return this.modelDelegate.getNamespaceName(this, separator); }; /** * Gets all packages that are owned by this Package. * @returns {elements.Package[]} A subset of PackagedElements. */ Profile.prototype.getNestedPackages = function () { return this.modelDelegate.getNestedPackages(this); }; /** * Gets all packages that contain this Package, working inwards from the top Package to the owning * package. * @returns {elements.Package[]} A collection of Packages. */ Profile.prototype.getNestingPackages = function () { return this.modelDelegate.getNestingPackages(this); }; /** * Constructs a name from the PackageableElement and the names of the nesting packages. The name is * constructed working inwards from the package that is defined as namespace root up to and including * the PackageableElement itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ Profile.prototype.getQualifiedName = function (separator) { return this.modelDelegate.getQualifiedName(this, separator); }; /** * Gets all types that are owned by this Package. This includes the following types of elements: Class, * Interface, DataType, PrimitiveType and Enumeration. * @returns {elements.Classifier[]} A subset of PackagedElements. */ Profile.prototype.getTypes = function () { return this.modelDelegate.getTypes(this); }; Profile.prototype.addAppliedStereotype = function (stereotype) { this.appliedStereotypes.push(stereotype); this.modelDelegate.onElementAdded(this, stereotype); return this; }; Profile.prototype.removeAppliedStereotype = function (stereotype) { removeFromArray(this.appliedStereotypes, stereotype); this.modelDelegate.onElementDeleted(this, stereotype); return this; }; Profile.prototype.addOwnedComment = function (properties) { var e = this.modelDelegate.createElement('comment', this, properties, null); this.ownedComments.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.deleteOwnedComment = function (comment) { removeFromArray(this.ownedComments, comment); comment.isDeleted = true; this.modelDelegate.onElementDeleted(this, comment); return this; }; Profile.prototype.addAppliedProfile = function (profile) { this.appliedProfiles.push(profile); this.modelDelegate.onElementAdded(this, profile); return this; }; Profile.prototype.removeAppliedProfile = function (profile) { removeFromArray(this.appliedProfiles, profile); this.modelDelegate.onElementDeleted(this, profile); return this; }; Profile.prototype.addPackage = function (properties, initFn) { var e = this.modelDelegate.createElement('package', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addProfile = function (properties, initFn) { var e = this.modelDelegate.createElement('profile', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addAssociation = function (properties, initFn) { var e = this.modelDelegate.createElement('association', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addClass = function (properties, initFn) { var e = this.modelDelegate.createElement('class', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addStereotype = function (properties, initFn) { var e = this.modelDelegate.createElement('stereotype', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addDataType = function (properties, initFn) { var e = this.modelDelegate.createElement('dataType', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addEnumeration = function (properties, initFn) { var e = this.modelDelegate.createElement('enumeration', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addPrimitiveType = function (properties, initFn) { var e = this.modelDelegate.createElement('primitiveType', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.addInterface = function (properties, initFn) { var e = this.modelDelegate.createElement('interface', this, properties, initFn || null); this.packagedElements.push(e); this.modelDelegate.onElementAdded(this, e); return this; }; Profile.prototype.deletePackagedElement = function (packageableElement) { packageableElement.isDeleted = true; removeFromArray(this.packagedElements, packageableElement); this.modelDelegate.onElementDeleted(this, packageableElement); return this; }; return Profile; }(Element)); export { Profile }; var DataType = /** @class */ (function (_super) { __extends(DataType, _super); function DataType(modelDelegate, owner) { var _this = _super.call(this, modelDelegate, owner) || this; _this.elementType = elements.ElementType.dataType; _this.appliedStereotypes = []; _this.generalizations = []; _this.isAbstract = false; _this.isDeprecated = false; _this.isFinalSpecialization = false; _this.isInferred = false; _this.isLeaf = false; _this.name = ''; _this.ownedAttributes = []; _this.ownedOperations = []; _this.taggedValues = []; _this.visibility = null; return _this; } Object.defineProperty(DataType.prototype, "package", { get: function () { return this.modelDelegate.getPackage(this); }, enumerable: false, configurable: true }); /** * Returns both inherited and owned attributes. * @returns {elements.Property[]} */ DataType.prototype.getAllAttributes = function () { return this.modelDelegate.getAllAttributes(this); }; /** * Returns both inherited and owned operations. Any inherited operation that has the same signature * (having the same name and parameter type order) in an inheriting type is not included. * @returns {elements.Operation[]} */ DataType.prototype.getAllOperations = function () { return this.modelDelegate.getAllOperations(this); }; /** * Returns all of the direct and indirect ancestors of a generalized Classifier, working outwards: more * specific classifiers will appear before more general classifiers. * @returns {elements.Classifier[]} */ DataType.prototype.getAllParents = function () { return this.modelDelegate.getAllParents(this); }; /** * Gets all classifiers of which this element is a direct or indirect general. * @returns {elements.Classifier[]} */ DataType.prototype.getAllSpecializations = function () { return this.modelDelegate.getAllSpecializations(this); }; /** * Gets the first direct generalization relationship of the element. * @returns {elements.Generalization} */ DataType.prototype.getFirstGeneralization = function () { return this.modelDelegate.getFirstGeneralization(this); }; /** * Gets the first classifier that is an immediate general of the current element. * @returns {elements.Classifier} */ DataType.prototype.getFirstParent = function () { return this.modelDelegate.getFirstParent(this); }; /** * Constructs a name from the names of the nesting packages. The name is constructed working inwards * from the package that is defined as namespace root up to but not including the PackageableElement * itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ DataType.prototype.getNamespaceName = function (separator) { return this.modelDelegate.getNamespaceName(this, separator); }; /** * Gets all packages that contain this Package, working inwards from the top Package to the owning * package. * @returns {elements.Package[]} A collection of Packages. */ DataType.prototype.getNestingPackages = function () { return this.modelDelegate.getNestingPackages(this); }; /** * Gives all of the immediate ancestors of a generalized Classifier. * @returns {elements.Classifier[]} */ DataType.prototype.getParents = function () { return this.modelDelegate.getParents(this); }; /** * Constructs a name from the PackageableElement and the names of the nesting packages. The name is * constructed working inwards from the package that is defined as namespace root up to and including * the PackageableElement itself. * @param {string} separator The string to use to separate names. If not specified, a dot "." will be * used. * @returns {string} A single string with all the names separated. */ DataType.prototype.getQualifiedName = function (separator) { return this.modelDelegate.getQualifiedName(this, separator); }; /** * Gets all classifiers of which this classifier is a direct general. * @returns {elements.Classifier[]} */ DataType.prototype.getSpecializations = function () { return this.modelDelegate.getSpecializations(this); }; /** * Gets the super types of this type, derived from its Generalizations. * @returns {this[]} */ DataTy