diff options
author | Einav Weiss Keidar <einavw@amdocs.com> | 2018-03-20 14:45:40 +0200 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-03-20 13:52:31 +0000 |
commit | 7fdf733a64670fceefc3ded35cfa581e1c458179 (patch) | |
tree | b3623ac9a331473830cb0167c0b487f2a176427c /dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/model/Metamodels.js | |
parent | c7916a4e5955ccc5f0f5252307363b791ec5c7b9 (diff) |
Adding Prettier and fixing up eslint version
Issue-ID: SDC-1094
Change-Id: Ie83ad95a03899345dd90235daf0323cbe3bc6afd
Signed-off-by: Einav Weiss Keidar <einavw@amdocs.com>
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.js | 97 |
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(); + } } |