From 7fdf733a64670fceefc3ded35cfa581e1c458179 Mon Sep 17 00:00:00 2001 From: Einav Weiss Keidar Date: Tue, 20 Mar 2018 14:45:40 +0200 Subject: Adding Prettier and fixing up eslint version Issue-ID: SDC-1094 Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd Signed-off-by: Einav Weiss Keidar --- .../lib/ecomp/asdc/sequencer/model/Metamodels.js | 97 +++++++++++----------- 1 file changed, 47 insertions(+), 50 deletions(-) (limited to 'dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js') 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(); + } } -- cgit 1.2.3-korg