aboutsummaryrefslogtreecommitdiffstats
path: root/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js
diff options
context:
space:
mode:
Diffstat (limited to 'dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js')
-rw-r--r--dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js97
1 files changed, 47 insertions, 50 deletions
diff --git a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js
index 4ecfc0b5f7..40756a8e09 100644
--- a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js
+++ b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js
@@ -21,67 +21,64 @@ import Metamodel from './Metamodel';
* A simple lookup for schemas by ID.
*/
export default class Metamodels {
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
- // ///////////////////////////////////////////////////////////////////////////////////////////////
+ /**
+ * Construct metamodels from provided JSON definitions.
+ * @param metamodels JSON metamodel definitions.
+ */
+ constructor(metamodels) {
+ Common.assertType(metamodels, 'Array');
- /**
- * Construct metamodels from provided JSON definitions.
- * @param metamodels JSON metamodel definitions.
- */
- constructor(metamodels) {
+ this.lookup = {};
- Common.assertType(metamodels, 'Array');
+ // Save each metamodel. It's up to the Metamodel class to make sense of
+ // potentially nonsense metamodel definitions.
- this.lookup = {};
+ for (const json of metamodels) {
+ const metamodel = new Metamodel(json);
+ this.lookup[metamodel.getId()] = metamodel;
+ }
- // Save each metamodel. It's up to the Metamodel class to make sense of
- // potentially nonsense metamodel definitions.
+ // Set (or override) the default metamodel with the inlined one.
- for (const json of metamodels) {
- const metamodel = new Metamodel(json);
- this.lookup[metamodel.getId()] = metamodel;
+ this.lookup.$ = Metamodel.getDefault();
+ Common.assertInstanceOf(this.lookup.$, Metamodel);
}
- // Set (or override) the default metamodel with the inlined one.
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
- this.lookup.$ = Metamodel.getDefault();
- Common.assertInstanceOf(this.lookup.$, Metamodel);
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Get Metamodel by its @id.
- * @param id identifier.
- * @returns Metamodel, or undefined if no matching metamodel found.
- */
- getMetamodel(id) {
- return this.lookup[id];
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Get the default (permissive) metamodel.
- * @returns default Metamodel.
- */
- getDefault() {
- return this.lookup.$;
- }
+ /**
+ * Get Metamodel by its @id.
+ * @param id identifier.
+ * @returns Metamodel, or undefined if no matching metamodel found.
+ */
+ getMetamodel(id) {
+ return this.lookup[id];
+ }
- // ///////////////////////////////////////////////////////////////////////////////////////////////
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
- /**
- * Get metamodel by its @id, falling back to the default.
- * @param id identifier.
- * @returns matching metamodel, or default.
- */
- getMetamodelOrDefault(id) {
- const metamodel = this.getMetamodel(id);
- if (metamodel) {
- return metamodel;
+ /**
+ * Get the default (permissive) metamodel.
+ * @returns default Metamodel.
+ */
+ getDefault() {
+ return this.lookup.$;
}
- return this.getDefault();
- }
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get metamodel by its @id, falling back to the default.
+ * @param id identifier.
+ * @returns matching metamodel, or default.
+ */
+ getMetamodelOrDefault(id) {
+ const metamodel = this.getMetamodel(id);
+ if (metamodel) {
+ return metamodel;
+ }
+ return this.getDefault();
+ }
}