From 04987d1944f813822ab415a1c352d5917165bb39 Mon Sep 17 00:00:00 2001 From: niklaus Date: Wed, 2 May 2018 12:06:52 +0900 Subject: [PATCH 01/18] Update for V3 --- CodeGenUtils.js | 97 +- JavaCodeGenerator.js | 1412 +++++++++++------------ JavaPreferences.js | 116 -- JavaReverseEngineer.js | 2157 +++++++++++++++++------------------ LICENSE | 2 +- README.md | 4 +- main.js | 233 ++-- menus/menu.json | 19 + package.json | 32 +- preferences/preference.json | 62 + unittests.js | 1001 ---------------- 11 files changed, 1984 insertions(+), 3151 deletions(-) delete mode 100644 JavaPreferences.js create mode 100644 menus/menu.json create mode 100644 preferences/preference.json delete mode 100644 unittests.js diff --git a/CodeGenUtils.js b/CodeGenUtils.js index e8c50cf..268b719 100644 --- a/CodeGenUtils.js +++ b/CodeGenUtils.js @@ -21,59 +21,54 @@ * */ -define(function (require, exports, module) { - "use strict"; +/** +* CodeWriter +* @constructor +*/ +function CodeWriter (indentString) { + + /** @member {Array.} lines */ + this.lines = []; + + /** @member {string} indentString */ + this.indentString = (indentString ? indentString : " "); // default 4 spaces + + /** @member {Array.} indentations */ + this.indentations = []; +} - /** - * CodeWriter - * @constructor - */ - function CodeWriter(indentString) { - - /** @member {Array.} lines */ - this.lines = []; +/** +* Indent +*/ +CodeWriter.prototype.indent = function () { + this.indentations.push(this.indentString); +}; - /** @member {string} indentString */ - this.indentString = (indentString ? indentString : " "); // default 4 spaces +/** +* Outdent +*/ +CodeWriter.prototype.outdent = function () { + this.indentations.splice(this.indentations.length-1, 1); +}; - /** @member {Array.} indentations */ - this.indentations = []; - } +/** +* Write a line +* @param {string} line +*/ +CodeWriter.prototype.writeLine = function (line) { + if (line) { + this.lines.push(this.indentations.join("") + line); + } else { + this.lines.push(""); + } +}; - /** - * Indent - */ - CodeWriter.prototype.indent = function () { - this.indentations.push(this.indentString); - }; +/** +* Return as all string data +* @return {string} +*/ +CodeWriter.prototype.getData = function () { + return this.lines.join("\n"); +}; - /** - * Outdent - */ - CodeWriter.prototype.outdent = function () { - this.indentations.splice(this.indentations.length-1, 1); - }; - - /** - * Write a line - * @param {string} line - */ - CodeWriter.prototype.writeLine = function (line) { - if (line) { - this.lines.push(this.indentations.join("") + line); - } else { - this.lines.push(""); - } - }; - - /** - * Return as all string data - * @return {string} - */ - CodeWriter.prototype.getData = function () { - return this.lines.join("\n"); - }; - - exports.CodeWriter = CodeWriter; - -}); \ No newline at end of file +exports.CodeWriter = CodeWriter; diff --git a/JavaCodeGenerator.js b/JavaCodeGenerator.js index 914ad4b..950de19 100644 --- a/JavaCodeGenerator.js +++ b/JavaCodeGenerator.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 MKLab. All rights reserved. + * Copyright (c) 2014-2018 MKLab. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -21,756 +21,726 @@ * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */ -/*global define, $, _, window, app, type, document, java7 */ - -define(function (require, exports, module) { - "use strict"; - - var Repository = app.getModule("core/Repository"), - ProjectManager = app.getModule("engine/ProjectManager"), - Engine = app.getModule("engine/Engine"), - FileSystem = app.getModule("filesystem/FileSystem"), - FileUtils = app.getModule("file/FileUtils"), - Async = app.getModule("utils/Async"), - UML = app.getModule("uml/UML"); - - var CodeGenUtils = require("CodeGenUtils"); - - /** - * Java Code Generator - * @constructor - * - * @param {type.UMLPackage} baseModel - * @param {string} basePath generated files and directories to be placed - */ - function JavaCodeGenerator(baseModel, basePath) { - - /** @member {type.Model} */ - this.baseModel = baseModel; - - /** @member {string} */ - this.basePath = basePath; +const fs = require('fs') +const path = require('path') +const _ = require('lodash') +const CodeGenUtils = require('./CodeGenUtils') +/** + * Java Code Generator + */ +class JavaCodeGenerator { + + /** + * @constructor + * + * @param {type.UMLPackage} baseModel + * @param {string} basePath generated files and directories to be placed + */ + constructor (baseModel, basePath) { + /** @member {type.Model} */ + this.baseModel = baseModel + + /** @member {string} */ + this.basePath = basePath + } + + /** + * Return Indent String based on options + * @param {Object} options + * @return {string} + */ + getIndentString (options) { + if (options.useTab) { + return '\t' + } else { + var i + var len + var indent = [] + for (i = 0, len = options.indentSpaces; i < len; i++) { + indent.push(' ') + } + return indent.join('') } - - /** - * Return Indent String based on options - * @param {Object} options - * @return {string} - */ - JavaCodeGenerator.prototype.getIndentString = function (options) { - if (options.useTab) { - return "\t"; - } else { - var i, len, indent = []; - for (i = 0, len = options.indentSpaces; i < len; i++) { - indent.push(" "); - } - return indent.join(""); - } - }; - - /** - * Generate codes from a given element - * @param {type.Model} elem - * @param {string} path - * @param {Object} options - * @return {$.Promise} - */ - JavaCodeGenerator.prototype.generate = function (elem, path, options) { - var result = new $.Deferred(), - self = this, - fullPath, - directory, - codeWriter, - file; - - // Package - if (elem instanceof type.UMLPackage) { - fullPath = path + "/" + elem.name; - directory = FileSystem.getDirectoryForPath(fullPath); - directory.create(function (err, stat) { - if (!err) { - Async.doSequentially( - elem.ownedElements, - function (child) { - return self.generate(child, fullPath, options); - }, - false - ).then(result.resolve, result.reject); - } else { - result.reject(err); - } - }); - } else if (elem instanceof type.UMLClass) { - - // AnnotationType - if (elem.stereotype === "annotationType") { - fullPath = path + "/" + elem.name + ".java"; - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)); - this.writePackageDeclaration(codeWriter, elem, options); - codeWriter.writeLine(); - codeWriter.writeLine("import java.util.*;"); - codeWriter.writeLine(); - this.writeAnnotationType(codeWriter, elem, options); - file = FileSystem.getFileForPath(fullPath); - FileUtils.writeText(file, codeWriter.getData(), true).then(result.resolve, result.reject); - - // Class - } else { - fullPath = path + "/" + elem.name + ".java"; - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)); - this.writePackageDeclaration(codeWriter, elem, options); - codeWriter.writeLine(); - codeWriter.writeLine("import java.util.*;"); - codeWriter.writeLine(); - this.writeClass(codeWriter, elem, options); - file = FileSystem.getFileForPath(fullPath); - FileUtils.writeText(file, codeWriter.getData(), true).then(result.resolve, result.reject); - } - - // Interface - } else if (elem instanceof type.UMLInterface) { - fullPath = path + "/" + elem.name + ".java"; - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)); - this.writePackageDeclaration(codeWriter, elem, options); - codeWriter.writeLine(); - codeWriter.writeLine("import java.util.*;"); - codeWriter.writeLine(); - this.writeInterface(codeWriter, elem, options); - file = FileSystem.getFileForPath(fullPath); - FileUtils.writeText(file, codeWriter.getData(), true).then(result.resolve, result.reject); - - // Enum - } else if (elem instanceof type.UMLEnumeration) { - fullPath = path + "/" + elem.name + ".java"; - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)); - this.writePackageDeclaration(codeWriter, elem, options); - codeWriter.writeLine(); - this.writeEnum(codeWriter, elem, options); - file = FileSystem.getFileForPath(fullPath); - FileUtils.writeText(file, codeWriter.getData(), true).then(result.resolve, result.reject); - - // Others (Nothing generated.) - } else { - result.resolve(); - } - return result.promise(); - }; - - - /** - * Return visibility - * @param {type.Model} elem - * @return {string} - */ - JavaCodeGenerator.prototype.getVisibility = function (elem) { - switch (elem.visibility) { - case UML.VK_PUBLIC: - return "public"; - case UML.VK_PROTECTED: - return "protected"; - case UML.VK_PRIVATE: - return "private"; - } - return null; - }; - - /** - * Collect modifiers of a given element. - * @param {type.Model} elem - * @return {Array.} - */ - JavaCodeGenerator.prototype.getModifiers = function (elem) { - var modifiers = []; - var visibility = this.getVisibility(elem); - if (visibility) { - modifiers.push(visibility); - } - if (elem.isStatic === true) { - modifiers.push("static"); - } - if (elem.isAbstract === true) { - modifiers.push("abstract"); - } - if (elem.isFinalSpecialization === true || elem.isLeaf === true) { - modifiers.push("final"); - } - if (elem.concurrency === UML.CCK_CONCURRENT) { - modifiers.push("synchronized"); - } - // transient - // volatile - // strictfp - // const - // native - return modifiers; - }; - - /** - * Collect super classes of a given element - * @param {type.Model} elem - * @return {Array.} - */ - JavaCodeGenerator.prototype.getSuperClasses = function (elem) { - var generalizations = Repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLGeneralization && rel.source === elem); - }); - return _.map(generalizations, function (gen) { return gen.target; }); - }; - - /** - * Collect super interfaces of a given element - * @param {type.Model} elem - * @return {Array.} - */ - JavaCodeGenerator.prototype.getSuperInterfaces = function (elem) { - var realizations = Repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLInterfaceRealization && rel.source === elem); - }); - return _.map(realizations, function (gen) { return gen.target; }); - }; - - /** - * Return type expression - * @param {type.Model} elem - * @return {string} - */ - JavaCodeGenerator.prototype.getType = function (elem) { - var _type = "void"; - // type name - if (elem instanceof type.UMLAssociationEnd) { - if (elem.reference instanceof type.UMLModelElement && elem.reference.name.length > 0) { - _type = elem.reference.name; - } + } + + /** + * Generate codes from a given element + * @param {type.Model} elem + * @param {string} basePath + * @param {Object} options + * @return {$.Promise} + */ + generate (elem, basePath, options) { + var fullPath + var codeWriter + + // Package + if (elem instanceof type.UMLPackage) { + fullPath = path.join(basePath, elem.name) + fs.mkdirSync(fullPath) + if (Array.isArray(elem.ownedElements)) { + elem.ownedElements.forEach(child => { + return this.generate(child, fullPath, options) + }) + } + } else if (elem instanceof type.UMLClass) { + // AnnotationType + if (elem.stereotype === 'annotationType') { + fullPath = path.join(basePath, elem.name + '.java') + codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + this.writePackageDeclaration(codeWriter, elem, options) + codeWriter.writeLine() + codeWriter.writeLine('import java.util.*;') + codeWriter.writeLine() + this.writeAnnotationType(codeWriter, elem, options) + fs.writeFileSync(fullPath, codeWriter.getData()) + // Class + } else { + fullPath = basePath + '/' + elem.name + '.java' + codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + this.writePackageDeclaration(codeWriter, elem, options) + codeWriter.writeLine() + codeWriter.writeLine('import java.util.*;') + codeWriter.writeLine() + this.writeClass(codeWriter, elem, options) + fs.writeFileSync(fullPath, codeWriter.getData()) + } + + // Interface + } else if (elem instanceof type.UMLInterface) { + fullPath = basePath + '/' + elem.name + '.java' + codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + this.writePackageDeclaration(codeWriter, elem, options) + codeWriter.writeLine() + codeWriter.writeLine('import java.util.*;') + codeWriter.writeLine() + this.writeInterface(codeWriter, elem, options) + fs.writeFileSync(fullPath, codeWriter.getData()) + + // Enum + } else if (elem instanceof type.UMLEnumeration) { + fullPath = basePath + '/' + elem.name + '.java' + codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + this.writePackageDeclaration(codeWriter, elem, options) + codeWriter.writeLine() + this.writeEnum(codeWriter, elem, options) + fs.writeFileSync(fullPath, codeWriter.getData()) + } + } + + /** + * Return visibility + * @param {type.Model} elem + * @return {string} + */ + getVisibility (elem) { + switch (elem.visibility) { + case type.UMLModelElement.VK_PUBLIC: + return 'public' + case type.UMLModelElement.VK_PROTECTED: + return 'protected' + case type.UMLModelElement.VK_PRIVATE: + return 'private' + } + return null + } + + /** + * Collect modifiers of a given element. + * @param {type.Model} elem + * @return {Array.} + */ + getModifiers (elem) { + var modifiers = [] + var visibility = this.getVisibility(elem) + if (visibility) { + modifiers.push(visibility) + } + if (elem.isStatic === true) { + modifiers.push('static') + } + if (elem.isAbstract === true) { + modifiers.push('abstract') + } + if (elem.isFinalSpecialization === true || elem.isLeaf === true) { + modifiers.push('final') + } + if (elem.concurrency === type.UMLBehavioralFeature.CCK_CONCURRENT) { + modifiers.push('synchronized') + } + // transient + // strictfp + // const + // native + return modifiers + } + + /** + * Collect super classes of a given element + * @param {type.Model} elem + * @return {Array.} + */ + getSuperClasses (elem) { + var generalizations = app.repository.getRelationshipsOf(elem, function (rel) { + return (rel instanceof type.UMLGeneralization && rel.source === elem) + }) + return _.map(generalizations, function (gen) { return gen.target }) + } + + /** + * Collect super interfaces of a given element + * @param {type.Model} elem + * @return {Array.} + */ + getSuperInterfaces (elem) { + var realizations = app.repository.getRelationshipsOf(elem, function (rel) { + return (rel instanceof type.UMLInterfaceRealization && rel.source === elem) + }) + return _.map(realizations, function (gen) { return gen.target }) + } + + /** + * Return type expression + * @param {type.Model} elem + * @return {string} + */ + getType (elem) { + var _type = 'void' + // type name + if (elem instanceof type.UMLAssociationEnd) { + if (elem.reference instanceof type.UMLModelElement && elem.reference.name.length > 0) { + _type = elem.reference.name + } + } else { + if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { + _type = elem.type.name + } else if (_.isString(elem.type) && elem.type.length > 0) { + _type = elem.type + } + } + // multiplicity + if (elem.multiplicity) { + if (_.includes(['0..*', '1..*', '*'], elem.multiplicity.trim())) { + if (elem.isOrdered === true) { + _type = 'List<' + _type + '>' } else { - if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { - _type = elem.type.name; - } else if (_.isString(elem.type) && elem.type.length > 0) { - _type = elem.type; - } - } - // multiplicity - if (elem.multiplicity) { - if (_.contains(["0..*", "1..*", "*"], elem.multiplicity.trim())) { - if (elem.isOrdered === true) { - _type = "List<" + _type + ">"; - } else { - _type = "Set<" + _type + ">"; - } - } else if (elem.multiplicity !== "1" && elem.multiplicity.match(/^\d+$/)) { // number - _type += "[]"; - } - } - return _type; - }; - - /** - * Write Doc - * @param {StringWriter} codeWriter - * @param {string} text - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeDoc = function (codeWriter, text, options) { - var i, len, lines; - if (options.javaDoc && _.isString(text)) { - lines = text.trim().split("\n"); - codeWriter.writeLine("/**"); - for (i = 0, len = lines.length; i < len; i++) { - codeWriter.writeLine(" * " + lines[i]); - } - codeWriter.writeLine(" */"); - } - }; - - /** - * Write Package Declaration - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writePackageDeclaration = function (codeWriter, elem, options) { - var path = null; - if (elem._parent) { - path = _.map(elem._parent.getPath(this.baseModel), function (e) { return e.name; }).join("."); - } - if (path) { - codeWriter.writeLine("package " + path + ";"); - } - }; - - /** - * Write Constructor - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeConstructor = function (codeWriter, elem, options) { - if (elem.name.length > 0) { - var terms = []; - // Doc - this.writeDoc(codeWriter, "Default constructor", options); - // Visibility - var visibility = this.getVisibility(elem); - if (visibility) { - terms.push(visibility); - } - terms.push(elem.name + "()"); - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.writeLine("}"); - } - }; - - /** - * Write Member Variable - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeMemberVariable = function (codeWriter, elem, options) { - if (elem.name.length > 0) { - var terms = []; - // doc - this.writeDoc(codeWriter, elem.documentation, options); - // modifiers - var _modifiers = this.getModifiers(elem); - if (_modifiers.length > 0) { - terms.push(_modifiers.join(" ")); - } - // type - terms.push(this.getType(elem)); - // name - terms.push(elem.name); - // initial value - if (elem.defaultValue && elem.defaultValue.length > 0) { - terms.push("= " + elem.defaultValue); - } - codeWriter.writeLine(terms.join(" ") + ";"); - } - }; - - /** - * Write Method - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - * @param {boolean} skipBody - * @param {boolean} skipParams - */ - JavaCodeGenerator.prototype.writeMethod = function (codeWriter, elem, options, skipBody, skipParams) { - if (elem.name.length > 0) { - var terms = []; - var params = elem.getNonReturnParameters(); - var returnParam = elem.getReturnParameter(); - - // doc - var doc = elem.documentation.trim(); - - //Erase Javadoc @param and @return - var i, lines = doc.split("\n"); - doc = ""; - for (i = 0, len = lines.length; i < len; i++) { - if(lines[i].lastIndexOf("@param", 0) !== 0 && lines[i].lastIndexOf("@return", 0) !== 0) { - doc += "\n" + lines[i]; - } - } - - _.each(params, function (param) { - doc += "\n@param " + param.name + " " + param.documentation; - }); - if (returnParam) { - doc += "\n@return " + returnParam.documentation; - } - this.writeDoc(codeWriter, doc, options); - - // modifiers - var _modifiers = this.getModifiers(elem); - if (_modifiers.length > 0) { - terms.push(_modifiers.join(" ")); - } - - // type - if (returnParam) { - terms.push(this.getType(returnParam)); - } else { - terms.push("void"); - } - - // name + parameters - var paramTerms = []; - if (!skipParams) { - var i, len; - for (i = 0, len = params.length; i < len; i++) { - var p = params[i]; - var s = this.getType(p) + " " + p.name; - if (p.isReadOnly === true) { - s = "final " + s; - } - paramTerms.push(s); - } - } - terms.push(elem.name + "(" + paramTerms.join(", ") + ")"); - - // body - if (skipBody === true || _.contains(_modifiers, "abstract")) { - codeWriter.writeLine(terms.join(" ") + ";"); - } else { - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.indent(); - codeWriter.writeLine("// TODO implement here"); - - // return statement - if (returnParam) { - var returnType = this.getType(returnParam); - if (returnType === "boolean") { - codeWriter.writeLine("return false;"); - } else if (returnType === "int" || returnType === "long" || returnType === "short" || returnType === "byte") { - codeWriter.writeLine("return 0;"); - } else if (returnType === "float") { - codeWriter.writeLine("return 0.0f;"); - } else if (returnType === "double") { - codeWriter.writeLine("return 0.0d;"); - } else if (returnType === "char") { - codeWriter.writeLine("return '0';"); - } else if (returnType === "String") { - codeWriter.writeLine('return "";'); - } else { - codeWriter.writeLine("return null;"); - } - } - - codeWriter.outdent(); - codeWriter.writeLine("}"); - } - } - }; - - /** - * Write Class - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeClass = function (codeWriter, elem, options) { - var i, len, terms = []; - - // Doc - var doc = elem.documentation.trim(); - if (ProjectManager.getProject().author && ProjectManager.getProject().author.length > 0) { - doc += "\n@author " + ProjectManager.getProject().author; - } - this.writeDoc(codeWriter, doc, options); - - // Modifiers - var _modifiers = this.getModifiers(elem); - if ( _.contains(_modifiers, "abstract") !== true && _.some(elem.operations, function (op) { return op.isAbstract === true; })) { - _modifiers.push("abstract"); - } - if (_modifiers.length > 0) { - terms.push(_modifiers.join(" ")); - } - - // Class - terms.push("class"); - terms.push(elem.name); - - // Extends - var _extends = this.getSuperClasses(elem); - if (_extends.length > 0) { - terms.push("extends " + _extends[0].name); - } - - // Implements - var _implements = this.getSuperInterfaces(elem); - if (_implements.length > 0) { - terms.push("implements " + _.map(_implements, function (e) { return e.name; }).join(", ")); - } - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.writeLine(); - codeWriter.indent(); - - // Constructor - this.writeConstructor(codeWriter, elem, options); - codeWriter.writeLine(); - - // Member Variables - // (from attributes) - for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options); - codeWriter.writeLine(); - } - // (from associations) - var associations = Repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLAssociation); - }); - for (i = 0, len = associations.length; i < len; i++) { - var asso = associations[i]; - if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options); - codeWriter.writeLine(); - } - if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options); - codeWriter.writeLine(); - } - } - - // Methods - for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, false, false); - codeWriter.writeLine(); - } - - // Extends methods - if (_extends.length > 0) { - for (i = 0, len = _extends[0].operations.length; i < len; i++) { - _modifiers = this.getModifiers(_extends[0].operations[i]); - if( _.contains(_modifiers, "abstract") === true ) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false); - codeWriter.writeLine(); - } - } - } - - // Interface methods - for (var j = 0; j < _implements.length; j++) { - for (i = 0, len = _implements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _implements[j].operations[i], options, false, false); - codeWriter.writeLine(); - } + _type = 'Set<' + _type + '>' } + } else if (elem.multiplicity !== '1' && elem.multiplicity.match(/^\d+$/)) { // number + _type += '[]' + } + } + return _type + } + + /** + * Write Doc + * @param {StringWriter} codeWriter + * @param {string} text + * @param {Object} options + */ + writeDoc (codeWriter, text, options) { + var i, len, lines + if (options.javaDoc && _.isString(text)) { + lines = text.trim().split('\n') + codeWriter.writeLine('/**') + for (i = 0, len = lines.length; i < len; i++) { + codeWriter.writeLine(' * ' + lines[i]) + } + codeWriter.writeLine(' */') + } + } + + /** + * Write Package Declaration + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writePackageDeclaration (codeWriter, elem, options) { + var packagePath = null + if (elem._parent) { + packagePath = _.map(elem._parent.getPath(this.baseModel), function (e) { return e.name }).join('.') + } + if (packagePath) { + codeWriter.writeLine('package ' + packagePath + ';') + } + } + + /** + * Write Constructor + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeConstructor (codeWriter, elem, options) { + if (elem.name.length > 0) { + var terms = [] + // Doc + this.writeDoc(codeWriter, 'Default constructor', options) + // Visibility + var visibility = this.getVisibility(elem) + if (visibility) { + terms.push(visibility) + } + terms.push(elem.name + '()') + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.writeLine('}') + } + } + + /** + * Write Member Variable + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeMemberVariable (codeWriter, elem, options) { + if (elem.name.length > 0) { + var terms = [] + // doc + this.writeDoc(codeWriter, elem.documentation, options) + // modifiers + var _modifiers = this.getModifiers(elem) + if (_modifiers.length > 0) { + terms.push(_modifiers.join(' ')) + } + // type + terms.push(this.getType(elem)) + // name + terms.push(elem.name) + // initial value + if (elem.defaultValue && elem.defaultValue.length > 0) { + terms.push('= ' + elem.defaultValue) + } + codeWriter.writeLine(terms.join(' ') + ';') + } + } + + /** + * Write Method + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + * @param {boolean} skipBody + * @param {boolean} skipParams + */ + writeMethod (codeWriter, elem, options, skipBody, skipParams) { + if (elem.name.length > 0) { + var terms = [] + var params = elem.getNonReturnParameters() + var returnParam = elem.getReturnParameter() + + // doc + var doc = elem.documentation.trim() + + // Erase Javadoc @param and @return + var i + var lines = doc.split('\n') + doc = '' + for (i = 0, len = lines.length; i < len; i++) { + if (lines[i].lastIndexOf('@param', 0) !== 0 && lines[i].lastIndexOf('@return', 0) !== 0) { + doc += '\n' + lines[i] + } + } + + _.each(params, function (param) { + doc += '\n@param ' + param.name + ' ' + param.documentation + }) + if (returnParam) { + doc += '\n@return ' + returnParam.documentation + } + this.writeDoc(codeWriter, doc, options) + + // modifiers + var _modifiers = this.getModifiers(elem) + if (_modifiers.length > 0) { + terms.push(_modifiers.join(' ')) + } + + // type + if (returnParam) { + terms.push(this.getType(returnParam)) + } else { + terms.push('void') + } + + // name + parameters + var paramTerms = [] + if (!skipParams) { + var len + for (i = 0, len = params.length; i < len; i++) { + var p = params[i] + var s = this.getType(p) + ' ' + p.name + if (p.isReadOnly === true) { + s = 'final ' + s + } + paramTerms.push(s) + } + } + terms.push(elem.name + '(' + paramTerms.join(', ') + ')') + + // body + if (skipBody === true || _.includes(_modifiers, 'abstract')) { + codeWriter.writeLine(terms.join(' ') + ';') + } else { + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.indent() + codeWriter.writeLine('// TODO implement here') + + // return statement + if (returnParam) { + var returnType = this.getType(returnParam) + if (returnType === 'boolean') { + codeWriter.writeLine('return false;') + } else if (returnType === 'int' || returnType === 'long' || returnType === 'short' || returnType === 'byte') { + codeWriter.writeLine('return 0;') + } else if (returnType === 'float') { + codeWriter.writeLine('return 0.0f;') + } else if (returnType === 'double') { + codeWriter.writeLine('return 0.0d;') + } else if (returnType === 'char') { + codeWriter.writeLine('return "0";') + } else if (returnType === 'String') { + codeWriter.writeLine('return "";') + } else { + codeWriter.writeLine('return null;') + } + } + + codeWriter.outdent() + codeWriter.writeLine('}') + } + } + } + + /** + * Write Class + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeClass (codeWriter, elem, options) { + var i, len + var terms = [] + + // Doc + var doc = elem.documentation.trim() + if (app.project.getProject().author && app.project.getProject().author.length > 0) { + doc += '\n@author ' + app.project.getProject().author + } + this.writeDoc(codeWriter, doc, options) - // Inner Definitions - for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i]; - if (def instanceof type.UMLClass) { - if (def.stereotype === "annotationType") { - this.writeAnnotationType(codeWriter, def, options); - } else { - this.writeClass(codeWriter, def, options); - } - codeWriter.writeLine(); - } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options); - codeWriter.writeLine(); - } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options); - codeWriter.writeLine(); - } - } + // Modifiers + var _modifiers = this.getModifiers(elem) + if (_.includes(_modifiers, 'abstract') !== true && _.some(elem.operations, function (op) { return op.isAbstract === true })) { + _modifiers.push('abstract') + } + if (_modifiers.length > 0) { + terms.push(_modifiers.join(' ')) + } - codeWriter.outdent(); - codeWriter.writeLine("}"); - }; + // Class + terms.push('class') + terms.push(elem.name) + // Extends + var _extends = this.getSuperClasses(elem) + if (_extends.length > 0) { + terms.push('extends ' + _extends[0].name) + } - /** - * Write Interface - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeInterface = function (codeWriter, elem, options) { - var i, len, terms = []; + // Implements + var _implements = this.getSuperInterfaces(elem) + if (_implements.length > 0) { + terms.push('implements ' + _.map(_implements, function (e) { return e.name }).join(', ')) + } + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.writeLine() + codeWriter.indent() + + // Constructor + this.writeConstructor(codeWriter, elem, options) + codeWriter.writeLine() + + // Member Variables + // (from attributes) + for (i = 0, len = elem.attributes.length; i < len; i++) { + this.writeMemberVariable(codeWriter, elem.attributes[i], options) + codeWriter.writeLine() + } + // (from associations) + var associations = app.repository.getRelationshipsOf(elem, function (rel) { + return (rel instanceof type.UMLAssociation) + }) + for (i = 0, len = associations.length; i < len; i++) { + var asso = associations[i] + if (asso.end1.reference === elem && asso.end2.navigable === true) { + this.writeMemberVariable(codeWriter, asso.end2, options) + codeWriter.writeLine() + } + if (asso.end2.reference === elem && asso.end1.navigable === true) { + this.writeMemberVariable(codeWriter, asso.end1, options) + codeWriter.writeLine() + } + } - // Doc - this.writeDoc(codeWriter, elem.documentation, options); + // Methods + for (i = 0, len = elem.operations.length; i < len; i++) { + this.writeMethod(codeWriter, elem.operations[i], options, false, false) + codeWriter.writeLine() + } - // Modifiers - var visibility = this.getVisibility(elem); - if (visibility) { - terms.push(visibility); + // Extends methods + if (_extends.length > 0) { + for (i = 0, len = _extends[0].operations.length; i < len; i++) { + _modifiers = this.getModifiers(_extends[0].operations[i]) + if (_.includes(_modifiers, 'abstract') === true) { + this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + codeWriter.writeLine() } + } + } - // Interface - terms.push("interface"); - terms.push(elem.name); - - // Extends - var _extends = this.getSuperClasses(elem); - if (_extends.length > 0) { - terms.push("extends " + _.map(_extends, function (e) { return e.name; }).join(", ")); - } - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.writeLine(); - codeWriter.indent(); - - // Member Variables - // (from attributes) - for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options); - codeWriter.writeLine(); - } - // (from associations) - var associations = Repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLAssociation); - }); - for (i = 0, len = associations.length; i < len; i++) { - var asso = associations[i]; - if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options); - codeWriter.writeLine(); - } - if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options); - codeWriter.writeLine(); - } - } + // Interface methods + for (var j = 0; j < _implements.length; j++) { + for (i = 0, len = _implements[j].operations.length; i < len; i++) { + this.writeMethod(codeWriter, _implements[j].operations[i], options, false, false) + codeWriter.writeLine() + } + } - // Methods - for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, false); - codeWriter.writeLine(); - } + // Inner Definitions + for (i = 0, len = elem.ownedElements.length; i < len; i++) { + var def = elem.ownedElements[i] + if (def instanceof type.UMLClass) { + if (def.stereotype === 'annotationType') { + this.writeAnnotationType(codeWriter, def, options) + } else { + this.writeClass(codeWriter, def, options) + } + codeWriter.writeLine() + } else if (def instanceof type.UMLInterface) { + this.writeInterface(codeWriter, def, options) + codeWriter.writeLine() + } else if (def instanceof type.UMLEnumeration) { + this.writeEnum(codeWriter, def, options) + codeWriter.writeLine() + } + } - // Inner Definitions - for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i]; - if (def instanceof type.UMLClass) { - if (def.stereotype === "annotationType") { - this.writeAnnotationType(codeWriter, def, options); - } else { - this.writeClass(codeWriter, def, options); - } - codeWriter.writeLine(); - } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options); - codeWriter.writeLine(); - } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options); - codeWriter.writeLine(); - } - } + codeWriter.outdent() + codeWriter.writeLine('}') + } + + /** + * Write Interface + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeInterface (codeWriter, elem, options) { + var i, len + var terms = [] + + // Doc + this.writeDoc(codeWriter, elem.documentation, options) + + // Modifiers + var visibility = this.getVisibility(elem) + if (visibility) { + terms.push(visibility) + } - codeWriter.outdent(); - codeWriter.writeLine("}"); - }; - - /** - * Write Enum - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeEnum = function (codeWriter, elem, options) { - var i, len, terms = []; - // Doc - this.writeDoc(codeWriter, elem.documentation, options); - - // Modifiers - var visibility = this.getVisibility(elem); - if (visibility) { - terms.push(visibility); - } - // Enum - terms.push("enum"); - terms.push(elem.name); + // Interface + terms.push('interface') + terms.push(elem.name) - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.indent(); + // Extends + var _extends = this.getSuperClasses(elem) + if (_extends.length > 0) { + terms.push('extends ' + _.map(_extends, function (e) { return e.name }).join(', ')) + } + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.writeLine() + codeWriter.indent() + + // Member Variables + // (from attributes) + for (i = 0, len = elem.attributes.length; i < len; i++) { + this.writeMemberVariable(codeWriter, elem.attributes[i], options) + codeWriter.writeLine() + } + // (from associations) + var associations = app.repository.getRelationshipsOf(elem, function (rel) { + return (rel instanceof type.UMLAssociation) + }) + for (i = 0, len = associations.length; i < len; i++) { + var asso = associations[i] + if (asso.end1.reference === elem && asso.end2.navigable === true) { + this.writeMemberVariable(codeWriter, asso.end2, options) + codeWriter.writeLine() + } + if (asso.end2.reference === elem && asso.end1.navigable === true) { + this.writeMemberVariable(codeWriter, asso.end1, options) + codeWriter.writeLine() + } + } - // Literals - for (i = 0, len = elem.literals.length; i < len; i++) { - codeWriter.writeLine(elem.literals[i].name + (i < elem.literals.length - 1 ? "," : "")); - } + // Methods + for (i = 0, len = elem.operations.length; i < len; i++) { + this.writeMethod(codeWriter, elem.operations[i], options, true, false) + codeWriter.writeLine() + } - codeWriter.outdent(); - codeWriter.writeLine("}"); - }; + // Inner Definitions + for (i = 0, len = elem.ownedElements.length; i < len; i++) { + var def = elem.ownedElements[i] + if (def instanceof type.UMLClass) { + if (def.stereotype === 'annotationType') { + this.writeAnnotationType(codeWriter, def, options) + } else { + this.writeClass(codeWriter, def, options) + } + codeWriter.writeLine() + } else if (def instanceof type.UMLInterface) { + this.writeInterface(codeWriter, def, options) + codeWriter.writeLine() + } else if (def instanceof type.UMLEnumeration) { + this.writeEnum(codeWriter, def, options) + codeWriter.writeLine() + } + } + codeWriter.outdent() + codeWriter.writeLine('}') + } + + /** + * Write Enum + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeEnum (codeWriter, elem, options) { + var i, len + var terms = [] + // Doc + this.writeDoc(codeWriter, elem.documentation, options) + + // Modifiers + var visibility = this.getVisibility(elem) + if (visibility) { + terms.push(visibility) + } + // Enum + terms.push('enum') + terms.push(elem.name) - /** - * Write AnnotationType - * @param {StringWriter} codeWriter - * @param {type.Model} elem - * @param {Object} options - */ - JavaCodeGenerator.prototype.writeAnnotationType = function (codeWriter, elem, options) { - var i, len, terms = []; + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.indent() - // Doc - var doc = elem.documentation.trim(); - if (ProjectManager.getProject().author && ProjectManager.getProject().author.length > 0) { - doc += "\n@author " + ProjectManager.getProject().author; - } - this.writeDoc(codeWriter, doc, options); + // Literals + for (i = 0, len = elem.literals.length; i < len; i++) { + codeWriter.writeLine(elem.literals[i].name + (i < elem.literals.length - 1 ? ',' : '')) + } - // Modifiers - var _modifiers = this.getModifiers(elem); - if (_.contains(_modifiers, "abstract") !== true && _.some(elem.operations, function (op) { return op.isAbstract === true; })) { - _modifiers.push("abstract"); - } - if (_modifiers.length > 0) { - terms.push(_modifiers.join(" ")); - } + codeWriter.outdent() + codeWriter.writeLine('}') + } + + /** + * Write AnnotationType + * @param {StringWriter} codeWriter + * @param {type.Model} elem + * @param {Object} options + */ + writeAnnotationType (codeWriter, elem, options) { + var i, len + var terms = [] + + // Doc + var doc = elem.documentation.trim() + if (app.project.getProject().author && app.project.getProject().author.length > 0) { + doc += '\n@author ' + app.project.getProject().author + } + this.writeDoc(codeWriter, doc, options) - // AnnotationType - terms.push("@interface"); - terms.push(elem.name); + // Modifiers + var _modifiers = this.getModifiers(elem) + if (_.includes(_modifiers, 'abstract') !== true && _.some(elem.operations, function (op) { return op.isAbstract === true })) { + _modifiers.push('abstract') + } + if (_modifiers.length > 0) { + terms.push(_modifiers.join(' ')) + } - codeWriter.writeLine(terms.join(" ") + " {"); - codeWriter.writeLine(); - codeWriter.indent(); + // AnnotationType + terms.push('@interface') + terms.push(elem.name) - // Member Variables - for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options); - codeWriter.writeLine(); - } + codeWriter.writeLine(terms.join(' ') + ' {') + codeWriter.writeLine() + codeWriter.indent() - // Methods - for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, true); - codeWriter.writeLine(); - } + // Member Variables + for (i = 0, len = elem.attributes.length; i < len; i++) { + this.writeMemberVariable(codeWriter, elem.attributes[i], options) + codeWriter.writeLine() + } - // Extends methods - if (_extends.length > 0) { - for (i = 0, len = _extends[0].operations.length; i < len; i++) { - _modifiers = this.getModifiers(_extends[0].operations[i]); - if(_.contains(_modifiers, "abstract") === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false); - codeWriter.writeLine(); - } - } - } + // Methods + for (i = 0, len = elem.operations.length; i < len; i++) { + this.writeMethod(codeWriter, elem.operations[i], options, true, true) + codeWriter.writeLine() + } - // Inner Definitions - for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i]; - if (def instanceof type.UMLClass) { - if (def.stereotype === "annotationType") { - this.writeAnnotationType(codeWriter, def, options); - } else { - this.writeClass(codeWriter, def, options); - } - codeWriter.writeLine(); - } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options); - codeWriter.writeLine(); - } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options); - codeWriter.writeLine(); - } + // Extends methods + var _extends = this.getSuperClasses(elem) + if (_extends.length > 0) { + for (i = 0, len = _extends[0].operations.length; i < len; i++) { + _modifiers = this.getModifiers(_extends[0].operations[i]) + if (_.includes(_modifiers, 'abstract') === true) { + this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + codeWriter.writeLine() } + } + } - codeWriter.outdent(); - codeWriter.writeLine("}"); - }; - - /** - * Generate - * @param {type.Model} baseModel - * @param {string} basePath - * @param {Object} options - */ - function generate(baseModel, basePath, options) { - var result = new $.Deferred(); - var javaCodeGenerator = new JavaCodeGenerator(baseModel, basePath); - return javaCodeGenerator.generate(baseModel, basePath, options); + // Inner Definitions + for (i = 0, len = elem.ownedElements.length; i < len; i++) { + var def = elem.ownedElements[i] + if (def instanceof type.UMLClass) { + if (def.stereotype === 'annotationType') { + this.writeAnnotationType(codeWriter, def, options) + } else { + this.writeClass(codeWriter, def, options) + } + codeWriter.writeLine() + } else if (def instanceof type.UMLInterface) { + this.writeInterface(codeWriter, def, options) + codeWriter.writeLine() + } else if (def instanceof type.UMLEnumeration) { + this.writeEnum(codeWriter, def, options) + codeWriter.writeLine() + } } - exports.generate = generate; + codeWriter.outdent() + codeWriter.writeLine('}') + } +} + +/** + * Generate + * @param {type.Model} baseModel + * @param {string} basePath + * @param {Object} options + */ +function generate (baseModel, basePath, options) { + var javaCodeGenerator = new JavaCodeGenerator(baseModel, basePath) + javaCodeGenerator.generate(baseModel, basePath, options) +} -}); +exports.generate = generate diff --git a/JavaPreferences.js b/JavaPreferences.js deleted file mode 100644 index 09cf64a..0000000 --- a/JavaPreferences.js +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013-2014 Minkyu Lee. All rights reserved. - * - * NOTICE: All information contained herein is, and remains the - * property of Minkyu Lee. The intellectual and technical concepts - * contained herein are proprietary to Minkyu Lee and may be covered - * by Republic of Korea and Foreign Patents, patents in process, - * and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Minkyu Lee (niklaus.lee@gmail.com). - * - */ - -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */ -/*global define, $, _, window, appshell, staruml */ - -define(function (require, exports, module) { - "use strict"; - - var AppInit = app.getModule("utils/AppInit"), - Core = app.getModule("core/Core"), - PreferenceManager = app.getModule("core/PreferenceManager"); - - var preferenceId = "java"; - - var javaPreferences = { - "java.gen": { - text: "Java Code Generation", - type: "Section" - }, - "java.gen.javaDoc": { - text: "JavaDoc", - description: "Generate JavaDoc comments.", - type: "Check", - default: true - }, - "java.gen.useTab": { - text: "Use Tab", - description: "Use Tab for indentation instead of spaces.", - type: "Check", - default: false - }, - "java.gen.indentSpaces": { - text: "Indent Spaces", - description: "Number of spaces for indentation.", - type: "Number", - default: 4 - }, - "java.rev": { - text: "Java Reverse Engineering", - type: "Section" - }, - "java.rev.association": { - text: "Use Association", - description: "Reverse Java Fields as UML Associations.", - type: "Check", - default: true - }, - "java.rev.publicOnly": { - text: "Public Only", - description: "Reverse public members only.", - type: "Check", - default: false - }, - "java.rev.typeHierarchy": { - text: "Type Hierarchy Diagram", - description: "Create a type hierarchy diagram for all classes and interfaces", - type: "Check", - default: true - }, - "java.rev.packageOverview": { - text: "Package Overview Diagram", - description: "Create overview diagram for each package", - type: "Check", - default: true - }, - "java.rev.packageStructure": { - text: "Package Structure Diagram", - description: "Create a package structure diagram for all packages", - type: "Check", - default: true - } - }; - - function getId() { - return preferenceId; - } - - function getGenOptions() { - return { - javaDoc : PreferenceManager.get("java.gen.javaDoc"), - useTab : PreferenceManager.get("java.gen.useTab"), - indentSpaces : PreferenceManager.get("java.gen.indentSpaces") - }; - } - - function getRevOptions() { - return { - association : PreferenceManager.get("java.rev.association"), - publicOnly : PreferenceManager.get("java.rev.publicOnly"), - typeHierarchy : PreferenceManager.get("java.rev.typeHierarchy"), - packageOverview : PreferenceManager.get("java.rev.packageOverview"), - packageStructure : PreferenceManager.get("java.rev.packageStructure") - }; - } - - AppInit.htmlReady(function () { - PreferenceManager.register(preferenceId, "Java", javaPreferences); - }); - - exports.getId = getId; - exports.getGenOptions = getGenOptions; - exports.getRevOptions = getRevOptions; - -}); diff --git a/JavaReverseEngineer.js b/JavaReverseEngineer.js index d0e3f21..fd87745 100644 --- a/JavaReverseEngineer.js +++ b/JavaReverseEngineer.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 MKLab. All rights reserved. + * Copyright (c) 2014-2018 MKLab. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -21,1189 +21,1146 @@ * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true, continue:true */ -/*global define, $, _, window, app, type, document, java7 */ -define(function (require, exports, module) { - "use strict"; - - var Core = app.getModule("core/Core"), - Repository = app.getModule("core/Repository"), - ProjectManager = app.getModule("engine/ProjectManager"), - CommandManager = app.getModule("command/CommandManager"), - UML = app.getModule("uml/UML"), - FileSystem = app.getModule("filesystem/FileSystem"), - FileSystemError = app.getModule("filesystem/FileSystemError"), - FileUtils = app.getModule("file/FileUtils"), - Async = app.getModule("utils/Async"); - - require("grammar/java7"); - - // Java Primitive Types - var javaPrimitiveTypes = [ - "void", - "byte", - "short", - "int", - "long", - "float", - "double", - "boolean", - "char", - "Byte", - "Double", - "Float", - "Integer", - "Long", - "Short", - "String", - "Character", - "java.lang.Byte", - "java.lang.Double", - "java.lang.Float", - "java.lang.Integer", - "java.lang.Long", - "java.lang.Short", - "java.lang.String", - "java.lang.Character" - ]; - - // Java Collection Types - var javaCollectionTypes = [ - "Collection", - "Set", - "SortedSet", - "NavigableSet", - "HashSet", - "TreeSet", - "LinkedHashSet", - "List", - "ArrayList", - "LinkedList", - "Deque", - "ArrayDeque", - "Queue" - ]; - - // Java Collection Types (full names) - var javaUtilCollectionTypes = _.map(javaCollectionTypes, function (c) { return "java.util." + c; }); - - /** - * Java Code Analyzer - * @constructor - */ - function JavaCodeAnalyzer() { - - /** @member {type.UMLModel} */ - this._root = new type.UMLModel(); - this._root.name = "JavaReverse"; - - /** @member {Array.} */ - this._files = []; - - /** @member {Object} */ - this._currentCompilationUnit = null; - - /** - * @member {{classifier:type.UMLClassifier, node: Object, kind:string}} - */ - this._extendPendings = []; - - /** - * @member {{classifier:type.UMLClassifier, node: Object}} - */ - this._implementPendings = []; - - /** - * @member {{classifier:type.UMLClassifier, association: type.UMLAssociation, node: Object}} - */ - this._associationPendings = []; - - /** - * @member {{operation:type.UMLOperation, node: Object}} - */ - this._throwPendings = []; - - /** - * @member {{namespace:type.UMLModelElement, feature:type.UMLStructuralFeature, node: Object}} - */ - this._typedFeaturePendings = []; - } - - /** - * Add File to Reverse Engineer - * @param {File} file - */ - JavaCodeAnalyzer.prototype.addFile = function (file) { - this._files.push(file); - }; - - /** - * Analyze all files. - * @param {Object} options - * @return {$.Promise} - */ - JavaCodeAnalyzer.prototype.analyze = function (options) { - var self = this, - promise; - - // Perform 1st Phase - promise = this.performFirstPhase(options); - - // Perform 2nd Phase - promise.always(function () { - self.performSecondPhase(options); - }); - - // Load To Project - promise.always(function () { - var writer = new Core.Writer(); - writer.writeObj("data", self._root); - var json = writer.current.data; - ProjectManager.importFromJson(ProjectManager.getProject(), json); - }); +const fs = require('fs') +const path = require('path') +const _ = require('lodash') +const java7 = require('./grammar/java7') + +// Java Primitive Types +var javaPrimitiveTypes = [ + 'void', + 'byte', + 'short', + 'int', + 'long', + 'float', + 'double', + 'boolean', + 'char', + 'Byte', + 'Double', + 'Float', + 'Integer', + 'Long', + 'Short', + 'String', + 'Character', + 'java.lang.Byte', + 'java.lang.Double', + 'java.lang.Float', + 'java.lang.Integer', + 'java.lang.Long', + 'java.lang.Short', + 'java.lang.String', + 'java.lang.Character' +] + +// Java Collection Types +var javaCollectionTypes = [ + 'Collection', + 'Set', + 'SortedSet', + 'NavigableSet', + 'HashSet', + 'TreeSet', + 'LinkedHashSet', + 'List', + 'ArrayList', + 'LinkedList', + 'Deque', + 'ArrayDeque', + 'Queue' +] + +// Java Collection Types (full names) +var javaUtilCollectionTypes = _.map(javaCollectionTypes, c => { return 'java.util.' + c }) + +/** + * Java Code Analyzer + */ +class JavaCodeAnalyzer { - // Generate Diagrams - promise.always(function () { - self.generateDiagrams(options); - console.log("[Java] done."); - }); + /** + * @constructor + */ + constructor () { + /** @member {type.UMLModel} */ + this._root = new type.UMLModel() + this._root.name = 'JavaReverse' - return promise; - }; + /** @member {Array.} */ + this._files = [] + /** @member {Object} */ + this._currentCompilationUnit = null /** - * Perform First Phase - * - Create Packages, Classes, Interfaces, Enums, AnnotationTypes. - * - * @param {Object} options - * @return {$.Promise} + * @member {{classifier:type.UMLClassifier, node: Object, kind:string}} */ - JavaCodeAnalyzer.prototype.performFirstPhase = function (options) { - var self = this; - return Async.doSequentially(this._files, function (file) { - var result = new $.Deferred(); - file.read({}, function (err, data, stat) { - if (!err) { - try { - var ast = java7.parse(data); - self._currentCompilationUnit = ast; - self._currentCompilationUnit.file = file; - self.translateCompilationUnit(options, self._root, ast); - result.resolve(); - } catch (ex) { - console.error("[Java] Failed to parse - " + file._name); - result.reject(ex); - } - } else { - result.reject(err); - } - }); - return result.promise(); - }, false); - }; + this._extendPendings = [] /** - * Perform Second Phase - * - Create Generalizations - * - Create InterfaceRealizations - * - Create Fields or Associations - * - Resolve Type References - * - * @param {Object} options + * @member {{classifier:type.UMLClassifier, node: Object}} */ - JavaCodeAnalyzer.prototype.performSecondPhase = function (options) { - var i, len, j, len2, _typeName, _type, _itemTypeName, _itemType, _pathName; - - // Create Generalizations - // if super type not found, create a Class correspond to the super type. - for (i = 0, len = this._extendPendings.length; i < len; i++) { - var _extend = this._extendPendings[i]; - _typeName = _extend.node.qualifiedName.name; - - _type = this._findType(_extend.classifier, _typeName, _extend.compilationUnitNode); - if (!_type) { - _pathName = this._toPathName(_typeName); - if (_extend.kind === "interface") { - _type = this._ensureInterface(this._root, _pathName); - } else { - _type = this._ensureClass(this._root, _pathName); - } - } - - var generalization = new type.UMLGeneralization(); - generalization._parent = _extend.classifier; - generalization.source = _extend.classifier; - generalization.target = _type; - _extend.classifier.ownedElements.push(generalization); - - } - - // Create InterfaceRealizations - // if super interface not found, create a Interface correspond to the super interface - for (i = 0, len = this._implementPendings.length; i < len; i++) { - var _implement = this._implementPendings[i]; - _typeName = _implement.node.qualifiedName.name; - _type = this._findType(_implement.classifier, _typeName, _implement.compilationUnitNode); - if (!_type) { - _pathName = this._toPathName(_typeName); - _type = this._ensureInterface(this._root, _pathName); - } - var realization = new type.UMLInterfaceRealization(); - realization._parent = _implement.classifier; - realization.source = _implement.classifier; - realization.target = _type; - _implement.classifier.ownedElements.push(realization); - } - - // Create Associations - for (i = 0, len = this._associationPendings.length; i < len; i++) { - var _asso = this._associationPendings[i]; - _typeName = _asso.node.type.qualifiedName.name; - _type = this._findType(_asso.classifier, _typeName, _asso.node.compilationUnitNode); - _itemTypeName = this._isGenericCollection(_asso.node.type, _asso.node.compilationUnitNode); - if (_itemTypeName) { - _itemType = this._findType(_asso.classifier, _itemTypeName, _asso.node.compilationUnitNode); - } else { - _itemType = null; - } - - // if type found, add as Association - if (_type || _itemType) { - for (j = 0, len2 = _asso.node.variables.length; j < len2; j++) { - var variableNode = _asso.node.variables[j]; - - // Create Association - var association = new type.UMLAssociation(); - association._parent = _asso.classifier; - _asso.classifier.ownedElements.push(association); - - // Set End1 - association.end1.reference = _asso.classifier; - association.end1.name = ""; - association.end1.visibility = UML.VK_PACKAGE; - association.end1.navigable = false; - - // Set End2 - if (_itemType) { - association.end2.reference = _itemType; - association.end2.multiplicity = "*"; - this._addTag(association.end2, Core.TK_STRING, "collection", _asso.node.type.qualifiedName.name); - } else { - association.end2.reference = _type; - } - association.end2.name = variableNode.name; - association.end2.visibility = this._getVisibility(_asso.node.modifiers); - association.end2.navigable = true; - - // Final Modifier - if (_.contains(_asso.node.modifiers, "final")) { - association.end2.isReadOnly = true; - } - - // Static Modifier - if (_.contains(_asso.node.modifiers, "static")) { - this._addTag(association.end2, Core.TK_BOOLEAN, "static", true); - } - - // Volatile Modifier - if (_.contains(_asso.node.modifiers, "volatile")) { - this._addTag(association.end2, Core.TK_BOOLEAN, "volatile", true); - } - - // Transient Modifier - if (_.contains(_asso.node.modifiers, "transient")) { - this._addTag(association.end2, Core.TK_BOOLEAN, "transient", true); - } - } - // if type not found, add as Attribute - } else { - this.translateFieldAsAttribute(options, _asso.classifier, _asso.node); - } - } - - // Assign Throws to Operations - for (i = 0, len = this._throwPendings.length; i < len; i++) { - var _throw = this._throwPendings[i]; - _typeName = _throw.node.name; - _type = this._findType(_throw.operation, _typeName, _throw.compilationUnitNode); - if (!_type) { - _pathName = this._toPathName(_typeName); - _type = this._ensureClass(this._root, _pathName); - } - _throw.operation.raisedExceptions.push(_type); - } - - // Resolve Type References - for (i = 0, len = this._typedFeaturePendings.length; i < len; i++) { - var _typedFeature = this._typedFeaturePendings[i]; - _typeName = _typedFeature.node.type.qualifiedName.name; - - // Find type and assign - _type = this._findType(_typedFeature.namespace, _typeName, _typedFeature.node.compilationUnitNode); - - // if type is exists - if (_type) { - _typedFeature.feature.type = _type; - // if type is not exists - } else { - // if type is generic collection type (e.g. java.util.List) - _itemTypeName = this._isGenericCollection(_typedFeature.node.type, _typedFeature.node.compilationUnitNode); - if (_itemTypeName) { - _typeName = _itemTypeName; - _typedFeature.feature.multiplicity = "*"; - this._addTag(_typedFeature.feature, Core.TK_STRING, "collection", _typedFeature.node.type.qualifiedName.name); - } - - // if type is primitive type - if (_.contains(javaPrimitiveTypes, _typeName)) { - _typedFeature.feature.type = _typeName; - // otherwise - } else { - _pathName = this._toPathName(_typeName); - var _newClass = this._ensureClass(this._root, _pathName); - _typedFeature.feature.type = _newClass; - } - } - - // Translate type's arrayDimension to multiplicity - if (_typedFeature.node.type.arrayDimension && _typedFeature.node.type.arrayDimension.length > 0) { - var _dim = []; - for (j = 0, len2 = _typedFeature.node.type.arrayDimension.length; j < len2; j++) { - _dim.push("*"); - } - _typedFeature.feature.multiplicity = _dim.join(","); - } - } - }; + this._implementPendings = [] /** - * Generate Diagrams (Type Hierarchy, Package Structure, Package Overview) - * @param {Object} options + * @member {{classifier:type.UMLClassifier, association: type.UMLAssociation, node: Object}} */ - JavaCodeAnalyzer.prototype.generateDiagrams = function (options) { - var baseModel = Repository.get(this._root._id); - if (options.packageStructure) { - CommandManager.execute("diagramGenerator.packageStructure", baseModel, true); - } - if (options.typeHierarchy) { - CommandManager.execute("diagramGenerator.typeHierarchy", baseModel, true); - } - if (options.packageOverview) { - baseModel.traverse(function (elem) { - if (elem instanceof type.UMLPackage) { - CommandManager.execute("diagramGenerator.overview", elem, true); - } - }); - } - }; + this._associationPendings = [] /** - * Convert string type name to path name (Array of string) - * @param {string} typeName - * @return {Array.} pathName + * @member {{operation:type.UMLOperation, node: Object}} */ - JavaCodeAnalyzer.prototype._toPathName = function (typeName) { - var pathName = (typeName.indexOf(".") > 0 ? typeName.trim().split(".") : null); - if (!pathName) { - pathName = [ typeName ]; - } - return pathName; - }; - + this._throwPendings = [] /** - * Find Type. - * - * @param {type.Model} namespace - * @param {string|Object} type Type name string or type node. - * @param {Object} compilationUnitNode To search type with import statements. - * @return {type.Model} element correspond to the type. + * @member {{namespace:type.UMLModelElement, feature:type.UMLStructuralFeature, node: Object}} */ - JavaCodeAnalyzer.prototype._findType = function (namespace, type, compilationUnitNode) { - var typeName, - pathName, - _type = null; - - if (type.node === "Type") { - typeName = type.qualifiedName.name; - } else if (_.isString(type)) { - typeName = type; - } - - pathName = this._toPathName(typeName); - - // 1. Lookdown from context - if (pathName.length > 1) { - _type = namespace.lookdown(pathName); + this._typedFeaturePendings = [] + } + + /** + * Add File to Reverse Engineer + * @param {File} file + */ + addFile (file) { + this._files.push(file) + } + + /** + * Analyze all files. + * @param {Object} options + * @return {$.Promise} + */ + analyze (options) { + // Perform 1st Phase + this.performFirstPhase(options) + + // Perform 2nd Phase + this.performSecondPhase(options) + + // Load To Project + var writer = new app.repository.Writer() + writer.writeObj('data', this._root) + var json = writer.current.data + app.project.importFromJson(app.project.getProject(), json) + + // Generate Diagrams + this.generateDiagrams(options) + console.log('[Java] done.') + } + + /** + * Perform First Phase + * - Create Packages, Classes, Interfaces, Enums, AnnotationTypes. + * + * @param {Object} options + */ + performFirstPhase (options) { + this._files.forEach(file => { + var data = fs.readFileSync(file, 'utf8') + try { + var ast = java7.parse(data) + this._currentCompilationUnit = ast + this._currentCompilationUnit.file = file + this.translateCompilationUnit(options, this._root, ast) + } catch (ex) { + console.error('[Java] Failed to parse - ' + file) + console.error(ex) + } + }) + } + + /** + * Perform Second Phase + * - Create Generalizations + * - Create InterfaceRealizations + * - Create Fields or Associations + * - Resolve Type References + * + * @param {Object} options + */ + performSecondPhase (options) { + var i, len, j, len2, _typeName, _type, _itemTypeName, _itemType, _pathName + + // Create Generalizations + // if super type not found, create a Class correspond to the super type. + for (i = 0, len = this._extendPendings.length; i < len; i++) { + var _extend = this._extendPendings[i] + _typeName = _extend.node.qualifiedName.name + + _type = this._findType(_extend.classifier, _typeName, _extend.compilationUnitNode) + if (!_type) { + _pathName = this._toPathName(_typeName) + if (_extend.kind === 'interface') { + _type = this._ensureInterface(this._root, _pathName) } else { - _type = namespace.findByName(typeName); + _type = this._ensureClass(this._root, _pathName) } + } - // 2. Lookup from context - if (!_type) { - _type = namespace.lookup(typeName, null, this._root); - } + var generalization = new type.UMLGeneralization() + generalization._parent = _extend.classifier + generalization.source = _extend.classifier + generalization.target = _type + _extend.classifier.ownedElements.push(generalization) + } - // 3. Find from imported namespaces - if (!_type) { - if (compilationUnitNode.imports) { - var i, len; - for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { - var _import = compilationUnitNode.imports[i]; - // Find in wildcard imports (e.g. import java.lang.*) - if (_import.wildcard) { - var _namespace = this._root.lookdown(_import.qualifiedName.name); - if (_namespace) { - _type = _namespace.findByName(typeName); - } - // Find in import exact matches (e.g. import java.lang.String) - } else { - _type = this._root.lookdown(_import.qualifiedName.name); - } - } - } - } + // Create InterfaceRealizations + // if super interface not found, create a Interface correspond to the super interface + for (i = 0, len = this._implementPendings.length; i < len; i++) { + var _implement = this._implementPendings[i] + _typeName = _implement.node.qualifiedName.name + _type = this._findType(_implement.classifier, _typeName, _implement.compilationUnitNode) + if (!_type) { + _pathName = this._toPathName(_typeName) + _type = this._ensureInterface(this._root, _pathName) + } + var realization = new type.UMLInterfaceRealization() + realization._parent = _implement.classifier + realization.source = _implement.classifier + realization.target = _type + _implement.classifier.ownedElements.push(realization) + } - // 4. Lookdown from Root - if (!_type) { - if (pathName.length > 1) { - _type = this._root.lookdown(pathName); - } else { - _type = this._root.findByName(typeName); - } + // Create Associations + for (i = 0, len = this._associationPendings.length; i < len; i++) { + var _asso = this._associationPendings[i] + _typeName = _asso.node.type.qualifiedName.name + _type = this._findType(_asso.classifier, _typeName, _asso.node.compilationUnitNode) + _itemTypeName = this._isGenericCollection(_asso.node.type, _asso.node.compilationUnitNode) + if (_itemTypeName) { + _itemType = this._findType(_asso.classifier, _itemTypeName, _asso.node.compilationUnitNode) + } else { + _itemType = null + } + + // if type found, add as Association + if (_type || _itemType) { + for (j = 0, len2 = _asso.node.variables.length; j < len2; j++) { + var variableNode = _asso.node.variables[j] + + // Create Association + var association = new type.UMLAssociation() + association._parent = _asso.classifier + _asso.classifier.ownedElements.push(association) + + // Set End1 + association.end1.reference = _asso.classifier + association.end1.name = '' + association.end1.visibility = type.UMLModelElement.VK_PACKAGE + association.end1.navigable = false + + // Set End2 + if (_itemType) { + association.end2.reference = _itemType + association.end2.multiplicity = '*' + this._addTag(association.end2, type.Tag.TK_STRING, 'collection', _asso.node.type.qualifiedName.name) + } else { + association.end2.reference = _type + } + association.end2.name = variableNode.name + association.end2.visibility = this._getVisibility(_asso.node.modifiers) + association.end2.navigable = true + + // Final Modifier + if (_.includes(_asso.node.modifiers, 'final')) { + association.end2.isReadOnly = true + } + + // Static Modifier + if (_.includes(_asso.node.modifiers, 'static')) { + this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'static', true) + } + + // Volatile Modifier + if (_.includes(_asso.node.modifiers, 'volatile')) { + this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'volatile', true) + } + + // Transient Modifier + if (_.includes(_asso.node.modifiers, 'transient')) { + this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'transient', true) + } } + // if type not found, add as Attribute + } else { + this.translateFieldAsAttribute(options, _asso.classifier, _asso.node) + } + } - return _type; - }; - - - /** - * Return visiblity from modifiers - * - * @param {Array.} modifiers - * @return {string} Visibility constants for UML Elements - */ - JavaCodeAnalyzer.prototype._getVisibility = function (modifiers) { - if (_.contains(modifiers, "public")) { - return UML.VK_PUBLIC; - } else if (_.contains(modifiers, "protected")) { - return UML.VK_PROTECTED; - } else if (_.contains(modifiers, "private")) { - return UML.VK_PRIVATE; - } - return UML.VK_PACKAGE; - }; + // Assign Throws to Operations + for (i = 0, len = this._throwPendings.length; i < len; i++) { + var _throw = this._throwPendings[i] + _typeName = _throw.node.name + _type = this._findType(_throw.operation, _typeName, _throw.compilationUnitNode) + if (!_type) { + _pathName = this._toPathName(_typeName) + _type = this._ensureClass(this._root, _pathName) + } + _throw.operation.raisedExceptions.push(_type) + } - /** - * Add a Tag - * @param {type.Model} elem - * @param {string} kind Kind of Tag - * @param {string} name - * @param {?} value Value of Tag - */ - JavaCodeAnalyzer.prototype._addTag = function (elem, kind, name, value) { - var tag = new type.Tag(); - tag._parent = elem; - tag.name = name; - tag.kind = kind; - switch (kind) { - case Core.TK_STRING: - tag.value = value; - break; - case Core.TK_BOOLEAN: - tag.checked = value; - break; - case Core.TK_NUMBER: - tag.number = value; - break; - case Core.TK_REFERENCE: - tag.reference = value; - break; - case Core.TK_HIDDEN: - tag.value = value; - break; + // Resolve Type References + for (i = 0, len = this._typedFeaturePendings.length; i < len; i++) { + var _typedFeature = this._typedFeaturePendings[i] + _typeName = _typedFeature.node.type.qualifiedName.name + + // Find type and assign + _type = this._findType(_typedFeature.namespace, _typeName, _typedFeature.node.compilationUnitNode) + + // if type is exists + if (_type) { + _typedFeature.feature.type = _type + // if type is not exists + } else { + // if type is generic collection type (e.g. java.util.List) + _itemTypeName = this._isGenericCollection(_typedFeature.node.type, _typedFeature.node.compilationUnitNode) + if (_itemTypeName) { + _typeName = _itemTypeName + _typedFeature.feature.multiplicity = '*' + this._addTag(_typedFeature.feature, type.Tag.TK_STRING, 'collection', _typedFeature.node.type.qualifiedName.name) } - elem.tags.push(tag); - }; - - /** - * Return the package of a given pathNames. If not exists, create the package. - * @param {type.Model} namespace - * @param {Array.} pathNames - * @return {type.Model} Package element corresponding to the pathNames - */ - JavaCodeAnalyzer.prototype._ensurePackage = function (namespace, pathNames) { - if (pathNames.length > 0) { - var name = pathNames.shift(); - if (name && name.length > 0) { - var elem = namespace.findByName(name); - if (elem !== null) { - // Package exists - if (pathNames.length > 0) { - return this._ensurePackage(elem, pathNames); - } else { - return elem; - } - } else { - // Package not exists, then create one. - var _package = new type.UMLPackage(); - namespace.ownedElements.push(_package); - _package._parent = namespace; - _package.name = name; - if (pathNames.length > 0) { - return this._ensurePackage(_package, pathNames); - } else { - return _package; - } - } - } + // if type is primitive type + if (_.includes(javaPrimitiveTypes, _typeName)) { + _typedFeature.feature.type = _typeName + // otherwise } else { - return namespace; + _pathName = this._toPathName(_typeName) + var _newClass = this._ensureClass(this._root, _pathName) + _typedFeature.feature.type = _newClass } - }; + } - /** - * Return the class of a given pathNames. If not exists, create the class. - * @param {type.Model} namespace - * @param {Array.} pathNames - * @return {type.Model} Class element corresponding to the pathNames - */ - JavaCodeAnalyzer.prototype._ensureClass = function (namespace, pathNames) { - if (pathNames.length > 0) { - var _className = pathNames.pop(), - _package = this._ensurePackage(namespace, pathNames), - _class = _package.findByName(_className); - if (!_class) { - _class = new type.UMLClass(); - _class._parent = _package; - _class.name = _className; - _class.visibility = UML.VK_PUBLIC; - _package.ownedElements.push(_class); - } - return _class; + // Translate type's arrayDimension to multiplicity + if (_typedFeature.node.type.arrayDimension && _typedFeature.node.type.arrayDimension.length > 0) { + var _dim = [] + for (j = 0, len2 = _typedFeature.node.type.arrayDimension.length; j < len2; j++) { + _dim.push('*') } - return null; - }; - - /** - * Return the interface of a given pathNames. If not exists, create the interface. - * @param {type.Model} namespace - * @param {Array.} pathNames - * @return {type.Model} Interface element corresponding to the pathNames - */ - JavaCodeAnalyzer.prototype._ensureInterface = function (namespace, pathNames) { - if (pathNames.length > 0) { - var _interfaceName = pathNames.pop(), - _package = this._ensurePackage(namespace, pathNames), - _interface = _package.findByName(_interfaceName); - if (!_interface) { - _interface = new type.UMLInterface(); - _interface._parent = _package; - _interface.name = _interfaceName; - _interface.visibility = UML.VK_PUBLIC; - _package.ownedElements.push(_interface); - } - return _interface; + _typedFeature.feature.multiplicity = _dim.join(',') + } + } + } + + /** + * Generate Diagrams (Type Hierarchy, Package Structure, Package Overview) + * @param {Object} options + */ + generateDiagrams (options) { + var baseModel = app.repository.get(this._root._id) + if (options.packageStructure) { + app.commands.execute('diagram-generator:package-structure', baseModel, true) + } + if (options.typeHierarchy) { + app.commands.execute('diagram-generator:type-hierarchy', baseModel, true) + } + if (options.packageOverview) { + baseModel.traverse(elem => { + if (elem instanceof type.UMLPackage) { + app.commands.execute('diagram-generator:overview', elem, true) } - return null; - }; - - /** - * Test a given type is a generic collection or not - * @param {Object} typeNode - * @return {string} Collection item type name - */ - JavaCodeAnalyzer.prototype._isGenericCollection = function (typeNode, compilationUnitNode) { - if (typeNode.qualifiedName.typeParameters && typeNode.qualifiedName.typeParameters.length > 0) { - var _collectionType = typeNode.qualifiedName.name, - _itemType = typeNode.qualifiedName.typeParameters[0].name; - - // Used Full name (e.g. java.util.List) - if (_.contains(javaUtilCollectionTypes, _collectionType)) { - return _itemType; - } + }) + } + } + + /** + * Convert string type name to path name (Array of string) + * @param {string} typeName + * @return {Array.} pathName + */ + _toPathName (typeName) { + var pathName = (typeName.indexOf('.') > 0 ? typeName.trim().split('.') : null) + if (!pathName) { + pathName = [ typeName ] + } + return pathName + } + + /** + * Find Type. + * + * @param {type.Model} namespace + * @param {string|Object} type Type name string or type node. + * @param {Object} compilationUnitNode To search type with import statements. + * @return {type.Model} element correspond to the type. + */ + _findType (namespace, type, compilationUnitNode) { + var typeName, pathName + var _type = null + + if (type.node === 'Type') { + typeName = type.qualifiedName.name + } else if (_.isString(type)) { + typeName = type + } - // Used name with imports (e.g. List and import java.util.List or java.util.*) - if (_.contains(javaCollectionTypes, _collectionType)) { - if (compilationUnitNode.imports) { - var i, len; - for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { - var _import = compilationUnitNode.imports[i]; - - // Full name import (e.g. import java.util.List) - if (_import.qualifiedName.name === "java.util." + _collectionType) { - return _itemType; - } - - // Wildcard import (e.g. import java.util.*) - if (_import.qualifiedName.name === "java.util" && _import.wildcard) { - return _itemType; - } - } - } - } - } - return null; - }; + pathName = this._toPathName(typeName) - /** - * Translate Java CompilationUnit Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} compilationUnitNode - */ - JavaCodeAnalyzer.prototype.translateCompilationUnit = function (options, namespace, compilationUnitNode) { - var _namespace = namespace, - i, - len; - - if (compilationUnitNode["package"]) { - var _package = this.translatePackage(options, namespace, compilationUnitNode["package"]); - if (_package !== null) { - _namespace = _package; - } - } + // 1. Lookdown from context + if (pathName.length > 1) { + _type = namespace.lookdown(pathName) + } else { + _type = namespace.findByName(typeName) + } - // Translate Types - this.translateTypes(options, _namespace, compilationUnitNode.types); - }; + // 2. Lookup from context + if (!_type) { + _type = namespace.lookup(typeName, null, this._root) + } - /** - * Translate Type Nodes - * @param {Object} options - * @param {type.Model} namespace - * @param {Array.} typeNodeArray - */ - JavaCodeAnalyzer.prototype.translateTypes = function (options, namespace, typeNodeArray) { - var i, len; - if (typeNodeArray.length > 0) { - for (i = 0, len = typeNodeArray.length; i < len; i++) { - var typeNode = typeNodeArray[i]; - switch (typeNode.node) { - case "Class": - this.translateClass(options, namespace, typeNode); - break; - case "Interface": - this.translateInterface(options, namespace, typeNode); - break; - case "Enum": - this.translateEnum(options, namespace, typeNode); - break; - case "AnnotationType": - this.translateAnnotationType(options, namespace, typeNode); - break; - } + // 3. Find from imported namespaces + if (!_type) { + if (compilationUnitNode.imports) { + var i, len + for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { + var _import = compilationUnitNode.imports[i] + // Find in wildcard imports (e.g. import java.lang.*) + if (_import.wildcard) { + var _namespace = this._root.lookdown(_import.qualifiedName.name) + if (_namespace) { + _type = _namespace.findByName(typeName) } + // Find in import exact matches (e.g. import java.lang.String) + } else { + _type = this._root.lookdown(_import.qualifiedName.name) + } } - }; - - /** - * Translate Java Package Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} compilationUnitNode - */ - JavaCodeAnalyzer.prototype.translatePackage = function (options, namespace, packageNode) { - if (packageNode && packageNode.qualifiedName && packageNode.qualifiedName.name) { - var pathNames = packageNode.qualifiedName.name.split("."); - return this._ensurePackage(namespace, pathNames); - } - return null; - }; + } + } + // 4. Lookdown from Root + if (!_type) { + if (pathName.length > 1) { + _type = this._root.lookdown(pathName) + } else { + _type = this._root.findByName(typeName) + } + } - /** - * Translate Members Nodes - * @param {Object} options - * @param {type.Model} namespace - * @param {Array.} memberNodeArray - */ - JavaCodeAnalyzer.prototype.translateMembers = function (options, namespace, memberNodeArray) { - var i, len; - if (memberNodeArray.length > 0) { - for (i = 0, len = memberNodeArray.length; i < len; i++) { - var memberNode = memberNodeArray[i], - visibility = this._getVisibility(memberNode.modifiers); - - // Generate public members only if publicOnly == true - if (options.publicOnly && visibility !== UML.VK_PUBLIC) { - continue; - } - - memberNode.compilationUnitNode = this._currentCompilationUnit; - - switch (memberNode.node) { - case "Field": - if (options.association) { - this.translateFieldAsAssociation(options, namespace, memberNode); - } else { - this.translateFieldAsAttribute(options, namespace, memberNode); - } - break; - case "Constructor": - this.translateMethod(options, namespace, memberNode, true); - break; - case "Method": - this.translateMethod(options, namespace, memberNode); - break; - case "EnumConstant": - this.translateEnumConstant(options, namespace, memberNode); - break; - } - } + return _type + } + + /** + * Return visiblity from modifiers + * + * @param {Array.} modifiers + * @return {string} Visibility constants for UML Elements + */ + _getVisibility (modifiers) { + if (_.includes(modifiers, 'public')) { + return type.UMLModelElement.VK_PUBLIC + } else if (_.includes(modifiers, 'protected')) { + return type.UMLModelElement.VK_PROTECTED + } else if (_.includes(modifiers, 'private')) { + return type.UMLModelElement.VK_PRIVATE + } + return type.UMLModelElement.VK_PACKAGE + } + + /** + * Add a Tag + * @param {type.Model} elem + * @param {string} kind Kind of Tag + * @param {string} name + * @param {?} value Value of Tag + */ + _addTag (elem, kind, name, value) { + var tag = new type.Tag() + tag._parent = elem + tag.name = name + tag.kind = kind + switch (kind) { + case type.Tag.TK_STRING: + tag.value = value + break + case type.Tag.TK_BOOLEAN: + tag.checked = value + break + case type.Tag.TK_NUMBER: + tag.number = value + break + case type.Tag.TK_REFERENCE: + tag.reference = value + break + case type.Tag.TK_HIDDEN: + tag.value = value + break + } + elem.tags.push(tag) + } + + /** + * Return the package of a given pathNames. If not exists, create the package. + * @param {type.Model} namespace + * @param {Array.} pathNames + * @return {type.Model} Package element corresponding to the pathNames + */ + _ensurePackage (namespace, pathNames) { + if (pathNames.length > 0) { + var name = pathNames.shift() + if (name && name.length > 0) { + var elem = namespace.findByName(name) + if (elem !== null) { + // Package exists + if (pathNames.length > 0) { + return this._ensurePackage(elem, pathNames) + } else { + return elem + } + } else { + // Package not exists, then create one. + var _package = new type.UMLPackage() + namespace.ownedElements.push(_package) + _package._parent = namespace + _package.name = name + if (pathNames.length > 0) { + return this._ensurePackage(_package, pathNames) + } else { + return _package + } } - }; - - - /** - * Translate Java Type Parameter Nodes. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} typeParameterNodeArray - */ - JavaCodeAnalyzer.prototype.translateTypeParameters = function (options, namespace, typeParameterNodeArray) { - if (typeParameterNodeArray) { - var i, len, _typeParam; - for (i = 0, len = typeParameterNodeArray.length; i < len; i++) { - _typeParam = typeParameterNodeArray[i]; - if (_typeParam.node === "TypeParameter") { - var _templateParameter = new type.UMLTemplateParameter(); - _templateParameter._parent = namespace; - _templateParameter.name = _typeParam.name; - if (_typeParam.type) { - _templateParameter.parameterType = _typeParam.type; - } - namespace.templateParameters.push(_templateParameter); - } + } + } else { + return namespace + } + } + + /** + * Return the class of a given pathNames. If not exists, create the class. + * @param {type.Model} namespace + * @param {Array.} pathNames + * @return {type.Model} Class element corresponding to the pathNames + */ + _ensureClass (namespace, pathNames) { + if (pathNames.length > 0) { + var _className = pathNames.pop() + var _package = this._ensurePackage(namespace, pathNames) + var _class = _package.findByName(_className) + if (!_class) { + _class = new type.UMLClass() + _class._parent = _package + _class.name = _className + _class.visibility = type.UMLModelElement.VK_PUBLIC + _package.ownedElements.push(_class) + } + return _class + } + return null + } + + /** + * Return the interface of a given pathNames. If not exists, create the interface. + * @param {type.Model} namespace + * @param {Array.} pathNames + * @return {type.Model} Interface element corresponding to the pathNames + */ + _ensureInterface (namespace, pathNames) { + if (pathNames.length > 0) { + var _interfaceName = pathNames.pop() + var _package = this._ensurePackage(namespace, pathNames) + var _interface = _package.findByName(_interfaceName) + if (!_interface) { + _interface = new type.UMLInterface() + _interface._parent = _package + _interface.name = _interfaceName + _interface.visibility = type.UMLModelElement.VK_PUBLIC + _package.ownedElements.push(_interface) + } + return _interface + } + return null + } + + /** + * Test a given type is a generic collection or not + * @param {Object} typeNode + * @return {string} Collection item type name + */ + _isGenericCollection (typeNode, compilationUnitNode) { + if (typeNode.qualifiedName.typeParameters && typeNode.qualifiedName.typeParameters.length > 0) { + var _collectionType = typeNode.qualifiedName.name + var _itemType = typeNode.qualifiedName.typeParameters[0].name + + // Used Full name (e.g. java.util.List) + if (_.includes(javaUtilCollectionTypes, _collectionType)) { + return _itemType + } + + // Used name with imports (e.g. List and import java.util.List or java.util.*) + if (_.includes(javaCollectionTypes, _collectionType)) { + if (compilationUnitNode.imports) { + var i, len + for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { + var _import = compilationUnitNode.imports[i] + + // Full name import (e.g. import java.util.List) + if (_import.qualifiedName.name === 'java.util.' + _collectionType) { + return _itemType } - } - }; - - /** - * Translate Java Class Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} compilationUnitNode - */ - JavaCodeAnalyzer.prototype.translateClass = function (options, namespace, classNode) { - var i, len, _class; - - // Create Class - _class = new type.UMLClass(); - _class._parent = namespace; - _class.name = classNode.name; - - // Access Modifiers - _class.visibility = this._getVisibility(classNode.modifiers); - - // Abstract Class - if (_.contains(classNode.modifiers, "abstract")) { - _class.isAbstract = true; - } - - // Final Class - if (_.contains(classNode.modifiers, "final")) { - _class.isFinalSpecialization = true; - _class.isLeaf = true; - } - - // JavaDoc - if (classNode.comment) { - _class.documentation = classNode.comment; - } - - namespace.ownedElements.push(_class); - - // Register Extends for 2nd Phase Translation - if (classNode["extends"]) { - var _extendPending = { - classifier: _class, - node: classNode["extends"], - kind: "class", - compilationUnitNode: this._currentCompilationUnit - }; - this._extendPendings.push(_extendPending); - } - - // - 1) 타입이 소스에 있는 경우 --> 해당 타입으로 Generalization 생성 - // - 2) 타입이 소스에 없는 경우 (e.g. java.util.ArrayList) --> 타입을 생성(어디에?)한 뒤 Generalization 생성 - // 모든 타입이 생성된 다음에 Generalization (혹은 기타 Relationships)이 연결되어야 하므로, 어딘가에 등록한 다음이 2nd Phase에서 처리. - - // Register Implements for 2nd Phase Translation - if (classNode["implements"]) { - for (i = 0, len = classNode["implements"].length; i < len; i++) { - var _impl = classNode["implements"][i]; - var _implementPending = { - classifier: _class, - node: _impl, - compilationUnitNode: this._currentCompilationUnit - }; - this._implementPendings.push(_implementPending); + // Wildcard import (e.g. import java.util.*) + if (_import.qualifiedName.name === 'java.util' && _import.wildcard) { + return _itemType } + } } - // Translate Type Parameters - this.translateTypeParameters(options, _class, classNode.typeParameters); - // Translate Types - this.translateTypes(options, _class, classNode.body); - // Translate Members - this.translateMembers(options, _class, classNode.body); - }; - - /** - * Translate Java Interface Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} interfaceNode - */ - JavaCodeAnalyzer.prototype.translateInterface = function (options, namespace, interfaceNode) { - var i, len, _interface; - - // Create Interface - _interface = new type.UMLInterface(); - _interface._parent = namespace; - _interface.name = interfaceNode.name; - _interface.visibility = this._getVisibility(interfaceNode.modifiers); + } + } + return null + } + + /** + * Translate Java CompilationUnit Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} compilationUnitNode + */ + translateCompilationUnit (options, namespace, compilationUnitNode) { + var _namespace = namespace + + if (compilationUnitNode['package']) { + var _package = this.translatePackage(options, namespace, compilationUnitNode['package']) + if (_package !== null) { + _namespace = _package + } + } - // JavaDoc - if (interfaceNode.comment) { - _interface.documentation = interfaceNode.comment; + // Translate Types + this.translateTypes(options, _namespace, compilationUnitNode.types) + } + + /** + * Translate Type Nodes + * @param {Object} options + * @param {type.Model} namespace + * @param {Array.} typeNodeArray + */ + translateTypes (options, namespace, typeNodeArray) { + var i, len + if (Array.isArray(typeNodeArray) && typeNodeArray.length > 0) { + for (i = 0, len = typeNodeArray.length; i < len; i++) { + var typeNode = typeNodeArray[i] + switch (typeNode.node) { + case 'Class': + this.translateClass(options, namespace, typeNode) + break + case 'Interface': + this.translateInterface(options, namespace, typeNode) + break + case 'Enum': + this.translateEnum(options, namespace, typeNode) + break + case 'AnnotationType': + this.translateAnnotationType(options, namespace, typeNode) + break } - - namespace.ownedElements.push(_interface); - - // Register Extends for 2nd Phase Translation - if (interfaceNode["extends"]) { - for (i = 0, len = interfaceNode["extends"].length; i < len; i++) { - var _extend = interfaceNode["extends"][i]; - this._extendPendings.push({ - classifier: _interface, - node: _extend, - kind: "interface", - compilationUnitNode: this._currentCompilationUnit - }); + } + } + } + + /** + * Translate Java Package Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} compilationUnitNode + */ + translatePackage (options, namespace, packageNode) { + if (packageNode && packageNode.qualifiedName && packageNode.qualifiedName.name) { + var pathNames = packageNode.qualifiedName.name.split('.') + return this._ensurePackage(namespace, pathNames) + } + return null + } + + /** + * Translate Members Nodes + * @param {Object} options + * @param {type.Model} namespace + * @param {Array.} memberNodeArray + */ + translateMembers (options, namespace, memberNodeArray) { + var i, len + if (Array.isArray(memberNodeArray) && memberNodeArray.length > 0) { + for (i = 0, len = memberNodeArray.length; i < len; i++) { + var memberNode = memberNodeArray[i] + if (_.isObject(memberNode) && memberNode.node) { + var visibility = this._getVisibility(memberNode.modifiers) + + // Generate public members only if publicOnly == true + if (options.publicOnly && visibility !== type.UMLModelElement.VK_PUBLIC) { + continue + } + + memberNode.compilationUnitNode = this._currentCompilationUnit + + switch (memberNode.node) { + case 'Field': + if (options.association) { + this.translateFieldAsAssociation(options, namespace, memberNode) + } else { + this.translateFieldAsAttribute(options, namespace, memberNode) } + break + case 'Constructor': + this.translateMethod(options, namespace, memberNode, true) + break + case 'Method': + this.translateMethod(options, namespace, memberNode) + break + case 'EnumConstant': + this.translateEnumConstant(options, namespace, memberNode) + break + } } - - // Translate Type Parameters - this.translateTypeParameters(options, _interface, interfaceNode.typeParameters); - // Translate Types - this.translateTypes(options, _interface, interfaceNode.body); - // Translate Members - this.translateMembers(options, _interface, interfaceNode.body); - }; - - /** - * Translate Java Enum Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} enumNode - */ - JavaCodeAnalyzer.prototype.translateEnum = function (options, namespace, enumNode) { - var _enum; - - // Create Enumeration - _enum = new type.UMLEnumeration(); - _enum._parent = namespace; - _enum.name = enumNode.name; - _enum.visibility = this._getVisibility(enumNode.modifiers); - - // JavaDoc - if (enumNode.comment) { - _enum.documentation = enumNode.comment; + } + } + } + + /** + * Translate Java Type Parameter Nodes. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} typeParameterNodeArray + */ + translateTypeParameters (options, namespace, typeParameterNodeArray) { + if (Array.isArray(typeParameterNodeArray)) { + var i, len, _typeParam + for (i = 0, len = typeParameterNodeArray.length; i < len; i++) { + _typeParam = typeParameterNodeArray[i] + if (_typeParam.node === 'TypeParameter') { + var _templateParameter = new type.UMLTemplateParameter() + _templateParameter._parent = namespace + _templateParameter.name = _typeParam.name + if (_typeParam.type) { + _templateParameter.parameterType = _typeParam.type + } + namespace.templateParameters.push(_templateParameter) } + } + } + } + + /** + * Translate Java Class Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} compilationUnitNode + */ + translateClass (options, namespace, classNode) { + var i, len, _class + + // Create Class + _class = new type.UMLClass() + _class._parent = namespace + _class.name = classNode.name + + // Access Modifiers + _class.visibility = this._getVisibility(classNode.modifiers) + + // Abstract Class + if (_.includes(classNode.modifiers, 'abstract')) { + _class.isAbstract = true + } - namespace.ownedElements.push(_enum); - - // Translate Type Parameters - this.translateTypeParameters(options, _enum, enumNode.typeParameters); - // Translate Types - this.translateTypes(options, _enum, enumNode.body); - // Translate Members - this.translateMembers(options, _enum, enumNode.body); - }; + // Final Class + if (_.includes(classNode.modifiers, 'final')) { + _class.isFinalSpecialization = true + _class.isLeaf = true + } - /** - * Translate Java AnnotationType Node. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} annotationTypeNode - */ - JavaCodeAnalyzer.prototype.translateAnnotationType = function (options, namespace, annotationTypeNode) { - var _annotationType; + // JavaDoc + if (classNode.comment) { + _class.documentation = classNode.comment + } - // Create Class <> - _annotationType = new type.UMLClass(); - _annotationType._parent = namespace; - _annotationType.name = annotationTypeNode.name; - _annotationType.stereotype = "annotationType"; - _annotationType.visibility = this._getVisibility(annotationTypeNode.modifiers); + namespace.ownedElements.push(_class) + + // Register Extends for 2nd Phase Translation + if (classNode['extends']) { + var _extendPending = { + classifier: _class, + node: classNode['extends'], + kind: 'class', + compilationUnitNode: this._currentCompilationUnit + } + this._extendPendings.push(_extendPending) + } - // JavaDoc - if (annotationTypeNode.comment) { - _annotationType.documentation = annotationTypeNode.comment; + // - 1) 타입이 소스에 있는 경우 --> 해당 타입으로 Generalization 생성 + // - 2) 타입이 소스에 없는 경우 (e.g. java.util.ArrayList) --> 타입을 생성(어디에?)한 뒤 Generalization 생성 + // 모든 타입이 생성된 다음에 Generalization (혹은 기타 Relationships)이 연결되어야 하므로, 어딘가에 등록한 다음이 2nd Phase에서 처리. + + // Register Implements for 2nd Phase Translation + if (classNode['implements']) { + for (i = 0, len = classNode['implements'].length; i < len; i++) { + var _impl = classNode['implements'][i] + var _implementPending = { + classifier: _class, + node: _impl, + compilationUnitNode: this._currentCompilationUnit } + this._implementPendings.push(_implementPending) + } + } + // Translate Type Parameters + this.translateTypeParameters(options, _class, classNode.typeParameters) + // Translate Types + this.translateTypes(options, _class, classNode.body) + // Translate Members + this.translateMembers(options, _class, classNode.body) + } + + /** + * Translate Java Interface Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} interfaceNode + */ + translateInterface (options, namespace, interfaceNode) { + var i, len, _interface + + // Create Interface + _interface = new type.UMLInterface() + _interface._parent = namespace + _interface.name = interfaceNode.name + _interface.visibility = this._getVisibility(interfaceNode.modifiers) + + // JavaDoc + if (interfaceNode.comment) { + _interface.documentation = interfaceNode.comment + } - namespace.ownedElements.push(_annotationType); - - // Translate Type Parameters - this.translateTypeParameters(options, _annotationType, annotationTypeNode.typeParameters); - // Translate Types - this.translateTypes(options, _annotationType, annotationTypeNode.body); - // Translate Members - this.translateMembers(options, _annotationType, annotationTypeNode.body); - }; - - /** - * Translate Java Field Node as UMLAssociation. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} fieldNode - */ - JavaCodeAnalyzer.prototype.translateFieldAsAssociation = function (options, namespace, fieldNode) { - var i, len; - if (fieldNode.variables && fieldNode.variables.length > 0) { - // Add to _associationPendings - var _associationPending = { - classifier: namespace, - node: fieldNode - }; - this._associationPendings.push(_associationPending); - } - }; + namespace.ownedElements.push(_interface) + + // Register Extends for 2nd Phase Translation + if (interfaceNode['extends']) { + for (i = 0, len = interfaceNode['extends'].length; i < len; i++) { + var _extend = interfaceNode['extends'][i] + this._extendPendings.push({ + classifier: _interface, + node: _extend, + kind: 'interface', + compilationUnitNode: this._currentCompilationUnit + }) + } + } - /** - * Translate Java Field Node as UMLAttribute. - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} fieldNode - */ - JavaCodeAnalyzer.prototype.translateFieldAsAttribute = function (options, namespace, fieldNode) { - var i, len; - if (fieldNode.variables && fieldNode.variables.length > 0) { - for (i = 0, len = fieldNode.variables.length; i < len; i++) { - var variableNode = fieldNode.variables[i]; - - // Create Attribute - var _attribute = new type.UMLAttribute(); - _attribute._parent = namespace; - _attribute.name = variableNode.name; - - // Access Modifiers - _attribute.visibility = this._getVisibility(fieldNode.modifiers); - if (variableNode.initializer) { - _attribute.defaultValue = variableNode.initializer; - } - - // Static Modifier - if (_.contains(fieldNode.modifiers, "static")) { - _attribute.isStatic = true; - } - - // Final Modifier - if (_.contains(fieldNode.modifiers, "final")) { - _attribute.isLeaf = true; - _attribute.isReadOnly = true; - } - - // Volatile Modifier - if (_.contains(fieldNode.modifiers, "volatile")) { - this._addTag(_attribute, Core.TK_BOOLEAN, "volatile", true); - } - - // Transient Modifier - if (_.contains(fieldNode.modifiers, "transient")) { - this._addTag(_attribute, Core.TK_BOOLEAN, "transient", true); - } - - // JavaDoc - if (fieldNode.comment) { - _attribute.documentation = fieldNode.comment; - } - - namespace.attributes.push(_attribute); - - // Add to _typedFeaturePendings - var _typedFeature = { - namespace: namespace, - feature: _attribute, - node: fieldNode - }; - this._typedFeaturePendings.push(_typedFeature); + // Translate Type Parameters + this.translateTypeParameters(options, _interface, interfaceNode.typeParameters) + // Translate Types + this.translateTypes(options, _interface, interfaceNode.body) + // Translate Members + this.translateMembers(options, _interface, interfaceNode.body) + } + + /** + * Translate Java Enum Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} enumNode + */ + translateEnum (options, namespace, enumNode) { + var _enum + + // Create Enumeration + _enum = new type.UMLEnumeration() + _enum._parent = namespace + _enum.name = enumNode.name + _enum.visibility = this._getVisibility(enumNode.modifiers) + + // JavaDoc + if (enumNode.comment) { + _enum.documentation = enumNode.comment + } - } - } - }; + namespace.ownedElements.push(_enum) + + // Translate Type Parameters + this.translateTypeParameters(options, _enum, enumNode.typeParameters) + // Translate Types + this.translateTypes(options, _enum, enumNode.body) + // Translate Members + this.translateMembers(options, _enum, enumNode.body) + } + + /** + * Translate Java AnnotationType Node. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} annotationTypeNode + */ + translateAnnotationType (options, namespace, annotationTypeNode) { + var _annotationType + + // Create Class <> + _annotationType = new type.UMLClass() + _annotationType._parent = namespace + _annotationType.name = annotationTypeNode.name + _annotationType.stereotype = 'annotationType' + _annotationType.visibility = this._getVisibility(annotationTypeNode.modifiers) + + // JavaDoc + if (annotationTypeNode.comment) { + _annotationType.documentation = annotationTypeNode.comment + } + namespace.ownedElements.push(_annotationType) + + // Translate Type Parameters + this.translateTypeParameters(options, _annotationType, annotationTypeNode.typeParameters) + // Translate Types + this.translateTypes(options, _annotationType, annotationTypeNode.body) + // Translate Members + this.translateMembers(options, _annotationType, annotationTypeNode.body) + } + + /** + * Translate Java Field Node as UMLAssociation. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} fieldNode + */ + translateFieldAsAssociation (options, namespace, fieldNode) { + if (fieldNode.variables && fieldNode.variables.length > 0) { + // Add to _associationPendings + var _associationPending = { + classifier: namespace, + node: fieldNode + } + this._associationPendings.push(_associationPending) + } + } + + /** + * Translate Java Field Node as UMLAttribute. + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} fieldNode + */ + translateFieldAsAttribute (options, namespace, fieldNode) { + var i, len + if (fieldNode.variables && fieldNode.variables.length > 0) { + for (i = 0, len = fieldNode.variables.length; i < len; i++) { + var variableNode = fieldNode.variables[i] + + // Create Attribute + var _attribute = new type.UMLAttribute() + _attribute._parent = namespace + _attribute.name = variableNode.name - /** - * Translate Method - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} methodNode - * @param {boolean} isConstructor - */ - JavaCodeAnalyzer.prototype.translateMethod = function (options, namespace, methodNode, isConstructor) { - var i, len, - _operation = new type.UMLOperation(); - _operation._parent = namespace; - _operation.name = methodNode.name; - namespace.operations.push(_operation); - - // Modifiers - _operation.visibility = this._getVisibility(methodNode.modifiers); - if (_.contains(methodNode.modifiers, "static")) { - _operation.isStatic = true; - } - if (_.contains(methodNode.modifiers, "abstract")) { - _operation.isAbstract = true; - } - if (_.contains(methodNode.modifiers, "final")) { - _operation.isLeaf = true; - } - if (_.contains(methodNode.modifiers, "synchronized")) { - _operation.concurrency = UML.CCK_CONCURRENT; - } - if (_.contains(methodNode.modifiers, "native")) { - this._addTag(_operation, Core.TK_BOOLEAN, "native", true); - } - if (_.contains(methodNode.modifiers, "strictfp")) { - this._addTag(_operation, Core.TK_BOOLEAN, "strictfp", true); + // Access Modifiers + _attribute.visibility = this._getVisibility(fieldNode.modifiers) + if (variableNode.initializer) { + _attribute.defaultValue = variableNode.initializer } - // Constructor - if (isConstructor) { - _operation.stereotype = "constructor"; + // Static Modifier + if (_.includes(fieldNode.modifiers, 'static')) { + _attribute.isStatic = true } - //Stuff to do here to grab the correct Javadoc and put it into parameters and return - - // Formal Parameters - if (methodNode.parameters && methodNode.parameters.length > 0) { - for (i = 0, len = methodNode.parameters.length; i < len; i++) { - var parameterNode = methodNode.parameters[i]; - parameterNode.compilationUnitNode = methodNode.compilationUnitNode; - this.translateParameter(options, _operation, parameterNode); - } + // Final Modifier + if (_.includes(fieldNode.modifiers, 'final')) { + _attribute.isLeaf = true + _attribute.isReadOnly = true } - // Return Type - if (methodNode.type) { - var _returnParam = new type.UMLParameter(); - _returnParam._parent = _operation; - _returnParam.name = ""; - _returnParam.direction = UML.DK_RETURN; - // Add to _typedFeaturePendings - this._typedFeaturePendings.push({ - namespace: namespace, - feature: _returnParam, - node: methodNode - }); - _operation.parameters.push(_returnParam); + // Volatile Modifier + if (_.includes(fieldNode.modifiers, 'volatile')) { + this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'volatile', true) } - // Throws - if (methodNode.throws) { - for (i = 0, len = methodNode.throws.length; i < len; i++) { - var _throwNode = methodNode.throws[i]; - var _throwPending = { - operation: _operation, - node: _throwNode, - compilationUnitNode: methodNode.compilationUnitNode - }; - this._throwPendings.push(_throwPending); - } + // Transient Modifier + if (_.includes(fieldNode.modifiers, 'transient')) { + this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'transient', true) } // JavaDoc - if (methodNode.comment) { - _operation.documentation = methodNode.comment; + if (fieldNode.comment) { + _attribute.documentation = fieldNode.comment } - // "default" for Annotation Type Element - if (methodNode.defaultValue) { - this._addTag(_operation, Core.TK_STRING, "default", methodNode.defaultValue); - } - - // Translate Type Parameters - this.translateTypeParameters(options, _operation, methodNode.typeParameters); - }; - - /** - * Translate Enumeration Constant - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} enumConstantNode - */ - JavaCodeAnalyzer.prototype.translateEnumConstant = function (options, namespace, enumConstantNode) { - var _literal = new type.UMLEnumerationLiteral(); - _literal._parent = namespace; - _literal.name = enumConstantNode.name; + namespace.attributes.push(_attribute) - // JavaDoc - if (enumConstantNode.comment) { - _literal.documentation = enumConstantNode.comment; + // Add to _typedFeaturePendings + var _typedFeature = { + namespace: namespace, + feature: _attribute, + node: fieldNode } + this._typedFeaturePendings.push(_typedFeature) + } + } + } + + /** + * Translate Method + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} methodNode + * @param {boolean} isConstructor + */ + translateMethod (options, namespace, methodNode, isConstructor) { + var i, len + var _operation = new type.UMLOperation() + _operation._parent = namespace + _operation.name = methodNode.name + namespace.operations.push(_operation) + + // Modifiers + _operation.visibility = this._getVisibility(methodNode.modifiers) + if (_.includes(methodNode.modifiers, 'static')) { + _operation.isStatic = true + } + if (_.includes(methodNode.modifiers, 'abstract')) { + _operation.isAbstract = true + } + if (_.includes(methodNode.modifiers, 'final')) { + _operation.isLeaf = true + } + if (_.includes(methodNode.modifiers, 'synchronized')) { + _operation.concurrency = type.UMLBehavioralFeature.CCK_CONCURRENT + } + if (_.includes(methodNode.modifiers, 'native')) { + this._addTag(_operation, type.Tag.TK_BOOLEAN, 'native', true) + } + if (_.includes(methodNode.modifiers, 'strictfp')) { + this._addTag(_operation, type.Tag.TK_BOOLEAN, 'strictfp', true) + } - namespace.literals.push(_literal); - }; + // Constructor + if (isConstructor) { + _operation.stereotype = 'constructor' + } + // Stuff to do here to grab the correct Javadoc and put it into parameters and return - /** - * Translate Method Parameters - * @param {Object} options - * @param {type.Model} namespace - * @param {Object} parameterNode - */ - JavaCodeAnalyzer.prototype.translateParameter = function (options, namespace, parameterNode) { - var _parameter = new type.UMLParameter(); - _parameter._parent = namespace; - _parameter.name = parameterNode.variable.name; - namespace.parameters.push(_parameter); + // Formal Parameters + if (methodNode.parameters && methodNode.parameters.length > 0) { + for (i = 0, len = methodNode.parameters.length; i < len; i++) { + var parameterNode = methodNode.parameters[i] + parameterNode.compilationUnitNode = methodNode.compilationUnitNode + this.translateParameter(options, _operation, parameterNode) + } + } - // Add to _typedFeaturePendings - this._typedFeaturePendings.push({ - namespace: namespace._parent, - feature: _parameter, - node: parameterNode - }); - }; + // Return Type + if (methodNode.type) { + var _returnParam = new type.UMLParameter() + _returnParam._parent = _operation + _returnParam.name = '' + _returnParam.direction = type.UMLParameter.DK_RETURN + // Add to _typedFeaturePendings + this._typedFeaturePendings.push({ + namespace: namespace, + feature: _returnParam, + node: methodNode + }) + _operation.parameters.push(_returnParam) + } - /** - * Analyze all java files in basePath - * @param {string} basePath - * @param {Object} options - * @return {$.Promise} - */ - function analyze(basePath, options) { - var result = new $.Deferred(), - javaAnalyzer = new JavaCodeAnalyzer(); - - function visitEntry(entry) { - if (entry._isFile === true) { - var ext = FileUtils.getFileExtension(entry._path); - if (ext && ext.toLowerCase() === "java") { - javaAnalyzer.addFile(entry); - } - } - return true; + // Throws + if (methodNode.throws) { + for (i = 0, len = methodNode.throws.length; i < len; i++) { + var _throwNode = methodNode.throws[i] + var _throwPending = { + operation: _operation, + node: _throwNode, + compilationUnitNode: methodNode.compilationUnitNode } + this._throwPendings.push(_throwPending) + } + } - // Traverse all file entries - var dir = FileSystem.getDirectoryForPath(basePath); - dir.visit(visitEntry, {}, function (err) { - if (!err) { - javaAnalyzer.analyze(options).then(result.resolve, result.reject); - } else { - result.reject(err); - } - }); + // JavaDoc + if (methodNode.comment) { + _operation.documentation = methodNode.comment + } - return result.promise(); + // "default" for Annotation Type Element + if (methodNode.defaultValue) { + this._addTag(_operation, type.Tag.TK_STRING, 'default', methodNode.defaultValue) } - exports.analyze = analyze; + // Translate Type Parameters + this.translateTypeParameters(options, _operation, methodNode.typeParameters) + } + + /** + * Translate Enumeration Constant + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} enumConstantNode + */ + translateEnumConstant (options, namespace, enumConstantNode) { + var _literal = new type.UMLEnumerationLiteral() + _literal._parent = namespace + _literal.name = enumConstantNode.name + + // JavaDoc + if (enumConstantNode.comment) { + _literal.documentation = enumConstantNode.comment + } + + namespace.literals.push(_literal) + } + + /** + * Translate Method Parameters + * @param {Object} options + * @param {type.Model} namespace + * @param {Object} parameterNode + */ + translateParameter (options, namespace, parameterNode) { + var _parameter = new type.UMLParameter() + _parameter._parent = namespace + _parameter.name = parameterNode.variable.name + namespace.parameters.push(_parameter) + + // Add to _typedFeaturePendings + this._typedFeaturePendings.push({ + namespace: namespace._parent, + feature: _parameter, + node: parameterNode + }) + } +} + +/** + * Analyze all java files in basePath + * @param {string} basePath + * @param {Object} options + * @return {$.Promise} + */ +function analyze (basePath, options) { + var javaAnalyzer = new JavaCodeAnalyzer() + + function visit (base) { + var stat = fs.lstatSync(base) + if (stat.isFile()) { + var ext = path.extname(base).toLowerCase() + if (ext === '.java') { + javaAnalyzer.addFile(base) + } + } else if (stat.isDirectory()) { + var files = fs.readdirSync(base) + if (files && files.length > 0) { + files.forEach(entry => { + var fullPath = path.join(base, entry) + visit(fullPath) + }) + } + } + } + + // Traverse all file entries + visit(basePath) + + // Perform reverse engineering + javaAnalyzer.analyze(options) +} -}); +exports.analyze = analyze diff --git a/LICENSE b/LICENSE index d3e1159..faeb4d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2014 MKLab. All rights reserved. +Copyright (c) 2014-2018 MKLab. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), diff --git a/README.md b/README.md index c6d7815..4b12212 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -Java Extension for StarUML 2 -============================ +Java Extension for StarUML +========================== This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. It is based on Java 1.7 specification. diff --git a/main.js b/main.js index 99f6c57..5dbb7a2 100644 --- a/main.js +++ b/main.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 MKLab. All rights reserved. + * Copyright (c) 2014-2018 MKLab. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -21,153 +21,100 @@ * */ -/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */ -/*global define, $, _, window, app, type, appshell, document */ - -define(function (require, exports, module) { - "use strict"; - - var AppInit = app.getModule("utils/AppInit"), - Repository = app.getModule("core/Repository"), - Engine = app.getModule("engine/Engine"), - Commands = app.getModule("command/Commands"), - CommandManager = app.getModule("command/CommandManager"), - MenuManager = app.getModule("menu/MenuManager"), - Dialogs = app.getModule("dialogs/Dialogs"), - ElementPickerDialog = app.getModule("dialogs/ElementPickerDialog"), - FileSystem = app.getModule("filesystem/FileSystem"), - FileSystemError = app.getModule("filesystem/FileSystemError"), - ExtensionUtils = app.getModule("utils/ExtensionUtils"), - UML = app.getModule("uml/UML"); - - var CodeGenUtils = require("CodeGenUtils"), - JavaPreferences = require("JavaPreferences"), - JavaCodeGenerator = require("JavaCodeGenerator"), - JavaReverseEngineer = require("JavaReverseEngineer"); - - /** - * Commands IDs - */ - var CMD_JAVA = 'java', - CMD_JAVA_GENERATE = 'java.generate', - CMD_JAVA_REVERSE = 'java.reverse', - CMD_JAVA_CONFIGURE = 'java.configure'; - - /** - * Command Handler for Java Generate - * - * @param {Element} base - * @param {string} path - * @param {Object} options - * @return {$.Promise} - */ - function _handleGenerate(base, path, options) { - var result = new $.Deferred(); - - // If options is not passed, get from preference - options = options || JavaPreferences.getGenOptions(); - - // If base is not assigned, popup ElementPicker - if (!base) { - ElementPickerDialog.showDialog("Select a base model to generate codes", null, type.UMLPackage) - .done(function (buttonId, selected) { - if (buttonId === Dialogs.DIALOG_BTN_OK && selected) { - base = selected; - - // If path is not assigned, popup Open Dialog to select a folder - if (!path) { - FileSystem.showOpenDialog(false, true, "Select a folder where generated codes to be located", null, null, function (err, files) { - if (!err) { - if (files.length > 0) { - path = files[0]; - JavaCodeGenerator.generate(base, path, options).then(result.resolve, result.reject); - } else { - result.reject(FileSystem.USER_CANCELED); - } - } else { - result.reject(err); - } - }); - } else { - JavaCodeGenerator.generate(base, path, options).then(result.resolve, result.reject); - } - } else { - result.reject(); - } - }); +const JavaCodeGenerator = require('./JavaCodeGenerator') +const JavaReverseEngineer = require('./JavaReverseEngineer') + +function getGenOptions () { + return { + javaDoc: app.preferences.get('java.gen.javaDoc'), + useTab: app.preferences.get('java.gen.useTab'), + indentSpaces: app.preferences.get('java.gen.indentSpaces') + } +} + +function getRevOptions () { + return { + association: app.preferences.get('java.rev.association'), + publicOnly: app.preferences.get('java.rev.publicOnly'), + typeHierarchy: app.preferences.get('java.rev.typeHierarchy'), + packageOverview: app.preferences.get('java.rev.packageOverview'), + packageStructure: app.preferences.get('java.rev.packageStructure') + } +} + +/** + * Command Handler for Java Generate + * + * @param {Element} base + * @param {string} path + * @param {Object} options + * @return {$.Promise} + */ +function _handleGenerate (base, path, options) { + // If options is not passed, get from preference + options = options || getGenOptions() + // If base is not assigned, popup ElementPicker + if (!base) { + app.elementPickerDialog.showDialog('Select a base model to generate codes', null, type.UMLPackage).then(function ({buttonId, returnValue}) { + if (buttonId === 'ok') { + base = returnValue + // If path is not assigned, popup Open Dialog to select a folder + if (!path) { + var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) + if (files && files.length > 0) { + path = files[0] + JavaCodeGenerator.generate(base, path, options) + } } else { - // If path is not assigned, popup Open Dialog to select a folder - if (!path) { - FileSystem.showOpenDialog(false, true, "Select a folder where generated codes to be located", null, null, function (err, files) { - if (!err) { - if (files.length > 0) { - path = files[0]; - JavaCodeGenerator.generate(base, path, options).then(result.resolve, result.reject); - } else { - result.reject(FileSystem.USER_CANCELED); - } - } else { - result.reject(err); - } - }); - } else { - JavaCodeGenerator.generate(base, path, options).then(result.resolve, result.reject); - } + JavaCodeGenerator.generate(base, path, options) } - return result.promise(); + } + }) + } else { + // If path is not assigned, popup Open Dialog to select a folder + if (!path) { + var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) + if (files && files.length > 0) { + path = files[0] + JavaCodeGenerator.generate(base, path, options) + } + } else { + JavaCodeGenerator.generate(base, path, options) } + } +} - /** - * Command Handler for Java Reverse - * - * @param {string} basePath - * @param {Object} options - * @return {$.Promise} - */ - function _handleReverse(basePath, options) { - var result = new $.Deferred(); - - // If options is not passed, get from preference - options = JavaPreferences.getRevOptions(); - - // If basePath is not assigned, popup Open Dialog to select a folder - if (!basePath) { - FileSystem.showOpenDialog(false, true, "Select Folder", null, null, function (err, files) { - if (!err) { - if (files.length > 0) { - basePath = files[0]; - JavaReverseEngineer.analyze(basePath, options).then(result.resolve, result.reject); - } else { - result.reject(FileSystem.USER_CANCELED); - } - } else { - result.reject(err); - } - }); - } - return result.promise(); - } - - - /** - * Popup PreferenceDialog with Java Preference Schema - */ - function _handleConfigure() { - CommandManager.execute(Commands.FILE_PREFERENCES, JavaPreferences.getId()); +/** + * Command Handler for Java Reverse + * + * @param {string} basePath + * @param {Object} options + * @return {$.Promise} + */ +function _handleReverse (basePath, options) { + // If options is not passed, get from preference + options = getRevOptions() + // If basePath is not assigned, popup Open Dialog to select a folder + if (!basePath) { + var files = app.dialogs.showOpenDialog('Select Folder', null, null, { properties: [ 'openDirectory' ] }) + if (files && files.length > 0) { + basePath = files[0] + JavaReverseEngineer.analyze(basePath, options) } + } +} - // Register Commands - CommandManager.register("Java", CMD_JAVA, CommandManager.doNothing); - CommandManager.register("Generate Code...", CMD_JAVA_GENERATE, _handleGenerate); - CommandManager.register("Reverse Code...", CMD_JAVA_REVERSE, _handleReverse); - CommandManager.register("Configure...", CMD_JAVA_CONFIGURE, _handleConfigure); +/** + * Popup PreferenceDialog with Java Preference Schema + */ +function _handleConfigure () { + app.commands.execute('application:preferences', 'java') +} - var menu, menuItem; - menu = MenuManager.getMenu(Commands.TOOLS); - menuItem = menu.addMenuItem(CMD_JAVA); - menuItem.addMenuItem(CMD_JAVA_GENERATE); - menuItem.addMenuItem(CMD_JAVA_REVERSE); - menuItem.addMenuDivider(); - menuItem.addMenuItem(CMD_JAVA_CONFIGURE); +function init () { + app.commands.register('java:generate', _handleGenerate) + app.commands.register('java:reverse', _handleReverse) + app.commands.register('java:configure', _handleConfigure) +} -}); \ No newline at end of file +exports.init = init diff --git a/menus/menu.json b/menus/menu.json new file mode 100644 index 0000000..4197997 --- /dev/null +++ b/menus/menu.json @@ -0,0 +1,19 @@ +{ + "menu": [ + { + "id": "tools", + "submenu": [ + { + "label": "Java", + "id": "tools.java", + "submenu": [ + { "label": "Generate Code...", "id": "tools.java.generate", "command": "java:generate" }, + { "label": "Reverse Code...", "id": "tools.java.reverse", "command": "java:reverse" }, + { "type": "separator" }, + { "label": "Configure...", "id": "tools.java.configure", "command": "java:configure" } + ] + } + ] + } + ] +} diff --git a/package.json b/package.json index de0e1fb..32a8a17 100644 --- a/package.json +++ b/package.json @@ -1,18 +1,18 @@ { - "name": "staruml.java", - "title": "Java", - "description": "Java code generation and reverse engineering.", - "homepage": "https://github.com/staruml/Java", - "issues": "https://github.com/staruml/Java/issues", - "keywords": ["java"], - "version": "0.9.3", - "author": { - "name": "Minkyu Lee", - "email": "niklaus.lee@gmail.com", - "url": "https://github.com/niklauslee" - }, - "license": "MIT", - "engines": { - "staruml": ">=2.0.0" - } + "name": "staruml.java", + "title": "Java", + "description": "Java code generation and reverse engineering.", + "homepage": "https://github.com/staruml/staruml-java", + "issues": "https://github.com/staruml/staruml-java/issues", + "keywords": ["java"], + "version": "0.9.4", + "author": { + "name": "Minkyu Lee", + "email": "niklaus.lee@gmail.com", + "url": "https://github.com/niklauslee" + }, + "license": "MIT", + "engines": { + "staruml": "^3.0.0" + } } diff --git a/preferences/preference.json b/preferences/preference.json new file mode 100644 index 0000000..2abfb64 --- /dev/null +++ b/preferences/preference.json @@ -0,0 +1,62 @@ +{ + "id": "java", + "name": "Java", + "schema": { + "java.gen": { + "text": "Java Code Generation", + "type": "section" + }, + "java.gen.javaDoc": { + "text": "JavaDoc", + "description": "Generate JavaDoc comments.", + "type": "check", + "default": true + }, + "java.gen.useTab": { + "text": "Use Tab", + "description": "Use Tab for indentation instead of spaces.", + "type": "check", + "default": false + }, + "java.gen.indentSpaces": { + "text": "Indent Spaces", + "description": "Number of spaces for indentation.", + "type": "number", + "default": 4 + }, + "java.rev": { + "text": "Java Reverse Engineering", + "type": "section" + }, + "java.rev.association": { + "text": "Use Association", + "description": "Reverse Java Fields as UML Associations.", + "type": "check", + "default": true + }, + "java.rev.publicOnly": { + "text": "Public Only", + "description": "Reverse public members only.", + "type": "check", + "default": false + }, + "java.rev.typeHierarchy": { + "text": "Type Hierarchy Diagram", + "description": "Create a type hierarchy diagram for all classes and interfaces", + "type": "check", + "default": true + }, + "java.rev.packageOverview": { + "text": "Package Overview Diagram", + "description": "Create overview diagram for each package", + "type": "check", + "default": true + }, + "java.rev.packageStructure": { + "text": "Package Structure Diagram", + "description": "Create a package structure diagram for all packages", + "type": "check", + "default": true + } + } +} diff --git a/unittests.js b/unittests.js deleted file mode 100644 index 05d1027..0000000 --- a/unittests.js +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * Copyright (c) 2013-2014 Minkyu Lee. All rights reserved. - * - * NOTICE: All information contained herein is, and remains the - * property of Minkyu Lee. The intellectual and technical concepts - * contained herein are proprietary to Minkyu Lee and may be covered - * by Republic of Korea and Foreign Patents, patents in process, - * and are protected by trade secret or copyright law. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Minkyu Lee (niklaus.lee@gmail.com). - * - */ - -/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */ -/*global define, describe, _, it, xit, expect, beforeFirst, afterLast, spyOn, beforeEach, afterEach, waitsFor, runs, $, type, app, waitsForDone, java7 */ - -define(function (require, exports, module) { - "use strict"; - - // Modules from the SpecRunner window - var Repository, // loaded from app.test - ProjectManager, // loaded from app.test - CommandManager, // loaded from app.test - Commands, // loaded from app.test - Dialogs, // loaded from app.test - FileSystem = app.getModule("filesystem/FileSystem"), - SpecRunnerUtils = app.getModule("spec/SpecRunnerUtils"), - FileUtils = app.getModule("file/FileUtils"), - ExtensionUtils = app.getModule("utils/ExtensionUtils"), - UML = app.getModule("uml/UML"); - - require("grammar/java7"); - - describe("Java", function () { - - describe("Java Parsing", function () { - - function parse(fileName) { - var result = new $.Deferred(); - var path = ExtensionUtils.getModulePath(module) + "unittest-files/parse/" + fileName; - var file = FileSystem.getFileForPath(path); - file.read({}, function (err, data, stat) { - if (!err) { - result.resolve(java7.parse(data)); - } else { - result.reject(err); - } - }); - return result.promise(); - } - - it("can parse CompilationUnit", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - // package com.mycompany.test; - expect(ast.node).toEqual("CompilationUnit"); - expect(ast["package"].node).toEqual("Package"); - expect(ast["package"].qualifiedName.node).toEqual("QualifiedName"); - expect(ast["package"].qualifiedName.name).toEqual("com.mycompany.test"); - }); - }); - - it("can parse Import", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - expect(ast.imports.length).toEqual(4); - - // import java.util.ArrayList; - expect(ast.imports[0].node).toEqual("Import"); - expect(ast.imports[0].qualifiedName.name).toEqual("java.util.ArrayList"); - - // import java.lang.*; - expect(ast.imports[1].node).toEqual("Import"); - expect(ast.imports[1].qualifiedName.name).toEqual("java.lang"); - expect(ast.imports[1].wildcard).toEqual(true); - - // import static java.awt.Color; - expect(ast.imports[2].node).toEqual("Import"); - expect(ast.imports[2].qualifiedName.name).toEqual("java.awt.Color"); - expect(ast.imports[2].isStatic).toEqual(true); - - // import static java.lang.Math.*; - expect(ast.imports[3].node).toEqual("Import"); - expect(ast.imports[3].qualifiedName.name).toEqual("java.lang.Math"); - expect(ast.imports[3].wildcard).toEqual(true); - expect(ast.imports[3].isStatic).toEqual(true); - }); - }); - - it("can parse Class", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - - // public class ClassTest - expect(_class.node).toEqual("Class"); - expect(_class.name).toEqual("ClassTest"); - expect(_class.modifiers[0]).toEqual("public"); - - // extends GenericClassTest - expect(_class["extends"].node).toEqual("Type"); - expect(_class["extends"].qualifiedName.name).toEqual("GenericClassTest"); - - // implements com.mycompany.test.InterfaceTest, java.lang.Runnable - expect(_class["implements"].length).toEqual(2); - expect(_class["implements"][0].node).toEqual("Type"); - expect(_class["implements"][0].qualifiedName.name).toEqual("com.mycompany.test.InterfaceTest"); - expect(_class["implements"][1].node).toEqual("Type"); - expect(_class["implements"][1].qualifiedName.name).toEqual("java.lang.Runnable"); - - }); - }); - - it("can parse Fields", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - - // private int _privateField; - expect(_class.body[0].node).toEqual("Field"); - expect(_class.body[0].modifiers[0]).toEqual("private"); - expect(_class.body[0].type.node).toEqual("Type"); - expect(_class.body[0].type.qualifiedName.name).toEqual("int"); - expect(_class.body[0].variables.length).toEqual(1); - expect(_class.body[0].variables[0].node).toEqual("Variable"); - expect(_class.body[0].variables[0].name).toEqual("_privateField"); - - // protected int _protectedField; - expect(_class.body[1].node).toEqual("Field"); - expect(_class.body[1].modifiers[0]).toEqual("protected"); - - // public int _publicField; - expect(_class.body[2].node).toEqual("Field"); - expect(_class.body[2].modifiers[0]).toEqual("public"); - - // int _packageField; -- menas 'package' visibility - expect(_class.body[3].node).toEqual("Field"); - expect(_class.body[3].modifiers).not.toBeDefined(); - }); - }); - - it("can parse Array Fields", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - // String[] StringArray; - expect(_class.body[4].node).toEqual("Field"); - expect(_class.body[4].type.arrayDimension.length).toEqual(1); - expect(_class.body[4].type.qualifiedName.name).toEqual("String"); - expect(_class.body[4].variables[0].name).toEqual("StringArray"); - - // int[][] int2DimentionalArray; - expect(_class.body[5].node).toEqual("Field"); - expect(_class.body[5].type.arrayDimension.length).toEqual(2); - }); - }); - - it("can parse Multiple Variable Fields", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - // int a, b, c, d; - expect(_class.body[6].node).toEqual("Field"); - expect(_class.body[6].variables.length).toEqual(4); - expect(_class.body[6].variables[0].name).toEqual("a"); - expect(_class.body[6].variables[1].name).toEqual("b"); - expect(_class.body[6].variables[2].name).toEqual("c"); - expect(_class.body[6].variables[3].name).toEqual("d"); - }); - }); - - it("can parse Field Modifiers", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - // static final transient volatile int _field; - expect(_class.body[7].node).toEqual("Field"); - expect(_class.body[7].modifiers.length).toEqual(4); - expect(_.contains(_class.body[7].modifiers, "static")).toBe(true); - expect(_.contains(_class.body[7].modifiers, "final")).toBe(true); - expect(_.contains(_class.body[7].modifiers, "transient")).toBe(true); - expect(_.contains(_class.body[7].modifiers, "volatile")).toBe(true); - }); - }); - - it("can parse Field Initializer", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - // int _fieldInt = 10; - expect(_class.body[8].variables[0].initializer).toEqual("10"); - - // String _fieldString = "String Literal"; - expect(_class.body[9].variables[0].initializer).toEqual('"String Literal"'); - - // char _fieldChar = 'c'; - expect(_class.body[10].variables[0].initializer).toEqual("'c'"); - - // boolean _fieldBoolean = true; - expect(_class.body[11].variables[0].initializer).toEqual("true"); - - // Object _fieldNull = null; - expect(_class.body[12].variables[0].initializer).toEqual("null"); - }); - }); - - - it("can parse Method", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _op = ast.types[0].body[13]; - - // public void test(int arg1, final String arg2) throws IllegalAccess, java.lang.Exception {} - expect(_op.node).toEqual("Method"); - expect(_op.modifiers[0]).toEqual("public"); - expect(_op.type.qualifiedName.name).toEqual("void"); - expect(_op.name).toEqual("test"); - - expect(_op.parameters.length).toEqual(2); - expect(_op.parameters[0].node).toEqual("Parameter"); - expect(_op.parameters[0].type.qualifiedName.name).toEqual("int"); - expect(_op.parameters[0].variable.name).toEqual("arg1"); - - expect(_op.parameters[1].node).toEqual("Parameter"); - expect(_op.parameters[1].type.qualifiedName.name).toEqual("String"); - expect(_op.parameters[1].variable.name).toEqual("arg2"); - expect(_op.parameters[1].modifiers[0]).toEqual("final"); - - expect(_op.throws.length).toEqual(2); - expect(_op.throws[0].name).toEqual("IllegalAccess"); - expect(_op.throws[1].name).toEqual("java.lang.Exception"); - }); - }); - - it("can parse Method Modifiers", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _op = ast.types[0].body[14]; - - // static final synchronized native strictfp void test2() {} - expect(_.contains(_op.modifiers, "static")).toBe(true); - expect(_.contains(_op.modifiers, "final")).toBe(true); - expect(_.contains(_op.modifiers, "synchronized")).toBe(true); - expect(_.contains(_op.modifiers, "native")).toBe(true); - expect(_.contains(_op.modifiers, "strictfp")).toBe(true); - }); - }); - - it("can parse Abstract Method", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _op = ast.types[0].body[15]; - // abstract int test3() {} - expect(_.contains(_op.modifiers, "abstract")).toBe(true); - }); - }); - - it("can parse Annotated Method", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _op = ast.types[0].body[16]; - // @Deprecated - // @SuppressWarnings({ "unchecked", "deprecation" }) - // @MethodInfo(author = "Pankaj", comments = "Main method", date = "Nov 17 2012", revision = 10) - // void annotatedMethod() {} - expect(_op.annotations.length).toEqual(3); - expect(_op.annotations[0].node).toEqual("Annotation"); - expect(_op.annotations[0].qualifiedName.name).toEqual("Deprecated"); - - expect(_op.annotations[1].node).toEqual("Annotation"); - expect(_op.annotations[1].qualifiedName.name).toEqual("SuppressWarnings"); - expect(_op.annotations[1].valueList.length).toEqual(1); - expect(Array.isArray(_op.annotations[1].valueList[0])).toBe(true); - expect(_op.annotations[1].valueList[0].length).toEqual(2); - expect(_op.annotations[1].valueList[0][0]).toEqual("\"unchecked\""); - expect(_op.annotations[1].valueList[0][1]).toEqual("\"deprecation\""); - - expect(_op.annotations[2].node).toEqual("Annotation"); - expect(_op.annotations[2].qualifiedName.name).toEqual("MethodInfo"); - expect(_op.annotations[2].valuePairs.length).toEqual(4); - expect(_op.annotations[2].valuePairs[0].node).toEqual("ValuePair"); - expect(_op.annotations[2].valuePairs[0].name).toEqual("author"); - expect(_op.annotations[2].valuePairs[0].value).toEqual("\"Pankaj\""); - expect(_op.annotations[2].valuePairs[1].node).toEqual("ValuePair"); - expect(_op.annotations[2].valuePairs[1].name).toEqual("comments"); - expect(_op.annotations[2].valuePairs[1].value).toEqual("\"Main method\""); - expect(_op.annotations[2].valuePairs[2].node).toEqual("ValuePair"); - expect(_op.annotations[2].valuePairs[2].name).toEqual("date"); - expect(_op.annotations[2].valuePairs[2].value).toEqual("\"Nov 17 2012\""); - expect(_op.annotations[2].valuePairs[3].node).toEqual("ValuePair"); - expect(_op.annotations[2].valuePairs[3].name).toEqual("revision"); - expect(_op.annotations[2].valuePairs[3].value).toEqual("10"); - }); - }); - - it("can parse Inner Class", function () { - var ast, promise; - - runs(function () { - promise = parse("ClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _innerClass = ast.types[0].body[17]; - // static class InnerClass {} - expect(_innerClass.node).toEqual("Class"); - expect(_innerClass.name).toEqual("InnerClass"); - expect(_innerClass.modifiers[0]).toEqual("static"); - }); - }); - - it("can parse Generic Class", function () { - var ast, promise; - - runs(function () { - promise = parse("GenericClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - - // public class Vector - expect(_class.node).toEqual("Class"); - expect(_class.name).toEqual("GenericClassTest"); - expect(_class.modifiers[0]).toEqual("public"); - expect(_class.typeParameters.length).toEqual(2); - expect(_class.typeParameters[0].node).toEqual("TypeParameter"); - expect(_class.typeParameters[0].name).toEqual("E"); - expect(_class.typeParameters[1].name).toEqual("T"); - expect(_class.typeParameters[1].type).toEqual("java.util.Collection"); - - // extends AbstractList - expect(_class["extends"].node).toEqual("Type"); - expect(_class["extends"].qualifiedName.name).toEqual("AbstractList"); - expect(_class["extends"].qualifiedName.typeParameters[0].name).toEqual("E"); - - // implements List, RandomAccess, Cloneable, java.io.Serializable - expect(_class["implements"].length).toEqual(4); - expect(_class["implements"][0].node).toEqual("Type"); - expect(_class["implements"][0].qualifiedName.name).toEqual("List"); - expect(_class["implements"][0].qualifiedName.typeParameters[0].name).toEqual("E"); - }); - }); - - it("can parse Field of Generic Class", function () { - var ast, promise; - - runs(function () { - promise = parse("GenericClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - - // private OrderedPair> p = new OrderedPair<>("primes", new Box()); - expect(_class.body[0].node).toEqual("Field"); - expect(_class.body[0].modifiers[0]).toEqual("private"); - expect(_class.body[0].type.node).toEqual("Type"); - expect(_class.body[0].type.qualifiedName.name).toEqual("OrderedPair"); - expect(_class.body[0].type.qualifiedName.typeParameters[0].name).toEqual("String"); - expect(_class.body[0].type.qualifiedName.typeParameters[1].name).toEqual("Box"); - expect(_class.body[0].variables.length).toEqual(1); - expect(_class.body[0].variables[0].node).toEqual("Variable"); - expect(_class.body[0].variables[0].name).toEqual("p"); - }); - }); - - it("can parse Methods of Generic Class", function () { - var ast, promise; - - runs(function () { - promise = parse("GenericClassTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _op; - - // Constructor - // public Vector(Collection c) {} - _op = ast.types[0].body[2]; - expect(_op.node).toEqual("Constructor"); - expect(_op.name).toEqual("GenericClassTest"); - expect(_op.modifiers[0]).toEqual("public"); - expect(_op.parameters[0].type.qualifiedName.name).toEqual("Collection"); - expect(_op.parameters[0].type.qualifiedName.typeParameters[0].name).toEqual("?"); - expect(_op.parameters[0].type.qualifiedName.typeParameters[0].type).toEqual("E"); - expect(_op.parameters[0].variable.name).toEqual("c"); - - // public Enumeration elements() {} - _op = ast.types[0].body[3]; - expect(_op.name).toEqual("elements"); - expect(_op.type.qualifiedName.name).toEqual("Enumeration"); - expect(_op.type.qualifiedName.typeParameters[0].name).toEqual("E"); - }); - }); - - it("can parse Interface", function () { - var ast, promise; - - runs(function () { - promise = parse("InterfaceTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _interface = ast.types[0]; - - // public interface InterfaceTest - expect(_interface.node).toEqual("Interface"); - expect(_interface.name).toEqual("InterfaceTest"); - expect(_interface.modifiers[0]).toEqual("public"); - - // extends java.lang.Runnable, java.lang.Serializable - expect(_interface["extends"].length).toEqual(2); - expect(_interface["extends"][0].node).toEqual("Type"); - expect(_interface["extends"][0].qualifiedName.name).toEqual("java.lang.Runnable"); - expect(_interface["extends"][1].node).toEqual("Type"); - expect(_interface["extends"][1].qualifiedName.name).toEqual("java.lang.Serializable"); - }); - }); - - it("can parse Field of Interface", function () { - var ast, promise; - - runs(function () { - promise = parse("InterfaceTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _class = ast.types[0]; - - // public static final int interfaceStaticField = 100; - expect(_class.body[0].node).toEqual("Field"); - expect(_.contains(_class.body[0].modifiers, "public")).toBe(true); - expect(_.contains(_class.body[0].modifiers, "static")).toBe(true); - expect(_.contains(_class.body[0].modifiers, "final")).toBe(true); - expect(_class.body[0].type.node).toEqual("Type"); - expect(_class.body[0].type.qualifiedName.name).toEqual("int"); - expect(_class.body[0].variables.length).toEqual(1); - expect(_class.body[0].variables[0].node).toEqual("Variable"); - expect(_class.body[0].variables[0].name).toEqual("interfaceStaticField"); - expect(_class.body[0].variables[0].initializer).toEqual("100"); - }); - }); - - it("can parse Operation of Interface", function () { - var ast, promise; - - runs(function () { - promise = parse("InterfaceTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - // public CompositeContext createContext(ColorModel srcColorModel, ColorModel dstColorModel); - var _op = ast.types[0].body[1]; - expect(_op.node).toEqual("Method"); - expect(_op.name).toEqual("createContext"); - expect(_op.modifiers[0]).toEqual("public"); - expect(_op.type.qualifiedName.name).toEqual("CompositeContext"); - expect(_op.parameters[0].type.qualifiedName.name).toEqual("ColorModel"); - expect(_op.parameters[0].variable.name).toEqual("srcColorModel"); - expect(_op.parameters[1].type.qualifiedName.name).toEqual("ColorModel"); - expect(_op.parameters[1].variable.name).toEqual("dstColorModel"); - }); - }); - - - it("can parse Enum", function () { - var ast, promise; - - runs(function () { - promise = parse("EnumTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _enum = ast.types[0]; - - // public enum RetryType - expect(_enum.node).toEqual("Enum"); - expect(_enum.name).toEqual("RetryType"); - expect(_enum.modifiers[0]).toEqual("public"); - - // NONE( false ), - expect(_enum.body[0].node).toEqual("EnumConstant"); - expect(_enum.body[0].name).toEqual("NONE"); - expect(_enum.body[0]["arguments"][0]).toEqual("false"); - - // BEFORE_RESPONSE( true ), - expect(_enum.body[1].node).toEqual("EnumConstant"); - expect(_enum.body[1].name).toEqual("BEFORE_RESPONSE"); - expect(_enum.body[1]["arguments"][0]).toEqual("true"); - - // AFTER_RESPONSE( true ) ; - expect(_enum.body[2].node).toEqual("EnumConstant"); - expect(_enum.body[2].name).toEqual("AFTER_RESPONSE"); - expect(_enum.body[2]["arguments"][0]).toEqual("true"); - }); - }); - - it("can parse AnnotationType", function () { - var ast, promise; - - runs(function () { - promise = parse("AnnotationTypeTest.java").done(function (_ast) { ast = _ast; }); - waitsForDone(promise, "Parsing...", 3000); - }); - - runs(function () { - var _annotationType = ast.types[0]; - - // @interface ClassPreamble - expect(_annotationType.node).toEqual("AnnotationType"); - expect(_annotationType.name).toEqual("ClassPreamble"); - - // int _annotationConstant; - expect(_annotationType.body[0].node).toEqual("Field"); - expect(_annotationType.body[0].type.qualifiedName.name).toEqual("int"); - expect(_annotationType.body[0].variables[0].name).toEqual("_annotationConstant"); - - // String author(); - expect(_annotationType.body[1].node).toEqual("Method"); - expect(_annotationType.body[1].name).toEqual("author"); - expect(_annotationType.body[1].type.qualifiedName.name).toEqual("String"); - - // String lastModified() default "N/A"; - expect(_annotationType.body[2].node).toEqual("Method"); - expect(_annotationType.body[2].name).toEqual("lastModified"); - expect(_annotationType.body[2].type.qualifiedName.name).toEqual("String"); - expect(_annotationType.body[2].defaultValue).toEqual("\"N/A\""); - }); - }); - - }); - - describe("Java Code Generation", function () { - // TODO: Test Cases for Code Generation - }); - - describe("Java Reverse Engineering", function () { - var testPath = FileUtils.getNativeModuleDirectoryPath(module) + "/unittest-files", - testWindow; - - beforeFirst(function () { - SpecRunnerUtils.createTestWindowAndRun(this, function (w) { - testWindow = w; - - // Load module instances from app.test - window.type = testWindow.type; - Repository = testWindow.app.test.Repository; - CommandManager = testWindow.app.test.CommandManager; - Commands = testWindow.app.test.Commands; - FileSystem = testWindow.app.test.FileSystem; - Dialogs = testWindow.app.test.Dialogs; - - // Reverse Java Codes in "/unittest-files/reverse/*.java" - var filePath; - - runs(function () { - CommandManager.execute(Commands.FILE_NEW); - }); - - runs(function () { - // Select a folder in Open Dialog - filePath = testPath + "/reverse"; - spyOn(FileSystem, 'showOpenDialog').andCallFake(function (allowMultipleSelection, chooseDirectories, title, initialPath, fileTypes, callback) { - callback(undefined, [filePath]); - }); - - var promise = CommandManager.execute("java.reverse"); - waitsForDone(promise, "java.reverse", 5000); // java reverse may takes long time. - }); - - }); - }); - - afterLast(function () { - - // Close Project after Java Reverse Tests - runs(function () { - // Click "Don't Save" Button - spyOn(Dialogs, "showSaveConfirmDialog").andCallFake(function (filename) { - return { done: function (callback) { callback(Dialogs.DIALOG_BTN_DONTSAVE); } }; - }); - - var promise = CommandManager.execute(Commands.FILE_CLOSE); - waitsForDone(promise); - }); - - runs(function () { - testWindow = null; - Repository = null; - CommandManager = null; - Commands = null; - FileSystem = null; - Dialogs = null; - SpecRunnerUtils.closeTestWindow(); - }); - - }); - - beforeEach(function () { - }); - - afterEach(function () { - }); - - /** Find an element by name in Repository */ - function find(name, type) { - return Repository.find(function (e) { - if (type) { - return (e.name === name) && (e instanceof type); - } else { - return e.name === name; - } - }); - } - - /** Expect a file to exist (failing test if not) and then delete it */ - function expectAndDelete(fullPath) { - runs(function () { - var promise = SpecRunnerUtils.resolveNativeFileSystemPath(fullPath); - waitsForDone(promise, "Verify file exists: " + fullPath); - }); - runs(function () { - var promise = SpecRunnerUtils.deletePath(fullPath); - waitsForDone(promise, "Remove testfile " + fullPath, 5000); - }); - } - - it("can reverse Java Package", function () { - runs(function () { - var _package = find("packagetest"); - expect(_package instanceof type.UMLPackage).toBe(true); - expect(_package._parent.name).toEqual("mycompany"); - expect(_package._parent._parent.name).toEqual("com"); - }); - }); - - it("can reverse Java Class", function () { - runs(function () { - var _class = find("ClassTest"); - expect(_class instanceof type.UMLClass).toBe(true); - }); - }); - - it("can reverse Java Class Access Modifiers", function () { - runs(function () { - var _publicClass = find("PublicClassTest"), - _protectedClass = find("ProtectedClassTest"), - _privateClass = find("PrivateClassTest"), - _packageClass = find("PackageClassTest"); - expect(_publicClass.visibility).toEqual(UML.VK_PUBLIC); - expect(_protectedClass.visibility).toEqual(UML.VK_PROTECTED); - expect(_privateClass.visibility).toEqual(UML.VK_PRIVATE); - expect(_packageClass.visibility).toEqual(UML.VK_PACKAGE); - }); - }); - - it("can reverse Java Final Class", function () { - runs(function () { - var _class = find("ClassFinalTest"); - expect(_class.isFinalSpecialization).toBe(true); - }); - }); - - it("can reverse Java Abstract Class", function () { - runs(function () { - var _class = find("ClassAbstractTest"); - expect(_class.isAbstract).toBe(true); - }); - }); - - it("can reverse Java Generic Class", function () { - runs(function () { - var _class = find("ClassGenericTest"); - expect(_class.templateParameters.length).toEqual(2); - expect(_class.templateParameters[0].name).toEqual("E"); - expect(_class.templateParameters[1].name).toEqual("T"); - expect(_class.templateParameters[1].parameterType).toEqual("java.util.Collection"); - }); - }); - - it("can reverse Java Class Extends", function () { - runs(function () { - var _class1 = find("ClassExtendsTest"), - _class2 = find("ClassTest"), - _generalizations = Repository.getRelationshipsOf(_class1, function (rel) { return rel instanceof type.UMLGeneralization; }); - expect(_generalizations.length).toEqual(1); - expect(_generalizations[0].source).toEqual(_class1); - expect(_generalizations[0].target).toEqual(_class2); - }); - }); - - it("can reverse Java Class Implements", function () { - runs(function () { - var _class = find("ClassImplementsTest"), - _interface = find("InterfaceTest"), - _realizations = Repository.getRelationshipsOf(_class, function (rel) { return rel instanceof type.UMLInterfaceRealization; }); - expect(_realizations.length).toEqual(1); - expect(_realizations[0].source).toEqual(_class); - expect(_realizations[0].target).toEqual(_interface); - }); - }); - - it("can reverse Java Class Constructor", function () { - runs(function () { - expect(find("ClassConstructorTest", type.UMLOperation) instanceof type.UMLOperation).toBe(true); - expect(find("ClassConstructorTest").stereotype).toEqual("constructor"); - }); - }); - - it("can reverse Java Interface", function () { - runs(function () { - expect(find("InterfaceTest") instanceof type.UMLInterface).toBe(true); - }); - }); - - it("can reverse Java Interface Extends", function () { - runs(function () { - var _interface1 = find("InterfaceExtendsTest"), - _interface2 = find("InterfaceTest"), - _generalizations = Repository.getRelationshipsOf(_interface1, function (rel) { return rel instanceof type.UMLGeneralization; }); - expect(_generalizations.length).toEqual(1); - expect(_generalizations[0].source).toEqual(_interface1); - expect(_generalizations[0].target).toEqual(_interface2); - }); - }); - - it("can reverse Java Field Access Modifiers", function () { - runs(function () { - expect(find("publicField").visibility).toEqual(UML.VK_PUBLIC); - expect(find("protectedField").visibility).toEqual(UML.VK_PROTECTED); - expect(find("privateField").visibility).toEqual(UML.VK_PRIVATE); - expect(find("packageField").visibility).toEqual(UML.VK_PACKAGE); - }); - }); - - it("can reverse Java Field Types", function () { - runs(function () { - expect(find("intField").type).toEqual("int"); - expect(find("floatField").type).toEqual("float"); - expect(find("longField").type).toEqual("long"); - expect(find("doubleField").type).toEqual("double"); - expect(find("stringField").type).toEqual("String"); - }); - }); - - it("can reverse Java Field Array Types", function () { - runs(function () { - expect(find("stringArrayField").type).toEqual("String"); - expect(find("stringArrayField").multiplicity).toEqual("*"); - expect(find("int2DArrayField").type).toEqual("int"); - expect(find("int2DArrayField").multiplicity).toEqual("*,*"); - }); - }); - - it("can reverse Java Field Collection Types", function () { - runs(function () { - expect(find("stringListField") instanceof type.UMLAttribute).toBe(true); - expect(find("stringListField").type).toEqual("String"); - expect(find("stringListField").multiplicity).toEqual("*"); - expect(find("stringListField").tags[0].name).toEqual("collection"); - expect(find("stringListField").tags[0].value).toEqual("java.util.List"); - - expect(find("classTestListField") instanceof type.UMLAssociationEnd).toBe(true); - expect(find("classTestListField").reference).toEqual(find("ClassTest")); - expect(find("classTestListField").multiplicity).toEqual("*"); - expect(find("classTestListField").tags[0].name).toEqual("collection"); - expect(find("classTestListField").tags[0].value).toEqual("ArrayList"); - }); - }); - - it("can reverse Java Multiple Field Variables", function () { - runs(function () { - expect(find("field1") instanceof type.UMLAttribute).toBe(true); - expect(find("field2") instanceof type.UMLAttribute).toBe(true); - expect(find("field3") instanceof type.UMLAttribute).toBe(true); - expect(find("field4") instanceof type.UMLAttribute).toBe(true); - }); - }); - - it("can reverse Java Field Modifiers", function () { - runs(function () { - expect(find("staticField").isStatic).toEqual(true); - expect(find("finalField").isLeaf).toEqual(true); - expect(find("finalField").isReadOnly).toEqual(true); - expect(find("transientField").tags[0].name).toEqual("transient"); - expect(find("transientField").tags[0].checked).toEqual(true); - expect(find("volatileField").tags[0].name).toEqual("volatile"); - expect(find("volatileField").tags[0].checked).toEqual(true); - }); - }); - - it("can reverse Java Field Initializers", function () { - runs(function () { - expect(find("intFieldInitializer").defaultValue).toEqual("10"); - expect(find("stringFieldInitializer").defaultValue).toEqual('"String Literal"'); - expect(find("charFieldInitializer").defaultValue).toEqual("'c'"); - expect(find("booleanFieldInitializer").defaultValue).toEqual("true"); - expect(find("objectFieldInitializer").defaultValue).toEqual("null"); - }); - }); - - it("can reverse Java Method", function () { - runs(function () { - expect(find("methodTest") instanceof type.UMLOperation).toBe(true); - }); - }); - - it("can reverse Java Method Parameters", function () { - runs(function () { - expect(find("paramTestMethod") instanceof type.UMLOperation).toBe(true); - expect(find("paramTestMethod").getNonReturnParameters().length).toEqual(3); - expect(find("stringParam") instanceof type.UMLParameter).toBe(true); - expect(find("stringParam").type).toEqual("String"); - expect(find("intParam") instanceof type.UMLParameter).toBe(true); - expect(find("intParam").type).toEqual("int"); - expect(find("classTestParam") instanceof type.UMLParameter).toBe(true); - expect(find("classTestParam").type).toEqual(find("ClassTest")); - }); - }); - - it("can reverse Java Method Return Types", function () { - runs(function () { - expect(find("intReturnMethod").getReturnParameter().type).toEqual("int"); - expect(find("classTestReturnMethod").getReturnParameter().type).toEqual(find("ClassTest")); - expect(find("enumerationReturnMethod").getReturnParameter().type).toEqual(find("Enumeration")); - }); - }); - - it("can reverse Java Method Modifiers", function () { - runs(function () { - expect(find("staticMethod").isStatic).toEqual(true); - expect(find("abstractMethod").isAbstract).toEqual(true); - expect(find("finalMethod").isLeaf).toEqual(true); - expect(find("synchronizedMethod").concurrency).toEqual(UML.CCK_CONCURRENT); - expect(find("nativeMethod").tags[0].name).toEqual("native"); - expect(find("nativeMethod").tags[0].checked).toEqual(true); - expect(find("strictfpMethod").tags[0].name).toEqual("strictfp"); - expect(find("strictfpMethod").tags[0].checked).toEqual(true); - }); - }); - - it("can reverse Java Generic Method", function () { - runs(function () { - expect(find("genericMethod") instanceof type.UMLOperation).toBe(true); - expect(find("genericMethod").templateParameters[0].parameterType).toEqual("Product"); - expect(find("genericMethod").templateParameters[0].name).toEqual("T"); - expect(find("genericMethodListParam") instanceof type.UMLParameter).toBe(true); - expect(find("genericMethodListParam").type).toEqual(find("ArrayList")); - }); - }); - - it("can reverse Java Method Throws", function () { - runs(function () { - expect(find("throwsTestMethod") instanceof type.UMLOperation).toBe(true); - expect(find("throwsTestMethod").raisedExceptions[0]).toEqual(find("Exception")); - }); - }); - - it("can reverse Java Enum", function () { - runs(function () { - expect(find("EnumTest", type.UMLEnumeration) instanceof type.UMLEnumeration).toBe(true); - }); - }); - - it("can reverse Java Enum Constants", function () { - runs(function () { - expect(find("EnumTest", type.UMLEnumeration).literals.length).toEqual(3); - expect(find("ENUM_CONSTANT1") instanceof type.UMLEnumerationLiteral).toBe(true); - expect(find("ENUM_CONSTANT2") instanceof type.UMLEnumerationLiteral).toBe(true); - expect(find("ENUM_CONSTANT3") instanceof type.UMLEnumerationLiteral).toBe(true); - }); - }); - - it("can reverse Java Enum Field", function () { - runs(function () { - expect(find("enumField") instanceof type.UMLAttribute).toBe(true); - }); - }); - - it("can reverse Java Enum Method", function () { - runs(function () { - expect(find("enumMethod") instanceof type.UMLOperation).toBe(true); - }); - }); - - it("can reverse Java Annotation Type", function () { - runs(function () { - expect(find("AnnotationTypeTest") instanceof type.UMLClass).toBe(true); - expect(find("AnnotationTypeTest").stereotype).toEqual("annotationType"); - }); - }); - - it("can reverse Java Annotation Type Elements", function () { - runs(function () { - expect(find("annotationTypeElement") instanceof type.UMLOperation).toBe(true); - expect(find("annotationTypeElement").getReturnParameter().type).toEqual("String"); - expect(find("annotationTypeElementWithDefault") instanceof type.UMLOperation).toBe(true); - expect(find("annotationTypeElementWithDefault").getReturnParameter().type).toEqual("String"); - expect(find("annotationTypeElementWithDefault").tags[0].name).toEqual("default"); - expect(find("annotationTypeElementWithDefault").tags[0].value).toEqual('"N/A"'); - }); - }); - - it("can reverse JavaDoc for Class", function () { - runs(function () { - var _doc = find("JavaDocClassTest").documentation, - _lines = _doc.split("\n"); - expect(_lines.length).toEqual(3); - expect(_lines[0]).toEqual("This is first line of JavaDoc documentation."); - expect(_lines[1]).toEqual("This is second line of JavaDoc documentation."); - expect(_lines[2]).toEqual("@author Minkyu Lee"); - }); - }); - - }); - - }); - -}); From c60cca060057a368eeab42cd4b85440b36b6cd44 Mon Sep 17 00:00:00 2001 From: niklaus Date: Wed, 2 May 2018 12:17:29 +0900 Subject: [PATCH 02/18] Change file names and README --- README.md | 7 +- JavaReverseEngineer.js => code-analyzer.js | 0 JavaCodeGenerator.js => code-generator.js | 10 +-- CodeGenUtils.js => codegen-utils.js | 96 +++++++++++----------- main.js | 14 ++-- 5 files changed, 68 insertions(+), 59 deletions(-) rename JavaReverseEngineer.js => code-analyzer.js (100%) rename JavaCodeGenerator.js => code-generator.js (98%) rename CodeGenUtils.js => codegen-utils.js (51%) diff --git a/README.md b/README.md index 4b12212..257296e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ Java Extension for StarUML ========================== -This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. It is based on Java 1.7 specification. +This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. + +> __Note__ +> +> This extension is based on Java 1.7 Specification. + Java Code Generation -------------------- diff --git a/JavaReverseEngineer.js b/code-analyzer.js similarity index 100% rename from JavaReverseEngineer.js rename to code-analyzer.js diff --git a/JavaCodeGenerator.js b/code-generator.js similarity index 98% rename from JavaCodeGenerator.js rename to code-generator.js index 950de19..b59d6c1 100644 --- a/JavaCodeGenerator.js +++ b/code-generator.js @@ -24,7 +24,7 @@ const fs = require('fs') const path = require('path') const _ = require('lodash') -const CodeGenUtils = require('./CodeGenUtils') +const codegen = require('./codegen-utils') /** * Java Code Generator @@ -88,7 +88,7 @@ class JavaCodeGenerator { // AnnotationType if (elem.stereotype === 'annotationType') { fullPath = path.join(basePath, elem.name + '.java') - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + codeWriter = new codegen.CodeWriter(this.getIndentString(options)) this.writePackageDeclaration(codeWriter, elem, options) codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') @@ -98,7 +98,7 @@ class JavaCodeGenerator { // Class } else { fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + codeWriter = new codegen.CodeWriter(this.getIndentString(options)) this.writePackageDeclaration(codeWriter, elem, options) codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') @@ -110,7 +110,7 @@ class JavaCodeGenerator { // Interface } else if (elem instanceof type.UMLInterface) { fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + codeWriter = new codegen.CodeWriter(this.getIndentString(options)) this.writePackageDeclaration(codeWriter, elem, options) codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') @@ -121,7 +121,7 @@ class JavaCodeGenerator { // Enum } else if (elem instanceof type.UMLEnumeration) { fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new CodeGenUtils.CodeWriter(this.getIndentString(options)) + codeWriter = new codegen.CodeWriter(this.getIndentString(options)) this.writePackageDeclaration(codeWriter, elem, options) codeWriter.writeLine() this.writeEnum(codeWriter, elem, options) diff --git a/CodeGenUtils.js b/codegen-utils.js similarity index 51% rename from CodeGenUtils.js rename to codegen-utils.js index 268b719..4eb4eda 100644 --- a/CodeGenUtils.js +++ b/codegen-utils.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 MKLab. All rights reserved. + * Copyright (c) 2014-2018 MKLab. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -22,53 +22,57 @@ */ /** -* CodeWriter -* @constructor -*/ -function CodeWriter (indentString) { - - /** @member {Array.} lines */ - this.lines = []; - - /** @member {string} indentString */ - this.indentString = (indentString ? indentString : " "); // default 4 spaces - - /** @member {Array.} indentations */ - this.indentations = []; -} + * CodeWriter + */ +class CodeWriter { + /** + * @constructor + */ + constructor (indentString) { + /** @member {Array.} lines */ + this.lines = [] -/** -* Indent -*/ -CodeWriter.prototype.indent = function () { - this.indentations.push(this.indentString); -}; + /** @member {string} indentString */ + this.indentString = indentString || ' ' // default 4 spaces -/** -* Outdent -*/ -CodeWriter.prototype.outdent = function () { - this.indentations.splice(this.indentations.length-1, 1); -}; + /** @member {Array.} indentations */ + this.indentations = [] + } -/** -* Write a line -* @param {string} line -*/ -CodeWriter.prototype.writeLine = function (line) { - if (line) { - this.lines.push(this.indentations.join("") + line); - } else { - this.lines.push(""); - } -}; + /** + * Indent + */ + indent () { + this.indentations.push(this.indentString) + } -/** -* Return as all string data -* @return {string} -*/ -CodeWriter.prototype.getData = function () { - return this.lines.join("\n"); -}; + /** + * Outdent + */ + outdent () { + this.indentations.splice(this.indentations.length - 1, 1) + } + + /** + * Write a line + * @param {string} line + */ + writeLine (line) { + if (line) { + this.lines.push(this.indentations.join('') + line) + } else { + this.lines.push('') + } + } + + /** + * Return as all string data + * @return {string} + */ + getData () { + return this.lines.join('\n') + } + +} -exports.CodeWriter = CodeWriter; +exports.CodeWriter = CodeWriter diff --git a/main.js b/main.js index 5dbb7a2..8b62403 100644 --- a/main.js +++ b/main.js @@ -21,8 +21,8 @@ * */ -const JavaCodeGenerator = require('./JavaCodeGenerator') -const JavaReverseEngineer = require('./JavaReverseEngineer') +const codeGenerator = require('./code-generator') +const codeAnalyzer = require('./code-analyzer') function getGenOptions () { return { @@ -63,10 +63,10 @@ function _handleGenerate (base, path, options) { var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) if (files && files.length > 0) { path = files[0] - JavaCodeGenerator.generate(base, path, options) + codeGenerator.generate(base, path, options) } } else { - JavaCodeGenerator.generate(base, path, options) + codeGenerator.generate(base, path, options) } } }) @@ -76,10 +76,10 @@ function _handleGenerate (base, path, options) { var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) if (files && files.length > 0) { path = files[0] - JavaCodeGenerator.generate(base, path, options) + codeGenerator.generate(base, path, options) } } else { - JavaCodeGenerator.generate(base, path, options) + codeGenerator.generate(base, path, options) } } } @@ -99,7 +99,7 @@ function _handleReverse (basePath, options) { var files = app.dialogs.showOpenDialog('Select Folder', null, null, { properties: [ 'openDirectory' ] }) if (files && files.length > 0) { basePath = files[0] - JavaReverseEngineer.analyze(basePath, options) + codeAnalyzer.analyze(basePath, options) } } } From e6bb04980417171a1aed3c199839206b7b1c593d Mon Sep 17 00:00:00 2001 From: niklaus Date: Mon, 14 May 2018 14:27:52 +0900 Subject: [PATCH 03/18] Fix some codes and README --- README.md | 5 +++-- code-analyzer.js | 2 -- code-generator.js | 1 - main.js | 2 -- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 257296e..592833f 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ Java Extension for StarUML This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. > __Note__ -> -> This extension is based on Java 1.7 Specification. +> This extensions do not provide perfect reverse engineering which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools. +> __Note__ +> This extension is based on Java 1.7 Specification. Java Code Generation -------------------- diff --git a/code-analyzer.js b/code-analyzer.js index fd87745..f19c17b 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -131,7 +131,6 @@ class JavaCodeAnalyzer { /** * Analyze all files. * @param {Object} options - * @return {$.Promise} */ analyze (options) { // Perform 1st Phase @@ -1133,7 +1132,6 @@ class JavaCodeAnalyzer { * Analyze all java files in basePath * @param {string} basePath * @param {Object} options - * @return {$.Promise} */ function analyze (basePath, options) { var javaAnalyzer = new JavaCodeAnalyzer() diff --git a/code-generator.js b/code-generator.js index b59d6c1..39fbd19 100644 --- a/code-generator.js +++ b/code-generator.js @@ -69,7 +69,6 @@ class JavaCodeGenerator { * @param {type.Model} elem * @param {string} basePath * @param {Object} options - * @return {$.Promise} */ generate (elem, basePath, options) { var fullPath diff --git a/main.js b/main.js index 8b62403..4ff55c5 100644 --- a/main.js +++ b/main.js @@ -48,7 +48,6 @@ function getRevOptions () { * @param {Element} base * @param {string} path * @param {Object} options - * @return {$.Promise} */ function _handleGenerate (base, path, options) { // If options is not passed, get from preference @@ -89,7 +88,6 @@ function _handleGenerate (base, path, options) { * * @param {string} basePath * @param {Object} options - * @return {$.Promise} */ function _handleReverse (basePath, options) { // If options is not passed, get from preference From 0e44f8d1d5e43744b048708d29af13da6798e31b Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Wed, 23 May 2018 20:35:47 +0900 Subject: [PATCH 04/18] remove lodash --- code-analyzer.js | 59 ++++++++++++++++++++++++----------------------- code-generator.js | 29 +++++++++++------------ 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/code-analyzer.js b/code-analyzer.js index f19c17b..0577ac2 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -23,7 +23,6 @@ const fs = require('fs') const path = require('path') -const _ = require('lodash') const java7 = require('./grammar/java7') // Java Primitive Types @@ -73,7 +72,7 @@ var javaCollectionTypes = [ ] // Java Collection Types (full names) -var javaUtilCollectionTypes = _.map(javaCollectionTypes, c => { return 'java.util.' + c }) +var javaUtilCollectionTypes = javaCollectionTypes.map(c => { return 'java.util.' + c }) /** * Java Code Analyzer @@ -264,22 +263,22 @@ class JavaCodeAnalyzer { association.end2.navigable = true // Final Modifier - if (_.includes(_asso.node.modifiers, 'final')) { + if (_asso.node.modifiers && _asso.node.modifiers.includes('final')) { association.end2.isReadOnly = true } // Static Modifier - if (_.includes(_asso.node.modifiers, 'static')) { + if (_asso.node.modifiers && _asso.node.modifiers.includes('static')) { this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'static', true) } // Volatile Modifier - if (_.includes(_asso.node.modifiers, 'volatile')) { + if (_asso.node.modifiers && _asso.node.modifiers.includes('volatile')) { this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'volatile', true) } // Transient Modifier - if (_.includes(_asso.node.modifiers, 'transient')) { + if (_asso.node.modifiers && _asso.node.modifiers.includes('transient')) { this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'transient', true) } } @@ -323,7 +322,7 @@ class JavaCodeAnalyzer { } // if type is primitive type - if (_.includes(javaPrimitiveTypes, _typeName)) { + if (javaPrimitiveTypes.includes(_typeName)) { _typedFeature.feature.type = _typeName // otherwise } else { @@ -392,7 +391,7 @@ class JavaCodeAnalyzer { if (type.node === 'Type') { typeName = type.qualifiedName.name - } else if (_.isString(type)) { + } else if (typeof type === 'string') { typeName = type } @@ -449,12 +448,14 @@ class JavaCodeAnalyzer { * @return {string} Visibility constants for UML Elements */ _getVisibility (modifiers) { - if (_.includes(modifiers, 'public')) { - return type.UMLModelElement.VK_PUBLIC - } else if (_.includes(modifiers, 'protected')) { - return type.UMLModelElement.VK_PROTECTED - } else if (_.includes(modifiers, 'private')) { - return type.UMLModelElement.VK_PRIVATE + if (modifiers) { + if (modifiers.includes('public')) { + return type.UMLModelElement.VK_PUBLIC + } else if (modifiers.includes('protected')) { + return type.UMLModelElement.VK_PROTECTED + } else if (modifiers.includes('private')) { + return type.UMLModelElement.VK_PRIVATE + } } return type.UMLModelElement.VK_PACKAGE } @@ -584,12 +585,12 @@ class JavaCodeAnalyzer { var _itemType = typeNode.qualifiedName.typeParameters[0].name // Used Full name (e.g. java.util.List) - if (_.includes(javaUtilCollectionTypes, _collectionType)) { + if (javaUtilCollectionTypes.includes(_collectionType)) { return _itemType } // Used name with imports (e.g. List and import java.util.List or java.util.*) - if (_.includes(javaCollectionTypes, _collectionType)) { + if (javaCollectionTypes.includes(_collectionType)) { if (compilationUnitNode.imports) { var i, len for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { @@ -685,7 +686,7 @@ class JavaCodeAnalyzer { if (Array.isArray(memberNodeArray) && memberNodeArray.length > 0) { for (i = 0, len = memberNodeArray.length; i < len; i++) { var memberNode = memberNodeArray[i] - if (_.isObject(memberNode) && memberNode.node) { + if ((typeof memberNode === 'string') && memberNode.node) { var visibility = this._getVisibility(memberNode.modifiers) // Generate public members only if publicOnly == true @@ -760,12 +761,12 @@ class JavaCodeAnalyzer { _class.visibility = this._getVisibility(classNode.modifiers) // Abstract Class - if (_.includes(classNode.modifiers, 'abstract')) { + if (classNode.modifiers && classNode.modifiers.includes('abstract')) { _class.isAbstract = true } // Final Class - if (_.includes(classNode.modifiers, 'final')) { + if (classNode.modifiers && classNode.modifiers.includes('final')) { _class.isFinalSpecialization = true _class.isLeaf = true } @@ -957,23 +958,23 @@ class JavaCodeAnalyzer { } // Static Modifier - if (_.includes(fieldNode.modifiers, 'static')) { + if (fieldNode.modifiers && fieldNode.modifiers.includes('static')) { _attribute.isStatic = true } // Final Modifier - if (_.includes(fieldNode.modifiers, 'final')) { + if (fieldNode.modifiers && fieldNode.modifiers.includes('final')) { _attribute.isLeaf = true _attribute.isReadOnly = true } // Volatile Modifier - if (_.includes(fieldNode.modifiers, 'volatile')) { + if (fieldNode.modifiers && fieldNode.modifiers.includes('volatile')) { this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'volatile', true) } // Transient Modifier - if (_.includes(fieldNode.modifiers, 'transient')) { + if (fieldNode.modifiers && fieldNode.modifiers.includes('transient')) { this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'transient', true) } @@ -1011,22 +1012,22 @@ class JavaCodeAnalyzer { // Modifiers _operation.visibility = this._getVisibility(methodNode.modifiers) - if (_.includes(methodNode.modifiers, 'static')) { + if (methodNode.modifiers && methodNode.modifiers.includes('static')) { _operation.isStatic = true } - if (_.includes(methodNode.modifiers, 'abstract')) { + if (methodNode.modifiers && methodNode.modifiers.includes('abstract')) { _operation.isAbstract = true } - if (_.includes(methodNode.modifiers, 'final')) { + if (methodNode.modifiers && methodNode.modifiers.includes('final')) { _operation.isLeaf = true } - if (_.includes(methodNode.modifiers, 'synchronized')) { + if (methodNode.modifiers && methodNode.modifiers.includes('synchronized')) { _operation.concurrency = type.UMLBehavioralFeature.CCK_CONCURRENT } - if (_.includes(methodNode.modifiers, 'native')) { + if (methodNode.modifiers && methodNode.modifiers.includes('native')) { this._addTag(_operation, type.Tag.TK_BOOLEAN, 'native', true) } - if (_.includes(methodNode.modifiers, 'strictfp')) { + if (methodNode.modifiers && methodNode.modifiers.includes('strictfp')) { this._addTag(_operation, type.Tag.TK_BOOLEAN, 'strictfp', true) } diff --git a/code-generator.js b/code-generator.js index 39fbd19..2421730 100644 --- a/code-generator.js +++ b/code-generator.js @@ -23,7 +23,6 @@ const fs = require('fs') const path = require('path') -const _ = require('lodash') const codegen = require('./codegen-utils') /** @@ -184,7 +183,7 @@ class JavaCodeGenerator { var generalizations = app.repository.getRelationshipsOf(elem, function (rel) { return (rel instanceof type.UMLGeneralization && rel.source === elem) }) - return _.map(generalizations, function (gen) { return gen.target }) + return generalizations.map(function (gen) { return gen.target }) } /** @@ -196,7 +195,7 @@ class JavaCodeGenerator { var realizations = app.repository.getRelationshipsOf(elem, function (rel) { return (rel instanceof type.UMLInterfaceRealization && rel.source === elem) }) - return _.map(realizations, function (gen) { return gen.target }) + return realizations.map(function (gen) { return gen.target }) } /** @@ -214,13 +213,13 @@ class JavaCodeGenerator { } else { if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { _type = elem.type.name - } else if (_.isString(elem.type) && elem.type.length > 0) { + } else if ((typeof elem.type === 'string') && elem.type.length > 0) { _type = elem.type } } // multiplicity if (elem.multiplicity) { - if (_.includes(['0..*', '1..*', '*'], elem.multiplicity.trim())) { + if (['0..*', '1..*', '*'].includes(elem.multiplicity.trim())) { if (elem.isOrdered === true) { _type = 'List<' + _type + '>' } else { @@ -241,7 +240,7 @@ class JavaCodeGenerator { */ writeDoc (codeWriter, text, options) { var i, len, lines - if (options.javaDoc && _.isString(text)) { + if (options.javaDoc && (typeof text === 'string')) { lines = text.trim().split('\n') codeWriter.writeLine('/**') for (i = 0, len = lines.length; i < len; i++) { @@ -260,7 +259,7 @@ class JavaCodeGenerator { writePackageDeclaration (codeWriter, elem, options) { var packagePath = null if (elem._parent) { - packagePath = _.map(elem._parent.getPath(this.baseModel), function (e) { return e.name }).join('.') + packagePath = elem._parent.getPath(this.baseModel).map(function (e) { return e.name }).join('.') } if (packagePath) { codeWriter.writeLine('package ' + packagePath + ';') @@ -344,7 +343,7 @@ class JavaCodeGenerator { } } - _.each(params, function (param) { + params.forEach(function (param) { doc += '\n@param ' + param.name + ' ' + param.documentation }) if (returnParam) { @@ -381,7 +380,7 @@ class JavaCodeGenerator { terms.push(elem.name + '(' + paramTerms.join(', ') + ')') // body - if (skipBody === true || _.includes(_modifiers, 'abstract')) { + if (skipBody === true || _modifiers.includes('abstract')) { codeWriter.writeLine(terms.join(' ') + ';') } else { codeWriter.writeLine(terms.join(' ') + ' {') @@ -433,7 +432,7 @@ class JavaCodeGenerator { // Modifiers var _modifiers = this.getModifiers(elem) - if (_.includes(_modifiers, 'abstract') !== true && _.some(elem.operations, function (op) { return op.isAbstract === true })) { + if (_modifiers.includes('abstract') !== true && elem.operations.some(function (op) { return op.isAbstract === true })) { _modifiers.push('abstract') } if (_modifiers.length > 0) { @@ -453,7 +452,7 @@ class JavaCodeGenerator { // Implements var _implements = this.getSuperInterfaces(elem) if (_implements.length > 0) { - terms.push('implements ' + _.map(_implements, function (e) { return e.name }).join(', ')) + terms.push('implements ' + _implements.map(function (e) { return e.name }).join(', ')) } codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.writeLine() @@ -495,7 +494,7 @@ class JavaCodeGenerator { if (_extends.length > 0) { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) - if (_.includes(_modifiers, 'abstract') === true) { + if (_modifiers.includes('abstract') === true) { this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) codeWriter.writeLine() } @@ -559,7 +558,7 @@ class JavaCodeGenerator { // Extends var _extends = this.getSuperClasses(elem) if (_extends.length > 0) { - terms.push('extends ' + _.map(_extends, function (e) { return e.name }).join(', ')) + terms.push('extends ' + _extends.map(function (e) { return e.name }).join(', ')) } codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.writeLine() @@ -668,7 +667,7 @@ class JavaCodeGenerator { // Modifiers var _modifiers = this.getModifiers(elem) - if (_.includes(_modifiers, 'abstract') !== true && _.some(elem.operations, function (op) { return op.isAbstract === true })) { + if (_modifiers.includes('abstract') !== true && elem.operations.some(function (op) { return op.isAbstract === true })) { _modifiers.push('abstract') } if (_modifiers.length > 0) { @@ -700,7 +699,7 @@ class JavaCodeGenerator { if (_extends.length > 0) { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) - if (_.includes(_modifiers, 'abstract') === true) { + if (_modifiers.includes('abstract') === true) { this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) codeWriter.writeLine() } From b83011c354921161ccfe9381e716654c3c425c36 Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Mon, 6 Aug 2018 12:25:53 +0900 Subject: [PATCH 05/18] No variables and methods are generated after the code is reversed in Windows10 #18 --- code-analyzer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code-analyzer.js b/code-analyzer.js index 0577ac2..dd5f6db 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -686,7 +686,7 @@ class JavaCodeAnalyzer { if (Array.isArray(memberNodeArray) && memberNodeArray.length > 0) { for (i = 0, len = memberNodeArray.length; i < len; i++) { var memberNode = memberNodeArray[i] - if ((typeof memberNode === 'string') && memberNode.node) { + if (memberNode && (typeof memberNode.node === 'string')) { var visibility = this._getVisibility(memberNode.modifiers) // Generate public members only if publicOnly == true From 8c993ffa97471f46481a3d56629369c5b6a44c13 Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Mon, 6 Aug 2018 12:27:16 +0900 Subject: [PATCH 06/18] Update to v0.9.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 32a8a17..df9d279 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "homepage": "https://github.com/staruml/staruml-java", "issues": "https://github.com/staruml/staruml-java/issues", "keywords": ["java"], - "version": "0.9.4", + "version": "0.9.5", "author": { "name": "Minkyu Lee", "email": "niklaus.lee@gmail.com", From 23f1339a517c0f9e0be836ce0b8c2f31579201b3 Mon Sep 17 00:00:00 2001 From: Rtfsc8 Date: Thu, 17 Jan 2019 22:53:44 +0800 Subject: [PATCH 07/18] fix bug: some reverse code error like qualifiedName attribute undefined. --- .gitignore | 217 +++++++++++++++++++++++++++++++++++++++++++++++ code-analyzer.js | 4 + 2 files changed, 221 insertions(+) diff --git a/.gitignore b/.gitignore index eadef60..52f6006 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,220 @@ Thumbs.db #Java Test Sources /unittest-files/src-jdk jisonOutput.txt +### Node template +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# TypeScript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# parcel-bundler cache (https://parceljs.org/) +.cache + +# next.js build output +.next + +# nuxt.js build output +.nuxt + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless +### Eclipse template + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet +### Linux template +*~ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +.idea/checkstyle-idea.xml +.idea/copyright/ +.idea/encodings.xml +.idea/inspectionProfiles/ +.idea/markdown-navigator.xml +.idea/markdown-navigator/ +.idea/misc.xml +.idea/modules.xml +.idea/staruml-java.iml +.idea/vcs.xml diff --git a/code-analyzer.js b/code-analyzer.js index dd5f6db..1edefc7 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -303,6 +303,10 @@ class JavaCodeAnalyzer { // Resolve Type References for (i = 0, len = this._typedFeaturePendings.length; i < len; i++) { var _typedFeature = this._typedFeaturePendings[i] + //Fix bug: some reverse code error like qualifiedName attribute undefined + if (!!!_typedFeature.node.type.qualifiedName) { + continue; + } _typeName = _typedFeature.node.type.qualifiedName.name // Find type and assign From 5bb172658e197728cbb99bcd2e9bde100e87b28e Mon Sep 17 00:00:00 2001 From: Rtfsc8 Date: Fri, 18 Jan 2019 18:04:51 +0800 Subject: [PATCH 08/18] Fix: Not processing empty file. --- .gitignore | 48 ++---------------------------------------------- code-analyzer.js | 4 ++++ 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/.gitignore b/.gitignore index 52f6006..2242592 100644 --- a/.gitignore +++ b/.gitignore @@ -159,40 +159,12 @@ local.properties # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/modules.xml -# .idea/*.iml -# .idea/modules +# ignore .idea directory +.idea/ # CMake cmake-build-*/ -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - # File-based project format *.iws @@ -205,25 +177,9 @@ out/ # JIRA plugin atlassian-ide-plugin.xml -# Cursive Clojure plugin -.idea/replstate.xml - # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml crashlytics.properties crashlytics-build.properties fabric.properties -# Editor-based Rest Client -.idea/httpRequests - -.idea/checkstyle-idea.xml -.idea/copyright/ -.idea/encodings.xml -.idea/inspectionProfiles/ -.idea/markdown-navigator.xml -.idea/markdown-navigator/ -.idea/misc.xml -.idea/modules.xml -.idea/staruml-java.iml -.idea/vcs.xml diff --git a/code-analyzer.js b/code-analyzer.js index 1edefc7..0146bb9 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -159,6 +159,10 @@ class JavaCodeAnalyzer { this._files.forEach(file => { var data = fs.readFileSync(file, 'utf8') try { + /* Not processing empty file @author Rtfsc8(rtfsc8@rtfsc8.top) */ + if (!!!data) { + return; + } var ast = java7.parse(data) this._currentCompilationUnit = ast this._currentCompilationUnit.file = file From 3f52c537a5bfaad8d30d816f9e218b947eddf2b5 Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Wed, 3 Feb 2021 11:42:32 +0800 Subject: [PATCH 09/18] remove "void" for Class's constructors those are identified by same method name wth Class's name --- code-generator.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/code-generator.js b/code-generator.js index 2421730..aa1a35c 100644 --- a/code-generator.js +++ b/code-generator.js @@ -323,8 +323,9 @@ class JavaCodeGenerator { * @param {Object} options * @param {boolean} skipBody * @param {boolean} skipParams + * @param {type.Model} owner */ - writeMethod (codeWriter, elem, options, skipBody, skipParams) { + writeMethod (codeWriter, elem, owner, options, skipBody, skipParams) { if (elem.name.length > 0) { var terms = [] var params = elem.getNonReturnParameters() @@ -361,7 +362,11 @@ class JavaCodeGenerator { if (returnParam) { terms.push(this.getType(returnParam)) } else { - terms.push('void') + if (elem.name === owner.name){ + //constructor has no return + }else{ + terms.push('void') + } } // name + parameters @@ -486,7 +491,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, false, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false) codeWriter.writeLine() } @@ -495,7 +500,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) codeWriter.writeLine() } } @@ -504,7 +509,7 @@ class JavaCodeGenerator { // Interface methods for (var j = 0; j < _implements.length; j++) { for (i = 0, len = _implements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _implements[j].operations[i], options, false, false) + this.writeMethod(codeWriter, _implements[j].operations[i], _implements[j], options, false, false) codeWriter.writeLine() } } @@ -588,7 +593,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false) codeWriter.writeLine() } @@ -690,7 +695,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, true) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true) codeWriter.writeLine() } @@ -700,7 +705,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) codeWriter.writeLine() } } From ed3de23f15b4bea2b70bb401c1e328736d0ae61f Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Wed, 3 Feb 2021 11:42:32 +0800 Subject: [PATCH 10/18] remove "void" for Class's constructors those are identified by same method name wth Class's name --- code-generator.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/code-generator.js b/code-generator.js index 2421730..896fd2c 100644 --- a/code-generator.js +++ b/code-generator.js @@ -320,11 +320,12 @@ class JavaCodeGenerator { * Write Method * @param {StringWriter} codeWriter * @param {type.Model} elem + * @param {type.Model} owner * @param {Object} options * @param {boolean} skipBody * @param {boolean} skipParams */ - writeMethod (codeWriter, elem, options, skipBody, skipParams) { + writeMethod (codeWriter, elem, owner, options, skipBody, skipParams) { if (elem.name.length > 0) { var terms = [] var params = elem.getNonReturnParameters() @@ -361,7 +362,11 @@ class JavaCodeGenerator { if (returnParam) { terms.push(this.getType(returnParam)) } else { - terms.push('void') + if (elem.name === owner.name){ + //constructor has no return + }else{ + terms.push('void') + } } // name + parameters @@ -486,7 +491,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, false, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false) codeWriter.writeLine() } @@ -495,7 +500,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) codeWriter.writeLine() } } @@ -504,7 +509,7 @@ class JavaCodeGenerator { // Interface methods for (var j = 0; j < _implements.length; j++) { for (i = 0, len = _implements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _implements[j].operations[i], options, false, false) + this.writeMethod(codeWriter, _implements[j].operations[i], _implements[j], options, false, false) codeWriter.writeLine() } } @@ -588,7 +593,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false) codeWriter.writeLine() } @@ -690,7 +695,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], options, true, true) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true) codeWriter.writeLine() } @@ -700,7 +705,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) codeWriter.writeLine() } } From b4e2cf907f7a34abfa931781953cfda03859ec95 Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Mon, 1 Mar 2021 23:52:14 +0800 Subject: [PATCH 11/18] auto generation of imports and inner definitions assumption: user select a root view of whole package for generation for example, user select "Local View" to general all types under this view. Then we can automatically generate imports for each type --- code-generator.js | 230 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 162 insertions(+), 68 deletions(-) diff --git a/code-generator.js b/code-generator.js index 896fd2c..65d32ae 100644 --- a/code-generator.js +++ b/code-generator.js @@ -68,10 +68,14 @@ class JavaCodeGenerator { * @param {type.Model} elem * @param {string} basePath * @param {Object} options + * @param {Object} curPackage */ - generate (elem, basePath, options) { + generate (elem, basePath, options, curPackage) { var fullPath var codeWriter + var codeWriter2 + + var imports = new Set() // Package if (elem instanceof type.UMLPackage) { @@ -79,7 +83,7 @@ class JavaCodeGenerator { fs.mkdirSync(fullPath) if (Array.isArray(elem.ownedElements)) { elem.ownedElements.forEach(child => { - return this.generate(child, fullPath, options) + return this.generate(child, fullPath, options, elem) }) } } else if (elem instanceof type.UMLClass) { @@ -87,43 +91,75 @@ class JavaCodeGenerator { if (elem.stereotype === 'annotationType') { fullPath = path.join(basePath, elem.name + '.java') codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options) + this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) + this.writeAnnotationType(codeWriter2, elem, options, imports, curPackage) + + if (imports.size > 0) { + codeWriter.writeLine() + imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + } codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine() - this.writeAnnotationType(codeWriter, elem, options) - fs.writeFileSync(fullPath, codeWriter.getData()) + codeWriter.writeLine('\n') + + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) // Class } else { fullPath = basePath + '/' + elem.name + '.java' codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options) + this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) + this.writeClass(codeWriter2, elem, options, imports, curPackage) + + if (imports.size > 0) { + codeWriter.writeLine() + imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + } codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine() - this.writeClass(codeWriter, elem, options) - fs.writeFileSync(fullPath, codeWriter.getData()) + codeWriter.writeLine('\n') + + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) } // Interface } else if (elem instanceof type.UMLInterface) { fullPath = basePath + '/' + elem.name + '.java' codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options) + this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) + this.writeInterface(codeWriter2, elem, options, imports, curPackage) + + if (imports.size > 0) { + codeWriter.writeLine() + imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + } codeWriter.writeLine() codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine() - this.writeInterface(codeWriter, elem, options) - fs.writeFileSync(fullPath, codeWriter.getData()) + codeWriter.writeLine('\n') + + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) // Enum } else if (elem instanceof type.UMLEnumeration) { fullPath = basePath + '/' + elem.name + '.java' codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options) - codeWriter.writeLine() - this.writeEnum(codeWriter, elem, options) - fs.writeFileSync(fullPath, codeWriter.getData()) + this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) + this.writeEnum(codeWriter2, elem, options, imports, curPackage) + + if (imports.size > 0) { + codeWriter.writeLine() + imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + } + codeWriter.writeLine('\n') + + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) } } @@ -201,22 +237,56 @@ class JavaCodeGenerator { /** * Return type expression * @param {type.Model} elem + * @param {Array.} imports Used to collect import declarations * @return {string} */ - getType (elem) { + getType (elem, imports, curPackage) { var _type = 'void' + var _import = '' + var owner = null + var topType = null + // type name if (elem instanceof type.UMLAssociationEnd) { if (elem.reference instanceof type.UMLModelElement && elem.reference.name.length > 0) { _type = elem.reference.name } + // inner types need to add owner's name as prefix + owner = elem.reference._parent + topType = elem.reference } else { if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { _type = elem.type.name + // inner types need add owner's name as prefix + owner = elem.type._parent + topType = elem.type } else if ((typeof elem.type === 'string') && elem.type.length > 0) { _type = elem.type } } + + // find package of elem and whole _type string with parents' decarations + while (owner instanceof type.UMLClass || owner instanceof type.UMLInterface) { + if (owner.name.length > 0) { + _type = owner.name +'.'+ _type + } else { + _type = '.'+ _type + } + topType = owner + owner = owner._parent + } + + // generate _import as fullpath of owner package + if (owner != null && owner != curPackage) { + var _fullImport = topType.name + while (owner instanceof type.UMLPackage) { + _import = _fullImport //ignore final root package that would be view point + _fullImport = owner.name + '.' + _fullImport + owner = owner._parent + } + imports.add(_import) + } + // multiplicity if (elem.multiplicity) { if (['0..*', '1..*', '*'].includes(elem.multiplicity.trim())) { @@ -237,8 +307,10 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {string} text * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeDoc (codeWriter, text, options) { + writeDoc (codeWriter, text, options, imports, curPackage) { var i, len, lines if (options.javaDoc && (typeof text === 'string')) { lines = text.trim().split('\n') @@ -255,8 +327,10 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writePackageDeclaration (codeWriter, elem, options) { + writePackageDeclaration (codeWriter, elem, options, imports, curPackage) { var packagePath = null if (elem._parent) { packagePath = elem._parent.getPath(this.baseModel).map(function (e) { return e.name }).join('.') @@ -272,11 +346,11 @@ class JavaCodeGenerator { * @param {type.Model} elem * @param {Object} options */ - writeConstructor (codeWriter, elem, options) { + writeConstructor (codeWriter, elem, options, imports, curPackage) { if (elem.name.length > 0) { var terms = [] // Doc - this.writeDoc(codeWriter, 'Default constructor', options) + this.writeDoc(codeWriter, 'Default constructor', options, imports, curPackage) // Visibility var visibility = this.getVisibility(elem) if (visibility) { @@ -293,19 +367,21 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeMemberVariable (codeWriter, elem, options) { + writeMemberVariable (codeWriter, elem, options, imports, curPackage) { if (elem.name.length > 0) { var terms = [] // doc - this.writeDoc(codeWriter, elem.documentation, options) + this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) // modifiers var _modifiers = this.getModifiers(elem) if (_modifiers.length > 0) { terms.push(_modifiers.join(' ')) } // type - terms.push(this.getType(elem)) + terms.push(this.getType(elem, imports, curPackage)) // name terms.push(elem.name) // initial value @@ -324,8 +400,10 @@ class JavaCodeGenerator { * @param {Object} options * @param {boolean} skipBody * @param {boolean} skipParams + * @param {Set.} imports + * @param {Object} curPackage */ - writeMethod (codeWriter, elem, owner, options, skipBody, skipParams) { + writeMethod (codeWriter, elem, owner, options, skipBody, skipParams, imports, curPackage) { if (elem.name.length > 0) { var terms = [] var params = elem.getNonReturnParameters() @@ -350,7 +428,7 @@ class JavaCodeGenerator { if (returnParam) { doc += '\n@return ' + returnParam.documentation } - this.writeDoc(codeWriter, doc, options) + this.writeDoc(codeWriter, doc, options, imports, curPackage) // modifiers var _modifiers = this.getModifiers(elem) @@ -360,9 +438,9 @@ class JavaCodeGenerator { // type if (returnParam) { - terms.push(this.getType(returnParam)) + terms.push(this.getType(returnParam, imports, curPackage)) } else { - if (elem.name === owner.name){ + if (elem.name === owner.name) { //constructor has no return }else{ terms.push('void') @@ -375,7 +453,7 @@ class JavaCodeGenerator { var len for (i = 0, len = params.length; i < len; i++) { var p = params[i] - var s = this.getType(p) + ' ' + p.name + var s = this.getType(p, imports, curPackage) + ' ' + p.name if (p.isReadOnly === true) { s = 'final ' + s } @@ -394,7 +472,7 @@ class JavaCodeGenerator { // return statement if (returnParam) { - var returnType = this.getType(returnParam) + var returnType = this.getType(returnParam, imports, curPackage) if (returnType === 'boolean') { codeWriter.writeLine('return false;') } else if (returnType === 'int' || returnType === 'long' || returnType === 'short' || returnType === 'byte') { @@ -423,8 +501,10 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeClass (codeWriter, elem, options) { + writeClass (codeWriter, elem, options, imports, curPackage) { var i, len var terms = [] @@ -433,7 +513,7 @@ class JavaCodeGenerator { if (app.project.getProject().author && app.project.getProject().author.length > 0) { doc += '\n@author ' + app.project.getProject().author } - this.writeDoc(codeWriter, doc, options) + this.writeDoc(codeWriter, doc, options, imports, curPackage) // Modifiers var _modifiers = this.getModifiers(elem) @@ -457,20 +537,28 @@ class JavaCodeGenerator { // Implements var _implements = this.getSuperInterfaces(elem) if (_implements.length > 0) { - terms.push('implements ' + _implements.map(function (e) { return e.name }).join(', ')) + terms.push('implements ' + _implements.map( + function (e) { + var _type = e.name + var owner = e._parent + if ((owner instanceof type.UMLClass || owner instanceof type.UMLInterface) && owner.name.length > 0) { + _type = owner.name +'.'+ _type + } + return _type + }).join(', ')) } codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.writeLine() codeWriter.indent() // Constructor - this.writeConstructor(codeWriter, elem, options) + this.writeConstructor(codeWriter, elem, options, imports, curPackage) codeWriter.writeLine() // Member Variables // (from attributes) for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options) + this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) codeWriter.writeLine() } // (from associations) @@ -480,18 +568,18 @@ class JavaCodeGenerator { for (i = 0, len = associations.length; i < len; i++) { var asso = associations[i] if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options) + this.writeMemberVariable(codeWriter, asso.end2, options, imports, curPackage) codeWriter.writeLine() } if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options) + this.writeMemberVariable(codeWriter, asso.end1, options, imports, curPackage) codeWriter.writeLine() } } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false, imports, curPackage) codeWriter.writeLine() } @@ -500,7 +588,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false, imports, curPackage) codeWriter.writeLine() } } @@ -509,7 +597,7 @@ class JavaCodeGenerator { // Interface methods for (var j = 0; j < _implements.length; j++) { for (i = 0, len = _implements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _implements[j].operations[i], _implements[j], options, false, false) + this.writeMethod(codeWriter, _implements[j].operations[i], _implements[j], options, false, false, imports, curPackage) codeWriter.writeLine() } } @@ -519,16 +607,16 @@ class JavaCodeGenerator { var def = elem.ownedElements[i] if (def instanceof type.UMLClass) { if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options) + this.writeAnnotationType(codeWriter, def, options, imports, curPackage) } else { - this.writeClass(codeWriter, def, options) + this.writeClass(codeWriter, def, options, imports, curPackage) } codeWriter.writeLine() } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options) + this.writeInterface(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options) + this.writeEnum(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } } @@ -542,13 +630,15 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeInterface (codeWriter, elem, options) { + writeInterface (codeWriter, elem, options, imports, curPackage) { var i, len var terms = [] // Doc - this.writeDoc(codeWriter, elem.documentation, options) + this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) // Modifiers var visibility = this.getVisibility(elem) @@ -572,7 +662,7 @@ class JavaCodeGenerator { // Member Variables // (from attributes) for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options) + this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) codeWriter.writeLine() } // (from associations) @@ -582,18 +672,18 @@ class JavaCodeGenerator { for (i = 0, len = associations.length; i < len; i++) { var asso = associations[i] if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options) + this.writeMemberVariable(codeWriter, asso.end2, options, imports, curPackage) codeWriter.writeLine() } if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options) + this.writeMemberVariable(codeWriter, asso.end1, options, imports, curPackage) codeWriter.writeLine() } } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false, imports, curPackage) codeWriter.writeLine() } @@ -602,16 +692,16 @@ class JavaCodeGenerator { var def = elem.ownedElements[i] if (def instanceof type.UMLClass) { if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options) + this.writeAnnotationType(codeWriter, def, options, imports, curPackage) } else { - this.writeClass(codeWriter, def, options) + this.writeClass(codeWriter, def, options, imports, curPackage) } codeWriter.writeLine() } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options) + this.writeInterface(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options) + this.writeEnum(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } } @@ -625,12 +715,14 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeEnum (codeWriter, elem, options) { + writeEnum (codeWriter, elem, options, imports, curPackage) { var i, len var terms = [] // Doc - this.writeDoc(codeWriter, elem.documentation, options) + this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) // Modifiers var visibility = this.getVisibility(elem) @@ -658,8 +750,10 @@ class JavaCodeGenerator { * @param {StringWriter} codeWriter * @param {type.Model} elem * @param {Object} options + * @param {Set.} imports + * @param {Object} curPackage */ - writeAnnotationType (codeWriter, elem, options) { + writeAnnotationType (codeWriter, elem, options, imports, curPackage) { var i, len var terms = [] @@ -668,7 +762,7 @@ class JavaCodeGenerator { if (app.project.getProject().author && app.project.getProject().author.length > 0) { doc += '\n@author ' + app.project.getProject().author } - this.writeDoc(codeWriter, doc, options) + this.writeDoc(codeWriter, doc, options, imports, curPackage) // Modifiers var _modifiers = this.getModifiers(elem) @@ -689,13 +783,13 @@ class JavaCodeGenerator { // Member Variables for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options) + this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) codeWriter.writeLine() } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true, imports, curPackage) codeWriter.writeLine() } @@ -705,7 +799,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false) + this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false, imports, curPackage) codeWriter.writeLine() } } @@ -716,16 +810,16 @@ class JavaCodeGenerator { var def = elem.ownedElements[i] if (def instanceof type.UMLClass) { if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options) + this.writeAnnotationType(codeWriter, def, options, imports, curPackage) } else { - this.writeClass(codeWriter, def, options) + this.writeClass(codeWriter, def, options, imports, curPackage) } codeWriter.writeLine() } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options) + this.writeInterface(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options) + this.writeEnum(codeWriter, def, options, imports, curPackage) codeWriter.writeLine() } } @@ -743,7 +837,7 @@ class JavaCodeGenerator { */ function generate (baseModel, basePath, options) { var javaCodeGenerator = new JavaCodeGenerator(baseModel, basePath) - javaCodeGenerator.generate(baseModel, basePath, options) + javaCodeGenerator.generate(baseModel, basePath, options, null) } exports.generate = generate From a239949ea8898894839eb023182fc5c4a62a502c Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Tue, 2 Mar 2021 00:22:29 +0800 Subject: [PATCH 12/18] Fixes --- code-generator.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/code-generator.js b/code-generator.js index ae57ea6..65d32ae 100644 --- a/code-generator.js +++ b/code-generator.js @@ -400,7 +400,6 @@ class JavaCodeGenerator { * @param {Object} options * @param {boolean} skipBody * @param {boolean} skipParams - * @param {type.Model} owner * @param {Set.} imports * @param {Object} curPackage */ @@ -441,11 +440,6 @@ class JavaCodeGenerator { if (returnParam) { terms.push(this.getType(returnParam, imports, curPackage)) } else { - if (elem.name === owner.name){ - //constructor has no return - }else{ - terms.push('void') - } if (elem.name === owner.name) { //constructor has no return }else{ From 4fb98f09242915394ca00082e8fbc4c1c17ee610 Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Tue, 2 Mar 2021 01:19:34 +0800 Subject: [PATCH 13/18] Fixes and improvements --- code-generator.js | 91 ++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/code-generator.js b/code-generator.js index 65d32ae..cfbd193 100644 --- a/code-generator.js +++ b/code-generator.js @@ -25,6 +25,41 @@ const fs = require('fs') const path = require('path') const codegen = require('./codegen-utils') +/** + * Return element's full path including parent's classes or interfaces + * @param {type.Model} elem + * @param {Array.} imports Used to collect import declarations + * @return {string} + */ +function getElemPath (elem, imports, curPackage) { + // find package of elem and whole _type string with parents' decarations + var owner = elem._parent + var _name = elem.name + while (owner instanceof type.UMLClass || owner instanceof type.UMLInterface) { + if (owner.name.length > 0) { + _name = owner.name +'.'+ _name + } else { + _name = '.'+ _name + } + elem = owner + owner = owner._parent + } + + // generate _import as fullpath of owner package + var _fullImport = elem.name + var _import = '' + if (owner != null && owner != curPackage) { + while (owner instanceof type.UMLPackage) { + _import = _fullImport //ignore final root package that would be view point + _fullImport = owner.name + '.' + _fullImport + owner = owner._parent + } + imports.add(_import) + } + + return _name +} + /** * Java Code Generator */ @@ -242,51 +277,25 @@ class JavaCodeGenerator { */ getType (elem, imports, curPackage) { var _type = 'void' - var _import = '' - var owner = null - var topType = null + var typeElem = null // type name if (elem instanceof type.UMLAssociationEnd) { if (elem.reference instanceof type.UMLModelElement && elem.reference.name.length > 0) { - _type = elem.reference.name - } - // inner types need to add owner's name as prefix - owner = elem.reference._parent - topType = elem.reference + typeElem = elem.reference + // inner types need add owner's name as prefix + _type = getElemPath(typeElem, imports, curPackage) + } } else { - if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { - _type = elem.type.name + if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { + typeElem = elem.type // inner types need add owner's name as prefix - owner = elem.type._parent - topType = elem.type + _type = getElemPath(typeElem, imports, curPackage) } else if ((typeof elem.type === 'string') && elem.type.length > 0) { _type = elem.type } } - // find package of elem and whole _type string with parents' decarations - while (owner instanceof type.UMLClass || owner instanceof type.UMLInterface) { - if (owner.name.length > 0) { - _type = owner.name +'.'+ _type - } else { - _type = '.'+ _type - } - topType = owner - owner = owner._parent - } - - // generate _import as fullpath of owner package - if (owner != null && owner != curPackage) { - var _fullImport = topType.name - while (owner instanceof type.UMLPackage) { - _import = _fullImport //ignore final root package that would be view point - _fullImport = owner.name + '.' + _fullImport - owner = owner._parent - } - imports.add(_import) - } - // multiplicity if (elem.multiplicity) { if (['0..*', '1..*', '*'].includes(elem.multiplicity.trim())) { @@ -531,21 +540,13 @@ class JavaCodeGenerator { // Extends var _extends = this.getSuperClasses(elem) if (_extends.length > 0) { - terms.push('extends ' + _extends[0].name) + terms.push('extends ' + getElemPath(_extends[0], imports, curPackage)) } // Implements var _implements = this.getSuperInterfaces(elem) if (_implements.length > 0) { - terms.push('implements ' + _implements.map( - function (e) { - var _type = e.name - var owner = e._parent - if ((owner instanceof type.UMLClass || owner instanceof type.UMLInterface) && owner.name.length > 0) { - _type = owner.name +'.'+ _type - } - return _type - }).join(', ')) + terms.push('implements ' + _implements.map(function (e) {return getElemPath(e, imports, curPackage)}).join(', ')) } codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.writeLine() @@ -653,7 +654,7 @@ class JavaCodeGenerator { // Extends var _extends = this.getSuperClasses(elem) if (_extends.length > 0) { - terms.push('extends ' + _extends.map(function (e) { return e.name }).join(', ')) + terms.push('extends ' + _extends.map(function (e) { return getElemPath(e, imports, curPackage) }).join(', ')) } codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.writeLine() From 94b343e79cc1a06d600516bde29e9c76b9e80c78 Mon Sep 17 00:00:00 2001 From: Wang Yong Date: Tue, 2 Mar 2021 20:44:50 +0800 Subject: [PATCH 14/18] auto write methods in classes for all super interfaces without implemented in super classes; fixes --- code-generator.js | 106 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 86 insertions(+), 20 deletions(-) diff --git a/code-generator.js b/code-generator.js index cfbd193..0604f8f 100644 --- a/code-generator.js +++ b/code-generator.js @@ -136,6 +136,7 @@ class JavaCodeGenerator { imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) } codeWriter.writeLine() + codeWriter.writeLine('import java.io.*;') codeWriter.writeLine('import java.util.*;') codeWriter.writeLine('\n') @@ -154,6 +155,7 @@ class JavaCodeGenerator { imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) } codeWriter.writeLine() + codeWriter.writeLine('import java.io.*;') codeWriter.writeLine('import java.util.*;') codeWriter.writeLine('\n') @@ -174,6 +176,7 @@ class JavaCodeGenerator { imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) } codeWriter.writeLine() + codeWriter.writeLine('import java.io.*;') codeWriter.writeLine('import java.util.*;') codeWriter.writeLine('\n') @@ -263,12 +266,52 @@ class JavaCodeGenerator { * @return {Array.} */ getSuperInterfaces (elem) { - var realizations = app.repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLInterfaceRealization && rel.source === elem) - }) - return realizations.map(function (gen) { return gen.target }) + if (elem instanceof type.UMLClass) { + var realizations = app.repository.getRelationshipsOf(elem, function (rel) { + return (rel instanceof type.UMLInterfaceRealization && rel.source === elem) + }) + return realizations.map(function (gen) { return gen.target }) + } else { + return this.getSuperClasses(elem) + } } + /** + * Collect all super classes to allExtends Array + * @param {type.Model} elem + * @param {Set.} allExtendsSet Used to avoid repeated elements in allExtends array + * @param {Array.} allExtends Used to collect super classes in order + */ + collectExtends (elem, allExtendsSet, allExtends) { + var _exts = this.getSuperClasses(elem) + for (var i = 0; i < _exts.length; i++) { + var _ext = _exts[i] + this.collectExtends(_ext, allExtendsSet, allExtends) + if (!allExtendsSet.has(_ext)) { + allExtendsSet.add(_ext) + allExtends.push(_ext) + } + } + } + + /** + * Collect all super interfaces to allImplements Array + * @param {type.Model} elem + * @param {Set.} allImplementsSet Used to avoid repeated elements in allImplements array + * @param {Array.} allImplements Used to collect super interfaces in order + */ + collectImplements (elem, allImplementsSet, allImplements) { + var _impls = this.getSuperInterfaces(elem) + for (var i = 0; i < _impls.length; i++) { + var _impl = _impls[i] + this.collectImplements(_impl, allImplementsSet, allImplements) + if (!allImplementsSet.has(_impl)) { + allImplementsSet.add(_impl) + allImplements.push(_impl) + } + } + } + /** * Return type expression * @param {type.Model} elem @@ -405,14 +448,15 @@ class JavaCodeGenerator { * Write Method * @param {StringWriter} codeWriter * @param {type.Model} elem - * @param {type.Model} owner + * @param {type.Model} owner Who wants to write this method * @param {Object} options * @param {boolean} skipBody * @param {boolean} skipParams + * @param {boolean} declaredBy Who declared this method * @param {Set.} imports * @param {Object} curPackage */ - writeMethod (codeWriter, elem, owner, options, skipBody, skipParams, imports, curPackage) { + writeMethod (codeWriter, elem, owner, options, skipBody, skipParams, declaredBy, imports, curPackage) { if (elem.name.length > 0) { var terms = [] var params = elem.getNonReturnParameters() @@ -477,8 +521,12 @@ class JavaCodeGenerator { } else { codeWriter.writeLine(terms.join(' ') + ' {') codeWriter.indent() - codeWriter.writeLine('// TODO implement here') - + if (declaredBy === owner) { + codeWriter.writeLine('// TODO implement here') + } else { + codeWriter.writeLine('// TODO implement ' + declaredBy.name + '.' + elem.name + '() here') + } + // return statement if (returnParam) { var returnType = this.getType(returnParam, imports, curPackage) @@ -580,25 +628,43 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false, imports, curPackage) + this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false, elem, imports, curPackage) codeWriter.writeLine() } - + // Extends methods if (_extends.length > 0) { for (i = 0, len = _extends[0].operations.length; i < len; i++) { - _modifiers = this.getModifiers(_extends[0].operations[i]) - if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false, imports, curPackage) + var _modifiers2 = this.getModifiers(_extends[0].operations[i]) + if (_modifiers2.includes('abstract') === true) { + this.writeMethod(codeWriter, _extends[0].operations[i], elem, options, false, false, _extends[0], imports, curPackage) codeWriter.writeLine() } } } - // Interface methods - for (var j = 0; j < _implements.length; j++) { - for (i = 0, len = _implements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _implements[j].operations[i], _implements[j], options, false, false, imports, curPackage) + // Interface methods including all super interfaces + var _allExtendsSet = new Set() + var _allExtends = new Array() + this.collectExtends(elem, _allExtendsSet, _allExtends) + + // collect methods implemented by all extends to _allImplementsSet to be ignored when writeLine + var _allImplementsSet = new Set() + var _allImplements = new Array() + if (_allExtends.length > 0) { + for (i = 0, len = _allExtends.length; i < len; i++) { + this.collectImplements(_allExtends[i], _allImplementsSet, _allImplements) + } + } + + // collect valid super interfaces + _allImplements.splice(0,_allImplements.length) + this.collectImplements(elem, _allImplementsSet, _allImplements) + + // write methods in valid super interfaces + for (var j = 0; j < _allImplements.length; j++) { + for (i = 0, len = _allImplements[j].operations.length; i < len; i++) { + this.writeMethod(codeWriter, _allImplements[j].operations[i], elem, options, false, false, _allImplements[j], imports, curPackage) codeWriter.writeLine() } } @@ -684,7 +750,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false, imports, curPackage) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false, elem, imports, curPackage) codeWriter.writeLine() } @@ -790,7 +856,7 @@ class JavaCodeGenerator { // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true, imports, curPackage) + this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true, elem, imports, curPackage) codeWriter.writeLine() } @@ -800,7 +866,7 @@ class JavaCodeGenerator { for (i = 0, len = _extends[0].operations.length; i < len; i++) { _modifiers = this.getModifiers(_extends[0].operations[i]) if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], _extends[0], options, false, false, imports, curPackage) + this.writeMethod(codeWriter, _extends[0].operations[i], elem, options, false, false, _extends[0], imports, curPackage) codeWriter.writeLine() } } From 86e598105310287a09be63ee6dee24390b1a32fa Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Mon, 28 Mar 2022 15:22:24 +0900 Subject: [PATCH 15/18] Update model files to recent .MDJ format --- README.md | 216 +- package.json | 6 +- unittest-files/generate/CodeGenTestModel.mdj | 4950 +++++++++++++++++ unittest-files/generate/CodeGenTestModel.umlj | 1 - 4 files changed, 5059 insertions(+), 114 deletions(-) create mode 100644 unittest-files/generate/CodeGenTestModel.mdj delete mode 100644 unittest-files/generate/CodeGenTestModel.umlj diff --git a/README.md b/README.md index 592833f..b4c0f28 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,14 @@ -Java Extension for StarUML -========================== +# Java Extension for StarUML This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. -> __Note__ +> :warning: **Note** > This extensions do not provide perfect reverse engineering which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools. -> __Note__ +> :warning: **Note** > This extension is based on Java 1.7 Specification. -Java Code Generation --------------------- +## Java Code Generation 1. Click the menu (`Tools > Java > Generate Code...`) 2. Select a base model (or package) that will be generated to Java. @@ -20,79 +18,77 @@ Belows are the rules to convert from UML model elements to Java source codes. ### UMLPackage -* converted to _Java Package_ (as a folder). +- converted to _Java Package_ (as a folder). ### UMLClass -* converted to _Java Class_. (as a separate `.java` file) -* `visibility` to one of modifiers `public`, `protected`, `private` and none. -* `isAbstract` property to `abstract` modifier. -* `isFinalSpecialization` and `isLeaf` property to `final` modifier. -* Default constructor is generated. -* All contained types (_UMLClass_, _UMLInterface_, _UMLEnumeration_) are generated as inner type definition. -* Documentation property to JavaDoc comment. +- converted to _Java Class_. (as a separate `.java` file) +- `visibility` to one of modifiers `public`, `protected`, `private` and none. +- `isAbstract` property to `abstract` modifier. +- `isFinalSpecialization` and `isLeaf` property to `final` modifier. +- Default constructor is generated. +- All contained types (_UMLClass_, _UMLInterface_, _UMLEnumeration_) are generated as inner type definition. +- Documentation property to JavaDoc comment. ### UMLAttribute -* converted to _Java Field_. -* `visibility` property to one of modifiers `public`, `protected`, `private` and none. -* `name` property to field identifier. -* `type` property to field type. -* `multiplicity` property to array type. -* `isStatic` property to `static` modifier. -* `isLeaf` property to `final` modifier. -* `defaultValue` property to initial value. -* Documentation property to JavaDoc comment. +- converted to _Java Field_. +- `visibility` property to one of modifiers `public`, `protected`, `private` and none. +- `name` property to field identifier. +- `type` property to field type. +- `multiplicity` property to array type. +- `isStatic` property to `static` modifier. +- `isLeaf` property to `final` modifier. +- `defaultValue` property to initial value. +- Documentation property to JavaDoc comment. ### UMLOperation -* converted to _Java Methods_. -* `visibility` property to one of modifiers `public`, `protected`, `private` and none. -* `name` property to method identifier. -* `isAbstract` property to `abstract` modifier. -* `isStatic` property to `static` modifier. -* _UMLParameter_ to _Java Method Parameters_. -* _UMLParameter_'s name property to parameter identifier. -* _UMLParameter_'s type property to type of parameter. -* _UMLParameter_ with `direction` = `return` to return type of method. When no return parameter, `void` is used. -* _UMLParameter_ with `isReadOnly` = `true` to `final` modifier of parameter. -* Documentation property to JavaDoc comment. +- converted to _Java Methods_. +- `visibility` property to one of modifiers `public`, `protected`, `private` and none. +- `name` property to method identifier. +- `isAbstract` property to `abstract` modifier. +- `isStatic` property to `static` modifier. +- _UMLParameter_ to _Java Method Parameters_. +- _UMLParameter_'s name property to parameter identifier. +- _UMLParameter_'s type property to type of parameter. +- _UMLParameter_ with `direction` = `return` to return type of method. When no return parameter, `void` is used. +- _UMLParameter_ with `isReadOnly` = `true` to `final` modifier of parameter. +- Documentation property to JavaDoc comment. ### UMLInterface -* converted to _Java Interface_. (as a separate `.java` file) -* `visibility` property to one of modifiers `public`, `protected`, `private` and none. -* Documentation property to JavaDoc comment. +- converted to _Java Interface_. (as a separate `.java` file) +- `visibility` property to one of modifiers `public`, `protected`, `private` and none. +- Documentation property to JavaDoc comment. ### UMLEnumeration -* converted to _Java Enum_. (as a separate `.java` file) -* `visibility` property to one of modifiers `public`, `protected`, `private` and none. -* _UMLEnumerationLiteral_ to literals of enum. +- converted to _Java Enum_. (as a separate `.java` file) +- `visibility` property to one of modifiers `public`, `protected`, `private` and none. +- _UMLEnumerationLiteral_ to literals of enum. ### UMLAssociationEnd -* converted to _Java Field_. -* `visibility` property to one of modifiers `public`, `protected`, `private` and none. -* `name` property to field identifier. -* `type` property to field type. -* If `multiplicity` is one of `0..*`, `1..*`, `*`, then collection type (`java.util.List<>` when `isOrdered` = `true` or `java.util.Set<>`) is used. -* `defaultValue` property to initial value. -* Documentation property to JavaDoc comment. +- converted to _Java Field_. +- `visibility` property to one of modifiers `public`, `protected`, `private` and none. +- `name` property to field identifier. +- `type` property to field type. +- If `multiplicity` is one of `0..*`, `1..*`, `*`, then collection type (`java.util.List<>` when `isOrdered` = `true` or `java.util.Set<>`) is used. +- `defaultValue` property to initial value. +- Documentation property to JavaDoc comment. ### UMLGeneralization -* converted to _Java Extends_ (`extends`). -* Allowed only for _UMLClass_ to _UMLClass_, and _UMLInterface_ to _UMLInterface_. +- converted to _Java Extends_ (`extends`). +- Allowed only for _UMLClass_ to _UMLClass_, and _UMLInterface_ to _UMLInterface_. ### UMLInterfaceRealization -* converted to _Java Implements_ (`implements`). -* Allowed only for _UMLClass_ to _UMLInterface_. +- converted to _Java Implements_ (`implements`). +- Allowed only for _UMLClass_ to _UMLInterface_. - -Java Reverse Engineering ------------------------- +## Java Reverse Engineering 1. Click the menu (`Tools > Java > Reverse Code...`) 2. Select a folder containing Java source files to be converted to UML model elements. @@ -102,88 +98,86 @@ Belows are the rules to convert from Java source code to UML model elements. ### Java Package -* converted to _UMLPackage_. +- converted to _UMLPackage_. ### Java Class -* converted to _UMLClass_. -* Class name to `name` property. -* Type parameters to _UMLTemplateParameter_. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* `abstract` modifier to `isAbstract` property. -* `final` modifier to `isLeaf` property. -* Constructors to _UMLOperation_ with stereotype `<>`. -* All contained types (_UMLClass_, _UMLInterface_, _UMLEnumeration_) are generated as inner type definition. -* JavaDoc comment to Documentation. - +- converted to _UMLClass_. +- Class name to `name` property. +- Type parameters to _UMLTemplateParameter_. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- `abstract` modifier to `isAbstract` property. +- `final` modifier to `isLeaf` property. +- Constructors to _UMLOperation_ with stereotype `<>`. +- All contained types (_UMLClass_, _UMLInterface_, _UMLEnumeration_) are generated as inner type definition. +- JavaDoc comment to Documentation. ### Java Field (to UMLAttribute) -* converted to _UMLAttribute_ if __"Use Association"__ is __off__ in Preferences. -* Field type to `type` property. +- converted to _UMLAttribute_ if **"Use Association"** is **off** in Preferences. +- Field type to `type` property. - * Primitive Types : `type` property has the primitive type name as string. - * `T[]`(array), `java.util.List`, `java.util.Set` or its decendants: `type` property refers to `T` with multiplicity `*`. - * `T` (User-Defined Types) : `type` property refers to the `T` type. - * Otherwise : `type` property has the type name as string. + - Primitive Types : `type` property has the primitive type name as string. + - `T[]`(array), `java.util.List`, `java.util.Set` or its decendants: `type` property refers to `T` with multiplicity `*`. + - `T` (User-Defined Types) : `type` property refers to the `T` type. + - Otherwise : `type` property has the type name as string. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* `static` modifier to `isStatic` property. -* `final` modifier to `isLeaf` and `isReadOnly` property. -* `transient` modifier to a Tag with `name="transient"` and `checked=true` . -* `volatile` modifier to a Tag with `name="volatile"` and `checked=true`. -* Initial value to `defaultValue` property. -* JavaDoc comment to Documentation. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- `static` modifier to `isStatic` property. +- `final` modifier to `isLeaf` and `isReadOnly` property. +- `transient` modifier to a Tag with `name="transient"` and `checked=true` . +- `volatile` modifier to a Tag with `name="volatile"` and `checked=true`. +- Initial value to `defaultValue` property. +- JavaDoc comment to Documentation. ### Java Field (to UMLAssociation) -* converted to (Directed) _UMLAssociation_ if __"Use Association"__ is __on__ in Preferences and there is a UML type element (_UMLClass_, _UMLInterface_, or _UMLEnumeration_) correspond to the field type. -* Field type to `end2.reference` property. +- converted to (Directed) _UMLAssociation_ if **"Use Association"** is **on** in Preferences and there is a UML type element (_UMLClass_, _UMLInterface_, or _UMLEnumeration_) correspond to the field type. +- Field type to `end2.reference` property. - * `T[]`(array), `java.util.List`, `java.util.Set` or its decendants: `reference` property refers to `T` with multiplicity `*`. - * `T` (User-Defined Types) : `reference` property refers to the `T` type. - * Otherwise : converted to _UMLAttribute_, not _UMLAssociation_. + - `T[]`(array), `java.util.List`, `java.util.Set` or its decendants: `reference` property refers to `T` with multiplicity `*`. + - `T` (User-Defined Types) : `reference` property refers to the `T` type. + - Otherwise : converted to _UMLAttribute_, not _UMLAssociation_. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* JavaDoc comment to Documentation. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- JavaDoc comment to Documentation. ### Java Method -* converted to _UMLOperation_. -* Type parameters to _UMLTemplateParameter_. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* `static` modifier to `isStatic` property. -* `abstract` modifier to `isAbstract` property. -* `final` modifier to `isLeaf` property. -* `synchronized` modifier to `concurrency="concurrent"` property. -* `native` modifier to a Tag with `name="native"` and `checked=true`. -* `strictfp` modifier to a Tag with `name="strictfp"` and `checked=true`. -* `throws` clauses to `raisedExceptions` property. -* JavaDoc comment to Documentation. +- converted to _UMLOperation_. +- Type parameters to _UMLTemplateParameter_. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- `static` modifier to `isStatic` property. +- `abstract` modifier to `isAbstract` property. +- `final` modifier to `isLeaf` property. +- `synchronized` modifier to `concurrency="concurrent"` property. +- `native` modifier to a Tag with `name="native"` and `checked=true`. +- `strictfp` modifier to a Tag with `name="strictfp"` and `checked=true`. +- `throws` clauses to `raisedExceptions` property. +- JavaDoc comment to Documentation. ### Java Interface -* converted to _UMLInterface_. -* Class name to `name` property. -* Type parameters to _UMLTemplateParameter_. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* JavaDoc comment to Documentation. +- converted to _UMLInterface_. +- Class name to `name` property. +- Type parameters to _UMLTemplateParameter_. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- JavaDoc comment to Documentation. ### Java Enum -* converted to _UMLEnumeration_. -* Enum name to `name` property. -* Type parameters to _UMLTemplateParameter_. -* Access modifier `public`, `protected` and `private` to `visibility` property. -* Enum constants are converted to _UMLEnumerationLiteral_. -* JavaDoc comment to Documentation. +- converted to _UMLEnumeration_. +- Enum name to `name` property. +- Type parameters to _UMLTemplateParameter_. +- Access modifier `public`, `protected` and `private` to `visibility` property. +- Enum constants are converted to _UMLEnumerationLiteral_. +- JavaDoc comment to Documentation. ### Java AnnotationType -* converted to _UMLClass_ with stereotype `<>`. -* Annotation type elements to _UMLOperation_. (Default value to a Tag with `name="default"`). -* JavaDoc comment to Documentation. - +- converted to _UMLClass_ with stereotype `<>`. +- Annotation type elements to _UMLOperation_. (Default value to a Tag with `name="default"`). +- JavaDoc comment to Documentation. --- diff --git a/package.json b/package.json index df9d279..a04e85a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "Java code generation and reverse engineering.", "homepage": "https://github.com/staruml/staruml-java", "issues": "https://github.com/staruml/staruml-java/issues", - "keywords": ["java"], + "keywords": [ + "java" + ], "version": "0.9.5", "author": { "name": "Minkyu Lee", @@ -13,6 +15,6 @@ }, "license": "MIT", "engines": { - "staruml": "^3.0.0" + "staruml": ">=3.0.0" } } diff --git a/unittest-files/generate/CodeGenTestModel.mdj b/unittest-files/generate/CodeGenTestModel.mdj new file mode 100644 index 0000000..8308eea --- /dev/null +++ b/unittest-files/generate/CodeGenTestModel.mdj @@ -0,0 +1,4950 @@ +{ + "_type": "Project", + "_id": "AAAAAAFF8HrPHGxHVqE=", + "name": "Untitled", + "ownedElements": [ + { + "_type": "UMLModel", + "_id": "AAAAAAFF8Hrm9GxIk8w=", + "_parent": { + "$ref": "AAAAAAFF8HrPHGxHVqE=" + }, + "name": "JavaCodeModel", + "ownedElements": [ + { + "_type": "UMLClassDiagram", + "_id": "AAAAAAFF8HsXlGxNhmc=", + "_parent": { + "$ref": "AAAAAAFF8Hrm9GxIk8w=" + }, + "name": "PackageStructure", + "defaultDiagram": true, + "ownedViews": [ + { + "_type": "UMLPackageView", + "_id": "AAAAAAFF8HsuDGxRmz4=", + "_parent": { + "$ref": "AAAAAAFF8HsXlGxNhmc=" + }, + "model": { + "$ref": "AAAAAAFF8HsuDGxQIN8=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8HsuDGxSIpc=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxRmz4=" + }, + "model": { + "$ref": "AAAAAAFF8HsuDGxQIN8=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8HsuDGxTvG8=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxSIpc=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HsuDGxUcVI=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxSIpc=" + }, + "font": "Arial;12;1", + "left": 85, + "top": 74, + "width": 90, + "height": 12, + "text": "com" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HsuDGxVops=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxSIpc=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 125, + "height": 12, + "text": "(from JavaCodeModel)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HsuDGxWXQQ=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxSIpc=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 80, + "top": 67, + "width": 100, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8HsuDGxTvG8=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8HsuDGxUcVI=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8HsuDGxVops=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8HsuDGxWXQQ=" + } + } + ], + "font": "Arial;12;0", + "left": 80, + "top": 52, + "width": 100, + "height": 72, + "nameCompartment": { + "$ref": "AAAAAAFF8HsuDGxSIpc=" + } + }, + { + "_type": "UMLPackageView", + "_id": "AAAAAAFF8HtFoGxrp0M=", + "_parent": { + "$ref": "AAAAAAFF8HsXlGxNhmc=" + }, + "model": { + "$ref": "AAAAAAFF8HtFoGxq9o8=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8HtFoGxsB7E=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxrp0M=" + }, + "model": { + "$ref": "AAAAAAFF8HtFoGxq9o8=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8HtFoGxta2k=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxsB7E=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HtFoGxughg=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxsB7E=" + }, + "font": "Arial;12;1", + "left": 81, + "top": 190, + "width": 91, + "height": 12, + "text": "company" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HtFoGxvqRI=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxsB7E=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 112, + "height": 12, + "text": "(from com)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8HtFoGxw2/U=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxsB7E=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 76, + "top": 183, + "width": 101, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8HtFoGxta2k=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8HtFoGxughg=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8HtFoGxvqRI=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8HtFoGxw2/U=" + } + } + ], + "font": "Arial;12;0", + "left": 76, + "top": 168, + "width": 101, + "height": 65, + "nameCompartment": { + "$ref": "AAAAAAFF8HtFoGxsB7E=" + } + }, + { + "_type": "UMLPackageView", + "_id": "AAAAAAFF8Hu5LWyG/DY=", + "_parent": { + "$ref": "AAAAAAFF8HsXlGxNhmc=" + }, + "model": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "subViews": [ + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8Hu5LWyHufc=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyG/DY=" + }, + "model": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8Hu5LWyIrBI=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyHufc=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Hu5LWyJeZ4=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyHufc=" + }, + "font": "Arial;12;1", + "left": 81, + "top": 306, + "width": 94, + "height": 12, + "text": "package1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Hu5LWyKuVY=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyHufc=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 112, + "height": 12, + "text": "(from company)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Hu5LWyLAww=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyHufc=" + }, + "visible": false, + "font": "Arial;12;0", + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 76, + "top": 299, + "width": 104, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8Hu5LWyIrBI=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8Hu5LWyJeZ4=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8Hu5LWyKuVY=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8Hu5LWyLAww=" + } + } + ], + "font": "Arial;12;0", + "left": 76, + "top": 284, + "width": 104, + "height": 68, + "nameCompartment": { + "$ref": "AAAAAAFF8Hu5LWyHufc=" + } + }, + { + "_type": "UMLContainmentView", + "_id": "AAAAAAFF8HvI02yftU0=", + "_parent": { + "$ref": "AAAAAAFF8HsXlGxNhmc=" + }, + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8HtFoGxrp0M=" + }, + "tail": { + "$ref": "AAAAAAFF8Hu5LWyG/DY=" + }, + "points": "126:284;126:232" + }, + { + "_type": "UMLContainmentView", + "_id": "AAAAAAFF8HvMTmyjwcc=", + "_parent": { + "$ref": "AAAAAAFF8HsXlGxNhmc=" + }, + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8HsuDGxRmz4=" + }, + "tail": { + "$ref": "AAAAAAFF8HtFoGxrp0M=" + }, + "points": "128:168;128:123" + } + ] + }, + { + "_type": "UMLPackage", + "_id": "AAAAAAFF8HsuDGxQIN8=", + "_parent": { + "$ref": "AAAAAAFF8Hrm9GxIk8w=" + }, + "name": "com", + "ownedElements": [ + { + "_type": "UMLPackage", + "_id": "AAAAAAFF8HtFoGxq9o8=", + "_parent": { + "$ref": "AAAAAAFF8HsuDGxQIN8=" + }, + "name": "company", + "ownedElements": [ + { + "_type": "UMLPackage", + "_id": "AAAAAAFF8Hu5LWyFBNo=", + "_parent": { + "$ref": "AAAAAAFF8HtFoGxq9o8=" + }, + "name": "package1", + "ownedElements": [ + { + "_type": "UMLClassDiagram", + "_id": "AAAAAAFF8IYa8WzeRC4=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Main", + "defaultDiagram": true, + "ownedViews": [ + { + "_type": "UMLClassView", + "_id": "AAAAAAFF8IY3RWzjX4w=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgIGBeYsE=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8IY3RWzkwcc=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8IY3RWzlwoM=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzkwcc=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -204, + "top": -84, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IY3RWzmzDo=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzkwcc=" + }, + "font": "Arial;12;1", + "left": 33, + "top": 39, + "width": 268, + "height": 12, + "text": "Class1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IY3RWznKes=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzkwcc=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -204, + "top": -84, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IY3RWzoAJs=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzkwcc=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 33, + "top": 53, + "width": 268, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 28, + "top": 32, + "width": 278, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IY3RWzlwoM=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8IY3RWzmzDo=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8IY3RWznKes=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IY3RWzoAJs=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF8IY3RWzpMZI=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "subViews": [ + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+W+30Th96uU=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+W+3yDh6/CA=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 61, + "width": 268, + "height": 12, + "text": "+Attribute1: String = \"DEFAULT_STRING\"", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+ZjW1VGKQ2E=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+ZjWz1GHi1w=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 75, + "width": 268, + "height": 12, + "underline": true, + "text": "+StaticVariable: Collection", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+bhoZiI5T8s=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+bhoXyI2PkY=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 89, + "width": 268, + "height": 12, + "text": "+IntArray: Integer[100]", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+bky5yL8L7o=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+bky4SL5r4M=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 103, + "width": 268, + "height": 12, + "text": "+StringList: String[0..*]", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+b8kUYbaWuo=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+b8kSobXncI=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 117, + "width": 268, + "height": 12, + "underline": true, + "text": "+StaticFinalVar: Boolean = false", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+8R/58XXqYE=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+8R/4sXUSCo=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 131, + "width": 268, + "height": 12, + "text": "-PrivateAttribute: Object", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+8TKUsYzgTk=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "model": { + "$ref": "AAAAAAFF+8TKTMYwPH4=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 145, + "width": 268, + "height": 12, + "text": "#ProtectedAttribute: String", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 28, + "top": 56, + "width": 278, + "height": 106 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF8IY3RWzqfAY=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFF+XErCjiEfok=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzqfAY=" + }, + "model": { + "$ref": "AAAAAAFF+XErBjiBsWU=" + }, + "font": "Arial;12;0", + "left": 33, + "top": 167, + "width": 268, + "height": 12, + "text": "+Operation1(Arg1: Integer, Arg2: String): Boolean", + "horizontalAlignment": 0 + }, + { + "_type": "UMLOperationView", + "_id": "AAAAAAFF+8QlXMV7xDA=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzqfAY=" + }, + "model": { + "$ref": "AAAAAAFF+8QlVMV4Go4=" + }, + "font": "Arial;12;2", + "left": 33, + "top": 181, + "width": 268, + "height": 12, + "text": "+AbstractOperation()", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 28, + "top": 162, + "width": 278, + "height": 36 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF8IY3RmzrZEM=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "model": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -136, + "top": -56, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 28, + "top": 32, + "width": 278, + "height": 166, + "nameCompartment": { + "$ref": "AAAAAAFF8IY3RWzkwcc=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF8IY3RWzpMZI=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF8IY3RWzqfAY=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgIGBeYsE=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF8IY3RmzrZEM=" + } + }, + { + "_type": "UMLInterfaceView", + "_id": "AAAAAAFF8IZDVW0Ip/o=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgImB9sv4=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8IZDVW0Jm48=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8IZDVW0KPVk=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Jm48=" + }, + "font": "Arial;12;0", + "left": 337, + "top": 37, + "width": 255, + "height": 12, + "text": "«interface»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IZDVW0LB0A=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Jm48=" + }, + "font": "Arial;12;1", + "left": 337, + "top": 51, + "width": 255, + "height": 12, + "text": "Interface1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IZDVW0MWtU=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Jm48=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 324, + "top": -84, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IZDVW0Ne3I=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Jm48=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 324, + "top": -84, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 332, + "top": 32, + "width": 265, + "height": 36, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IZDVW0KPVk=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8IZDVW0LB0A=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8IZDVW0MWtU=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IZDVW0Ne3I=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF8IZDVW0OeTw=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "subViews": [ + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+8MSrcOh/Pg=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0OeTw=" + }, + "model": { + "$ref": "AAAAAAFF+8MSo8OeeCM=" + }, + "font": "Arial;12;0", + "left": 337, + "top": 73, + "width": 255, + "height": 12, + "text": "+Attribute1: int = 100", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 332, + "top": 68, + "width": 265, + "height": 22 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF8IZDVW0Pw7Y=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFF+8NnW8QPXa4=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Pw7Y=" + }, + "model": { + "$ref": "AAAAAAFF+8NnU8QMHKM=" + }, + "font": "Arial;12;0", + "left": 337, + "top": 95, + "width": 255, + "height": 12, + "text": "+Operation2(arg1: String, arg2: Integer): Object", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 332, + "top": 90, + "width": 265, + "height": 22 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF8IZDVW0QYys=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "model": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 216, + "top": -56, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 332, + "top": 32, + "width": 265, + "height": 80, + "nameCompartment": { + "$ref": "AAAAAAFF8IZDVW0Jm48=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF8IZDVW0OeTw=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF8IZDVW0Pw7Y=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgImB9sv4=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF8IZDVW0QYys=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFF8IaVw20w1ck=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgI2CVT4A=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8IaVw20xqzs=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8IaVw20yoMA=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20xqzs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 480, + "top": 300, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IaVw20z3q0=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20xqzs=" + }, + "font": "Arial;12;3", + "left": 217, + "top": 307, + "width": 90, + "height": 12, + "text": "AbstractClass1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IaVw2008T4=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20xqzs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 480, + "top": 300, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IaVw201HsE=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20xqzs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 480, + "top": 300, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 212, + "top": 300, + "width": 100, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IaVw20yoMA=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8IaVw20z3q0=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8IaVw2008T4=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IaVw201HsE=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF8IaVw2029Hs=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "font": "Arial;12;0", + "left": 212, + "top": 324, + "width": 100, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF8IaVw203wM4=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "font": "Arial;12;0", + "left": 212, + "top": 334, + "width": 100, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF8IaVw204JXk=", + "_parent": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "model": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 320, + "top": 200, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 212, + "top": 300, + "width": 100, + "height": 69, + "nameCompartment": { + "$ref": "AAAAAAFF8IaVw20xqzs=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF8IaVw2029Hs=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF8IaVw203wM4=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgI2CVT4A=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF8IaVw204JXk=" + } + }, + { + "_type": "UMLGeneralizationView", + "_id": "AAAAAAFF8IahYm1Vqw0=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IahYm1UT3g=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IahYm1WhCs=", + "_parent": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "model": { + "$ref": "AAAAAAFF8IahYm1UT3g=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 169, + "top": 327, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IahYm1XjU8=", + "_parent": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "model": { + "$ref": "AAAAAAFF8IahYm1UT3g=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 154, + "top": 327, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IahYm1Y+0Y=", + "_parent": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "model": { + "$ref": "AAAAAAFF8IahYm1UT3g=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 199, + "top": 328, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IahYm1Vqw0=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "tail": { + "$ref": "AAAAAAFF8IaVw20w1ck=" + }, + "points": "212:334;184:334;184:197", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF8IahYm1WhCs=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IahYm1XjU8=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IahYm1Y+0Y=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFF8IcE0G1og04=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgJGCy/gg=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8IcE0G1p+3c=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8IcE0G1qeCs=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1p+3c=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 360, + "top": 24, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IcE0G1rIi8=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1p+3c=" + }, + "font": "Arial;12;1", + "left": 345, + "top": 215, + "width": 255, + "height": 12, + "text": "Collection" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IcE0G1s+qM=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1p+3c=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 360, + "top": 24, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8IcE0G1tjlI=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1p+3c=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 360, + "top": 24, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 340, + "top": 208, + "width": 265, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IcE0G1qeCs=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8IcE0G1rIi8=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8IcE0G1s+qM=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IcE0G1tjlI=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF8IcE0G1uiPo=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "font": "Arial;12;0", + "left": 340, + "top": 232, + "width": 265, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF8IcE0G1vMfU=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFHs+jwV2ELlX0=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1vMfU=" + }, + "model": { + "$ref": "AAAAAAFHs+jwTmEIu5k=" + }, + "font": "Arial;12;0", + "left": 345, + "top": 247, + "width": 255, + "height": 12, + "text": "+AbstractOperation()", + "horizontalAlignment": 0 + }, + { + "_type": "UMLOperationView", + "_id": "AAAAAAFHs/KdQGG2FVA=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1vMfU=" + }, + "model": { + "$ref": "AAAAAAFHs/KdOWGzDSY=" + }, + "font": "Arial;12;0", + "left": 345, + "top": 261, + "width": 255, + "height": 12, + "text": "+Operation2(arg1: String, arg2: Integer): Object", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 340, + "top": 242, + "width": 265, + "height": 36 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF8IcE0W1wBwc=", + "_parent": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "model": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 240, + "top": 16, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 340, + "top": 208, + "width": 265, + "height": 80, + "nameCompartment": { + "$ref": "AAAAAAFF8IcE0G1p+3c=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF8IcE0G1uiPo=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF8IcE0G1vMfU=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgJGCy/gg=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF8IcE0W1wBwc=" + } + }, + { + "_type": "UMLGeneralizationView", + "_id": "AAAAAAFF8IcWOm2OleM=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IcWOm2NEHU=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IcWOm2PIOk=", + "_parent": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "model": { + "$ref": "AAAAAAFF8IcWOm2NEHU=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 241, + "top": 240, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IcWOm2QHWU=", + "_parent": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "model": { + "$ref": "AAAAAAFF8IcWOm2NEHU=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 226, + "top": 240, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IcWOm2RoLA=", + "_parent": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "model": { + "$ref": "AAAAAAFF8IcWOm2NEHU=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 270, + "top": 241, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IcWOm2OleM=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "tail": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "points": "340:247;256:247;256:197", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF8IcWOm2PIOk=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IcWOm2QHWU=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IcWOm2RoLA=" + } + }, + { + "_type": "UMLInterfaceRealizationView", + "_id": "AAAAAAFF8Ichh22fXWM=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8Ichh22ebss=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8Ichh22gkrc=", + "_parent": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "model": { + "$ref": "AAAAAAFF8Ichh22ebss=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 451, + "top": 152, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8Ichh22hmSg=", + "_parent": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "model": { + "$ref": "AAAAAAFF8Ichh22ebss=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 436, + "top": 152, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8Ichh22igbI=", + "_parent": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "model": { + "$ref": "AAAAAAFF8Ichh22ebss=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 480, + "top": 153, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8Ichh22fXWM=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8IZDVW0Ip/o=" + }, + "tail": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "points": "466:208;466:111", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF8Ichh22gkrc=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF8Ichh22hmSg=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8Ichh22igbI=" + } + }, + { + "_type": "UMLInterfaceView", + "_id": "AAAAAAFF8Icylm2wJuo=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgJWDYy18=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "visible": false, + "font": "Arial;12;0", + "top": -4, + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF8Icyl22xnPM=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF8Icyl22yVhc=", + "_parent": { + "$ref": "AAAAAAFF8Icyl22xnPM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 900, + "top": 520, + "width": 65.20793151855469, + "height": 12, + "text": "«interface»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Icyl22zA34=", + "_parent": { + "$ref": "AAAAAAFF8Icyl22xnPM=" + }, + "font": "Arial;12;1", + "left": 657, + "top": 274, + "width": 73, + "height": 12, + "text": "SubInterface" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Icyl220bpo=", + "_parent": { + "$ref": "AAAAAAFF8Icyl22xnPM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 900, + "top": 520, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF8Icyl221ZYI=", + "_parent": { + "$ref": "AAAAAAFF8Icyl22xnPM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 900, + "top": 520, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 652, + "top": 267, + "width": 83, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF8Icyl22yVhc=" + }, + "nameLabel": { + "$ref": "AAAAAAFF8Icyl22zA34=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF8Icyl220bpo=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8Icyl221ZYI=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF8Icyl222sKU=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 600, + "top": 348, + "width": 10, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF8Icyl223O/o=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 600, + "top": 348, + "width": 10, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF8Icyl224+Zs=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "model": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 600, + "top": 348, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 652, + "top": 232, + "width": 83, + "height": 60, + "stereotypeDisplay": "icon", + "nameCompartment": { + "$ref": "AAAAAAFF8Icyl22xnPM=" + }, + "suppressAttributes": true, + "suppressOperations": true, + "attributeCompartment": { + "$ref": "AAAAAAFF8Icyl222sKU=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF8Icyl223O/o=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgJWDYy18=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF8Icyl224+Zs=" + } + }, + { + "_type": "UMLInterfaceRealizationView", + "_id": "AAAAAAFF8IdB5m3Vv2c=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF8IdB5m3UfCk=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IdB5m3W9Vw=", + "_parent": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "model": { + "$ref": "AAAAAAFF8IdB5m3UfCk=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 639, + "top": 228, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IdB5m3XPsc=", + "_parent": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "model": { + "$ref": "AAAAAAFF8IdB5m3UfCk=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 639, + "top": 213, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF8IdB5m3Y93E=", + "_parent": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "model": { + "$ref": "AAAAAAFF8IdB5m3UfCk=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 639, + "top": 258, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF8IdB5m3Vv2c=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "tail": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "points": "604:249;675.5:249", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF8IdB5m3W9Vw=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF8IdB5m3XPsc=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF8IdB5m3Y93E=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFF+ZqVxVGSV0I=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgJmD1I+o=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "visible": false, + "font": "Arial;12;0", + "top": 84, + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+ZqVxlGTvOg=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+ZqVxlGUYIw=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxlGTvOg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 24, + "top": 192, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+ZqVxlGVBIE=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxlGTvOg=" + }, + "font": "Arial;12;1", + "left": 381, + "top": 447, + "width": 87, + "height": 12, + "text": "Item" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+ZqVxlGW0oI=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxlGTvOg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 24, + "top": 192, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+ZqVxlGX7tM=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxlGTvOg=" + }, + "font": "Arial;12;0", + "left": 381, + "top": 461, + "width": 87, + "height": 12, + "text": "{leaf}", + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 376, + "top": 440, + "width": 97, + "height": 38, + "stereotypeLabel": { + "$ref": "AAAAAAFF+ZqVxlGUYIw=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+ZqVxlGVBIE=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+ZqVxlGW0oI=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+ZqVxlGX7tM=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+ZqVxlGYEpQ=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "font": "Arial;12;0", + "left": 376, + "top": 478, + "width": 97, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+ZqVxlGZ28M=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFHyQ8ppi6KE0g=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxlGZ28M=" + }, + "model": { + "$ref": "AAAAAAFHyQ8pni6H6OE=" + }, + "font": "Arial;12;0", + "left": 381, + "top": 493, + "width": 87, + "height": 12, + "text": "+Operation1()", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 376, + "top": 488, + "width": 97, + "height": 22 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+ZqVxlGaEFI=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "model": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 16, + "top": 100, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 376, + "top": 440, + "width": 97, + "height": 70, + "nameCompartment": { + "$ref": "AAAAAAFF+ZqVxlGTvOg=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF+ZqVxlGYEpQ=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+ZqVxlGZ28M=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgJmD1I+o=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+ZqVxlGaEFI=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFF+ZrZgFG9dsg=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVG+ceU=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 443, + "top": 356, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVG/RII=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 428, + "top": 356, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHArXw=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 472, + "top": 357, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHBSAg=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG7W0k=" + }, + "font": "Arial;12;0", + "left": 467, + "top": 422, + "width": 36, + "height": 12, + "alpha": -1.1885894870612226, + "distance": 29.4930708397087, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 2, + "text": "+items" + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHCRA0=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG7W0k=" + }, + "font": "Arial;12;0", + "left": 405, + "top": 405, + "width": 49.376953125, + "height": 12, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 2, + "text": "{ordered}" + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHDc7g=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG7W0k=" + }, + "font": "Arial;12;0", + "left": 467, + "top": 409, + "width": 18.01171875, + "height": 12, + "alpha": -0.6318663649720168, + "distance": 30.774821855549835, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "edgePosition": 2, + "text": "0..*" + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHESKA=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG8sxs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 443, + "top": 306, + "height": 12, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHFa6w=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG8sxs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 429, + "top": 309, + "height": 12, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+ZrZgVHGxaw=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG8sxs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 470, + "top": 302, + "height": 12, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + } + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFF+ZrZgVHHM+g=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG7W0k=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 128, + "width": 10, + "height": 10 + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFF+ZrZgVHIh5U=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG9dsg=" + }, + "model": { + "$ref": "AAAAAAFF+ZrZgFG8sxs=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 128, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "tail": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "points": "458:440;458:287", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF+ZrZgVG+ceU=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF+ZrZgVG/RII=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+ZrZgVHArXw=" + }, + "tailRoleNameLabel": { + "$ref": "AAAAAAFF+ZrZgVHBSAg=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFF+ZrZgVHCRA0=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFF+ZrZgVHDc7g=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFF+ZrZgVHESKA=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFF+ZrZgVHFa6w=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFF+ZrZgVHGxaw=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFF+ZrZgVHHM+g=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFF+ZrZgVHIh5U=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFF+aMrTHWf7X8=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgKWEjaGM=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+aMrTHWgHMM=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+aMrTHWhiqs=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWgHMM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": 24, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+aMrTHWiu4U=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWgHMM=" + }, + "font": "Arial;12;1", + "left": 537, + "top": 363, + "width": 102, + "height": 12, + "text": "NotNavigableItem" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+aMrTHWjYYU=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWgHMM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": 24, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+aMrTHWkuNc=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWgHMM=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": 24, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 532, + "top": 356, + "width": 112, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF+aMrTHWhiqs=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+aMrTHWiu4U=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+aMrTHWjYYU=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+aMrTHWkuNc=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+aMrTHWlyL8=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "font": "Arial;12;0", + "left": 532, + "top": 380, + "width": 112, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+aMrTXWmEdc=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "font": "Arial;12;0", + "left": 532, + "top": 390, + "width": 112, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+aMrTXWnVA8=", + "_parent": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "model": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 112, + "top": 16, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 532, + "top": 356, + "width": 112, + "height": 44, + "nameCompartment": { + "$ref": "AAAAAAFF+aMrTHWgHMM=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF+aMrTHWlyL8=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+aMrTXWmEdc=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgKWEjaGM=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+aMrTXWnVA8=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFF+aNsrnXintA=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXjYyU=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 508, + "top": 356, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXkwE0=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 508, + "top": 341, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXlcCE=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 508, + "top": 386, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXmh0c=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXgbmo=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 523, + "top": 306, + "height": 12, + "alpha": 0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 2 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXnbno=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXgbmo=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 536, + "top": 309, + "height": 12, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 2 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsrnXohhw=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXgbmo=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 495, + "top": 302, + "height": 12, + "alpha": -0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "edgePosition": 2 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsr3XpbyA=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXhVro=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 506, + "top": 356, + "height": 12, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsr3XqdXM=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXhVro=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 503, + "top": 342, + "height": 12, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+aNsr3Xr/TA=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXhVro=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 510, + "top": 383, + "height": 12, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFF+aNsrnXintA=" + } + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFF+aNsr3Xs26c=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXgbmo=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 128, + "width": 10, + "height": 10 + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFF+aNsr3XtGAw=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXintA=" + }, + "model": { + "$ref": "AAAAAAFF+aNsrnXhVro=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 128, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF+aMrTHWf7X8=" + }, + "tail": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "points": "508:287;508:377;532:377", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF+aNsrnXjYyU=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF+aNsrnXkwE0=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+aNsrnXlcCE=" + }, + "tailRoleNameLabel": { + "$ref": "AAAAAAFF+aNsrnXmh0c=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFF+aNsrnXnbno=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFF+aNsrnXohhw=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFF+aNsr3XpbyA=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFF+aNsr3XqdXM=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFF+aNsr3Xr/TA=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFF+aNsr3Xs26c=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFF+aNsr3XtGAw=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFF+hk0VMqUyAs=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgKmFQtbc=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+hk0VMqVPk0=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+hk0VcqW/pc=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqVPk0=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -96, + "top": -24, + "height": 12 + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+hk0VcqXhec=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqVPk0=" + }, + "font": "Arial;12;1", + "left": 41, + "top": 307, + "width": 114, + "height": 12, + "text": "InnerClass" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+hk0VcqYmrI=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqVPk0=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -96, + "top": -24, + "width": 81, + "height": 12, + "text": "(from Class1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+hk0VcqZ3Hw=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqVPk0=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -96, + "top": -24, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 36, + "top": 300, + "width": 124, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF+hk0VcqW/pc=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+hk0VcqXhec=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+hk0VcqYmrI=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+hk0VcqZ3Hw=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+hk0VcqaSEU=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "subViews": [ + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFF+hl2assn4XI=", + "_parent": { + "$ref": "AAAAAAFF+hk0VcqaSEU=" + }, + "model": { + "$ref": "AAAAAAFF+hl2YMseKZ0=" + }, + "font": "Arial;12;0", + "left": 41, + "top": 329, + "width": 114, + "height": 12, + "text": "+Attribute1: String", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 36, + "top": 324, + "width": 124, + "height": 22 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+hk0VcqbTRo=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFF+hmWf8tMCys=", + "_parent": { + "$ref": "AAAAAAFF+hk0VcqbTRo=" + }, + "model": { + "$ref": "AAAAAAFF+hmWdMtDXYk=" + }, + "font": "Arial;12;0", + "left": 41, + "top": 351, + "width": 114, + "height": 12, + "text": "+Operation1(): String", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 36, + "top": 346, + "width": 124, + "height": 22 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+hk0VsqcI34=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "model": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -64, + "top": -16, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 36, + "top": 300, + "width": 124, + "height": 68, + "nameCompartment": { + "$ref": "AAAAAAFF+hk0VMqVPk0=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFF+hk0VcqaSEU=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+hk0VcqbTRo=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgKmFQtbc=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+hk0VsqcI34=" + } + }, + { + "_type": "UMLContainmentView", + "_id": "AAAAAAFF+hlfIsr2ydg=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF8IY3RWzjX4w=" + }, + "tail": { + "$ref": "AAAAAAFF+hk0VMqUyAs=" + }, + "points": "104:300;104:197" + }, + { + "_type": "UMLInterfaceView", + "_id": "AAAAAAFF+71lysIF4HE=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgK2Fph6c=", + "_parent": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+71lysIGbPQ=", + "_parent": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+71lysIHvYA=", + "_parent": { + "$ref": "AAAAAAFF+71lysIGbPQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -24, + "top": 240, + "width": 65.20793151855469, + "height": 12, + "text": "«interface»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+71lysIIpIA=", + "_parent": { + "$ref": "AAAAAAFF+71lysIGbPQ=" + }, + "font": "Arial;12;1", + "left": 581, + "top": 178, + "width": 92, + "height": 12, + "text": "SuperInterface1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+71lysIJU80=", + "_parent": { + "$ref": "AAAAAAFF+71lysIGbPQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -24, + "top": 240, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+71lysIKd7I=", + "_parent": { + "$ref": "AAAAAAFF+71lysIGbPQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -24, + "top": 240, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 576, + "top": 171, + "width": 102, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF+71lysIHvYA=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+71lysIIpIA=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+71lysIJU80=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+71lysIKd7I=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+71ly8ILoag=", + "_parent": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -16, + "top": 160, + "width": 10, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+71ly8IMVlo=", + "_parent": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -16, + "top": 160, + "width": 10, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+71ly8INszE=", + "_parent": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "model": { + "$ref": "AAAAAAFF+71lysIEAmg=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -16, + "top": 160, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 576, + "top": 136, + "width": 102, + "height": 60, + "stereotypeDisplay": "icon", + "nameCompartment": { + "$ref": "AAAAAAFF+71lysIGbPQ=" + }, + "suppressAttributes": true, + "suppressOperations": true, + "attributeCompartment": { + "$ref": "AAAAAAFF+71ly8ILoag=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+71ly8IMVlo=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgK2Fph6c=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+71ly8INszE=" + } + }, + { + "_type": "UMLGeneralizationView", + "_id": "AAAAAAFF+72UrMJ1m0s=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+72UrMJ0uuE=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+72UrMJ2phU=", + "_parent": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "model": { + "$ref": "AAAAAAFF+72UrMJ0uuE=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 647, + "top": 215, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+72UrMJ33YE=", + "_parent": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "model": { + "$ref": "AAAAAAFF+72UrMJ0uuE=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 635, + "top": 224, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+72UrMJ4cL8=", + "_parent": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "model": { + "$ref": "AAAAAAFF+72UrMJ0uuE=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 672, + "top": 198, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+72UrMJ1m0s=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF+71lysIF4HE=" + }, + "tail": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "lineStyle": 1, + "points": "672:231;648:196", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF+72UrMJ2phU=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF+72UrMJ33YE=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+72UrMJ4cL8=" + } + }, + { + "_type": "UMLEnumerationView", + "_id": "AAAAAAFF+8W2xMdA0kI=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgLGGGpOA=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+8W2xMdB8Q4=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+8W2xMdCWbc=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdB8Q4=" + }, + "font": "Arial;12;0", + "left": 629, + "top": 37, + "width": 84.76789855957031, + "height": 12, + "text": "«enumeration»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8W2xMdDyL0=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdB8Q4=" + }, + "font": "Arial;12;1", + "left": 629, + "top": 51, + "width": 84.76789855957031, + "height": 12, + "text": "Enumeration1" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8W2xMdEx/c=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdB8Q4=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -84, + "top": -12, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8W2xMdFw74=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdB8Q4=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -84, + "top": -12, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 624, + "top": 32, + "width": 94.76789855957031, + "height": 36, + "stereotypeLabel": { + "$ref": "AAAAAAFF+8W2xMdCWbc=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+8W2xMdDyL0=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+8W2xMdEx/c=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+8W2xMdFw74=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+8W2xMdGSRQ=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -56, + "top": -8, + "width": 10, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+8W2xMdHpGU=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -56, + "top": -8, + "width": 10, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+8W2xcdIz84=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "visible": false, + "font": "Arial;12;0", + "left": -56, + "top": -8, + "width": 10, + "height": 10 + }, + { + "_type": "UMLEnumerationLiteralCompartmentView", + "_id": "AAAAAAFF+8W2xcdJviQ=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMdA0kI=" + }, + "model": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "subViews": [ + { + "_type": "UMLEnumerationLiteralView", + "_id": "AAAAAAFF+8XGiMeJe0w=", + "_parent": { + "$ref": "AAAAAAFF+8W2xcdJviQ=" + }, + "model": { + "$ref": "AAAAAAFF+8XGdMeAM7s=" + }, + "font": "Arial;12;0", + "left": 629, + "top": 73, + "width": 84.76789855957031, + "height": 12, + "text": "Literal1", + "horizontalAlignment": 0 + }, + { + "_type": "UMLEnumerationLiteralView", + "_id": "AAAAAAFF+8XYF8eujtM=", + "_parent": { + "$ref": "AAAAAAFF+8W2xcdJviQ=" + }, + "model": { + "$ref": "AAAAAAFF+8XYCMel55s=" + }, + "font": "Arial;12;0", + "left": 629, + "top": 87, + "width": 84.76789855957031, + "height": 12, + "text": "Literal2", + "horizontalAlignment": 0 + }, + { + "_type": "UMLEnumerationLiteralView", + "_id": "AAAAAAFF+8Xi1MfN2Aw=", + "_parent": { + "$ref": "AAAAAAFF+8W2xcdJviQ=" + }, + "model": { + "$ref": "AAAAAAFF+8XizcfEeH8=" + }, + "font": "Arial;12;0", + "left": 629, + "top": 101, + "width": 84.76789855957031, + "height": 12, + "text": "Literal3", + "horizontalAlignment": 0 + } + ], + "font": "Arial;12;0", + "left": 624, + "top": 68, + "width": 94.76789855957031, + "height": 50 + } + ], + "font": "Arial;12;0", + "left": 624, + "top": 32, + "width": 94.76789855957031, + "height": 86, + "nameCompartment": { + "$ref": "AAAAAAFF+8W2xMdB8Q4=" + }, + "suppressAttributes": true, + "suppressOperations": true, + "attributeCompartment": { + "$ref": "AAAAAAFF+8W2xMdGSRQ=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+8W2xMdHpGU=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgLGGGpOA=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+8W2xcdIz84=" + }, + "enumerationLiteralCompartment": { + "$ref": "AAAAAAFF+8W2xcdJviQ=" + } + }, + { + "_type": "UMLInterfaceView", + "_id": "AAAAAAFF+8gJIOU4Dng=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgLWGhiys=", + "_parent": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "visible": false, + "font": "Arial;12;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFF+8gJIeU5ZaQ=", + "_parent": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFF+8gJIeU6ELo=", + "_parent": { + "$ref": "AAAAAAFF+8gJIeU5ZaQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": -24, + "width": 65.20793151855469, + "height": 12, + "text": "«interface»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8gJIeU75R8=", + "_parent": { + "$ref": "AAAAAAFF+8gJIeU5ZaQ=" + }, + "font": "Arial;12;1", + "left": 697, + "top": 174, + "width": 92, + "height": 12, + "text": "SuperInterface2" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8gJIeU84/Q=", + "_parent": { + "$ref": "AAAAAAFF+8gJIeU5ZaQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": -24, + "width": 89, + "height": 12, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFF+8gJIeU9o10=", + "_parent": { + "$ref": "AAAAAAFF+8gJIeU5ZaQ=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 168, + "top": -24, + "height": 12, + "horizontalAlignment": 1 + } + ], + "font": "Arial;12;0", + "left": 692, + "top": 167, + "width": 102, + "height": 24, + "stereotypeLabel": { + "$ref": "AAAAAAFF+8gJIeU6ELo=" + }, + "nameLabel": { + "$ref": "AAAAAAFF+8gJIeU75R8=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFF+8gJIeU84/Q=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+8gJIeU9o10=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFF+8gJIeU+vls=", + "_parent": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 112, + "top": -16, + "width": 10, + "height": 10 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFF+8gJIuU/Rr0=", + "_parent": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 112, + "top": -16, + "width": 10, + "height": 10 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFF+8gJIuVA1Ho=", + "_parent": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "model": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 112, + "top": -16, + "width": 10, + "height": 10 + } + ], + "font": "Arial;12;0", + "left": 692, + "top": 132, + "width": 102, + "height": 60, + "stereotypeDisplay": "icon", + "nameCompartment": { + "$ref": "AAAAAAFF+8gJIeU5ZaQ=" + }, + "suppressAttributes": true, + "suppressOperations": true, + "attributeCompartment": { + "$ref": "AAAAAAFF+8gJIeU+vls=" + }, + "operationCompartment": { + "$ref": "AAAAAAFF+8gJIuU/Rr0=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgLWGhiys=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFF+8gJIuVA1Ho=" + } + }, + { + "_type": "UMLGeneralizationView", + "_id": "AAAAAAFF+8hGt+YXPb4=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFF+8hGt+YW0i0=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+8hGt+YY5oc=", + "_parent": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "model": { + "$ref": "AAAAAAFF+8hGt+YW0i0=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 703, + "top": 198, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+8hGuOYZ5dg=", + "_parent": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "model": { + "$ref": "AAAAAAFF+8hGt+YW0i0=" + }, + "visible": null, + "font": "Arial;12;0", + "left": 690, + "top": 191, + "height": 12, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFF+8hGuOYac3U=", + "_parent": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "model": { + "$ref": "AAAAAAFF+8hGt+YW0i0=" + }, + "visible": false, + "font": "Arial;12;0", + "left": 730, + "top": 211, + "height": 12, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFF+8hGt+YXPb4=" + }, + "edgePosition": 1 + } + ], + "font": "Arial;12;0", + "head": { + "$ref": "AAAAAAFF+8gJIOU4Dng=" + }, + "tail": { + "$ref": "AAAAAAFF8Icylm2wJuo=" + }, + "lineStyle": 1, + "points": "708:231;727:192", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFF+8hGt+YY5oc=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFF+8hGuOYZ5dg=" + }, + "propertyLabel": { + "$ref": "AAAAAAFF+8hGuOYac3U=" + } + }, + { + "_type": "UMLAssociationView", + "_id": "AAAAAAFHtFufG0o4ryM=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "subViews": [ + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo5JmU=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 385, + "top": 356, + "height": 13, + "alpha": 1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo6nGs=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "visible": null, + "font": "Arial;13;0", + "left": 370, + "top": 356, + "height": 13, + "alpha": 1.5707963267948966, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo77X8=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 414, + "top": 357, + "height": 13, + "alpha": -1.5707963267948966, + "distance": 15, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 1 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo8Evk=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o2XV4=" + }, + "font": "Arial;13;0", + "left": 294, + "top": 423, + "width": 98.642578125, + "height": 13, + "alpha": -4.906348096058522, + "distance": 57.0701322935211, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 2, + "text": "+unorderedItems" + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo9XeA=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o2XV4=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 371, + "top": 405, + "height": 13, + "alpha": 0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 2 + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo+iQY=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o2XV4=" + }, + "font": "Arial;13;0", + "left": 380, + "top": 407, + "width": 5.05908203125, + "height": 13, + "alpha": -5.677640758647128, + "distance": 31.622776601683793, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "edgePosition": 2, + "text": "*" + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEo/I8k=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o3QL0=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 385, + "top": 306, + "height": 13, + "alpha": -0.5235987755982988, + "distance": 30, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEpAwew=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o3QL0=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 371, + "top": 309, + "height": 13, + "alpha": -0.7853981633974483, + "distance": 40, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + } + }, + { + "_type": "EdgeLabelView", + "_id": "AAAAAAFHtFufHEpBqaU=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o3QL0=" + }, + "visible": false, + "font": "Arial;13;0", + "left": 412, + "top": 302, + "height": 13, + "alpha": 0.5235987755982988, + "distance": 25, + "hostEdge": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + } + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFHtFufHEpCMdg=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o2XV4=" + }, + "visible": false, + "font": "Arial;13;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLQualifierCompartmentView", + "_id": "AAAAAAFHtFufHEpDysk=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o4ryM=" + }, + "model": { + "$ref": "AAAAAAFHtFufG0o3QL0=" + }, + "visible": false, + "font": "Arial;13;0", + "width": 10, + "height": 10 + } + ], + "font": "Arial;13;0", + "head": { + "$ref": "AAAAAAFF8IcE0G1og04=" + }, + "tail": { + "$ref": "AAAAAAFF+ZqVxVGSV0I=" + }, + "points": "400:440;400:287", + "showVisibility": true, + "nameLabel": { + "$ref": "AAAAAAFHtFufHEo5JmU=" + }, + "stereotypeLabel": { + "$ref": "AAAAAAFHtFufHEo6nGs=" + }, + "propertyLabel": { + "$ref": "AAAAAAFHtFufHEo77X8=" + }, + "tailRoleNameLabel": { + "$ref": "AAAAAAFHtFufHEo8Evk=" + }, + "tailPropertyLabel": { + "$ref": "AAAAAAFHtFufHEo9XeA=" + }, + "tailMultiplicityLabel": { + "$ref": "AAAAAAFHtFufHEo+iQY=" + }, + "headRoleNameLabel": { + "$ref": "AAAAAAFHtFufHEo/I8k=" + }, + "headPropertyLabel": { + "$ref": "AAAAAAFHtFufHEpAwew=" + }, + "headMultiplicityLabel": { + "$ref": "AAAAAAFHtFufHEpBqaU=" + }, + "tailQualifiersCompartment": { + "$ref": "AAAAAAFHtFufHEpCMdg=" + }, + "headQualifiersCompartment": { + "$ref": "AAAAAAFHtFufHEpDysk=" + } + }, + { + "_type": "UMLClassView", + "_id": "AAAAAAFHyP51nSsyY0s=", + "_parent": { + "$ref": "AAAAAAFF8IYa8WzeRC4=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "subViews": [ + { + "_type": "UMLReceptionCompartmentView", + "_id": "AAAAAAF/zwIgL2HVMaM=", + "_parent": { + "$ref": "AAAAAAFHyP51nSsyY0s=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "visible": false, + "font": "Arial;13;0", + "width": 10, + "height": 10 + }, + { + "_type": "UMLNameCompartmentView", + "_id": "AAAAAAFHyP51nSszt2w=", + "_parent": { + "$ref": "AAAAAAFHyP51nSsyY0s=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "subViews": [ + { + "_type": "LabelView", + "_id": "AAAAAAFHyP51nSs0krM=", + "_parent": { + "$ref": "AAAAAAFHyP51nSszt2w=" + }, + "font": "Arial;13;0", + "left": 45, + "top": 417, + "width": 210, + "height": 13, + "text": "«annotationType»" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFHyP51nSs1O4U=", + "_parent": { + "$ref": "AAAAAAFHyP51nSszt2w=" + }, + "font": "Arial;13;1", + "left": 45, + "top": 432, + "width": 210, + "height": 13, + "text": "AnnotationTest" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFHyP51nSs2Ue0=", + "_parent": { + "$ref": "AAAAAAFHyP51nSszt2w=" + }, + "visible": false, + "font": "Arial;13;0", + "left": -84, + "top": -96, + "width": 94.64990234375, + "height": 13, + "text": "(from package1)" + }, + { + "_type": "LabelView", + "_id": "AAAAAAFHyP51nSs34/Q=", + "_parent": { + "$ref": "AAAAAAFHyP51nSszt2w=" + }, + "visible": false, + "font": "Arial;13;0", + "left": -84, + "top": -96, + "height": 13, + "horizontalAlignment": 1 + } + ], + "font": "Arial;13;0", + "left": 40, + "top": 412, + "width": 220, + "height": 38, + "stereotypeLabel": { + "$ref": "AAAAAAFHyP51nSs0krM=" + }, + "nameLabel": { + "$ref": "AAAAAAFHyP51nSs1O4U=" + }, + "namespaceLabel": { + "$ref": "AAAAAAFHyP51nSs2Ue0=" + }, + "propertyLabel": { + "$ref": "AAAAAAFHyP51nSs34/Q=" + } + }, + { + "_type": "UMLAttributeCompartmentView", + "_id": "AAAAAAFHyP51nSs49zw=", + "_parent": { + "$ref": "AAAAAAFHyP51nSsyY0s=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "subViews": [ + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFHyQfSAiwGa8M=", + "_parent": { + "$ref": "AAAAAAFHyP51nSs49zw=" + }, + "model": { + "$ref": "AAAAAAFHyQfR+Cv6DyI=" + }, + "font": "Arial;13;0", + "left": 45, + "top": 455, + "width": 210, + "height": 13, + "text": "+annotationField1: int = 100", + "horizontalAlignment": 0 + }, + { + "_type": "UMLAttributeView", + "_id": "AAAAAAFHyQildSywss8=", + "_parent": { + "$ref": "AAAAAAFHyP51nSs49zw=" + }, + "model": { + "$ref": "AAAAAAFHyQilbCykWDE=" + }, + "font": "Arial;13;0", + "left": 45, + "top": 470, + "width": 210, + "height": 13, + "text": "+annotationField2: int = 200", + "horizontalAlignment": 0 + } + ], + "font": "Arial;13;0", + "left": 40, + "top": 450, + "width": 220, + "height": 38 + }, + { + "_type": "UMLOperationCompartmentView", + "_id": "AAAAAAFHyP51nSs56VI=", + "_parent": { + "$ref": "AAAAAAFHyP51nSsyY0s=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "subViews": [ + { + "_type": "UMLOperationView", + "_id": "AAAAAAFHyQjFaS0INc0=", + "_parent": { + "$ref": "AAAAAAFHyP51nSs56VI=" + }, + "model": { + "$ref": "AAAAAAFHyQjFXiz8zcc=" + }, + "font": "Arial;13;0", + "left": 45, + "top": 493, + "width": 210, + "height": 13, + "text": "+author(): String", + "horizontalAlignment": 0 + }, + { + "_type": "UMLOperationView", + "_id": "AAAAAAFHyQjrAi2EFug=", + "_parent": { + "$ref": "AAAAAAFHyP51nSs56VI=" + }, + "model": { + "$ref": "AAAAAAFHyQjq+y14okc=" + }, + "font": "Arial;13;0", + "left": 45, + "top": 508, + "width": 210, + "height": 13, + "text": "+date(): String", + "horizontalAlignment": 0 + } + ], + "font": "Arial;13;0", + "left": 40, + "top": 488, + "width": 220, + "height": 38 + }, + { + "_type": "UMLTemplateParameterCompartmentView", + "_id": "AAAAAAFHyP51nSs6sTA=", + "_parent": { + "$ref": "AAAAAAFHyP51nSsyY0s=" + }, + "model": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "visible": false, + "font": "Arial;13;0", + "left": -56, + "top": -64, + "width": 10, + "height": 10 + } + ], + "font": "Arial;13;0", + "left": 40, + "top": 412, + "width": 220, + "height": 114, + "nameCompartment": { + "$ref": "AAAAAAFHyP51nSszt2w=" + }, + "attributeCompartment": { + "$ref": "AAAAAAFHyP51nSs49zw=" + }, + "operationCompartment": { + "$ref": "AAAAAAFHyP51nSs56VI=" + }, + "receptionCompartment": { + "$ref": "AAAAAAF/zwIgL2HVMaM=" + }, + "templateParameterCompartment": { + "$ref": "AAAAAAFHyP51nSs6sTA=" + } + } + ] + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFF8IY3RWzik2A=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Class1", + "ownedElements": [ + { + "_type": "UMLClass", + "_id": "AAAAAAFF+hk0VMqTrv4=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "InnerClass", + "attributes": [ + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+hl2YMseKZ0=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "name": "Attribute1", + "type": "String" + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFF+hmWdMtDXYk=", + "_parent": { + "$ref": "AAAAAAFF+hk0VMqTrv4=" + }, + "name": "Operation1", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFHs/y3BxZTNM0=", + "_parent": { + "$ref": "AAAAAAFF+hmWdMtDXYk=" + }, + "type": "String", + "direction": "return" + } + ] + } + ] + } + ], + "documentation": "This Class1's documentation\nThis is second line of documentation\nThis is third line of documentation\n", + "attributes": [ + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+W+3yDh6/CA=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "Attribute1", + "documentation": "This is attribute documentation", + "type": "String", + "defaultValue": "\"DEFAULT_STRING\"" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+ZjWz1GHi1w=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "StaticVariable", + "isStatic": true, + "type": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + } + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+bhoXyI2PkY=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "IntArray", + "type": "Integer", + "multiplicity": "100" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+bky4SL5r4M=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "StringList", + "type": "String", + "multiplicity": "0..*" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+b8kSobXncI=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "StaticFinalVar", + "isStatic": true, + "isLeaf": true, + "type": "Boolean", + "defaultValue": "false" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+8R/4sXUSCo=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "PrivateAttribute", + "visibility": "private", + "type": "Object" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+8TKTMYwPH4=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "ProtectedAttribute", + "visibility": "protected", + "type": "String" + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFF+XErBjiBsWU=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "Operation1", + "documentation": "This is operation documentation", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+cIydYexAxI=", + "_parent": { + "$ref": "AAAAAAFF+XErBjiBsWU=" + }, + "documentation": "The return parameter", + "type": "Boolean", + "direction": "return" + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+cm3pIgyE50=", + "_parent": { + "$ref": "AAAAAAFF+XErBjiBsWU=" + }, + "name": "Arg1", + "documentation": "The first argument", + "type": "Integer", + "isReadOnly": true + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+cm3pYgzIrI=", + "_parent": { + "$ref": "AAAAAAFF+XErBjiBsWU=" + }, + "name": "Arg2", + "documentation": "The second argument", + "type": "String" + } + ] + }, + { + "_type": "UMLOperation", + "_id": "AAAAAAFF+8QlVMV4Go4=", + "_parent": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + }, + "name": "AbstractOperation", + "isAbstract": true + } + ] + }, + { + "_type": "UMLInterface", + "_id": "AAAAAAFF8IZDVW0HciI=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Interface1", + "attributes": [ + { + "_type": "UMLAttribute", + "_id": "AAAAAAFF+8MSo8OeeCM=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "name": "Attribute1", + "type": "int", + "defaultValue": "100" + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFF+8NnU8QMHKM=", + "_parent": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + }, + "name": "Operation2", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+8O7bcQrZrM=", + "_parent": { + "$ref": "AAAAAAFF+8NnU8QMHKM=" + }, + "name": "arg1", + "type": "String" + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+8O7bcQstXw=", + "_parent": { + "$ref": "AAAAAAFF+8NnU8QMHKM=" + }, + "name": "arg2", + "type": "Integer" + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFF+8O7bsQtssc=", + "_parent": { + "$ref": "AAAAAAFF+8NnU8QMHKM=" + }, + "type": "Object", + "direction": "return" + } + ] + } + ] + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFF8IaVwm0vD2c=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "AbstractClass1", + "ownedElements": [ + { + "_type": "UMLGeneralization", + "_id": "AAAAAAFF8IahYm1UT3g=", + "_parent": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "source": { + "$ref": "AAAAAAFF8IaVwm0vD2c=" + }, + "target": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + } + } + ], + "isAbstract": true + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFF8IcEz21nWVg=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Collection", + "ownedElements": [ + { + "_type": "UMLGeneralization", + "_id": "AAAAAAFF8IcWOm2NEHU=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "source": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "target": { + "$ref": "AAAAAAFF8IY3RWzik2A=" + } + }, + { + "_type": "UMLInterfaceRealization", + "_id": "AAAAAAFF8Ichh22ebss=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "source": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "target": { + "$ref": "AAAAAAFF8IZDVW0HciI=" + } + }, + { + "_type": "UMLInterfaceRealization", + "_id": "AAAAAAFF8IdB5m3UfCk=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "source": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "target": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + } + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFF+aNsrnXfbqI=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFF+aNsrnXgbmo=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "reference": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + } + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFF+aNsrnXhVro=", + "_parent": { + "$ref": "AAAAAAFF+aNsrnXfbqI=" + }, + "reference": { + "$ref": "AAAAAAFF+aMrTHWeP30=" + }, + "navigable": "unspecified" + } + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFHs+jwTmEIu5k=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "name": "AbstractOperation" + }, + { + "_type": "UMLOperation", + "_id": "AAAAAAFHs/KdOWGzDSY=", + "_parent": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "name": "Operation2", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFHs/KjamHMpck=", + "_parent": { + "$ref": "AAAAAAFHs/KdOWGzDSY=" + }, + "name": "arg1", + "type": "String" + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFHs/KjamHNpB8=", + "_parent": { + "$ref": "AAAAAAFHs/KdOWGzDSY=" + }, + "name": "arg2", + "type": "Integer" + }, + { + "_type": "UMLParameter", + "_id": "AAAAAAFHs/Kja2HOQXA=", + "_parent": { + "$ref": "AAAAAAFHs/KdOWGzDSY=" + }, + "type": "Object", + "direction": "return" + } + ] + } + ] + }, + { + "_type": "UMLInterface", + "_id": "AAAAAAFF8Icylm2vpFY=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "SubInterface", + "ownedElements": [ + { + "_type": "UMLGeneralization", + "_id": "AAAAAAFF+72UrMJ0uuE=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "source": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "target": { + "$ref": "AAAAAAFF+71lysIEAmg=" + } + }, + { + "_type": "UMLGeneralization", + "_id": "AAAAAAFF+8hGt+YW0i0=", + "_parent": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "source": { + "$ref": "AAAAAAFF8Icylm2vpFY=" + }, + "target": { + "$ref": "AAAAAAFF+8gJIOU3L3Q=" + } + } + ] + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFF+ZqVxVGRY8A=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Item", + "ownedElements": [ + { + "_type": "UMLAssociation", + "_id": "AAAAAAFF+ZrZgFG6qZY=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFF+ZrZgFG7W0k=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "name": "items", + "reference": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "multiplicity": "0..*", + "isOrdered": true + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFF+ZrZgFG8sxs=", + "_parent": { + "$ref": "AAAAAAFF+ZrZgFG6qZY=" + }, + "reference": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "aggregation": "composite" + } + }, + { + "_type": "UMLAssociation", + "_id": "AAAAAAFHtFufG0o1Mpk=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "end1": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFHtFufG0o2XV4=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "name": "unorderedItems", + "reference": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "multiplicity": "*" + }, + "end2": { + "_type": "UMLAssociationEnd", + "_id": "AAAAAAFHtFufG0o3QL0=", + "_parent": { + "$ref": "AAAAAAFHtFufG0o1Mpk=" + }, + "reference": { + "$ref": "AAAAAAFF8IcEz21nWVg=" + }, + "aggregation": "shared" + } + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFHyQ8pni6H6OE=", + "_parent": { + "$ref": "AAAAAAFF+ZqVxVGRY8A=" + }, + "name": "Operation1", + "concurrency": "concurrent" + } + ], + "isLeaf": true + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFF+aMrTHWeP30=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "NotNavigableItem" + }, + { + "_type": "UMLInterface", + "_id": "AAAAAAFF+71lysIEAmg=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "SuperInterface1" + }, + { + "_type": "UMLEnumeration", + "_id": "AAAAAAFF+8W2xMc//fI=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "Enumeration1", + "literals": [ + { + "_type": "UMLEnumerationLiteral", + "_id": "AAAAAAFF+8XGdMeAM7s=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "name": "Literal1" + }, + { + "_type": "UMLEnumerationLiteral", + "_id": "AAAAAAFF+8XYCMel55s=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "name": "Literal2" + }, + { + "_type": "UMLEnumerationLiteral", + "_id": "AAAAAAFF+8XizcfEeH8=", + "_parent": { + "$ref": "AAAAAAFF+8W2xMc//fI=" + }, + "name": "Literal3" + } + ] + }, + { + "_type": "UMLInterface", + "_id": "AAAAAAFF+8gJIOU3L3Q=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "SuperInterface2" + }, + { + "_type": "UMLClass", + "_id": "AAAAAAFHyP51nCsxXGA=", + "_parent": { + "$ref": "AAAAAAFF8Hu5LWyFBNo=" + }, + "name": "AnnotationTest", + "stereotype": "annotationType", + "attributes": [ + { + "_type": "UMLAttribute", + "_id": "AAAAAAFHyQfR+Cv6DyI=", + "_parent": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "name": "annotationField1", + "type": "int ", + "defaultValue": "100" + }, + { + "_type": "UMLAttribute", + "_id": "AAAAAAFHyQilbCykWDE=", + "_parent": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "name": "annotationField2", + "type": "int ", + "defaultValue": "200" + } + ], + "operations": [ + { + "_type": "UMLOperation", + "_id": "AAAAAAFHyQjFXiz8zcc=", + "_parent": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "name": "author", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFHyRNu4Z7jDAw=", + "_parent": { + "$ref": "AAAAAAFHyQjFXiz8zcc=" + }, + "type": "String", + "direction": "return" + } + ] + }, + { + "_type": "UMLOperation", + "_id": "AAAAAAFHyQjq+y14okc=", + "_parent": { + "$ref": "AAAAAAFHyP51nCsxXGA=" + }, + "name": "date", + "parameters": [ + { + "_type": "UMLParameter", + "_id": "AAAAAAFHyRN+mp8TXaw=", + "_parent": { + "$ref": "AAAAAAFHyQjq+y14okc=" + }, + "type": "String", + "direction": "return" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + } + ], + "author": "Minkyu Lee" +} \ No newline at end of file diff --git a/unittest-files/generate/CodeGenTestModel.umlj b/unittest-files/generate/CodeGenTestModel.umlj deleted file mode 100644 index f5f4cba..0000000 --- a/unittest-files/generate/CodeGenTestModel.umlj +++ /dev/null @@ -1 +0,0 @@ -{"_type":"Project","_id":"AAAAAAFF8HrPHGxHVqE=","name":"Untitled","ownedElements":[{"_type":"UMLModel","_id":"AAAAAAFF8Hrm9GxIk8w=","_parent":{"$ref":"AAAAAAFF8HrPHGxHVqE="},"name":"JavaCodeModel","ownedElements":[{"_type":"UMLClassDiagram","_id":"AAAAAAFF8HsXlGxNhmc=","_parent":{"$ref":"AAAAAAFF8Hrm9GxIk8w="},"name":"PackageStructure","defaultDiagram":true,"ownedViews":[{"_type":"UMLPackageView","_id":"AAAAAAFF8HsuDGxRmz4=","_parent":{"$ref":"AAAAAAFF8HsXlGxNhmc="},"model":{"$ref":"AAAAAAFF8HsuDGxQIN8="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8HsuDGxSIpc=","_parent":{"$ref":"AAAAAAFF8HsuDGxRmz4="},"model":{"$ref":"AAAAAAFF8HsuDGxQIN8="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8HsuDGxTvG8=","_parent":{"$ref":"AAAAAAFF8HsuDGxSIpc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8HsuDGxUcVI=","_parent":{"$ref":"AAAAAAFF8HsuDGxSIpc="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":85,"top":74,"width":90,"height":12,"text":"com"},{"_type":"LabelView","_id":"AAAAAAFF8HsuDGxVops=","_parent":{"$ref":"AAAAAAFF8HsuDGxSIpc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"width":125,"height":12,"text":"(from JavaCodeModel)"},{"_type":"LabelView","_id":"AAAAAAFF8HsuDGxWXQQ=","_parent":{"$ref":"AAAAAAFF8HsuDGxSIpc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":80,"top":67,"width":100,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8HsuDGxTvG8="},"nameLabel":{"$ref":"AAAAAAFF8HsuDGxUcVI="},"namespaceLabel":{"$ref":"AAAAAAFF8HsuDGxVops="},"propertyLabel":{"$ref":"AAAAAAFF8HsuDGxWXQQ="}}],"fillColor":"#ffffff","font":"Arial;12;0","left":80,"top":52,"width":100,"height":72,"nameCompartment":{"$ref":"AAAAAAFF8HsuDGxSIpc="}},{"_type":"UMLPackageView","_id":"AAAAAAFF8HtFoGxrp0M=","_parent":{"$ref":"AAAAAAFF8HsXlGxNhmc="},"model":{"$ref":"AAAAAAFF8HtFoGxq9o8="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8HtFoGxsB7E=","_parent":{"$ref":"AAAAAAFF8HtFoGxrp0M="},"model":{"$ref":"AAAAAAFF8HtFoGxq9o8="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8HtFoGxta2k=","_parent":{"$ref":"AAAAAAFF8HtFoGxsB7E="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8HtFoGxughg=","_parent":{"$ref":"AAAAAAFF8HtFoGxsB7E="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":81,"top":190,"width":91,"height":12,"text":"company"},{"_type":"LabelView","_id":"AAAAAAFF8HtFoGxvqRI=","_parent":{"$ref":"AAAAAAFF8HtFoGxsB7E="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"width":112,"height":12,"text":"(from com)"},{"_type":"LabelView","_id":"AAAAAAFF8HtFoGxw2/U=","_parent":{"$ref":"AAAAAAFF8HtFoGxsB7E="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":76,"top":183,"width":101,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8HtFoGxta2k="},"nameLabel":{"$ref":"AAAAAAFF8HtFoGxughg="},"namespaceLabel":{"$ref":"AAAAAAFF8HtFoGxvqRI="},"propertyLabel":{"$ref":"AAAAAAFF8HtFoGxw2/U="}}],"fillColor":"#ffffff","font":"Arial;12;0","left":76,"top":168,"width":101,"height":65,"nameCompartment":{"$ref":"AAAAAAFF8HtFoGxsB7E="}},{"_type":"UMLPackageView","_id":"AAAAAAFF8Hu5LWyG/DY=","_parent":{"$ref":"AAAAAAFF8HsXlGxNhmc="},"model":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8Hu5LWyHufc=","_parent":{"$ref":"AAAAAAFF8Hu5LWyG/DY="},"model":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8Hu5LWyIrBI=","_parent":{"$ref":"AAAAAAFF8Hu5LWyHufc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8Hu5LWyJeZ4=","_parent":{"$ref":"AAAAAAFF8Hu5LWyHufc="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":81,"top":306,"width":94,"height":12,"text":"package1"},{"_type":"LabelView","_id":"AAAAAAFF8Hu5LWyKuVY=","_parent":{"$ref":"AAAAAAFF8Hu5LWyHufc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"width":112,"height":12,"text":"(from company)"},{"_type":"LabelView","_id":"AAAAAAFF8Hu5LWyLAww=","_parent":{"$ref":"AAAAAAFF8Hu5LWyHufc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":76,"top":299,"width":104,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8Hu5LWyIrBI="},"nameLabel":{"$ref":"AAAAAAFF8Hu5LWyJeZ4="},"namespaceLabel":{"$ref":"AAAAAAFF8Hu5LWyKuVY="},"propertyLabel":{"$ref":"AAAAAAFF8Hu5LWyLAww="}}],"fillColor":"#ffffff","font":"Arial;12;0","left":76,"top":284,"width":104,"height":68,"nameCompartment":{"$ref":"AAAAAAFF8Hu5LWyHufc="}},{"_type":"UMLContainmentView","_id":"AAAAAAFF8HvI02yftU0=","_parent":{"$ref":"AAAAAAFF8HsXlGxNhmc="},"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8HtFoGxrp0M="},"tail":{"$ref":"AAAAAAFF8Hu5LWyG/DY="},"points":"126.7094017094017:283;126.28205128205128:233"},{"_type":"UMLContainmentView","_id":"AAAAAAFF8HvMTmyjwcc=","_parent":{"$ref":"AAAAAAFF8HsXlGxNhmc="},"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8HsuDGxRmz4="},"tail":{"$ref":"AAAAAAFF8HtFoGxrp0M="},"points":"126.87610619469027:167;128.01769911504425:124"}]},{"_type":"UMLPackage","_id":"AAAAAAFF8HsuDGxQIN8=","_parent":{"$ref":"AAAAAAFF8Hrm9GxIk8w="},"name":"com","ownedElements":[{"_type":"UMLPackage","_id":"AAAAAAFF8HtFoGxq9o8=","_parent":{"$ref":"AAAAAAFF8HsuDGxQIN8="},"name":"company","ownedElements":[{"_type":"UMLPackage","_id":"AAAAAAFF8Hu5LWyFBNo=","_parent":{"$ref":"AAAAAAFF8HtFoGxq9o8="},"name":"package1","ownedElements":[{"_type":"UMLClassDiagram","_id":"AAAAAAFF8IYa8WzeRC4=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Main","defaultDiagram":true,"ownedViews":[{"_type":"UMLClassView","_id":"AAAAAAFF8IY3RWzjX4w=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IY3RWzik2A="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8IY3RWzkwcc=","_parent":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"model":{"$ref":"AAAAAAFF8IY3RWzik2A="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8IY3RWzlwoM=","_parent":{"$ref":"AAAAAAFF8IY3RWzkwcc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-204,"top":-84,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8IY3RWzmzDo=","_parent":{"$ref":"AAAAAAFF8IY3RWzkwcc="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":33,"top":39,"width":268,"height":12,"text":"Class1"},{"_type":"LabelView","_id":"AAAAAAFF8IY3RWznKes=","_parent":{"$ref":"AAAAAAFF8IY3RWzkwcc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-204,"top":-84,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF8IY3RWzoAJs=","_parent":{"$ref":"AAAAAAFF8IY3RWzkwcc="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":53,"width":268,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":28,"top":32,"width":278,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8IY3RWzlwoM="},"nameLabel":{"$ref":"AAAAAAFF8IY3RWzmzDo="},"namespaceLabel":{"$ref":"AAAAAAFF8IY3RWznKes="},"propertyLabel":{"$ref":"AAAAAAFF8IY3RWzoAJs="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF8IY3RWzpMZI=","_parent":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"model":{"$ref":"AAAAAAFF8IY3RWzik2A="},"subViews":[{"_type":"UMLAttributeView","_id":"AAAAAAFF+W+30Th96uU=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+W+3yDh6/CA="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":61,"width":268,"height":12,"text":"+Attribute1: String = \"DEFAULT_STRING\"","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+ZjW1VGKQ2E=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+ZjWz1GHi1w="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":75,"width":268,"height":12,"underline":true,"text":"+StaticVariable: Collection","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+bhoZiI5T8s=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+bhoXyI2PkY="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":89,"width":268,"height":12,"text":"+IntArray: Integer[100]","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+bky5yL8L7o=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+bky4SL5r4M="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":103,"width":268,"height":12,"text":"+StringList: String[0..*]","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+b8kUYbaWuo=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+b8kSobXncI="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":117,"width":268,"height":12,"underline":true,"text":"+StaticFinalVar: Boolean = false","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+8R/58XXqYE=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+8R/4sXUSCo="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":131,"width":268,"height":12,"text":"-PrivateAttribute: Object","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFF+8TKUsYzgTk=","_parent":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"model":{"$ref":"AAAAAAFF+8TKTMYwPH4="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":145,"width":268,"height":12,"text":"#ProtectedAttribute: String","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":28,"top":56,"width":278,"height":106},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF8IY3RWzqfAY=","_parent":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"model":{"$ref":"AAAAAAFF8IY3RWzik2A="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFF+XErCjiEfok=","_parent":{"$ref":"AAAAAAFF8IY3RWzqfAY="},"model":{"$ref":"AAAAAAFF+XErBjiBsWU="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":33,"top":167,"width":268,"height":12,"text":"+Operation1(Arg1: Integer, Arg2: String): Boolean","horizontalAlignment":0},{"_type":"UMLOperationView","_id":"AAAAAAFF+8QlXMV7xDA=","_parent":{"$ref":"AAAAAAFF8IY3RWzqfAY="},"model":{"$ref":"AAAAAAFF+8QlVMV4Go4="},"fillColor":"#ffffff","font":"Arial;12;2","parentStyle":true,"left":33,"top":181,"width":268,"height":12,"text":"+AbstractOperation()","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":28,"top":162,"width":278,"height":36},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF8IY3RmzrZEM=","_parent":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"model":{"$ref":"AAAAAAFF8IY3RWzik2A="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-136,"top":-56,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":28,"top":32,"width":278,"height":166,"nameCompartment":{"$ref":"AAAAAAFF8IY3RWzkwcc="},"attributeCompartment":{"$ref":"AAAAAAFF8IY3RWzpMZI="},"operationCompartment":{"$ref":"AAAAAAFF8IY3RWzqfAY="},"templateParameterCompartment":{"$ref":"AAAAAAFF8IY3RmzrZEM="}},{"_type":"UMLInterfaceView","_id":"AAAAAAFF8IZDVW0Ip/o=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IZDVW0HciI="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8IZDVW0Jm48=","_parent":{"$ref":"AAAAAAFF8IZDVW0Ip/o="},"model":{"$ref":"AAAAAAFF8IZDVW0HciI="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8IZDVW0KPVk=","_parent":{"$ref":"AAAAAAFF8IZDVW0Jm48="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":337,"top":37,"width":255,"height":12,"text":"«interface»"},{"_type":"LabelView","_id":"AAAAAAFF8IZDVW0LB0A=","_parent":{"$ref":"AAAAAAFF8IZDVW0Jm48="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":337,"top":51,"width":255,"height":12,"text":"Interface1"},{"_type":"LabelView","_id":"AAAAAAFF8IZDVW0MWtU=","_parent":{"$ref":"AAAAAAFF8IZDVW0Jm48="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":324,"top":-84,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF8IZDVW0Ne3I=","_parent":{"$ref":"AAAAAAFF8IZDVW0Jm48="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":324,"top":-84,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":332,"top":32,"width":265,"height":36,"stereotypeLabel":{"$ref":"AAAAAAFF8IZDVW0KPVk="},"nameLabel":{"$ref":"AAAAAAFF8IZDVW0LB0A="},"namespaceLabel":{"$ref":"AAAAAAFF8IZDVW0MWtU="},"propertyLabel":{"$ref":"AAAAAAFF8IZDVW0Ne3I="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF8IZDVW0OeTw=","_parent":{"$ref":"AAAAAAFF8IZDVW0Ip/o="},"model":{"$ref":"AAAAAAFF8IZDVW0HciI="},"subViews":[{"_type":"UMLAttributeView","_id":"AAAAAAFF+8MSrcOh/Pg=","_parent":{"$ref":"AAAAAAFF8IZDVW0OeTw="},"model":{"$ref":"AAAAAAFF+8MSo8OeeCM="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":337,"top":73,"width":255,"height":12,"text":"+Attribute1: int = 100","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":332,"top":68,"width":265,"height":22},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF8IZDVW0Pw7Y=","_parent":{"$ref":"AAAAAAFF8IZDVW0Ip/o="},"model":{"$ref":"AAAAAAFF8IZDVW0HciI="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFF+8NnW8QPXa4=","_parent":{"$ref":"AAAAAAFF8IZDVW0Pw7Y="},"model":{"$ref":"AAAAAAFF+8NnU8QMHKM="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":337,"top":95,"width":255,"height":12,"text":"+Operation2(arg1: String, arg2: Integer): Object","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":332,"top":90,"width":265,"height":22},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF8IZDVW0QYys=","_parent":{"$ref":"AAAAAAFF8IZDVW0Ip/o="},"model":{"$ref":"AAAAAAFF8IZDVW0HciI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":216,"top":-56,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":332,"top":32,"width":265,"height":80,"nameCompartment":{"$ref":"AAAAAAFF8IZDVW0Jm48="},"attributeCompartment":{"$ref":"AAAAAAFF8IZDVW0OeTw="},"operationCompartment":{"$ref":"AAAAAAFF8IZDVW0Pw7Y="},"templateParameterCompartment":{"$ref":"AAAAAAFF8IZDVW0QYys="}},{"_type":"UMLClassView","_id":"AAAAAAFF8IaVw20w1ck=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8IaVw20xqzs=","_parent":{"$ref":"AAAAAAFF8IaVw20w1ck="},"model":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8IaVw20yoMA=","_parent":{"$ref":"AAAAAAFF8IaVw20xqzs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":480,"top":300,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8IaVw20z3q0=","_parent":{"$ref":"AAAAAAFF8IaVw20xqzs="},"fillColor":"#ffffff","font":"Arial;12;3","parentStyle":true,"left":217,"top":307,"width":90,"height":12,"text":"AbstractClass1"},{"_type":"LabelView","_id":"AAAAAAFF8IaVw2008T4=","_parent":{"$ref":"AAAAAAFF8IaVw20xqzs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":480,"top":300,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF8IaVw201HsE=","_parent":{"$ref":"AAAAAAFF8IaVw20xqzs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":480,"top":300,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":212,"top":300,"width":100,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8IaVw20yoMA="},"nameLabel":{"$ref":"AAAAAAFF8IaVw20z3q0="},"namespaceLabel":{"$ref":"AAAAAAFF8IaVw2008T4="},"propertyLabel":{"$ref":"AAAAAAFF8IaVw201HsE="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF8IaVw2029Hs=","_parent":{"$ref":"AAAAAAFF8IaVw20w1ck="},"model":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":212,"top":324,"width":100,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF8IaVw203wM4=","_parent":{"$ref":"AAAAAAFF8IaVw20w1ck="},"model":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":212,"top":334,"width":100,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF8IaVw204JXk=","_parent":{"$ref":"AAAAAAFF8IaVw20w1ck="},"model":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":320,"top":200,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":212,"top":300,"width":100,"height":69,"nameCompartment":{"$ref":"AAAAAAFF8IaVw20xqzs="},"attributeCompartment":{"$ref":"AAAAAAFF8IaVw2029Hs="},"operationCompartment":{"$ref":"AAAAAAFF8IaVw203wM4="},"templateParameterCompartment":{"$ref":"AAAAAAFF8IaVw204JXk="}},{"_type":"UMLGeneralizationView","_id":"AAAAAAFF8IahYm1Vqw0=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IahYm1UT3g="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF8IahYm1WhCs=","_parent":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"model":{"$ref":"AAAAAAFF8IahYm1UT3g="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":210,"top":247,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IahYm1XjU8=","_parent":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"model":{"$ref":"AAAAAAFF8IahYm1UT3g="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":196,"top":253,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IahYm1Y+0Y=","_parent":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"model":{"$ref":"AAAAAAFF8IahYm1UT3g="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":237,"top":236,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IahYm1Vqw0="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"tail":{"$ref":"AAAAAAFF8IaVw20w1ck="},"points":"245.88636363636363:299;202.27272727272728:198","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF8IahYm1WhCs="},"stereotypeLabel":{"$ref":"AAAAAAFF8IahYm1XjU8="},"propertyLabel":{"$ref":"AAAAAAFF8IahYm1Y+0Y="}},{"_type":"UMLClassView","_id":"AAAAAAFF8IcE0G1og04=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IcEz21nWVg="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8IcE0G1p+3c=","_parent":{"$ref":"AAAAAAFF8IcE0G1og04="},"model":{"$ref":"AAAAAAFF8IcEz21nWVg="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8IcE0G1qeCs=","_parent":{"$ref":"AAAAAAFF8IcE0G1p+3c="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":360,"top":24,"height":12},{"_type":"LabelView","_id":"AAAAAAFF8IcE0G1rIi8=","_parent":{"$ref":"AAAAAAFF8IcE0G1p+3c="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":345,"top":215,"width":255,"height":12,"text":"Collection"},{"_type":"LabelView","_id":"AAAAAAFF8IcE0G1s+qM=","_parent":{"$ref":"AAAAAAFF8IcE0G1p+3c="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":360,"top":24,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF8IcE0G1tjlI=","_parent":{"$ref":"AAAAAAFF8IcE0G1p+3c="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":360,"top":24,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":340,"top":208,"width":265,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8IcE0G1qeCs="},"nameLabel":{"$ref":"AAAAAAFF8IcE0G1rIi8="},"namespaceLabel":{"$ref":"AAAAAAFF8IcE0G1s+qM="},"propertyLabel":{"$ref":"AAAAAAFF8IcE0G1tjlI="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF8IcE0G1uiPo=","_parent":{"$ref":"AAAAAAFF8IcE0G1og04="},"model":{"$ref":"AAAAAAFF8IcEz21nWVg="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":340,"top":232,"width":265,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF8IcE0G1vMfU=","_parent":{"$ref":"AAAAAAFF8IcE0G1og04="},"model":{"$ref":"AAAAAAFF8IcEz21nWVg="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFHs+jwV2ELlX0=","_parent":{"$ref":"AAAAAAFF8IcE0G1vMfU="},"model":{"$ref":"AAAAAAFHs+jwTmEIu5k="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":345,"top":247,"width":255,"height":12,"text":"+AbstractOperation()","horizontalAlignment":0},{"_type":"UMLOperationView","_id":"AAAAAAFHs/KdQGG2FVA=","_parent":{"$ref":"AAAAAAFF8IcE0G1vMfU="},"model":{"$ref":"AAAAAAFHs/KdOWGzDSY="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":345,"top":261,"width":255,"height":12,"text":"+Operation2(arg1: String, arg2: Integer): Object","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":340,"top":242,"width":265,"height":36},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF8IcE0W1wBwc=","_parent":{"$ref":"AAAAAAFF8IcE0G1og04="},"model":{"$ref":"AAAAAAFF8IcEz21nWVg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":240,"top":16,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":340,"top":208,"width":265,"height":80,"nameCompartment":{"$ref":"AAAAAAFF8IcE0G1p+3c="},"attributeCompartment":{"$ref":"AAAAAAFF8IcE0G1uiPo="},"operationCompartment":{"$ref":"AAAAAAFF8IcE0G1vMfU="},"templateParameterCompartment":{"$ref":"AAAAAAFF8IcE0W1wBwc="}},{"_type":"UMLGeneralizationView","_id":"AAAAAAFF8IcWOm2OleM=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IcWOm2NEHU="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF8IcWOm2PIOk=","_parent":{"$ref":"AAAAAAFF8IcWOm2OleM="},"model":{"$ref":"AAAAAAFF8IcWOm2NEHU="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":336,"top":197,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IcWOm2OleM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IcWOm2QHWU=","_parent":{"$ref":"AAAAAAFF8IcWOm2OleM="},"model":{"$ref":"AAAAAAFF8IcWOm2NEHU="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":330,"top":211,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF8IcWOm2OleM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IcWOm2RoLA=","_parent":{"$ref":"AAAAAAFF8IcWOm2OleM="},"model":{"$ref":"AAAAAAFF8IcWOm2NEHU="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":347,"top":170,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IcWOm2OleM="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"tail":{"$ref":"AAAAAAFF8IcE0G1og04="},"points":"379.96992481203006:207;306:174.84967320261438","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF8IcWOm2PIOk="},"stereotypeLabel":{"$ref":"AAAAAAFF8IcWOm2QHWU="},"propertyLabel":{"$ref":"AAAAAAFF8IcWOm2RoLA="}},{"_type":"UMLInterfaceRealizationView","_id":"AAAAAAFF8Ichh22fXWM=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8Ichh22ebss="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF8Ichh22gkrc=","_parent":{"$ref":"AAAAAAFF8Ichh22fXWM="},"model":{"$ref":"AAAAAAFF8Ichh22ebss="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":453,"top":153,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8Ichh22fXWM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8Ichh22hmSg=","_parent":{"$ref":"AAAAAAFF8Ichh22fXWM="},"model":{"$ref":"AAAAAAFF8Ichh22ebss="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":438,"top":154,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF8Ichh22fXWM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8Ichh22igbI=","_parent":{"$ref":"AAAAAAFF8Ichh22fXWM="},"model":{"$ref":"AAAAAAFF8Ichh22ebss="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":482,"top":152,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8Ichh22fXWM="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8IZDVW0Ip/o="},"tail":{"$ref":"AAAAAAFF8IcE0G1og04="},"points":"470.1818181818182:207;465.8636363636364:112","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF8Ichh22gkrc="},"stereotypeLabel":{"$ref":"AAAAAAFF8Ichh22hmSg="},"propertyLabel":{"$ref":"AAAAAAFF8Ichh22igbI="}},{"_type":"UMLInterfaceView","_id":"AAAAAAFF8Icylm2wJuo=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8Icylm2vpFY="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF8Icyl22xnPM=","_parent":{"$ref":"AAAAAAFF8Icylm2wJuo="},"model":{"$ref":"AAAAAAFF8Icylm2vpFY="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF8Icyl22yVhc=","_parent":{"$ref":"AAAAAAFF8Icyl22xnPM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":900,"top":528,"width":61,"height":12,"text":"«interface»"},{"_type":"LabelView","_id":"AAAAAAFF8Icyl22zA34=","_parent":{"$ref":"AAAAAAFF8Icyl22xnPM="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":657,"top":278,"width":73,"height":12,"text":"SubInterface"},{"_type":"LabelView","_id":"AAAAAAFF8Icyl220bpo=","_parent":{"$ref":"AAAAAAFF8Icyl22xnPM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":900,"top":528,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF8Icyl221ZYI=","_parent":{"$ref":"AAAAAAFF8Icyl22xnPM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":900,"top":528,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":652,"top":271,"width":83,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF8Icyl22yVhc="},"nameLabel":{"$ref":"AAAAAAFF8Icyl22zA34="},"namespaceLabel":{"$ref":"AAAAAAFF8Icyl220bpo="},"propertyLabel":{"$ref":"AAAAAAFF8Icyl221ZYI="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF8Icyl222sKU=","_parent":{"$ref":"AAAAAAFF8Icylm2wJuo="},"model":{"$ref":"AAAAAAFF8Icylm2vpFY="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":600,"top":352,"width":10,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF8Icyl223O/o=","_parent":{"$ref":"AAAAAAFF8Icylm2wJuo="},"model":{"$ref":"AAAAAAFF8Icylm2vpFY="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":600,"top":352,"width":10,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF8Icyl224+Zs=","_parent":{"$ref":"AAAAAAFF8Icylm2wJuo="},"model":{"$ref":"AAAAAAFF8Icylm2vpFY="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":600,"top":352,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":652,"top":236,"width":83,"height":60,"stereotypeDisplay":"icon","nameCompartment":{"$ref":"AAAAAAFF8Icyl22xnPM="},"suppressAttributes":true,"suppressOperations":true,"attributeCompartment":{"$ref":"AAAAAAFF8Icyl222sKU="},"operationCompartment":{"$ref":"AAAAAAFF8Icyl223O/o="},"templateParameterCompartment":{"$ref":"AAAAAAFF8Icyl224+Zs="}},{"_type":"UMLInterfaceRealizationView","_id":"AAAAAAFF8IdB5m3Vv2c=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF8IdB5m3UfCk="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF8IdB5m3W9Vw=","_parent":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"model":{"$ref":"AAAAAAFF8IdB5m3UfCk="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":639,"top":236,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IdB5m3XPsc=","_parent":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"model":{"$ref":"AAAAAAFF8IdB5m3UfCk="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":639,"top":221,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF8IdB5m3Y93E=","_parent":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"model":{"$ref":"AAAAAAFF8IdB5m3UfCk="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":640,"top":265,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF8IdB5m3Vv2c="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8Icylm2wJuo="},"tail":{"$ref":"AAAAAAFF8IcE0G1og04="},"points":"605:257.8325791855204;675.5:256.57466063348414","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF8IdB5m3W9Vw="},"stereotypeLabel":{"$ref":"AAAAAAFF8IdB5m3XPsc="},"propertyLabel":{"$ref":"AAAAAAFF8IdB5m3Y93E="}},{"_type":"UMLClassView","_id":"AAAAAAFF+ZqVxVGSV0I=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+ZqVxlGTvOg=","_parent":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"model":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+ZqVxlGUYIw=","_parent":{"$ref":"AAAAAAFF+ZqVxlGTvOg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":24,"top":24,"height":12},{"_type":"LabelView","_id":"AAAAAAFF+ZqVxlGVBIE=","_parent":{"$ref":"AAAAAAFF+ZqVxlGTvOg="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":381,"top":363,"width":87,"height":12,"text":"Item"},{"_type":"LabelView","_id":"AAAAAAFF+ZqVxlGW0oI=","_parent":{"$ref":"AAAAAAFF+ZqVxlGTvOg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":24,"top":24,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF+ZqVxlGX7tM=","_parent":{"$ref":"AAAAAAFF+ZqVxlGTvOg="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":381,"top":377,"width":87,"height":12,"text":"{leaf}","horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":376,"top":356,"width":97,"height":38,"stereotypeLabel":{"$ref":"AAAAAAFF+ZqVxlGUYIw="},"nameLabel":{"$ref":"AAAAAAFF+ZqVxlGVBIE="},"namespaceLabel":{"$ref":"AAAAAAFF+ZqVxlGW0oI="},"propertyLabel":{"$ref":"AAAAAAFF+ZqVxlGX7tM="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+ZqVxlGYEpQ=","_parent":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"model":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":376,"top":394,"width":97,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+ZqVxlGZ28M=","_parent":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"model":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFHyQ8ppi6KE0g=","_parent":{"$ref":"AAAAAAFF+ZqVxlGZ28M="},"model":{"$ref":"AAAAAAFHyQ8pni6H6OE="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":381,"top":409,"width":87,"height":12,"text":"+Operation1()","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":376,"top":404,"width":97,"height":22},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+ZqVxlGaEFI=","_parent":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"model":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":16,"top":16,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":376,"top":356,"width":97,"height":70,"nameCompartment":{"$ref":"AAAAAAFF+ZqVxlGTvOg="},"attributeCompartment":{"$ref":"AAAAAAFF+ZqVxlGYEpQ="},"operationCompartment":{"$ref":"AAAAAAFF+ZqVxlGZ28M="},"templateParameterCompartment":{"$ref":"AAAAAAFF+ZqVxlGaEFI="}},{"_type":"UMLAssociationView","_id":"AAAAAAFF+ZrZgFG9dsg=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVG+ceU=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":442,"top":314,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVG/RII=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":427,"top":314,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHArXw=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":471,"top":315,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHBSAg=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG7W0k="},"fillColor":"#ffffff","font":"Arial;12;0","left":466.6350364963504,"top":338,"width":36,"height":12,"alpha":-1.1885894870612226,"distance":29.4930708397087,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":2,"text":"+items"},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHCRA0=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG7W0k="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":428.6350364963504,"top":321,"height":12,"alpha":0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":2},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHDc7g=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG7W0k="},"fillColor":"#ffffff","font":"Arial;12;0","left":466.6350364963504,"top":325,"width":18,"height":12,"alpha":-0.6318663649720168,"distance":30.774821855549835,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"edgePosition":2,"text":"0..*"},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHESKA=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG8sxs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":442.6350364963504,"top":306,"height":12,"alpha":-0.5235987755982988,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="}},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHFa6w=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG8sxs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":428.6350364963504,"top":309,"height":12,"alpha":-0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="}},{"_type":"EdgeLabelView","_id":"AAAAAAFF+ZrZgVHGxaw=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG8sxs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":469.6350364963504,"top":302,"height":12,"alpha":0.5235987755982988,"distance":25,"hostEdge":{"$ref":"AAAAAAFF+ZrZgFG9dsg="}},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFF+ZrZgVHHM+g=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG7W0k="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":128,"width":10,"height":10},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFF+ZrZgVHIh5U=","_parent":{"$ref":"AAAAAAFF+ZrZgFG9dsg="},"model":{"$ref":"AAAAAAFF+ZrZgFG8sxs="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":128,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8IcE0G1og04="},"tail":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"lineStyle":0,"points":"457.6350364963504:356;457.6350364963504:287","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF+ZrZgVG+ceU="},"stereotypeLabel":{"$ref":"AAAAAAFF+ZrZgVG/RII="},"propertyLabel":{"$ref":"AAAAAAFF+ZrZgVHArXw="},"tailRoleNameLabel":{"$ref":"AAAAAAFF+ZrZgVHBSAg="},"tailPropertyLabel":{"$ref":"AAAAAAFF+ZrZgVHCRA0="},"tailMultiplicityLabel":{"$ref":"AAAAAAFF+ZrZgVHDc7g="},"headRoleNameLabel":{"$ref":"AAAAAAFF+ZrZgVHESKA="},"headPropertyLabel":{"$ref":"AAAAAAFF+ZrZgVHFa6w="},"headMultiplicityLabel":{"$ref":"AAAAAAFF+ZrZgVHGxaw="},"tailQualifiersCompartment":{"$ref":"AAAAAAFF+ZrZgVHHM+g="},"headQualifiersCompartment":{"$ref":"AAAAAAFF+ZrZgVHIh5U="}},{"_type":"UMLClassView","_id":"AAAAAAFF+aMrTHWf7X8=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+aMrTHWeP30="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+aMrTHWgHMM=","_parent":{"$ref":"AAAAAAFF+aMrTHWf7X8="},"model":{"$ref":"AAAAAAFF+aMrTHWeP30="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+aMrTHWhiqs=","_parent":{"$ref":"AAAAAAFF+aMrTHWgHMM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":24,"height":12},{"_type":"LabelView","_id":"AAAAAAFF+aMrTHWiu4U=","_parent":{"$ref":"AAAAAAFF+aMrTHWgHMM="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":537,"top":363,"width":102,"height":12,"text":"NotNavigableItem"},{"_type":"LabelView","_id":"AAAAAAFF+aMrTHWjYYU=","_parent":{"$ref":"AAAAAAFF+aMrTHWgHMM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":24,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF+aMrTHWkuNc=","_parent":{"$ref":"AAAAAAFF+aMrTHWgHMM="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":24,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":532,"top":356,"width":112,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF+aMrTHWhiqs="},"nameLabel":{"$ref":"AAAAAAFF+aMrTHWiu4U="},"namespaceLabel":{"$ref":"AAAAAAFF+aMrTHWjYYU="},"propertyLabel":{"$ref":"AAAAAAFF+aMrTHWkuNc="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+aMrTHWlyL8=","_parent":{"$ref":"AAAAAAFF+aMrTHWf7X8="},"model":{"$ref":"AAAAAAFF+aMrTHWeP30="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":532,"top":380,"width":112,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+aMrTXWmEdc=","_parent":{"$ref":"AAAAAAFF+aMrTHWf7X8="},"model":{"$ref":"AAAAAAFF+aMrTHWeP30="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":532,"top":390,"width":112,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+aMrTXWnVA8=","_parent":{"$ref":"AAAAAAFF+aMrTHWf7X8="},"model":{"$ref":"AAAAAAFF+aMrTHWeP30="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":112,"top":16,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":532,"top":356,"width":112,"height":44,"nameCompartment":{"$ref":"AAAAAAFF+aMrTHWgHMM="},"attributeCompartment":{"$ref":"AAAAAAFF+aMrTHWlyL8="},"operationCompartment":{"$ref":"AAAAAAFF+aMrTXWmEdc="},"templateParameterCompartment":{"$ref":"AAAAAAFF+aMrTXWnVA8="}},{"_type":"UMLAssociationView","_id":"AAAAAAFF+aNsrnXintA=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXjYyU=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":548,"top":304,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXkwE0=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":559,"top":294,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXlcCE=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":525,"top":325,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXmh0c=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXgbmo="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":536.2692307692307,"top":291,"height":12,"alpha":0.5235987755982988,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":2},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXnbno=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXgbmo="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":547.2692307692307,"top":284,"height":12,"alpha":0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":2},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsrnXohhw=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXgbmo="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":512.2692307692307,"top":306,"height":12,"alpha":-0.5235987755982988,"distance":25,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="},"edgePosition":2},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsr3XpbyA=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXhVro="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":561.5384615384615,"top":319,"height":12,"alpha":-0.5235987755982988,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="}},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsr3XqdXM=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXhVro="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":569.5384615384615,"top":309,"height":12,"alpha":-0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="}},{"_type":"EdgeLabelView","_id":"AAAAAAFF+aNsr3Xr/TA=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXhVro="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":543.5384615384615,"top":341,"height":12,"alpha":0.5235987755982988,"distance":25,"hostEdge":{"$ref":"AAAAAAFF+aNsrnXintA="}},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFF+aNsr3Xs26c=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXgbmo="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":128,"width":10,"height":10},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFF+aNsr3XtGAw=","_parent":{"$ref":"AAAAAAFF+aNsrnXintA="},"model":{"$ref":"AAAAAAFF+aNsrnXhVro="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":128,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF+aMrTHWf7X8="},"tail":{"$ref":"AAAAAAFF8IcE0G1og04="},"points":"508.2692307692308:288;567.5384615384615:355","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF+aNsrnXjYyU="},"stereotypeLabel":{"$ref":"AAAAAAFF+aNsrnXkwE0="},"propertyLabel":{"$ref":"AAAAAAFF+aNsrnXlcCE="},"tailRoleNameLabel":{"$ref":"AAAAAAFF+aNsrnXmh0c="},"tailPropertyLabel":{"$ref":"AAAAAAFF+aNsrnXnbno="},"tailMultiplicityLabel":{"$ref":"AAAAAAFF+aNsrnXohhw="},"headRoleNameLabel":{"$ref":"AAAAAAFF+aNsr3XpbyA="},"headPropertyLabel":{"$ref":"AAAAAAFF+aNsr3XqdXM="},"headMultiplicityLabel":{"$ref":"AAAAAAFF+aNsr3Xr/TA="},"tailQualifiersCompartment":{"$ref":"AAAAAAFF+aNsr3Xs26c="},"headQualifiersCompartment":{"$ref":"AAAAAAFF+aNsr3XtGAw="}},{"_type":"UMLClassView","_id":"AAAAAAFF+hk0VMqUyAs=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+hk0VMqVPk0=","_parent":{"$ref":"AAAAAAFF+hk0VMqUyAs="},"model":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+hk0VcqW/pc=","_parent":{"$ref":"AAAAAAFF+hk0VMqVPk0="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-96,"top":-24,"height":12},{"_type":"LabelView","_id":"AAAAAAFF+hk0VcqXhec=","_parent":{"$ref":"AAAAAAFF+hk0VMqVPk0="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":41,"top":307,"width":114,"height":12,"text":"InnerClass"},{"_type":"LabelView","_id":"AAAAAAFF+hk0VcqYmrI=","_parent":{"$ref":"AAAAAAFF+hk0VMqVPk0="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-96,"top":-24,"width":81,"height":12,"text":"(from Class1)"},{"_type":"LabelView","_id":"AAAAAAFF+hk0VcqZ3Hw=","_parent":{"$ref":"AAAAAAFF+hk0VMqVPk0="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-96,"top":-24,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":36,"top":300,"width":124,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF+hk0VcqW/pc="},"nameLabel":{"$ref":"AAAAAAFF+hk0VcqXhec="},"namespaceLabel":{"$ref":"AAAAAAFF+hk0VcqYmrI="},"propertyLabel":{"$ref":"AAAAAAFF+hk0VcqZ3Hw="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+hk0VcqaSEU=","_parent":{"$ref":"AAAAAAFF+hk0VMqUyAs="},"model":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"subViews":[{"_type":"UMLAttributeView","_id":"AAAAAAFF+hl2assn4XI=","_parent":{"$ref":"AAAAAAFF+hk0VcqaSEU="},"model":{"$ref":"AAAAAAFF+hl2YMseKZ0="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":41,"top":329,"width":114,"height":12,"text":"+Attribute1: String","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":36,"top":324,"width":124,"height":22},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+hk0VcqbTRo=","_parent":{"$ref":"AAAAAAFF+hk0VMqUyAs="},"model":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFF+hmWf8tMCys=","_parent":{"$ref":"AAAAAAFF+hk0VcqbTRo="},"model":{"$ref":"AAAAAAFF+hmWdMtDXYk="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":41,"top":351,"width":114,"height":12,"text":"+Operation1(): String","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":36,"top":346,"width":124,"height":22},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+hk0VsqcI34=","_parent":{"$ref":"AAAAAAFF+hk0VMqUyAs="},"model":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-64,"top":-16,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":36,"top":300,"width":124,"height":68,"nameCompartment":{"$ref":"AAAAAAFF+hk0VMqVPk0="},"attributeCompartment":{"$ref":"AAAAAAFF+hk0VcqaSEU="},"operationCompartment":{"$ref":"AAAAAAFF+hk0VcqbTRo="},"templateParameterCompartment":{"$ref":"AAAAAAFF+hk0VsqcI34="}},{"_type":"UMLContainmentView","_id":"AAAAAAFF+hlfIsr2ydg=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF8IY3RWzjX4w="},"tail":{"$ref":"AAAAAAFF+hk0VMqUyAs="},"points":"107.7123287671233:299;139.53424657534248:198"},{"_type":"UMLInterfaceView","_id":"AAAAAAFF+71lysIF4HE=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+71lysIEAmg="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+71lysIGbPQ=","_parent":{"$ref":"AAAAAAFF+71lysIF4HE="},"model":{"$ref":"AAAAAAFF+71lysIEAmg="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+71lysIHvYA=","_parent":{"$ref":"AAAAAAFF+71lysIGbPQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-24,"top":240,"width":61,"height":12,"text":"«interface»"},{"_type":"LabelView","_id":"AAAAAAFF+71lysIIpIA=","_parent":{"$ref":"AAAAAAFF+71lysIGbPQ="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":581,"top":178,"width":92,"height":12,"text":"SuperInterface1"},{"_type":"LabelView","_id":"AAAAAAFF+71lysIJU80=","_parent":{"$ref":"AAAAAAFF+71lysIGbPQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-24,"top":240,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF+71lysIKd7I=","_parent":{"$ref":"AAAAAAFF+71lysIGbPQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-24,"top":240,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":576,"top":171,"width":102,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF+71lysIHvYA="},"nameLabel":{"$ref":"AAAAAAFF+71lysIIpIA="},"namespaceLabel":{"$ref":"AAAAAAFF+71lysIJU80="},"propertyLabel":{"$ref":"AAAAAAFF+71lysIKd7I="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+71ly8ILoag=","_parent":{"$ref":"AAAAAAFF+71lysIF4HE="},"model":{"$ref":"AAAAAAFF+71lysIEAmg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-16,"top":160,"width":10,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+71ly8IMVlo=","_parent":{"$ref":"AAAAAAFF+71lysIF4HE="},"model":{"$ref":"AAAAAAFF+71lysIEAmg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-16,"top":160,"width":10,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+71ly8INszE=","_parent":{"$ref":"AAAAAAFF+71lysIF4HE="},"model":{"$ref":"AAAAAAFF+71lysIEAmg="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-16,"top":160,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":576,"top":136,"width":102,"height":60,"stereotypeDisplay":"icon","nameCompartment":{"$ref":"AAAAAAFF+71lysIGbPQ="},"suppressAttributes":true,"suppressOperations":true,"attributeCompartment":{"$ref":"AAAAAAFF+71ly8ILoag="},"operationCompartment":{"$ref":"AAAAAAFF+71ly8IMVlo="},"templateParameterCompartment":{"$ref":"AAAAAAFF+71ly8INszE="}},{"_type":"UMLGeneralizationView","_id":"AAAAAAFF+72UrMJ1m0s=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+72UrMJ0uuE="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF+72UrMJ2phU=","_parent":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"model":{"$ref":"AAAAAAFF+72UrMJ0uuE="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":646,"top":217,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+72UrMJ33YE=","_parent":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"model":{"$ref":"AAAAAAFF+72UrMJ0uuE="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":633,"top":225,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+72UrMJ4cL8=","_parent":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"model":{"$ref":"AAAAAAFF+72UrMJ0uuE="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":671,"top":200,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+72UrMJ1m0s="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF+71lysIF4HE="},"tail":{"$ref":"AAAAAAFF8Icylm2wJuo="},"points":"672.9:235;646.77:196","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF+72UrMJ2phU="},"stereotypeLabel":{"$ref":"AAAAAAFF+72UrMJ33YE="},"propertyLabel":{"$ref":"AAAAAAFF+72UrMJ4cL8="}},{"_type":"UMLEnumerationView","_id":"AAAAAAFF+8W2xMdA0kI=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+8W2xMdB8Q4=","_parent":{"$ref":"AAAAAAFF+8W2xMdA0kI="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+8W2xMdCWbc=","_parent":{"$ref":"AAAAAAFF+8W2xMdB8Q4="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":629,"top":37,"width":83,"height":12,"text":"«enumeration»"},{"_type":"LabelView","_id":"AAAAAAFF+8W2xMdDyL0=","_parent":{"$ref":"AAAAAAFF+8W2xMdB8Q4="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":629,"top":51,"width":83,"height":12,"text":"Enumeration1"},{"_type":"LabelView","_id":"AAAAAAFF+8W2xMdEx/c=","_parent":{"$ref":"AAAAAAFF+8W2xMdB8Q4="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-84,"top":-12,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF+8W2xMdFw74=","_parent":{"$ref":"AAAAAAFF+8W2xMdB8Q4="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-84,"top":-12,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":624,"top":32,"width":93,"height":36,"stereotypeLabel":{"$ref":"AAAAAAFF+8W2xMdCWbc="},"nameLabel":{"$ref":"AAAAAAFF+8W2xMdDyL0="},"namespaceLabel":{"$ref":"AAAAAAFF+8W2xMdEx/c="},"propertyLabel":{"$ref":"AAAAAAFF+8W2xMdFw74="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+8W2xMdGSRQ=","_parent":{"$ref":"AAAAAAFF+8W2xMdA0kI="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-56,"top":-8,"width":10,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+8W2xMdHpGU=","_parent":{"$ref":"AAAAAAFF+8W2xMdA0kI="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-56,"top":-8,"width":10,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+8W2xcdIz84=","_parent":{"$ref":"AAAAAAFF+8W2xMdA0kI="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":-56,"top":-8,"width":10,"height":10},{"_type":"UMLEnumerationLiteralCompartmentView","_id":"AAAAAAFF+8W2xcdJviQ=","_parent":{"$ref":"AAAAAAFF+8W2xMdA0kI="},"model":{"$ref":"AAAAAAFF+8W2xMc//fI="},"subViews":[{"_type":"UMLEnumerationLiteralView","_id":"AAAAAAFF+8XGiMeJe0w=","_parent":{"$ref":"AAAAAAFF+8W2xcdJviQ="},"model":{"$ref":"AAAAAAFF+8XGdMeAM7s="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":629,"top":73,"width":83,"height":12,"text":"Literal1","horizontalAlignment":0},{"_type":"UMLEnumerationLiteralView","_id":"AAAAAAFF+8XYF8eujtM=","_parent":{"$ref":"AAAAAAFF+8W2xcdJviQ="},"model":{"$ref":"AAAAAAFF+8XYCMel55s="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":629,"top":87,"width":83,"height":12,"text":"Literal2","horizontalAlignment":0},{"_type":"UMLEnumerationLiteralView","_id":"AAAAAAFF+8Xi1MfN2Aw=","_parent":{"$ref":"AAAAAAFF+8W2xcdJviQ="},"model":{"$ref":"AAAAAAFF+8XizcfEeH8="},"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":629,"top":101,"width":83,"height":12,"text":"Literal3","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":624,"top":68,"width":93,"height":50}],"fillColor":"#ffffff","font":"Arial;12;0","left":624,"top":32,"width":93,"height":86,"nameCompartment":{"$ref":"AAAAAAFF+8W2xMdB8Q4="},"suppressAttributes":true,"suppressOperations":true,"attributeCompartment":{"$ref":"AAAAAAFF+8W2xMdGSRQ="},"operationCompartment":{"$ref":"AAAAAAFF+8W2xMdHpGU="},"templateParameterCompartment":{"$ref":"AAAAAAFF+8W2xcdIz84="},"enumerationLiteralCompartment":{"$ref":"AAAAAAFF+8W2xcdJviQ="}},{"_type":"UMLInterfaceView","_id":"AAAAAAFF+8gJIOU4Dng=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+8gJIOU3L3Q="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFF+8gJIeU5ZaQ=","_parent":{"$ref":"AAAAAAFF+8gJIOU4Dng="},"model":{"$ref":"AAAAAAFF+8gJIOU3L3Q="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFF+8gJIeU6ELo=","_parent":{"$ref":"AAAAAAFF+8gJIeU5ZaQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":-24,"width":61,"height":12,"text":"«interface»"},{"_type":"LabelView","_id":"AAAAAAFF+8gJIeU75R8=","_parent":{"$ref":"AAAAAAFF+8gJIeU5ZaQ="},"fillColor":"#ffffff","font":"Arial;12;1","parentStyle":true,"left":697,"top":174,"width":92,"height":12,"text":"SuperInterface2"},{"_type":"LabelView","_id":"AAAAAAFF+8gJIeU84/Q=","_parent":{"$ref":"AAAAAAFF+8gJIeU5ZaQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":-24,"width":89,"height":12,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFF+8gJIeU9o10=","_parent":{"$ref":"AAAAAAFF+8gJIeU5ZaQ="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":168,"top":-24,"height":12,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":692,"top":167,"width":102,"height":24,"stereotypeLabel":{"$ref":"AAAAAAFF+8gJIeU6ELo="},"nameLabel":{"$ref":"AAAAAAFF+8gJIeU75R8="},"namespaceLabel":{"$ref":"AAAAAAFF+8gJIeU84/Q="},"propertyLabel":{"$ref":"AAAAAAFF+8gJIeU9o10="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFF+8gJIeU+vls=","_parent":{"$ref":"AAAAAAFF+8gJIOU4Dng="},"model":{"$ref":"AAAAAAFF+8gJIOU3L3Q="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":112,"top":-16,"width":10,"height":10},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFF+8gJIuU/Rr0=","_parent":{"$ref":"AAAAAAFF+8gJIOU4Dng="},"model":{"$ref":"AAAAAAFF+8gJIOU3L3Q="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":112,"top":-16,"width":10,"height":10},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFF+8gJIuVA1Ho=","_parent":{"$ref":"AAAAAAFF+8gJIOU4Dng="},"model":{"$ref":"AAAAAAFF+8gJIOU3L3Q="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","parentStyle":true,"left":112,"top":-16,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;12;0","left":692,"top":132,"width":102,"height":60,"stereotypeDisplay":"icon","nameCompartment":{"$ref":"AAAAAAFF+8gJIeU5ZaQ="},"suppressAttributes":true,"suppressOperations":true,"attributeCompartment":{"$ref":"AAAAAAFF+8gJIeU+vls="},"operationCompartment":{"$ref":"AAAAAAFF+8gJIuU/Rr0="},"templateParameterCompartment":{"$ref":"AAAAAAFF+8gJIuVA1Ho="}},{"_type":"UMLGeneralizationView","_id":"AAAAAAFF+8hGt+YXPb4=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFF+8hGt+YW0i0="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFF+8hGt+YY5oc=","_parent":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"model":{"$ref":"AAAAAAFF+8hGt+YW0i0="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":703,"top":200,"height":12,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+8hGuOYZ5dg=","_parent":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"model":{"$ref":"AAAAAAFF+8hGt+YW0i0="},"visible":null,"fillColor":"#ffffff","font":"Arial;12;0","left":690,"top":193,"height":12,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFF+8hGuOYac3U=","_parent":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"model":{"$ref":"AAAAAAFF+8hGt+YW0i0="},"visible":false,"fillColor":"#ffffff","font":"Arial;12;0","left":730,"top":213,"height":12,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFF+8hGt+YXPb4="},"edgePosition":1}],"fillColor":"#ffffff","font":"Arial;12;0","head":{"$ref":"AAAAAAFF+8gJIOU4Dng="},"tail":{"$ref":"AAAAAAFF8Icylm2wJuo="},"points":"707.1346153846154:235;727.3942307692307:192","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFF+8hGt+YY5oc="},"stereotypeLabel":{"$ref":"AAAAAAFF+8hGuOYZ5dg="},"propertyLabel":{"$ref":"AAAAAAFF+8hGuOYac3U="}},{"_type":"UMLAssociationView","_id":"AAAAAAFHtFufG0o4ryM=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"subViews":[{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo5JmU=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":385,"top":314,"height":13,"alpha":1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo6nGs=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"visible":null,"fillColor":"#ffffff","font":"Arial;13;0","left":370,"top":314,"height":13,"alpha":1.5707963267948966,"distance":30,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo77X8=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":414,"top":315,"height":13,"alpha":-1.5707963267948966,"distance":15,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":1},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo8Evk=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o2XV4="},"fillColor":"#ffffff","font":"Arial;13;0","left":327,"top":339,"width":98,"height":13,"alpha":-5.107180103085962,"distance":26,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":2,"text":"+unorderedItems"},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo9XeA=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o2XV4="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":371,"top":321,"height":13,"alpha":0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":2},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo+iQY=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o2XV4="},"fillColor":"#ffffff","font":"Arial;13;0","left":380,"top":323,"width":5,"height":13,"alpha":-5.677640758647128,"distance":31.622776601683793,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="},"edgePosition":2,"text":"*"},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEo/I8k=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o3QL0="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":385,"top":306,"height":13,"alpha":-0.5235987755982988,"distance":30,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="}},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEpAwew=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o3QL0="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":371,"top":309,"height":13,"alpha":-0.7853981633974483,"distance":40,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="}},{"_type":"EdgeLabelView","_id":"AAAAAAFHtFufHEpBqaU=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o3QL0="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","left":412,"top":302,"height":13,"alpha":0.5235987755982988,"distance":25,"hostEdge":{"$ref":"AAAAAAFHtFufG0o4ryM="}},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFHtFufHEpCMdg=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o2XV4="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"width":10,"height":10},{"_type":"UMLQualifierCompartmentView","_id":"AAAAAAFHtFufHEpDysk=","_parent":{"$ref":"AAAAAAFHtFufG0o4ryM="},"model":{"$ref":"AAAAAAFHtFufG0o3QL0="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;13;0","head":{"$ref":"AAAAAAFF8IcE0G1og04="},"tail":{"$ref":"AAAAAAFF+ZqVxVGSV0I="},"lineStyle":0,"points":"400:356;400:287","showVisibility":true,"nameLabel":{"$ref":"AAAAAAFHtFufHEo5JmU="},"stereotypeLabel":{"$ref":"AAAAAAFHtFufHEo6nGs="},"propertyLabel":{"$ref":"AAAAAAFHtFufHEo77X8="},"tailRoleNameLabel":{"$ref":"AAAAAAFHtFufHEo8Evk="},"tailPropertyLabel":{"$ref":"AAAAAAFHtFufHEo9XeA="},"tailMultiplicityLabel":{"$ref":"AAAAAAFHtFufHEo+iQY="},"headRoleNameLabel":{"$ref":"AAAAAAFHtFufHEo/I8k="},"headPropertyLabel":{"$ref":"AAAAAAFHtFufHEpAwew="},"headMultiplicityLabel":{"$ref":"AAAAAAFHtFufHEpBqaU="},"tailQualifiersCompartment":{"$ref":"AAAAAAFHtFufHEpCMdg="},"headQualifiersCompartment":{"$ref":"AAAAAAFHtFufHEpDysk="}},{"_type":"UMLClassView","_id":"AAAAAAFHyP51nSsyY0s=","_parent":{"$ref":"AAAAAAFF8IYa8WzeRC4="},"model":{"$ref":"AAAAAAFHyP51nCsxXGA="},"subViews":[{"_type":"UMLNameCompartmentView","_id":"AAAAAAFHyP51nSszt2w=","_parent":{"$ref":"AAAAAAFHyP51nSsyY0s="},"model":{"$ref":"AAAAAAFHyP51nCsxXGA="},"subViews":[{"_type":"LabelView","_id":"AAAAAAFHyP51nSs0krM=","_parent":{"$ref":"AAAAAAFHyP51nSszt2w="},"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":45,"top":417,"width":210,"height":13,"text":"«annotationType»"},{"_type":"LabelView","_id":"AAAAAAFHyP51nSs1O4U=","_parent":{"$ref":"AAAAAAFHyP51nSszt2w="},"fillColor":"#ffffff","font":"Arial;13;1","parentStyle":true,"left":45,"top":432,"width":210,"height":13,"text":"AnnotationTest"},{"_type":"LabelView","_id":"AAAAAAFHyP51nSs2Ue0=","_parent":{"$ref":"AAAAAAFHyP51nSszt2w="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":-84,"top":-96,"width":94,"height":13,"text":"(from package1)"},{"_type":"LabelView","_id":"AAAAAAFHyP51nSs34/Q=","_parent":{"$ref":"AAAAAAFHyP51nSszt2w="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":-84,"top":-96,"height":13,"horizontalAlignment":1}],"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":40,"top":412,"width":220,"height":38,"stereotypeLabel":{"$ref":"AAAAAAFHyP51nSs0krM="},"nameLabel":{"$ref":"AAAAAAFHyP51nSs1O4U="},"namespaceLabel":{"$ref":"AAAAAAFHyP51nSs2Ue0="},"propertyLabel":{"$ref":"AAAAAAFHyP51nSs34/Q="}},{"_type":"UMLAttributeCompartmentView","_id":"AAAAAAFHyP51nSs49zw=","_parent":{"$ref":"AAAAAAFHyP51nSsyY0s="},"model":{"$ref":"AAAAAAFHyP51nCsxXGA="},"subViews":[{"_type":"UMLAttributeView","_id":"AAAAAAFHyQfSAiwGa8M=","_parent":{"$ref":"AAAAAAFHyP51nSs49zw="},"model":{"$ref":"AAAAAAFHyQfR+Cv6DyI="},"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":45,"top":455,"width":210,"height":13,"text":"+annotationField1: int = 100","horizontalAlignment":0},{"_type":"UMLAttributeView","_id":"AAAAAAFHyQildSywss8=","_parent":{"$ref":"AAAAAAFHyP51nSs49zw="},"model":{"$ref":"AAAAAAFHyQilbCykWDE="},"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":45,"top":470,"width":210,"height":13,"text":"+annotationField2: int = 200","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":40,"top":450,"width":220,"height":38},{"_type":"UMLOperationCompartmentView","_id":"AAAAAAFHyP51nSs56VI=","_parent":{"$ref":"AAAAAAFHyP51nSsyY0s="},"model":{"$ref":"AAAAAAFHyP51nCsxXGA="},"subViews":[{"_type":"UMLOperationView","_id":"AAAAAAFHyQjFaS0INc0=","_parent":{"$ref":"AAAAAAFHyP51nSs56VI="},"model":{"$ref":"AAAAAAFHyQjFXiz8zcc="},"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":45,"top":493,"width":210,"height":13,"text":"+author(): String","horizontalAlignment":0},{"_type":"UMLOperationView","_id":"AAAAAAFHyQjrAi2EFug=","_parent":{"$ref":"AAAAAAFHyP51nSs56VI="},"model":{"$ref":"AAAAAAFHyQjq+y14okc="},"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":45,"top":508,"width":210,"height":13,"text":"+date(): String","horizontalAlignment":0}],"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":40,"top":488,"width":220,"height":38},{"_type":"UMLTemplateParameterCompartmentView","_id":"AAAAAAFHyP51nSs6sTA=","_parent":{"$ref":"AAAAAAFHyP51nSsyY0s="},"model":{"$ref":"AAAAAAFHyP51nCsxXGA="},"visible":false,"fillColor":"#ffffff","font":"Arial;13;0","parentStyle":true,"left":-56,"top":-64,"width":10,"height":10}],"fillColor":"#ffffff","font":"Arial;13;0","left":40,"top":412,"width":220,"height":114,"nameCompartment":{"$ref":"AAAAAAFHyP51nSszt2w="},"attributeCompartment":{"$ref":"AAAAAAFHyP51nSs49zw="},"operationCompartment":{"$ref":"AAAAAAFHyP51nSs56VI="},"templateParameterCompartment":{"$ref":"AAAAAAFHyP51nSs6sTA="}}]},{"_type":"UMLClass","_id":"AAAAAAFF8IY3RWzik2A=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Class1","ownedElements":[{"_type":"UMLClass","_id":"AAAAAAFF+hk0VMqTrv4=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"InnerClass","attributes":[{"_type":"UMLAttribute","_id":"AAAAAAFF+hl2YMseKZ0=","_parent":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"name":"Attribute1","type":"String"}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFF+hmWdMtDXYk=","_parent":{"$ref":"AAAAAAFF+hk0VMqTrv4="},"name":"Operation1","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFHs/y3BxZTNM0=","_parent":{"$ref":"AAAAAAFF+hmWdMtDXYk="},"type":"String","direction":"return"}]}]}],"documentation":"This Class1's documentation\nThis is second line of documentation\nThis is third line of documentation\n","attributes":[{"_type":"UMLAttribute","_id":"AAAAAAFF+W+3yDh6/CA=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"Attribute1","documentation":"This is attribute documentation","type":"String","defaultValue":"\"DEFAULT_STRING\""},{"_type":"UMLAttribute","_id":"AAAAAAFF+ZjWz1GHi1w=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"StaticVariable","isStatic":true,"type":{"$ref":"AAAAAAFF8IcEz21nWVg="}},{"_type":"UMLAttribute","_id":"AAAAAAFF+bhoXyI2PkY=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"IntArray","type":"Integer","multiplicity":"100"},{"_type":"UMLAttribute","_id":"AAAAAAFF+bky4SL5r4M=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"StringList","type":"String","multiplicity":"0..*"},{"_type":"UMLAttribute","_id":"AAAAAAFF+b8kSobXncI=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"StaticFinalVar","isStatic":true,"isLeaf":true,"type":"Boolean","defaultValue":"false"},{"_type":"UMLAttribute","_id":"AAAAAAFF+8R/4sXUSCo=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"PrivateAttribute","visibility":"private","type":"Object"},{"_type":"UMLAttribute","_id":"AAAAAAFF+8TKTMYwPH4=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"ProtectedAttribute","visibility":"protected","type":"String"}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFF+XErBjiBsWU=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"Operation1","documentation":"This is operation documentation","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFF+cIydYexAxI=","_parent":{"$ref":"AAAAAAFF+XErBjiBsWU="},"documentation":"The return parameter","type":"Boolean","direction":"return"},{"_type":"UMLParameter","_id":"AAAAAAFF+cm3pIgyE50=","_parent":{"$ref":"AAAAAAFF+XErBjiBsWU="},"name":"Arg1","documentation":"The first argument","type":"Integer","isReadOnly":true},{"_type":"UMLParameter","_id":"AAAAAAFF+cm3pYgzIrI=","_parent":{"$ref":"AAAAAAFF+XErBjiBsWU="},"name":"Arg2","documentation":"The second argument","type":"String"}]},{"_type":"UMLOperation","_id":"AAAAAAFF+8QlVMV4Go4=","_parent":{"$ref":"AAAAAAFF8IY3RWzik2A="},"name":"AbstractOperation","isAbstract":true}]},{"_type":"UMLInterface","_id":"AAAAAAFF8IZDVW0HciI=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Interface1","attributes":[{"_type":"UMLAttribute","_id":"AAAAAAFF+8MSo8OeeCM=","_parent":{"$ref":"AAAAAAFF8IZDVW0HciI="},"name":"Attribute1","type":"int","defaultValue":"100"}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFF+8NnU8QMHKM=","_parent":{"$ref":"AAAAAAFF8IZDVW0HciI="},"name":"Operation2","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFF+8O7bcQrZrM=","_parent":{"$ref":"AAAAAAFF+8NnU8QMHKM="},"name":"arg1","type":"String"},{"_type":"UMLParameter","_id":"AAAAAAFF+8O7bcQstXw=","_parent":{"$ref":"AAAAAAFF+8NnU8QMHKM="},"name":"arg2","type":"Integer"},{"_type":"UMLParameter","_id":"AAAAAAFF+8O7bsQtssc=","_parent":{"$ref":"AAAAAAFF+8NnU8QMHKM="},"type":"Object","direction":"return"}]}]},{"_type":"UMLClass","_id":"AAAAAAFF8IaVwm0vD2c=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"AbstractClass1","ownedElements":[{"_type":"UMLGeneralization","_id":"AAAAAAFF8IahYm1UT3g=","_parent":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"source":{"$ref":"AAAAAAFF8IaVwm0vD2c="},"target":{"$ref":"AAAAAAFF8IY3RWzik2A="}}],"isAbstract":true},{"_type":"UMLClass","_id":"AAAAAAFF8IcEz21nWVg=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Collection","ownedElements":[{"_type":"UMLGeneralization","_id":"AAAAAAFF8IcWOm2NEHU=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"source":{"$ref":"AAAAAAFF8IcEz21nWVg="},"target":{"$ref":"AAAAAAFF8IY3RWzik2A="}},{"_type":"UMLInterfaceRealization","_id":"AAAAAAFF8Ichh22ebss=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"source":{"$ref":"AAAAAAFF8IcEz21nWVg="},"target":{"$ref":"AAAAAAFF8IZDVW0HciI="}},{"_type":"UMLInterfaceRealization","_id":"AAAAAAFF8IdB5m3UfCk=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"source":{"$ref":"AAAAAAFF8IcEz21nWVg="},"target":{"$ref":"AAAAAAFF8Icylm2vpFY="}},{"_type":"UMLAssociation","_id":"AAAAAAFF+aNsrnXfbqI=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"end1":{"_type":"UMLAssociationEnd","_id":"AAAAAAFF+aNsrnXgbmo=","_parent":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"reference":{"$ref":"AAAAAAFF8IcEz21nWVg="}},"end2":{"_type":"UMLAssociationEnd","_id":"AAAAAAFF+aNsrnXhVro=","_parent":{"$ref":"AAAAAAFF+aNsrnXfbqI="},"reference":{"$ref":"AAAAAAFF+aMrTHWeP30="},"navigable":false}}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFHs+jwTmEIu5k=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"name":"AbstractOperation"},{"_type":"UMLOperation","_id":"AAAAAAFHs/KdOWGzDSY=","_parent":{"$ref":"AAAAAAFF8IcEz21nWVg="},"name":"Operation2","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFHs/KjamHMpck=","_parent":{"$ref":"AAAAAAFHs/KdOWGzDSY="},"name":"arg1","type":"String"},{"_type":"UMLParameter","_id":"AAAAAAFHs/KjamHNpB8=","_parent":{"$ref":"AAAAAAFHs/KdOWGzDSY="},"name":"arg2","type":"Integer"},{"_type":"UMLParameter","_id":"AAAAAAFHs/Kja2HOQXA=","_parent":{"$ref":"AAAAAAFHs/KdOWGzDSY="},"type":"Object","direction":"return"}]}]},{"_type":"UMLInterface","_id":"AAAAAAFF8Icylm2vpFY=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"SubInterface","ownedElements":[{"_type":"UMLGeneralization","_id":"AAAAAAFF+72UrMJ0uuE=","_parent":{"$ref":"AAAAAAFF8Icylm2vpFY="},"source":{"$ref":"AAAAAAFF8Icylm2vpFY="},"target":{"$ref":"AAAAAAFF+71lysIEAmg="}},{"_type":"UMLGeneralization","_id":"AAAAAAFF+8hGt+YW0i0=","_parent":{"$ref":"AAAAAAFF8Icylm2vpFY="},"source":{"$ref":"AAAAAAFF8Icylm2vpFY="},"target":{"$ref":"AAAAAAFF+8gJIOU3L3Q="}}]},{"_type":"UMLClass","_id":"AAAAAAFF+ZqVxVGRY8A=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Item","ownedElements":[{"_type":"UMLAssociation","_id":"AAAAAAFF+ZrZgFG6qZY=","_parent":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"end1":{"_type":"UMLAssociationEnd","_id":"AAAAAAFF+ZrZgFG7W0k=","_parent":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"name":"items","reference":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"multiplicity":"0..*","isOrdered":true},"end2":{"_type":"UMLAssociationEnd","_id":"AAAAAAFF+ZrZgFG8sxs=","_parent":{"$ref":"AAAAAAFF+ZrZgFG6qZY="},"reference":{"$ref":"AAAAAAFF8IcEz21nWVg="},"aggregation":"composite"}},{"_type":"UMLAssociation","_id":"AAAAAAFHtFufG0o1Mpk=","_parent":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"end1":{"_type":"UMLAssociationEnd","_id":"AAAAAAFHtFufG0o2XV4=","_parent":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"name":"unorderedItems","reference":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"multiplicity":"*"},"end2":{"_type":"UMLAssociationEnd","_id":"AAAAAAFHtFufG0o3QL0=","_parent":{"$ref":"AAAAAAFHtFufG0o1Mpk="},"reference":{"$ref":"AAAAAAFF8IcEz21nWVg="},"aggregation":"shared"}}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFHyQ8pni6H6OE=","_parent":{"$ref":"AAAAAAFF+ZqVxVGRY8A="},"name":"Operation1","concurrency":"concurrent"}],"isLeaf":true},{"_type":"UMLClass","_id":"AAAAAAFF+aMrTHWeP30=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"NotNavigableItem"},{"_type":"UMLInterface","_id":"AAAAAAFF+71lysIEAmg=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"SuperInterface1"},{"_type":"UMLEnumeration","_id":"AAAAAAFF+8W2xMc//fI=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"Enumeration1","literals":[{"_type":"UMLEnumerationLiteral","_id":"AAAAAAFF+8XGdMeAM7s=","_parent":{"$ref":"AAAAAAFF+8W2xMc//fI="},"name":"Literal1"},{"_type":"UMLEnumerationLiteral","_id":"AAAAAAFF+8XYCMel55s=","_parent":{"$ref":"AAAAAAFF+8W2xMc//fI="},"name":"Literal2"},{"_type":"UMLEnumerationLiteral","_id":"AAAAAAFF+8XizcfEeH8=","_parent":{"$ref":"AAAAAAFF+8W2xMc//fI="},"name":"Literal3"}]},{"_type":"UMLInterface","_id":"AAAAAAFF+8gJIOU3L3Q=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"SuperInterface2"},{"_type":"UMLClass","_id":"AAAAAAFHyP51nCsxXGA=","_parent":{"$ref":"AAAAAAFF8Hu5LWyFBNo="},"name":"AnnotationTest","stereotype":"annotationType","attributes":[{"_type":"UMLAttribute","_id":"AAAAAAFHyQfR+Cv6DyI=","_parent":{"$ref":"AAAAAAFHyP51nCsxXGA="},"name":"annotationField1","type":"int ","defaultValue":"100"},{"_type":"UMLAttribute","_id":"AAAAAAFHyQilbCykWDE=","_parent":{"$ref":"AAAAAAFHyP51nCsxXGA="},"name":"annotationField2","type":"int ","defaultValue":"200"}],"operations":[{"_type":"UMLOperation","_id":"AAAAAAFHyQjFXiz8zcc=","_parent":{"$ref":"AAAAAAFHyP51nCsxXGA="},"name":"author","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFHyRNu4Z7jDAw=","_parent":{"$ref":"AAAAAAFHyQjFXiz8zcc="},"type":"String","direction":"return"}]},{"_type":"UMLOperation","_id":"AAAAAAFHyQjq+y14okc=","_parent":{"$ref":"AAAAAAFHyP51nCsxXGA="},"name":"date","parameters":[{"_type":"UMLParameter","_id":"AAAAAAFHyRN+mp8TXaw=","_parent":{"$ref":"AAAAAAFHyQjq+y14okc="},"type":"String","direction":"return"}]}]}]}]}]}]}],"author":"Minkyu Lee"} \ No newline at end of file From 8ba324f0e2a15ee03b13810f150a67ae65b86e7c Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Mon, 28 Mar 2022 15:28:21 +0900 Subject: [PATCH 16/18] Update README --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b4c0f28..79a0347 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ This extension for StarUML(http://staruml.io) support to generate Java code from UML model and to reverse Java code to UML model. Install this extension from Extension Manager of StarUML. -> :warning: **Note** -> This extensions do not provide perfect reverse engineering which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools. +> :warning: This extensions do not provide perfect reverse engineering which is a test and temporal feature. If you need a complete reverse engineering feature, please check other professional reverse engineering tools. -> :warning: **Note** -> This extension is based on Java 1.7 Specification. +> :white_check_mark: This extension is based on Java 1.7 Specification. ## Java Code Generation From 870d644d69c89f9d98bca5d0ba65647d09319d60 Mon Sep 17 00:00:00 2001 From: Minkyu Lee Date: Wed, 7 Aug 2024 11:50:01 +0900 Subject: [PATCH 17/18] Fix for async dialogs --- code-analyzer.js | 1081 +++++++++++++++++++++++++-------------------- code-generator.js | 1022 ++++++++++++++++++++++++++---------------- codegen-utils.js | 29 +- main.js | 113 +++-- package.json | 4 +- 5 files changed, 1322 insertions(+), 927 deletions(-) diff --git a/code-analyzer.js b/code-analyzer.js index 0146bb9..e9045d8 100644 --- a/code-analyzer.js +++ b/code-analyzer.js @@ -21,132 +21,133 @@ * */ -const fs = require('fs') -const path = require('path') -const java7 = require('./grammar/java7') +const fs = require("fs"); +const path = require("path"); +const java7 = require("./grammar/java7"); // Java Primitive Types var javaPrimitiveTypes = [ - 'void', - 'byte', - 'short', - 'int', - 'long', - 'float', - 'double', - 'boolean', - 'char', - 'Byte', - 'Double', - 'Float', - 'Integer', - 'Long', - 'Short', - 'String', - 'Character', - 'java.lang.Byte', - 'java.lang.Double', - 'java.lang.Float', - 'java.lang.Integer', - 'java.lang.Long', - 'java.lang.Short', - 'java.lang.String', - 'java.lang.Character' -] + "void", + "byte", + "short", + "int", + "long", + "float", + "double", + "boolean", + "char", + "Byte", + "Double", + "Float", + "Integer", + "Long", + "Short", + "String", + "Character", + "java.lang.Byte", + "java.lang.Double", + "java.lang.Float", + "java.lang.Integer", + "java.lang.Long", + "java.lang.Short", + "java.lang.String", + "java.lang.Character", +]; // Java Collection Types var javaCollectionTypes = [ - 'Collection', - 'Set', - 'SortedSet', - 'NavigableSet', - 'HashSet', - 'TreeSet', - 'LinkedHashSet', - 'List', - 'ArrayList', - 'LinkedList', - 'Deque', - 'ArrayDeque', - 'Queue' -] + "Collection", + "Set", + "SortedSet", + "NavigableSet", + "HashSet", + "TreeSet", + "LinkedHashSet", + "List", + "ArrayList", + "LinkedList", + "Deque", + "ArrayDeque", + "Queue", +]; // Java Collection Types (full names) -var javaUtilCollectionTypes = javaCollectionTypes.map(c => { return 'java.util.' + c }) +var javaUtilCollectionTypes = javaCollectionTypes.map((c) => { + return "java.util." + c; +}); /** * Java Code Analyzer */ class JavaCodeAnalyzer { - /** * @constructor */ - constructor () { + constructor() { /** @member {type.UMLModel} */ - this._root = new type.UMLModel() - this._root.name = 'JavaReverse' + this._root = new type.UMLModel(); + this._root.name = "JavaReverse"; /** @member {Array.} */ - this._files = [] + this._files = []; /** @member {Object} */ - this._currentCompilationUnit = null + this._currentCompilationUnit = null; /** * @member {{classifier:type.UMLClassifier, node: Object, kind:string}} */ - this._extendPendings = [] + this._extendPendings = []; /** * @member {{classifier:type.UMLClassifier, node: Object}} */ - this._implementPendings = [] + this._implementPendings = []; /** * @member {{classifier:type.UMLClassifier, association: type.UMLAssociation, node: Object}} */ - this._associationPendings = [] + this._associationPendings = []; /** * @member {{operation:type.UMLOperation, node: Object}} */ - this._throwPendings = [] + this._throwPendings = []; /** * @member {{namespace:type.UMLModelElement, feature:type.UMLStructuralFeature, node: Object}} */ - this._typedFeaturePendings = [] + this._typedFeaturePendings = []; } /** * Add File to Reverse Engineer * @param {File} file */ - addFile (file) { - this._files.push(file) + addFile(file) { + this._files.push(file); } /** * Analyze all files. * @param {Object} options */ - analyze (options) { + analyze(options) { // Perform 1st Phase - this.performFirstPhase(options) + this.performFirstPhase(options); // Perform 2nd Phase - this.performSecondPhase(options) + this.performSecondPhase(options); // Load To Project - var writer = new app.repository.Writer() - writer.writeObj('data', this._root) - var json = writer.current.data - app.project.importFromJson(app.project.getProject(), json) + var writer = new app.repository.Writer(); + writer.writeObj("data", this._root); + var json = writer.current.data; + app.project.importFromJson(app.project.getProject(), json); // Generate Diagrams - this.generateDiagrams(options) - console.log('[Java] done.') + this.generateDiagrams(options); + console.log("[Java] done."); } /** @@ -155,23 +156,23 @@ class JavaCodeAnalyzer { * * @param {Object} options */ - performFirstPhase (options) { - this._files.forEach(file => { - var data = fs.readFileSync(file, 'utf8') + performFirstPhase(options) { + this._files.forEach((file) => { + var data = fs.readFileSync(file, "utf8"); try { /* Not processing empty file @author Rtfsc8(rtfsc8@rtfsc8.top) */ if (!!!data) { - return; + return; } - var ast = java7.parse(data) - this._currentCompilationUnit = ast - this._currentCompilationUnit.file = file - this.translateCompilationUnit(options, this._root, ast) + var ast = java7.parse(data); + this._currentCompilationUnit = ast; + this._currentCompilationUnit.file = file; + this.translateCompilationUnit(options, this._root, ast); } catch (ex) { - console.error('[Java] Failed to parse - ' + file) - console.error(ex) + console.error("[Java] Failed to parse - " + file); + console.error(ex); } - }) + }); } /** @@ -183,170 +184,235 @@ class JavaCodeAnalyzer { * * @param {Object} options */ - performSecondPhase (options) { - var i, len, j, len2, _typeName, _type, _itemTypeName, _itemType, _pathName + performSecondPhase(options) { + var i, len, j, len2, _typeName, _type, _itemTypeName, _itemType, _pathName; // Create Generalizations // if super type not found, create a Class correspond to the super type. for (i = 0, len = this._extendPendings.length; i < len; i++) { - var _extend = this._extendPendings[i] - _typeName = _extend.node.qualifiedName.name - - _type = this._findType(_extend.classifier, _typeName, _extend.compilationUnitNode) + var _extend = this._extendPendings[i]; + _typeName = _extend.node.qualifiedName.name; + + _type = this._findType( + _extend.classifier, + _typeName, + _extend.compilationUnitNode, + ); if (!_type) { - _pathName = this._toPathName(_typeName) - if (_extend.kind === 'interface') { - _type = this._ensureInterface(this._root, _pathName) + _pathName = this._toPathName(_typeName); + if (_extend.kind === "interface") { + _type = this._ensureInterface(this._root, _pathName); } else { - _type = this._ensureClass(this._root, _pathName) + _type = this._ensureClass(this._root, _pathName); } } - var generalization = new type.UMLGeneralization() - generalization._parent = _extend.classifier - generalization.source = _extend.classifier - generalization.target = _type - _extend.classifier.ownedElements.push(generalization) + var generalization = new type.UMLGeneralization(); + generalization._parent = _extend.classifier; + generalization.source = _extend.classifier; + generalization.target = _type; + _extend.classifier.ownedElements.push(generalization); } // Create InterfaceRealizations // if super interface not found, create a Interface correspond to the super interface for (i = 0, len = this._implementPendings.length; i < len; i++) { - var _implement = this._implementPendings[i] - _typeName = _implement.node.qualifiedName.name - _type = this._findType(_implement.classifier, _typeName, _implement.compilationUnitNode) + var _implement = this._implementPendings[i]; + _typeName = _implement.node.qualifiedName.name; + _type = this._findType( + _implement.classifier, + _typeName, + _implement.compilationUnitNode, + ); if (!_type) { - _pathName = this._toPathName(_typeName) - _type = this._ensureInterface(this._root, _pathName) + _pathName = this._toPathName(_typeName); + _type = this._ensureInterface(this._root, _pathName); } - var realization = new type.UMLInterfaceRealization() - realization._parent = _implement.classifier - realization.source = _implement.classifier - realization.target = _type - _implement.classifier.ownedElements.push(realization) + var realization = new type.UMLInterfaceRealization(); + realization._parent = _implement.classifier; + realization.source = _implement.classifier; + realization.target = _type; + _implement.classifier.ownedElements.push(realization); } // Create Associations for (i = 0, len = this._associationPendings.length; i < len; i++) { - var _asso = this._associationPendings[i] - _typeName = _asso.node.type.qualifiedName.name - _type = this._findType(_asso.classifier, _typeName, _asso.node.compilationUnitNode) - _itemTypeName = this._isGenericCollection(_asso.node.type, _asso.node.compilationUnitNode) + var _asso = this._associationPendings[i]; + _typeName = _asso.node.type.qualifiedName.name; + _type = this._findType( + _asso.classifier, + _typeName, + _asso.node.compilationUnitNode, + ); + _itemTypeName = this._isGenericCollection( + _asso.node.type, + _asso.node.compilationUnitNode, + ); if (_itemTypeName) { - _itemType = this._findType(_asso.classifier, _itemTypeName, _asso.node.compilationUnitNode) + _itemType = this._findType( + _asso.classifier, + _itemTypeName, + _asso.node.compilationUnitNode, + ); } else { - _itemType = null + _itemType = null; } // if type found, add as Association if (_type || _itemType) { for (j = 0, len2 = _asso.node.variables.length; j < len2; j++) { - var variableNode = _asso.node.variables[j] + var variableNode = _asso.node.variables[j]; // Create Association - var association = new type.UMLAssociation() - association._parent = _asso.classifier - _asso.classifier.ownedElements.push(association) + var association = new type.UMLAssociation(); + association._parent = _asso.classifier; + _asso.classifier.ownedElements.push(association); // Set End1 - association.end1.reference = _asso.classifier - association.end1.name = '' - association.end1.visibility = type.UMLModelElement.VK_PACKAGE - association.end1.navigable = false + association.end1.reference = _asso.classifier; + association.end1.name = ""; + association.end1.visibility = type.UMLModelElement.VK_PACKAGE; + association.end1.navigable = false; // Set End2 if (_itemType) { - association.end2.reference = _itemType - association.end2.multiplicity = '*' - this._addTag(association.end2, type.Tag.TK_STRING, 'collection', _asso.node.type.qualifiedName.name) + association.end2.reference = _itemType; + association.end2.multiplicity = "*"; + this._addTag( + association.end2, + type.Tag.TK_STRING, + "collection", + _asso.node.type.qualifiedName.name, + ); } else { - association.end2.reference = _type + association.end2.reference = _type; } - association.end2.name = variableNode.name - association.end2.visibility = this._getVisibility(_asso.node.modifiers) - association.end2.navigable = true + association.end2.name = variableNode.name; + association.end2.visibility = this._getVisibility( + _asso.node.modifiers, + ); + association.end2.navigable = true; // Final Modifier - if (_asso.node.modifiers && _asso.node.modifiers.includes('final')) { - association.end2.isReadOnly = true + if (_asso.node.modifiers && _asso.node.modifiers.includes("final")) { + association.end2.isReadOnly = true; } // Static Modifier - if (_asso.node.modifiers && _asso.node.modifiers.includes('static')) { - this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'static', true) + if (_asso.node.modifiers && _asso.node.modifiers.includes("static")) { + this._addTag(association.end2, type.Tag.TK_BOOLEAN, "static", true); } // Volatile Modifier - if (_asso.node.modifiers && _asso.node.modifiers.includes('volatile')) { - this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'volatile', true) + if ( + _asso.node.modifiers && + _asso.node.modifiers.includes("volatile") + ) { + this._addTag( + association.end2, + type.Tag.TK_BOOLEAN, + "volatile", + true, + ); } // Transient Modifier - if (_asso.node.modifiers && _asso.node.modifiers.includes('transient')) { - this._addTag(association.end2, type.Tag.TK_BOOLEAN, 'transient', true) + if ( + _asso.node.modifiers && + _asso.node.modifiers.includes("transient") + ) { + this._addTag( + association.end2, + type.Tag.TK_BOOLEAN, + "transient", + true, + ); } } // if type not found, add as Attribute } else { - this.translateFieldAsAttribute(options, _asso.classifier, _asso.node) + this.translateFieldAsAttribute(options, _asso.classifier, _asso.node); } } // Assign Throws to Operations for (i = 0, len = this._throwPendings.length; i < len; i++) { - var _throw = this._throwPendings[i] - _typeName = _throw.node.name - _type = this._findType(_throw.operation, _typeName, _throw.compilationUnitNode) + var _throw = this._throwPendings[i]; + _typeName = _throw.node.name; + _type = this._findType( + _throw.operation, + _typeName, + _throw.compilationUnitNode, + ); if (!_type) { - _pathName = this._toPathName(_typeName) - _type = this._ensureClass(this._root, _pathName) + _pathName = this._toPathName(_typeName); + _type = this._ensureClass(this._root, _pathName); } - _throw.operation.raisedExceptions.push(_type) + _throw.operation.raisedExceptions.push(_type); } // Resolve Type References for (i = 0, len = this._typedFeaturePendings.length; i < len; i++) { - var _typedFeature = this._typedFeaturePendings[i] + var _typedFeature = this._typedFeaturePendings[i]; //Fix bug: some reverse code error like qualifiedName attribute undefined if (!!!_typedFeature.node.type.qualifiedName) { continue; } - _typeName = _typedFeature.node.type.qualifiedName.name + _typeName = _typedFeature.node.type.qualifiedName.name; // Find type and assign - _type = this._findType(_typedFeature.namespace, _typeName, _typedFeature.node.compilationUnitNode) + _type = this._findType( + _typedFeature.namespace, + _typeName, + _typedFeature.node.compilationUnitNode, + ); // if type is exists if (_type) { - _typedFeature.feature.type = _type + _typedFeature.feature.type = _type; // if type is not exists } else { // if type is generic collection type (e.g. java.util.List) - _itemTypeName = this._isGenericCollection(_typedFeature.node.type, _typedFeature.node.compilationUnitNode) + _itemTypeName = this._isGenericCollection( + _typedFeature.node.type, + _typedFeature.node.compilationUnitNode, + ); if (_itemTypeName) { - _typeName = _itemTypeName - _typedFeature.feature.multiplicity = '*' - this._addTag(_typedFeature.feature, type.Tag.TK_STRING, 'collection', _typedFeature.node.type.qualifiedName.name) + _typeName = _itemTypeName; + _typedFeature.feature.multiplicity = "*"; + this._addTag( + _typedFeature.feature, + type.Tag.TK_STRING, + "collection", + _typedFeature.node.type.qualifiedName.name, + ); } // if type is primitive type if (javaPrimitiveTypes.includes(_typeName)) { - _typedFeature.feature.type = _typeName + _typedFeature.feature.type = _typeName; // otherwise } else { - _pathName = this._toPathName(_typeName) - var _newClass = this._ensureClass(this._root, _pathName) - _typedFeature.feature.type = _newClass + _pathName = this._toPathName(_typeName); + var _newClass = this._ensureClass(this._root, _pathName); + _typedFeature.feature.type = _newClass; } } // Translate type's arrayDimension to multiplicity - if (_typedFeature.node.type.arrayDimension && _typedFeature.node.type.arrayDimension.length > 0) { - var _dim = [] - for (j = 0, len2 = _typedFeature.node.type.arrayDimension.length; j < len2; j++) { - _dim.push('*') + if ( + _typedFeature.node.type.arrayDimension && + _typedFeature.node.type.arrayDimension.length > 0 + ) { + var _dim = []; + for ( + j = 0, len2 = _typedFeature.node.type.arrayDimension.length; + j < len2; + j++ + ) { + _dim.push("*"); } - _typedFeature.feature.multiplicity = _dim.join(',') + _typedFeature.feature.multiplicity = _dim.join(","); } } } @@ -355,20 +421,24 @@ class JavaCodeAnalyzer { * Generate Diagrams (Type Hierarchy, Package Structure, Package Overview) * @param {Object} options */ - generateDiagrams (options) { - var baseModel = app.repository.get(this._root._id) + generateDiagrams(options) { + var baseModel = app.repository.get(this._root._id); if (options.packageStructure) { - app.commands.execute('diagram-generator:package-structure', baseModel, true) + app.commands.execute( + "diagram-generator:package-structure", + baseModel, + true, + ); } if (options.typeHierarchy) { - app.commands.execute('diagram-generator:type-hierarchy', baseModel, true) + app.commands.execute("diagram-generator:type-hierarchy", baseModel, true); } if (options.packageOverview) { - baseModel.traverse(elem => { + baseModel.traverse((elem) => { if (elem instanceof type.UMLPackage) { - app.commands.execute('diagram-generator:overview', elem, true) + app.commands.execute("diagram-generator:overview", elem, true); } - }) + }); } } @@ -377,12 +447,13 @@ class JavaCodeAnalyzer { * @param {string} typeName * @return {Array.} pathName */ - _toPathName (typeName) { - var pathName = (typeName.indexOf('.') > 0 ? typeName.trim().split('.') : null) + _toPathName(typeName) { + var pathName = + typeName.indexOf(".") > 0 ? typeName.trim().split(".") : null; if (!pathName) { - pathName = [ typeName ] + pathName = [typeName]; } - return pathName + return pathName; } /** @@ -393,45 +464,45 @@ class JavaCodeAnalyzer { * @param {Object} compilationUnitNode To search type with import statements. * @return {type.Model} element correspond to the type. */ - _findType (namespace, type, compilationUnitNode) { - var typeName, pathName - var _type = null - - if (type.node === 'Type') { - typeName = type.qualifiedName.name - } else if (typeof type === 'string') { - typeName = type + _findType(namespace, type, compilationUnitNode) { + var typeName, pathName; + var _type = null; + + if (type.node === "Type") { + typeName = type.qualifiedName.name; + } else if (typeof type === "string") { + typeName = type; } - pathName = this._toPathName(typeName) + pathName = this._toPathName(typeName); // 1. Lookdown from context if (pathName.length > 1) { - _type = namespace.lookdown(pathName) + _type = namespace.lookdown(pathName); } else { - _type = namespace.findByName(typeName) + _type = namespace.findByName(typeName); } // 2. Lookup from context if (!_type) { - _type = namespace.lookup(typeName, null, this._root) + _type = namespace.lookup(typeName, null, this._root); } // 3. Find from imported namespaces if (!_type) { if (compilationUnitNode.imports) { - var i, len + var i, len; for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { - var _import = compilationUnitNode.imports[i] + var _import = compilationUnitNode.imports[i]; // Find in wildcard imports (e.g. import java.lang.*) if (_import.wildcard) { - var _namespace = this._root.lookdown(_import.qualifiedName.name) + var _namespace = this._root.lookdown(_import.qualifiedName.name); if (_namespace) { - _type = _namespace.findByName(typeName) + _type = _namespace.findByName(typeName); } // Find in import exact matches (e.g. import java.lang.String) } else { - _type = this._root.lookdown(_import.qualifiedName.name) + _type = this._root.lookdown(_import.qualifiedName.name); } } } @@ -440,13 +511,13 @@ class JavaCodeAnalyzer { // 4. Lookdown from Root if (!_type) { if (pathName.length > 1) { - _type = this._root.lookdown(pathName) + _type = this._root.lookdown(pathName); } else { - _type = this._root.findByName(typeName) + _type = this._root.findByName(typeName); } } - return _type + return _type; } /** @@ -455,17 +526,17 @@ class JavaCodeAnalyzer { * @param {Array.} modifiers * @return {string} Visibility constants for UML Elements */ - _getVisibility (modifiers) { + _getVisibility(modifiers) { if (modifiers) { - if (modifiers.includes('public')) { - return type.UMLModelElement.VK_PUBLIC - } else if (modifiers.includes('protected')) { - return type.UMLModelElement.VK_PROTECTED - } else if (modifiers.includes('private')) { - return type.UMLModelElement.VK_PRIVATE + if (modifiers.includes("public")) { + return type.UMLModelElement.VK_PUBLIC; + } else if (modifiers.includes("protected")) { + return type.UMLModelElement.VK_PROTECTED; + } else if (modifiers.includes("private")) { + return type.UMLModelElement.VK_PRIVATE; } } - return type.UMLModelElement.VK_PACKAGE + return type.UMLModelElement.VK_PACKAGE; } /** @@ -475,29 +546,29 @@ class JavaCodeAnalyzer { * @param {string} name * @param {?} value Value of Tag */ - _addTag (elem, kind, name, value) { - var tag = new type.Tag() - tag._parent = elem - tag.name = name - tag.kind = kind + _addTag(elem, kind, name, value) { + var tag = new type.Tag(); + tag._parent = elem; + tag.name = name; + tag.kind = kind; switch (kind) { - case type.Tag.TK_STRING: - tag.value = value - break - case type.Tag.TK_BOOLEAN: - tag.checked = value - break - case type.Tag.TK_NUMBER: - tag.number = value - break - case type.Tag.TK_REFERENCE: - tag.reference = value - break - case type.Tag.TK_HIDDEN: - tag.value = value - break + case type.Tag.TK_STRING: + tag.value = value; + break; + case type.Tag.TK_BOOLEAN: + tag.checked = value; + break; + case type.Tag.TK_NUMBER: + tag.number = value; + break; + case type.Tag.TK_REFERENCE: + tag.reference = value; + break; + case type.Tag.TK_HIDDEN: + tag.value = value; + break; } - elem.tags.push(tag) + elem.tags.push(tag); } /** @@ -506,57 +577,57 @@ class JavaCodeAnalyzer { * @param {Array.} pathNames * @return {type.Model} Package element corresponding to the pathNames */ - _ensurePackage (namespace, pathNames) { + _ensurePackage(namespace, pathNames) { if (pathNames.length > 0) { - var name = pathNames.shift() + var name = pathNames.shift(); if (name && name.length > 0) { - var elem = namespace.findByName(name) + var elem = namespace.findByName(name); if (elem !== null) { // Package exists if (pathNames.length > 0) { - return this._ensurePackage(elem, pathNames) + return this._ensurePackage(elem, pathNames); } else { - return elem + return elem; } } else { // Package not exists, then create one. - var _package = new type.UMLPackage() - namespace.ownedElements.push(_package) - _package._parent = namespace - _package.name = name + var _package = new type.UMLPackage(); + namespace.ownedElements.push(_package); + _package._parent = namespace; + _package.name = name; if (pathNames.length > 0) { - return this._ensurePackage(_package, pathNames) + return this._ensurePackage(_package, pathNames); } else { - return _package + return _package; } } } } else { - return namespace + return namespace; } } /** - * Return the class of a given pathNames. If not exists, create the class. - * @param {type.Model} namespace - * @param {Array.} pathNames - * @return {type.Model} Class element corresponding to the pathNames - */ - _ensureClass (namespace, pathNames) { + * Return the class of a given pathNames. If not exists, create the class. + * @param {type.Model} namespace + * @param {Array.} pathNames + * @return {type.Model} Class element corresponding to the pathNames + */ + _ensureClass(namespace, pathNames) { if (pathNames.length > 0) { - var _className = pathNames.pop() - var _package = this._ensurePackage(namespace, pathNames) - var _class = _package.findByName(_className) + var _className = pathNames.pop(); + var _package = this._ensurePackage(namespace, pathNames); + var _class = _package.findByName(_className); if (!_class) { - _class = new type.UMLClass() - _class._parent = _package - _class.name = _className - _class.visibility = type.UMLModelElement.VK_PUBLIC - _package.ownedElements.push(_class) + _class = new type.UMLClass(); + _class._parent = _package; + _class.name = _className; + _class.visibility = type.UMLModelElement.VK_PUBLIC; + _package.ownedElements.push(_class); } - return _class + return _class; } - return null + return null; } /** @@ -565,21 +636,21 @@ class JavaCodeAnalyzer { * @param {Array.} pathNames * @return {type.Model} Interface element corresponding to the pathNames */ - _ensureInterface (namespace, pathNames) { + _ensureInterface(namespace, pathNames) { if (pathNames.length > 0) { - var _interfaceName = pathNames.pop() - var _package = this._ensurePackage(namespace, pathNames) - var _interface = _package.findByName(_interfaceName) + var _interfaceName = pathNames.pop(); + var _package = this._ensurePackage(namespace, pathNames); + var _interface = _package.findByName(_interfaceName); if (!_interface) { - _interface = new type.UMLInterface() - _interface._parent = _package - _interface.name = _interfaceName - _interface.visibility = type.UMLModelElement.VK_PUBLIC - _package.ownedElements.push(_interface) + _interface = new type.UMLInterface(); + _interface._parent = _package; + _interface.name = _interfaceName; + _interface.visibility = type.UMLModelElement.VK_PUBLIC; + _package.ownedElements.push(_interface); } - return _interface + return _interface; } - return null + return null; } /** @@ -587,37 +658,43 @@ class JavaCodeAnalyzer { * @param {Object} typeNode * @return {string} Collection item type name */ - _isGenericCollection (typeNode, compilationUnitNode) { - if (typeNode.qualifiedName.typeParameters && typeNode.qualifiedName.typeParameters.length > 0) { - var _collectionType = typeNode.qualifiedName.name - var _itemType = typeNode.qualifiedName.typeParameters[0].name + _isGenericCollection(typeNode, compilationUnitNode) { + if ( + typeNode.qualifiedName.typeParameters && + typeNode.qualifiedName.typeParameters.length > 0 + ) { + var _collectionType = typeNode.qualifiedName.name; + var _itemType = typeNode.qualifiedName.typeParameters[0].name; // Used Full name (e.g. java.util.List) if (javaUtilCollectionTypes.includes(_collectionType)) { - return _itemType + return _itemType; } // Used name with imports (e.g. List and import java.util.List or java.util.*) if (javaCollectionTypes.includes(_collectionType)) { if (compilationUnitNode.imports) { - var i, len + var i, len; for (i = 0, len = compilationUnitNode.imports.length; i < len; i++) { - var _import = compilationUnitNode.imports[i] + var _import = compilationUnitNode.imports[i]; // Full name import (e.g. import java.util.List) - if (_import.qualifiedName.name === 'java.util.' + _collectionType) { - return _itemType + if (_import.qualifiedName.name === "java.util." + _collectionType) { + return _itemType; } // Wildcard import (e.g. import java.util.*) - if (_import.qualifiedName.name === 'java.util' && _import.wildcard) { - return _itemType + if ( + _import.qualifiedName.name === "java.util" && + _import.wildcard + ) { + return _itemType; } } } } } - return null + return null; } /** @@ -626,18 +703,22 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} compilationUnitNode */ - translateCompilationUnit (options, namespace, compilationUnitNode) { - var _namespace = namespace - - if (compilationUnitNode['package']) { - var _package = this.translatePackage(options, namespace, compilationUnitNode['package']) + translateCompilationUnit(options, namespace, compilationUnitNode) { + var _namespace = namespace; + + if (compilationUnitNode["package"]) { + var _package = this.translatePackage( + options, + namespace, + compilationUnitNode["package"], + ); if (_package !== null) { - _namespace = _package + _namespace = _package; } } // Translate Types - this.translateTypes(options, _namespace, compilationUnitNode.types) + this.translateTypes(options, _namespace, compilationUnitNode.types); } /** @@ -646,24 +727,24 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Array.} typeNodeArray */ - translateTypes (options, namespace, typeNodeArray) { - var i, len + translateTypes(options, namespace, typeNodeArray) { + var i, len; if (Array.isArray(typeNodeArray) && typeNodeArray.length > 0) { for (i = 0, len = typeNodeArray.length; i < len; i++) { - var typeNode = typeNodeArray[i] + var typeNode = typeNodeArray[i]; switch (typeNode.node) { - case 'Class': - this.translateClass(options, namespace, typeNode) - break - case 'Interface': - this.translateInterface(options, namespace, typeNode) - break - case 'Enum': - this.translateEnum(options, namespace, typeNode) - break - case 'AnnotationType': - this.translateAnnotationType(options, namespace, typeNode) - break + case "Class": + this.translateClass(options, namespace, typeNode); + break; + case "Interface": + this.translateInterface(options, namespace, typeNode); + break; + case "Enum": + this.translateEnum(options, namespace, typeNode); + break; + case "AnnotationType": + this.translateAnnotationType(options, namespace, typeNode); + break; } } } @@ -675,12 +756,16 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} compilationUnitNode */ - translatePackage (options, namespace, packageNode) { - if (packageNode && packageNode.qualifiedName && packageNode.qualifiedName.name) { - var pathNames = packageNode.qualifiedName.name.split('.') - return this._ensurePackage(namespace, pathNames) + translatePackage(options, namespace, packageNode) { + if ( + packageNode && + packageNode.qualifiedName && + packageNode.qualifiedName.name + ) { + var pathNames = packageNode.qualifiedName.name.split("."); + return this._ensurePackage(namespace, pathNames); } - return null + return null; } /** @@ -689,38 +774,45 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Array.} memberNodeArray */ - translateMembers (options, namespace, memberNodeArray) { - var i, len + translateMembers(options, namespace, memberNodeArray) { + var i, len; if (Array.isArray(memberNodeArray) && memberNodeArray.length > 0) { for (i = 0, len = memberNodeArray.length; i < len; i++) { - var memberNode = memberNodeArray[i] - if (memberNode && (typeof memberNode.node === 'string')) { - var visibility = this._getVisibility(memberNode.modifiers) + var memberNode = memberNodeArray[i]; + if (memberNode && typeof memberNode.node === "string") { + var visibility = this._getVisibility(memberNode.modifiers); // Generate public members only if publicOnly == true - if (options.publicOnly && visibility !== type.UMLModelElement.VK_PUBLIC) { - continue + if ( + options.publicOnly && + visibility !== type.UMLModelElement.VK_PUBLIC + ) { + continue; } - memberNode.compilationUnitNode = this._currentCompilationUnit + memberNode.compilationUnitNode = this._currentCompilationUnit; switch (memberNode.node) { - case 'Field': - if (options.association) { - this.translateFieldAsAssociation(options, namespace, memberNode) - } else { - this.translateFieldAsAttribute(options, namespace, memberNode) - } - break - case 'Constructor': - this.translateMethod(options, namespace, memberNode, true) - break - case 'Method': - this.translateMethod(options, namespace, memberNode) - break - case 'EnumConstant': - this.translateEnumConstant(options, namespace, memberNode) - break + case "Field": + if (options.association) { + this.translateFieldAsAssociation( + options, + namespace, + memberNode, + ); + } else { + this.translateFieldAsAttribute(options, namespace, memberNode); + } + break; + case "Constructor": + this.translateMethod(options, namespace, memberNode, true); + break; + case "Method": + this.translateMethod(options, namespace, memberNode); + break; + case "EnumConstant": + this.translateEnumConstant(options, namespace, memberNode); + break; } } } @@ -733,19 +825,19 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} typeParameterNodeArray */ - translateTypeParameters (options, namespace, typeParameterNodeArray) { + translateTypeParameters(options, namespace, typeParameterNodeArray) { if (Array.isArray(typeParameterNodeArray)) { - var i, len, _typeParam + var i, len, _typeParam; for (i = 0, len = typeParameterNodeArray.length; i < len; i++) { - _typeParam = typeParameterNodeArray[i] - if (_typeParam.node === 'TypeParameter') { - var _templateParameter = new type.UMLTemplateParameter() - _templateParameter._parent = namespace - _templateParameter.name = _typeParam.name + _typeParam = typeParameterNodeArray[i]; + if (_typeParam.node === "TypeParameter") { + var _templateParameter = new type.UMLTemplateParameter(); + _templateParameter._parent = namespace; + _templateParameter.name = _typeParam.name; if (_typeParam.type) { - _templateParameter.parameterType = _typeParam.type + _templateParameter.parameterType = _typeParam.type; } - namespace.templateParameters.push(_templateParameter) + namespace.templateParameters.push(_templateParameter); } } } @@ -757,44 +849,44 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} compilationUnitNode */ - translateClass (options, namespace, classNode) { - var i, len, _class + translateClass(options, namespace, classNode) { + var i, len, _class; // Create Class - _class = new type.UMLClass() - _class._parent = namespace - _class.name = classNode.name + _class = new type.UMLClass(); + _class._parent = namespace; + _class.name = classNode.name; // Access Modifiers - _class.visibility = this._getVisibility(classNode.modifiers) + _class.visibility = this._getVisibility(classNode.modifiers); // Abstract Class - if (classNode.modifiers && classNode.modifiers.includes('abstract')) { - _class.isAbstract = true + if (classNode.modifiers && classNode.modifiers.includes("abstract")) { + _class.isAbstract = true; } // Final Class - if (classNode.modifiers && classNode.modifiers.includes('final')) { - _class.isFinalSpecialization = true - _class.isLeaf = true + if (classNode.modifiers && classNode.modifiers.includes("final")) { + _class.isFinalSpecialization = true; + _class.isLeaf = true; } // JavaDoc if (classNode.comment) { - _class.documentation = classNode.comment + _class.documentation = classNode.comment; } - namespace.ownedElements.push(_class) + namespace.ownedElements.push(_class); // Register Extends for 2nd Phase Translation - if (classNode['extends']) { + if (classNode["extends"]) { var _extendPending = { classifier: _class, - node: classNode['extends'], - kind: 'class', - compilationUnitNode: this._currentCompilationUnit - } - this._extendPendings.push(_extendPending) + node: classNode["extends"], + kind: "class", + compilationUnitNode: this._currentCompilationUnit, + }; + this._extendPendings.push(_extendPending); } // - 1) 타입이 소스에 있는 경우 --> 해당 타입으로 Generalization 생성 @@ -802,23 +894,23 @@ class JavaCodeAnalyzer { // 모든 타입이 생성된 다음에 Generalization (혹은 기타 Relationships)이 연결되어야 하므로, 어딘가에 등록한 다음이 2nd Phase에서 처리. // Register Implements for 2nd Phase Translation - if (classNode['implements']) { - for (i = 0, len = classNode['implements'].length; i < len; i++) { - var _impl = classNode['implements'][i] + if (classNode["implements"]) { + for (i = 0, len = classNode["implements"].length; i < len; i++) { + var _impl = classNode["implements"][i]; var _implementPending = { classifier: _class, node: _impl, - compilationUnitNode: this._currentCompilationUnit - } - this._implementPendings.push(_implementPending) + compilationUnitNode: this._currentCompilationUnit, + }; + this._implementPendings.push(_implementPending); } } // Translate Type Parameters - this.translateTypeParameters(options, _class, classNode.typeParameters) + this.translateTypeParameters(options, _class, classNode.typeParameters); // Translate Types - this.translateTypes(options, _class, classNode.body) + this.translateTypes(options, _class, classNode.body); // Translate Members - this.translateMembers(options, _class, classNode.body) + this.translateMembers(options, _class, classNode.body); } /** @@ -827,41 +919,45 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} interfaceNode */ - translateInterface (options, namespace, interfaceNode) { - var i, len, _interface + translateInterface(options, namespace, interfaceNode) { + var i, len, _interface; // Create Interface - _interface = new type.UMLInterface() - _interface._parent = namespace - _interface.name = interfaceNode.name - _interface.visibility = this._getVisibility(interfaceNode.modifiers) + _interface = new type.UMLInterface(); + _interface._parent = namespace; + _interface.name = interfaceNode.name; + _interface.visibility = this._getVisibility(interfaceNode.modifiers); // JavaDoc if (interfaceNode.comment) { - _interface.documentation = interfaceNode.comment + _interface.documentation = interfaceNode.comment; } - namespace.ownedElements.push(_interface) + namespace.ownedElements.push(_interface); // Register Extends for 2nd Phase Translation - if (interfaceNode['extends']) { - for (i = 0, len = interfaceNode['extends'].length; i < len; i++) { - var _extend = interfaceNode['extends'][i] + if (interfaceNode["extends"]) { + for (i = 0, len = interfaceNode["extends"].length; i < len; i++) { + var _extend = interfaceNode["extends"][i]; this._extendPendings.push({ classifier: _interface, node: _extend, - kind: 'interface', - compilationUnitNode: this._currentCompilationUnit - }) + kind: "interface", + compilationUnitNode: this._currentCompilationUnit, + }); } } // Translate Type Parameters - this.translateTypeParameters(options, _interface, interfaceNode.typeParameters) + this.translateTypeParameters( + options, + _interface, + interfaceNode.typeParameters, + ); // Translate Types - this.translateTypes(options, _interface, interfaceNode.body) + this.translateTypes(options, _interface, interfaceNode.body); // Translate Members - this.translateMembers(options, _interface, interfaceNode.body) + this.translateMembers(options, _interface, interfaceNode.body); } /** @@ -870,28 +966,28 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} enumNode */ - translateEnum (options, namespace, enumNode) { - var _enum + translateEnum(options, namespace, enumNode) { + var _enum; // Create Enumeration - _enum = new type.UMLEnumeration() - _enum._parent = namespace - _enum.name = enumNode.name - _enum.visibility = this._getVisibility(enumNode.modifiers) + _enum = new type.UMLEnumeration(); + _enum._parent = namespace; + _enum.name = enumNode.name; + _enum.visibility = this._getVisibility(enumNode.modifiers); // JavaDoc if (enumNode.comment) { - _enum.documentation = enumNode.comment + _enum.documentation = enumNode.comment; } - namespace.ownedElements.push(_enum) + namespace.ownedElements.push(_enum); // Translate Type Parameters - this.translateTypeParameters(options, _enum, enumNode.typeParameters) + this.translateTypeParameters(options, _enum, enumNode.typeParameters); // Translate Types - this.translateTypes(options, _enum, enumNode.body) + this.translateTypes(options, _enum, enumNode.body); // Translate Members - this.translateMembers(options, _enum, enumNode.body) + this.translateMembers(options, _enum, enumNode.body); } /** @@ -900,29 +996,35 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} annotationTypeNode */ - translateAnnotationType (options, namespace, annotationTypeNode) { - var _annotationType + translateAnnotationType(options, namespace, annotationTypeNode) { + var _annotationType; // Create Class <> - _annotationType = new type.UMLClass() - _annotationType._parent = namespace - _annotationType.name = annotationTypeNode.name - _annotationType.stereotype = 'annotationType' - _annotationType.visibility = this._getVisibility(annotationTypeNode.modifiers) + _annotationType = new type.UMLClass(); + _annotationType._parent = namespace; + _annotationType.name = annotationTypeNode.name; + _annotationType.stereotype = "annotationType"; + _annotationType.visibility = this._getVisibility( + annotationTypeNode.modifiers, + ); // JavaDoc if (annotationTypeNode.comment) { - _annotationType.documentation = annotationTypeNode.comment + _annotationType.documentation = annotationTypeNode.comment; } - namespace.ownedElements.push(_annotationType) + namespace.ownedElements.push(_annotationType); // Translate Type Parameters - this.translateTypeParameters(options, _annotationType, annotationTypeNode.typeParameters) + this.translateTypeParameters( + options, + _annotationType, + annotationTypeNode.typeParameters, + ); // Translate Types - this.translateTypes(options, _annotationType, annotationTypeNode.body) + this.translateTypes(options, _annotationType, annotationTypeNode.body); // Translate Members - this.translateMembers(options, _annotationType, annotationTypeNode.body) + this.translateMembers(options, _annotationType, annotationTypeNode.body); } /** @@ -931,14 +1033,14 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} fieldNode */ - translateFieldAsAssociation (options, namespace, fieldNode) { + translateFieldAsAssociation(options, namespace, fieldNode) { if (fieldNode.variables && fieldNode.variables.length > 0) { // Add to _associationPendings var _associationPending = { classifier: namespace, - node: fieldNode - } - this._associationPendings.push(_associationPending) + node: fieldNode, + }; + this._associationPendings.push(_associationPending); } } @@ -948,58 +1050,58 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} fieldNode */ - translateFieldAsAttribute (options, namespace, fieldNode) { - var i, len + translateFieldAsAttribute(options, namespace, fieldNode) { + var i, len; if (fieldNode.variables && fieldNode.variables.length > 0) { for (i = 0, len = fieldNode.variables.length; i < len; i++) { - var variableNode = fieldNode.variables[i] + var variableNode = fieldNode.variables[i]; // Create Attribute - var _attribute = new type.UMLAttribute() - _attribute._parent = namespace - _attribute.name = variableNode.name + var _attribute = new type.UMLAttribute(); + _attribute._parent = namespace; + _attribute.name = variableNode.name; // Access Modifiers - _attribute.visibility = this._getVisibility(fieldNode.modifiers) + _attribute.visibility = this._getVisibility(fieldNode.modifiers); if (variableNode.initializer) { - _attribute.defaultValue = variableNode.initializer + _attribute.defaultValue = variableNode.initializer; } // Static Modifier - if (fieldNode.modifiers && fieldNode.modifiers.includes('static')) { - _attribute.isStatic = true + if (fieldNode.modifiers && fieldNode.modifiers.includes("static")) { + _attribute.isStatic = true; } // Final Modifier - if (fieldNode.modifiers && fieldNode.modifiers.includes('final')) { - _attribute.isLeaf = true - _attribute.isReadOnly = true + if (fieldNode.modifiers && fieldNode.modifiers.includes("final")) { + _attribute.isLeaf = true; + _attribute.isReadOnly = true; } // Volatile Modifier - if (fieldNode.modifiers && fieldNode.modifiers.includes('volatile')) { - this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'volatile', true) + if (fieldNode.modifiers && fieldNode.modifiers.includes("volatile")) { + this._addTag(_attribute, type.Tag.TK_BOOLEAN, "volatile", true); } // Transient Modifier - if (fieldNode.modifiers && fieldNode.modifiers.includes('transient')) { - this._addTag(_attribute, type.Tag.TK_BOOLEAN, 'transient', true) + if (fieldNode.modifiers && fieldNode.modifiers.includes("transient")) { + this._addTag(_attribute, type.Tag.TK_BOOLEAN, "transient", true); } // JavaDoc if (fieldNode.comment) { - _attribute.documentation = fieldNode.comment + _attribute.documentation = fieldNode.comment; } - namespace.attributes.push(_attribute) + namespace.attributes.push(_attribute); // Add to _typedFeaturePendings var _typedFeature = { namespace: namespace, feature: _attribute, - node: fieldNode - } - this._typedFeaturePendings.push(_typedFeature) + node: fieldNode, + }; + this._typedFeaturePendings.push(_typedFeature); } } } @@ -1011,37 +1113,37 @@ class JavaCodeAnalyzer { * @param {Object} methodNode * @param {boolean} isConstructor */ - translateMethod (options, namespace, methodNode, isConstructor) { - var i, len - var _operation = new type.UMLOperation() - _operation._parent = namespace - _operation.name = methodNode.name - namespace.operations.push(_operation) + translateMethod(options, namespace, methodNode, isConstructor) { + var i, len; + var _operation = new type.UMLOperation(); + _operation._parent = namespace; + _operation.name = methodNode.name; + namespace.operations.push(_operation); // Modifiers - _operation.visibility = this._getVisibility(methodNode.modifiers) - if (methodNode.modifiers && methodNode.modifiers.includes('static')) { - _operation.isStatic = true + _operation.visibility = this._getVisibility(methodNode.modifiers); + if (methodNode.modifiers && methodNode.modifiers.includes("static")) { + _operation.isStatic = true; } - if (methodNode.modifiers && methodNode.modifiers.includes('abstract')) { - _operation.isAbstract = true + if (methodNode.modifiers && methodNode.modifiers.includes("abstract")) { + _operation.isAbstract = true; } - if (methodNode.modifiers && methodNode.modifiers.includes('final')) { - _operation.isLeaf = true + if (methodNode.modifiers && methodNode.modifiers.includes("final")) { + _operation.isLeaf = true; } - if (methodNode.modifiers && methodNode.modifiers.includes('synchronized')) { - _operation.concurrency = type.UMLBehavioralFeature.CCK_CONCURRENT + if (methodNode.modifiers && methodNode.modifiers.includes("synchronized")) { + _operation.concurrency = type.UMLBehavioralFeature.CCK_CONCURRENT; } - if (methodNode.modifiers && methodNode.modifiers.includes('native')) { - this._addTag(_operation, type.Tag.TK_BOOLEAN, 'native', true) + if (methodNode.modifiers && methodNode.modifiers.includes("native")) { + this._addTag(_operation, type.Tag.TK_BOOLEAN, "native", true); } - if (methodNode.modifiers && methodNode.modifiers.includes('strictfp')) { - this._addTag(_operation, type.Tag.TK_BOOLEAN, 'strictfp', true) + if (methodNode.modifiers && methodNode.modifiers.includes("strictfp")) { + this._addTag(_operation, type.Tag.TK_BOOLEAN, "strictfp", true); } // Constructor if (isConstructor) { - _operation.stereotype = 'constructor' + _operation.stereotype = "constructor"; } // Stuff to do here to grab the correct Javadoc and put it into parameters and return @@ -1049,52 +1151,61 @@ class JavaCodeAnalyzer { // Formal Parameters if (methodNode.parameters && methodNode.parameters.length > 0) { for (i = 0, len = methodNode.parameters.length; i < len; i++) { - var parameterNode = methodNode.parameters[i] - parameterNode.compilationUnitNode = methodNode.compilationUnitNode - this.translateParameter(options, _operation, parameterNode) + var parameterNode = methodNode.parameters[i]; + parameterNode.compilationUnitNode = methodNode.compilationUnitNode; + this.translateParameter(options, _operation, parameterNode); } } // Return Type if (methodNode.type) { - var _returnParam = new type.UMLParameter() - _returnParam._parent = _operation - _returnParam.name = '' - _returnParam.direction = type.UMLParameter.DK_RETURN + var _returnParam = new type.UMLParameter(); + _returnParam._parent = _operation; + _returnParam.name = ""; + _returnParam.direction = type.UMLParameter.DK_RETURN; // Add to _typedFeaturePendings this._typedFeaturePendings.push({ namespace: namespace, feature: _returnParam, - node: methodNode - }) - _operation.parameters.push(_returnParam) + node: methodNode, + }); + _operation.parameters.push(_returnParam); } // Throws if (methodNode.throws) { for (i = 0, len = methodNode.throws.length; i < len; i++) { - var _throwNode = methodNode.throws[i] + var _throwNode = methodNode.throws[i]; var _throwPending = { operation: _operation, node: _throwNode, - compilationUnitNode: methodNode.compilationUnitNode - } - this._throwPendings.push(_throwPending) + compilationUnitNode: methodNode.compilationUnitNode, + }; + this._throwPendings.push(_throwPending); } } // JavaDoc if (methodNode.comment) { - _operation.documentation = methodNode.comment + _operation.documentation = methodNode.comment; } // "default" for Annotation Type Element if (methodNode.defaultValue) { - this._addTag(_operation, type.Tag.TK_STRING, 'default', methodNode.defaultValue) + this._addTag( + _operation, + type.Tag.TK_STRING, + "default", + methodNode.defaultValue, + ); } // Translate Type Parameters - this.translateTypeParameters(options, _operation, methodNode.typeParameters) + this.translateTypeParameters( + options, + _operation, + methodNode.typeParameters, + ); } /** @@ -1103,17 +1214,17 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} enumConstantNode */ - translateEnumConstant (options, namespace, enumConstantNode) { - var _literal = new type.UMLEnumerationLiteral() - _literal._parent = namespace - _literal.name = enumConstantNode.name + translateEnumConstant(options, namespace, enumConstantNode) { + var _literal = new type.UMLEnumerationLiteral(); + _literal._parent = namespace; + _literal.name = enumConstantNode.name; // JavaDoc if (enumConstantNode.comment) { - _literal.documentation = enumConstantNode.comment + _literal.documentation = enumConstantNode.comment; } - namespace.literals.push(_literal) + namespace.literals.push(_literal); } /** @@ -1122,18 +1233,18 @@ class JavaCodeAnalyzer { * @param {type.Model} namespace * @param {Object} parameterNode */ - translateParameter (options, namespace, parameterNode) { - var _parameter = new type.UMLParameter() - _parameter._parent = namespace - _parameter.name = parameterNode.variable.name - namespace.parameters.push(_parameter) + translateParameter(options, namespace, parameterNode) { + var _parameter = new type.UMLParameter(); + _parameter._parent = namespace; + _parameter.name = parameterNode.variable.name; + namespace.parameters.push(_parameter); // Add to _typedFeaturePendings this._typedFeaturePendings.push({ namespace: namespace._parent, feature: _parameter, - node: parameterNode - }) + node: parameterNode, + }); } } @@ -1142,32 +1253,32 @@ class JavaCodeAnalyzer { * @param {string} basePath * @param {Object} options */ -function analyze (basePath, options) { - var javaAnalyzer = new JavaCodeAnalyzer() +function analyze(basePath, options) { + var javaAnalyzer = new JavaCodeAnalyzer(); - function visit (base) { - var stat = fs.lstatSync(base) + function visit(base) { + var stat = fs.lstatSync(base); if (stat.isFile()) { - var ext = path.extname(base).toLowerCase() - if (ext === '.java') { - javaAnalyzer.addFile(base) + var ext = path.extname(base).toLowerCase(); + if (ext === ".java") { + javaAnalyzer.addFile(base); } } else if (stat.isDirectory()) { - var files = fs.readdirSync(base) + var files = fs.readdirSync(base); if (files && files.length > 0) { - files.forEach(entry => { - var fullPath = path.join(base, entry) - visit(fullPath) - }) + files.forEach((entry) => { + var fullPath = path.join(base, entry); + visit(fullPath); + }); } } } // Traverse all file entries - visit(basePath) + visit(basePath); // Perform reverse engineering - javaAnalyzer.analyze(options) + javaAnalyzer.analyze(options); } -exports.analyze = analyze +exports.analyze = analyze; diff --git a/code-generator.js b/code-generator.js index 0604f8f..a826d89 100644 --- a/code-generator.js +++ b/code-generator.js @@ -21,9 +21,9 @@ * */ -const fs = require('fs') -const path = require('path') -const codegen = require('./codegen-utils') +const fs = require("fs"); +const path = require("path"); +const codegen = require("./codegen-utils"); /** * Return element's full path including parent's classes or interfaces @@ -31,52 +31,51 @@ const codegen = require('./codegen-utils') * @param {Array.} imports Used to collect import declarations * @return {string} */ -function getElemPath (elem, imports, curPackage) { +function getElemPath(elem, imports, curPackage) { // find package of elem and whole _type string with parents' decarations - var owner = elem._parent - var _name = elem.name + var owner = elem._parent; + var _name = elem.name; while (owner instanceof type.UMLClass || owner instanceof type.UMLInterface) { if (owner.name.length > 0) { - _name = owner.name +'.'+ _name + _name = owner.name + "." + _name; } else { - _name = '.'+ _name + _name = "." + _name; } - elem = owner - owner = owner._parent + elem = owner; + owner = owner._parent; } // generate _import as fullpath of owner package - var _fullImport = elem.name - var _import = '' + var _fullImport = elem.name; + var _import = ""; if (owner != null && owner != curPackage) { while (owner instanceof type.UMLPackage) { - _import = _fullImport //ignore final root package that would be view point - _fullImport = owner.name + '.' + _fullImport - owner = owner._parent + _import = _fullImport; //ignore final root package that would be view point + _fullImport = owner.name + "." + _fullImport; + owner = owner._parent; } - imports.add(_import) + imports.add(_import); } - return _name + return _name; } /** * Java Code Generator */ class JavaCodeGenerator { - /** * @constructor * * @param {type.UMLPackage} baseModel * @param {string} basePath generated files and directories to be placed */ - constructor (baseModel, basePath) { + constructor(baseModel, basePath) { /** @member {type.Model} */ - this.baseModel = baseModel + this.baseModel = baseModel; /** @member {string} */ - this.basePath = basePath + this.basePath = basePath; } /** @@ -84,17 +83,17 @@ class JavaCodeGenerator { * @param {Object} options * @return {string} */ - getIndentString (options) { + getIndentString(options) { if (options.useTab) { - return '\t' + return "\t"; } else { - var i - var len - var indent = [] + var i; + var len; + var indent = []; for (i = 0, len = options.indentSpaces; i < len; i++) { - indent.push(' ') + indent.push(" "); } - return indent.join('') + return indent.join(""); } } @@ -105,99 +104,143 @@ class JavaCodeGenerator { * @param {Object} options * @param {Object} curPackage */ - generate (elem, basePath, options, curPackage) { - var fullPath - var codeWriter - var codeWriter2 + generate(elem, basePath, options, curPackage) { + var fullPath; + var codeWriter; + var codeWriter2; - var imports = new Set() + var imports = new Set(); // Package if (elem instanceof type.UMLPackage) { - fullPath = path.join(basePath, elem.name) - fs.mkdirSync(fullPath) + fullPath = path.join(basePath, elem.name); + fs.mkdirSync(fullPath); if (Array.isArray(elem.ownedElements)) { - elem.ownedElements.forEach(child => { - return this.generate(child, fullPath, options, elem) - }) + elem.ownedElements.forEach((child) => { + return this.generate(child, fullPath, options, elem); + }); } } else if (elem instanceof type.UMLClass) { // AnnotationType - if (elem.stereotype === 'annotationType') { - fullPath = path.join(basePath, elem.name + '.java') - codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) - - codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) - this.writeAnnotationType(codeWriter2, elem, options, imports, curPackage) + if (elem.stereotype === "annotationType") { + fullPath = path.join(basePath, elem.name + ".java"); + codeWriter = new codegen.CodeWriter(this.getIndentString(options)); + this.writePackageDeclaration( + codeWriter, + elem, + options, + imports, + curPackage, + ); + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)); + this.writeAnnotationType( + codeWriter2, + elem, + options, + imports, + curPackage, + ); if (imports.size > 0) { - codeWriter.writeLine() - imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + codeWriter.writeLine(); + imports.forEach(function (v, i, s) { + codeWriter.writeLine("import " + v + ";"); + }); } - codeWriter.writeLine() - codeWriter.writeLine('import java.io.*;') - codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine('\n') - - fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) - // Class + codeWriter.writeLine(); + codeWriter.writeLine("import java.io.*;"); + codeWriter.writeLine("import java.util.*;"); + codeWriter.writeLine("\n"); + + fs.writeFileSync( + fullPath, + codeWriter.getData() + codeWriter2.getData(), + ); + // Class } else { - fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + fullPath = basePath + "/" + elem.name + ".java"; + codeWriter = new codegen.CodeWriter(this.getIndentString(options)); + this.writePackageDeclaration( + codeWriter, + elem, + options, + imports, + curPackage, + ); + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)); + this.writeClass(codeWriter2, elem, options, imports, curPackage); - codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) - this.writeClass(codeWriter2, elem, options, imports, curPackage) - if (imports.size > 0) { - codeWriter.writeLine() - imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + codeWriter.writeLine(); + imports.forEach(function (v, i, s) { + codeWriter.writeLine("import " + v + ";"); + }); } - codeWriter.writeLine() - codeWriter.writeLine('import java.io.*;') - codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine('\n') - - fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) + codeWriter.writeLine(); + codeWriter.writeLine("import java.io.*;"); + codeWriter.writeLine("import java.util.*;"); + codeWriter.writeLine("\n"); + + fs.writeFileSync( + fullPath, + codeWriter.getData() + codeWriter2.getData(), + ); } - // Interface + // Interface } else if (elem instanceof type.UMLInterface) { - fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) - - codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) - this.writeInterface(codeWriter2, elem, options, imports, curPackage) - + fullPath = basePath + "/" + elem.name + ".java"; + codeWriter = new codegen.CodeWriter(this.getIndentString(options)); + this.writePackageDeclaration( + codeWriter, + elem, + options, + imports, + curPackage, + ); + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)); + this.writeInterface(codeWriter2, elem, options, imports, curPackage); + if (imports.size > 0) { - codeWriter.writeLine() - imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + codeWriter.writeLine(); + imports.forEach(function (v, i, s) { + codeWriter.writeLine("import " + v + ";"); + }); } - codeWriter.writeLine() - codeWriter.writeLine('import java.io.*;') - codeWriter.writeLine('import java.util.*;') - codeWriter.writeLine('\n') + codeWriter.writeLine(); + codeWriter.writeLine("import java.io.*;"); + codeWriter.writeLine("import java.util.*;"); + codeWriter.writeLine("\n"); - fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()); - // Enum + // Enum } else if (elem instanceof type.UMLEnumeration) { - fullPath = basePath + '/' + elem.name + '.java' - codeWriter = new codegen.CodeWriter(this.getIndentString(options)) - this.writePackageDeclaration(codeWriter, elem, options, imports, curPackage) + fullPath = basePath + "/" + elem.name + ".java"; + codeWriter = new codegen.CodeWriter(this.getIndentString(options)); + this.writePackageDeclaration( + codeWriter, + elem, + options, + imports, + curPackage, + ); + + codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)); + this.writeEnum(codeWriter2, elem, options, imports, curPackage); - codeWriter2 = new codegen.CodeWriter(this.getIndentString(options)) - this.writeEnum(codeWriter2, elem, options, imports, curPackage) - if (imports.size > 0) { - codeWriter.writeLine() - imports.forEach(function(v,i,s) {codeWriter.writeLine('import ' + v + ';')}) + codeWriter.writeLine(); + imports.forEach(function (v, i, s) { + codeWriter.writeLine("import " + v + ";"); + }); } - codeWriter.writeLine('\n') + codeWriter.writeLine("\n"); - fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()) + fs.writeFileSync(fullPath, codeWriter.getData() + codeWriter2.getData()); } } @@ -206,16 +249,16 @@ class JavaCodeGenerator { * @param {type.Model} elem * @return {string} */ - getVisibility (elem) { + getVisibility(elem) { switch (elem.visibility) { - case type.UMLModelElement.VK_PUBLIC: - return 'public' - case type.UMLModelElement.VK_PROTECTED: - return 'protected' - case type.UMLModelElement.VK_PRIVATE: - return 'private' - } - return null + case type.UMLModelElement.VK_PUBLIC: + return "public"; + case type.UMLModelElement.VK_PROTECTED: + return "protected"; + case type.UMLModelElement.VK_PRIVATE: + return "private"; + } + return null; } /** @@ -223,29 +266,29 @@ class JavaCodeGenerator { * @param {type.Model} elem * @return {Array.} */ - getModifiers (elem) { - var modifiers = [] - var visibility = this.getVisibility(elem) + getModifiers(elem) { + var modifiers = []; + var visibility = this.getVisibility(elem); if (visibility) { - modifiers.push(visibility) + modifiers.push(visibility); } if (elem.isStatic === true) { - modifiers.push('static') + modifiers.push("static"); } if (elem.isAbstract === true) { - modifiers.push('abstract') + modifiers.push("abstract"); } if (elem.isFinalSpecialization === true || elem.isLeaf === true) { - modifiers.push('final') + modifiers.push("final"); } if (elem.concurrency === type.UMLBehavioralFeature.CCK_CONCURRENT) { - modifiers.push('synchronized') + modifiers.push("synchronized"); } // transient // strictfp // const // native - return modifiers + return modifiers; } /** @@ -253,11 +296,16 @@ class JavaCodeGenerator { * @param {type.Model} elem * @return {Array.} */ - getSuperClasses (elem) { - var generalizations = app.repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLGeneralization && rel.source === elem) - }) - return generalizations.map(function (gen) { return gen.target }) + getSuperClasses(elem) { + var generalizations = app.repository.getRelationshipsOf( + elem, + function (rel) { + return rel instanceof type.UMLGeneralization && rel.source === elem; + }, + ); + return generalizations.map(function (gen) { + return gen.target; + }); } /** @@ -265,14 +313,21 @@ class JavaCodeGenerator { * @param {type.Model} elem * @return {Array.} */ - getSuperInterfaces (elem) { + getSuperInterfaces(elem) { if (elem instanceof type.UMLClass) { - var realizations = app.repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLInterfaceRealization && rel.source === elem) - }) - return realizations.map(function (gen) { return gen.target }) + var realizations = app.repository.getRelationshipsOf( + elem, + function (rel) { + return ( + rel instanceof type.UMLInterfaceRealization && rel.source === elem + ); + }, + ); + return realizations.map(function (gen) { + return gen.target; + }); } else { - return this.getSuperClasses(elem) + return this.getSuperClasses(elem); } } @@ -282,14 +337,14 @@ class JavaCodeGenerator { * @param {Set.} allExtendsSet Used to avoid repeated elements in allExtends array * @param {Array.} allExtends Used to collect super classes in order */ - collectExtends (elem, allExtendsSet, allExtends) { - var _exts = this.getSuperClasses(elem) + collectExtends(elem, allExtendsSet, allExtends) { + var _exts = this.getSuperClasses(elem); for (var i = 0; i < _exts.length; i++) { - var _ext = _exts[i] - this.collectExtends(_ext, allExtendsSet, allExtends) + var _ext = _exts[i]; + this.collectExtends(_ext, allExtendsSet, allExtends); if (!allExtendsSet.has(_ext)) { - allExtendsSet.add(_ext) - allExtends.push(_ext) + allExtendsSet.add(_ext); + allExtends.push(_ext); } } } @@ -300,58 +355,68 @@ class JavaCodeGenerator { * @param {Set.} allImplementsSet Used to avoid repeated elements in allImplements array * @param {Array.} allImplements Used to collect super interfaces in order */ - collectImplements (elem, allImplementsSet, allImplements) { - var _impls = this.getSuperInterfaces(elem) + collectImplements(elem, allImplementsSet, allImplements) { + var _impls = this.getSuperInterfaces(elem); for (var i = 0; i < _impls.length; i++) { - var _impl = _impls[i] - this.collectImplements(_impl, allImplementsSet, allImplements) + var _impl = _impls[i]; + this.collectImplements(_impl, allImplementsSet, allImplements); if (!allImplementsSet.has(_impl)) { - allImplementsSet.add(_impl) - allImplements.push(_impl) + allImplementsSet.add(_impl); + allImplements.push(_impl); } } } - + /** * Return type expression * @param {type.Model} elem * @param {Array.} imports Used to collect import declarations * @return {string} */ - getType (elem, imports, curPackage) { - var _type = 'void' - var typeElem = null - + getType(elem, imports, curPackage) { + var _type = "void"; + var typeElem = null; + // type name if (elem instanceof type.UMLAssociationEnd) { - if (elem.reference instanceof type.UMLModelElement && elem.reference.name.length > 0) { - typeElem = elem.reference + if ( + elem.reference instanceof type.UMLModelElement && + elem.reference.name.length > 0 + ) { + typeElem = elem.reference; // inner types need add owner's name as prefix - _type = getElemPath(typeElem, imports, curPackage) - } + _type = getElemPath(typeElem, imports, curPackage); + } } else { - if (elem.type instanceof type.UMLModelElement && elem.type.name.length > 0) { - typeElem = elem.type + if ( + elem.type instanceof type.UMLModelElement && + elem.type.name.length > 0 + ) { + typeElem = elem.type; // inner types need add owner's name as prefix - _type = getElemPath(typeElem, imports, curPackage) - } else if ((typeof elem.type === 'string') && elem.type.length > 0) { - _type = elem.type + _type = getElemPath(typeElem, imports, curPackage); + } else if (typeof elem.type === "string" && elem.type.length > 0) { + _type = elem.type; } } - + // multiplicity if (elem.multiplicity) { - if (['0..*', '1..*', '*'].includes(elem.multiplicity.trim())) { + if (["0..*", "1..*", "*"].includes(elem.multiplicity.trim())) { if (elem.isOrdered === true) { - _type = 'List<' + _type + '>' + _type = "List<" + _type + ">"; } else { - _type = 'Set<' + _type + '>' + _type = "Set<" + _type + ">"; } - } else if (elem.multiplicity !== '1' && elem.multiplicity.match(/^\d+$/)) { // number - _type += '[]' + } else if ( + elem.multiplicity !== "1" && + elem.multiplicity.match(/^\d+$/) + ) { + // number + _type += "[]"; } } - return _type + return _type; } /** @@ -362,15 +427,15 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeDoc (codeWriter, text, options, imports, curPackage) { - var i, len, lines - if (options.javaDoc && (typeof text === 'string')) { - lines = text.trim().split('\n') - codeWriter.writeLine('/**') + writeDoc(codeWriter, text, options, imports, curPackage) { + var i, len, lines; + if (options.javaDoc && typeof text === "string") { + lines = text.trim().split("\n"); + codeWriter.writeLine("/**"); for (i = 0, len = lines.length; i < len; i++) { - codeWriter.writeLine(' * ' + lines[i]) + codeWriter.writeLine(" * " + lines[i]); } - codeWriter.writeLine(' */') + codeWriter.writeLine(" */"); } } @@ -382,13 +447,18 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writePackageDeclaration (codeWriter, elem, options, imports, curPackage) { - var packagePath = null + writePackageDeclaration(codeWriter, elem, options, imports, curPackage) { + var packagePath = null; if (elem._parent) { - packagePath = elem._parent.getPath(this.baseModel).map(function (e) { return e.name }).join('.') + packagePath = elem._parent + .getPath(this.baseModel) + .map(function (e) { + return e.name; + }) + .join("."); } if (packagePath) { - codeWriter.writeLine('package ' + packagePath + ';') + codeWriter.writeLine("package " + packagePath + ";"); } } @@ -398,19 +468,25 @@ class JavaCodeGenerator { * @param {type.Model} elem * @param {Object} options */ - writeConstructor (codeWriter, elem, options, imports, curPackage) { + writeConstructor(codeWriter, elem, options, imports, curPackage) { if (elem.name.length > 0) { - var terms = [] + var terms = []; // Doc - this.writeDoc(codeWriter, 'Default constructor', options, imports, curPackage) + this.writeDoc( + codeWriter, + "Default constructor", + options, + imports, + curPackage, + ); // Visibility - var visibility = this.getVisibility(elem) + var visibility = this.getVisibility(elem); if (visibility) { - terms.push(visibility) + terms.push(visibility); } - terms.push(elem.name + '()') - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.writeLine('}') + terms.push(elem.name + "()"); + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.writeLine("}"); } } @@ -422,25 +498,31 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeMemberVariable (codeWriter, elem, options, imports, curPackage) { + writeMemberVariable(codeWriter, elem, options, imports, curPackage) { if (elem.name.length > 0) { - var terms = [] + var terms = []; // doc - this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) + this.writeDoc( + codeWriter, + elem.documentation, + options, + imports, + curPackage, + ); // modifiers - var _modifiers = this.getModifiers(elem) + var _modifiers = this.getModifiers(elem); if (_modifiers.length > 0) { - terms.push(_modifiers.join(' ')) + terms.push(_modifiers.join(" ")); } // type - terms.push(this.getType(elem, imports, curPackage)) + terms.push(this.getType(elem, imports, curPackage)); // name - terms.push(elem.name) + terms.push(elem.name); // initial value if (elem.defaultValue && elem.defaultValue.length > 0) { - terms.push('= ' + elem.defaultValue) + terms.push("= " + elem.defaultValue); } - codeWriter.writeLine(terms.join(' ') + ';') + codeWriter.writeLine(terms.join(" ") + ";"); } } @@ -456,99 +538,123 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeMethod (codeWriter, elem, owner, options, skipBody, skipParams, declaredBy, imports, curPackage) { + writeMethod( + codeWriter, + elem, + owner, + options, + skipBody, + skipParams, + declaredBy, + imports, + curPackage, + ) { if (elem.name.length > 0) { - var terms = [] - var params = elem.getNonReturnParameters() - var returnParam = elem.getReturnParameter() + var terms = []; + var params = elem.getNonReturnParameters(); + var returnParam = elem.getReturnParameter(); // doc - var doc = elem.documentation.trim() + var doc = elem.documentation.trim(); // Erase Javadoc @param and @return - var i - var lines = doc.split('\n') - doc = '' + var i; + var lines = doc.split("\n"); + doc = ""; for (i = 0, len = lines.length; i < len; i++) { - if (lines[i].lastIndexOf('@param', 0) !== 0 && lines[i].lastIndexOf('@return', 0) !== 0) { - doc += '\n' + lines[i] + if ( + lines[i].lastIndexOf("@param", 0) !== 0 && + lines[i].lastIndexOf("@return", 0) !== 0 + ) { + doc += "\n" + lines[i]; } } params.forEach(function (param) { - doc += '\n@param ' + param.name + ' ' + param.documentation - }) + doc += "\n@param " + param.name + " " + param.documentation; + }); if (returnParam) { - doc += '\n@return ' + returnParam.documentation + doc += "\n@return " + returnParam.documentation; } - this.writeDoc(codeWriter, doc, options, imports, curPackage) + this.writeDoc(codeWriter, doc, options, imports, curPackage); // modifiers - var _modifiers = this.getModifiers(elem) + var _modifiers = this.getModifiers(elem); if (_modifiers.length > 0) { - terms.push(_modifiers.join(' ')) + terms.push(_modifiers.join(" ")); } // type if (returnParam) { - terms.push(this.getType(returnParam, imports, curPackage)) + terms.push(this.getType(returnParam, imports, curPackage)); } else { if (elem.name === owner.name) { //constructor has no return - }else{ - terms.push('void') + } else { + terms.push("void"); } } // name + parameters - var paramTerms = [] + var paramTerms = []; if (!skipParams) { - var len + var len; for (i = 0, len = params.length; i < len; i++) { - var p = params[i] - var s = this.getType(p, imports, curPackage) + ' ' + p.name + var p = params[i]; + var s = this.getType(p, imports, curPackage) + " " + p.name; if (p.isReadOnly === true) { - s = 'final ' + s + s = "final " + s; } - paramTerms.push(s) + paramTerms.push(s); } } - terms.push(elem.name + '(' + paramTerms.join(', ') + ')') + terms.push(elem.name + "(" + paramTerms.join(", ") + ")"); // body - if (skipBody === true || _modifiers.includes('abstract')) { - codeWriter.writeLine(terms.join(' ') + ';') + if (skipBody === true || _modifiers.includes("abstract")) { + codeWriter.writeLine(terms.join(" ") + ";"); } else { - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.indent() + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.indent(); if (declaredBy === owner) { - codeWriter.writeLine('// TODO implement here') + codeWriter.writeLine("// TODO implement here"); } else { - codeWriter.writeLine('// TODO implement ' + declaredBy.name + '.' + elem.name + '() here') + codeWriter.writeLine( + "// TODO implement " + + declaredBy.name + + "." + + elem.name + + "() here", + ); } - + // return statement if (returnParam) { - var returnType = this.getType(returnParam, imports, curPackage) - if (returnType === 'boolean') { - codeWriter.writeLine('return false;') - } else if (returnType === 'int' || returnType === 'long' || returnType === 'short' || returnType === 'byte') { - codeWriter.writeLine('return 0;') - } else if (returnType === 'float') { - codeWriter.writeLine('return 0.0f;') - } else if (returnType === 'double') { - codeWriter.writeLine('return 0.0d;') - } else if (returnType === 'char') { - codeWriter.writeLine('return "0";') - } else if (returnType === 'String') { - codeWriter.writeLine('return "";') + var returnType = this.getType(returnParam, imports, curPackage); + if (returnType === "boolean") { + codeWriter.writeLine("return false;"); + } else if ( + returnType === "int" || + returnType === "long" || + returnType === "short" || + returnType === "byte" + ) { + codeWriter.writeLine("return 0;"); + } else if (returnType === "float") { + codeWriter.writeLine("return 0.0f;"); + } else if (returnType === "double") { + codeWriter.writeLine("return 0.0d;"); + } else if (returnType === "char") { + codeWriter.writeLine('return "0";'); + } else if (returnType === "String") { + codeWriter.writeLine('return "";'); } else { - codeWriter.writeLine('return null;') + codeWriter.writeLine("return null;"); } } - codeWriter.outdent() - codeWriter.writeLine('}') + codeWriter.outdent(); + codeWriter.writeLine("}"); } } } @@ -561,135 +667,208 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeClass (codeWriter, elem, options, imports, curPackage) { - var i, len - var terms = [] + writeClass(codeWriter, elem, options, imports, curPackage) { + var i, len; + var terms = []; // Doc - var doc = elem.documentation.trim() - if (app.project.getProject().author && app.project.getProject().author.length > 0) { - doc += '\n@author ' + app.project.getProject().author + var doc = elem.documentation.trim(); + if ( + app.project.getProject().author && + app.project.getProject().author.length > 0 + ) { + doc += "\n@author " + app.project.getProject().author; } - this.writeDoc(codeWriter, doc, options, imports, curPackage) + this.writeDoc(codeWriter, doc, options, imports, curPackage); // Modifiers - var _modifiers = this.getModifiers(elem) - if (_modifiers.includes('abstract') !== true && elem.operations.some(function (op) { return op.isAbstract === true })) { - _modifiers.push('abstract') + var _modifiers = this.getModifiers(elem); + if ( + _modifiers.includes("abstract") !== true && + elem.operations.some(function (op) { + return op.isAbstract === true; + }) + ) { + _modifiers.push("abstract"); } if (_modifiers.length > 0) { - terms.push(_modifiers.join(' ')) + terms.push(_modifiers.join(" ")); } // Class - terms.push('class') - terms.push(elem.name) + terms.push("class"); + terms.push(elem.name); // Extends - var _extends = this.getSuperClasses(elem) + var _extends = this.getSuperClasses(elem); if (_extends.length > 0) { - terms.push('extends ' + getElemPath(_extends[0], imports, curPackage)) + terms.push("extends " + getElemPath(_extends[0], imports, curPackage)); } // Implements - var _implements = this.getSuperInterfaces(elem) + var _implements = this.getSuperInterfaces(elem); if (_implements.length > 0) { - terms.push('implements ' + _implements.map(function (e) {return getElemPath(e, imports, curPackage)}).join(', ')) + terms.push( + "implements " + + _implements + .map(function (e) { + return getElemPath(e, imports, curPackage); + }) + .join(", "), + ); } - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.writeLine() - codeWriter.indent() + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.writeLine(); + codeWriter.indent(); // Constructor - this.writeConstructor(codeWriter, elem, options, imports, curPackage) - codeWriter.writeLine() + this.writeConstructor(codeWriter, elem, options, imports, curPackage); + codeWriter.writeLine(); // Member Variables // (from attributes) for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + elem.attributes[i], + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } // (from associations) var associations = app.repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLAssociation) - }) + return rel instanceof type.UMLAssociation; + }); for (i = 0, len = associations.length; i < len; i++) { - var asso = associations[i] + var asso = associations[i]; if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + asso.end2, + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + asso.end1, + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, false, false, elem, imports, curPackage) - codeWriter.writeLine() + this.writeMethod( + codeWriter, + elem.operations[i], + elem, + options, + false, + false, + elem, + imports, + curPackage, + ); + codeWriter.writeLine(); } - + // Extends methods if (_extends.length > 0) { for (i = 0, len = _extends[0].operations.length; i < len; i++) { - var _modifiers2 = this.getModifiers(_extends[0].operations[i]) - if (_modifiers2.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], elem, options, false, false, _extends[0], imports, curPackage) - codeWriter.writeLine() + var _modifiers2 = this.getModifiers(_extends[0].operations[i]); + if (_modifiers2.includes("abstract") === true) { + this.writeMethod( + codeWriter, + _extends[0].operations[i], + elem, + options, + false, + false, + _extends[0], + imports, + curPackage, + ); + codeWriter.writeLine(); } } } // Interface methods including all super interfaces - var _allExtendsSet = new Set() - var _allExtends = new Array() - this.collectExtends(elem, _allExtendsSet, _allExtends) + var _allExtendsSet = new Set(); + var _allExtends = new Array(); + this.collectExtends(elem, _allExtendsSet, _allExtends); // collect methods implemented by all extends to _allImplementsSet to be ignored when writeLine - var _allImplementsSet = new Set() - var _allImplements = new Array() + var _allImplementsSet = new Set(); + var _allImplements = new Array(); if (_allExtends.length > 0) { for (i = 0, len = _allExtends.length; i < len; i++) { - this.collectImplements(_allExtends[i], _allImplementsSet, _allImplements) + this.collectImplements( + _allExtends[i], + _allImplementsSet, + _allImplements, + ); } } // collect valid super interfaces - _allImplements.splice(0,_allImplements.length) - this.collectImplements(elem, _allImplementsSet, _allImplements) + _allImplements.splice(0, _allImplements.length); + this.collectImplements(elem, _allImplementsSet, _allImplements); // write methods in valid super interfaces for (var j = 0; j < _allImplements.length; j++) { for (i = 0, len = _allImplements[j].operations.length; i < len; i++) { - this.writeMethod(codeWriter, _allImplements[j].operations[i], elem, options, false, false, _allImplements[j], imports, curPackage) - codeWriter.writeLine() + this.writeMethod( + codeWriter, + _allImplements[j].operations[i], + elem, + options, + false, + false, + _allImplements[j], + imports, + curPackage, + ); + codeWriter.writeLine(); } } // Inner Definitions for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i] + var def = elem.ownedElements[i]; if (def instanceof type.UMLClass) { - if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options, imports, curPackage) + if (def.stereotype === "annotationType") { + this.writeAnnotationType( + codeWriter, + def, + options, + imports, + curPackage, + ); } else { - this.writeClass(codeWriter, def, options, imports, curPackage) + this.writeClass(codeWriter, def, options, imports, curPackage); } - codeWriter.writeLine() + codeWriter.writeLine(); } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeInterface(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeEnum(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } } - codeWriter.outdent() - codeWriter.writeLine('}') + codeWriter.outdent(); + codeWriter.writeLine("}"); } /** @@ -700,81 +879,122 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeInterface (codeWriter, elem, options, imports, curPackage) { - var i, len - var terms = [] + writeInterface(codeWriter, elem, options, imports, curPackage) { + var i, len; + var terms = []; // Doc - this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) + this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage); // Modifiers - var visibility = this.getVisibility(elem) + var visibility = this.getVisibility(elem); if (visibility) { - terms.push(visibility) + terms.push(visibility); } // Interface - terms.push('interface') - terms.push(elem.name) + terms.push("interface"); + terms.push(elem.name); // Extends - var _extends = this.getSuperClasses(elem) + var _extends = this.getSuperClasses(elem); if (_extends.length > 0) { - terms.push('extends ' + _extends.map(function (e) { return getElemPath(e, imports, curPackage) }).join(', ')) + terms.push( + "extends " + + _extends + .map(function (e) { + return getElemPath(e, imports, curPackage); + }) + .join(", "), + ); } - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.writeLine() - codeWriter.indent() + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.writeLine(); + codeWriter.indent(); // Member Variables // (from attributes) for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + elem.attributes[i], + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } // (from associations) var associations = app.repository.getRelationshipsOf(elem, function (rel) { - return (rel instanceof type.UMLAssociation) - }) + return rel instanceof type.UMLAssociation; + }); for (i = 0, len = associations.length; i < len; i++) { - var asso = associations[i] + var asso = associations[i]; if (asso.end1.reference === elem && asso.end2.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end2, options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + asso.end2, + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } if (asso.end2.reference === elem && asso.end1.navigable === true) { - this.writeMemberVariable(codeWriter, asso.end1, options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + asso.end1, + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, false, elem, imports, curPackage) - codeWriter.writeLine() + this.writeMethod( + codeWriter, + elem.operations[i], + elem, + options, + true, + false, + elem, + imports, + curPackage, + ); + codeWriter.writeLine(); } // Inner Definitions for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i] + var def = elem.ownedElements[i]; if (def instanceof type.UMLClass) { - if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options, imports, curPackage) + if (def.stereotype === "annotationType") { + this.writeAnnotationType( + codeWriter, + def, + options, + imports, + curPackage, + ); } else { - this.writeClass(codeWriter, def, options, imports, curPackage) + this.writeClass(codeWriter, def, options, imports, curPackage); } - codeWriter.writeLine() + codeWriter.writeLine(); } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeInterface(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeEnum(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } } - codeWriter.outdent() - codeWriter.writeLine('}') + codeWriter.outdent(); + codeWriter.writeLine("}"); } /** @@ -785,31 +1005,33 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeEnum (codeWriter, elem, options, imports, curPackage) { - var i, len - var terms = [] + writeEnum(codeWriter, elem, options, imports, curPackage) { + var i, len; + var terms = []; // Doc - this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage) + this.writeDoc(codeWriter, elem.documentation, options, imports, curPackage); // Modifiers - var visibility = this.getVisibility(elem) + var visibility = this.getVisibility(elem); if (visibility) { - terms.push(visibility) + terms.push(visibility); } // Enum - terms.push('enum') - terms.push(elem.name) + terms.push("enum"); + terms.push(elem.name); - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.indent() + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.indent(); // Literals for (i = 0, len = elem.literals.length; i < len; i++) { - codeWriter.writeLine(elem.literals[i].name + (i < elem.literals.length - 1 ? ',' : '')) + codeWriter.writeLine( + elem.literals[i].name + (i < elem.literals.length - 1 ? "," : ""), + ); } - codeWriter.outdent() - codeWriter.writeLine('}') + codeWriter.outdent(); + codeWriter.writeLine("}"); } /** @@ -820,79 +1042,119 @@ class JavaCodeGenerator { * @param {Set.} imports * @param {Object} curPackage */ - writeAnnotationType (codeWriter, elem, options, imports, curPackage) { - var i, len - var terms = [] + writeAnnotationType(codeWriter, elem, options, imports, curPackage) { + var i, len; + var terms = []; // Doc - var doc = elem.documentation.trim() - if (app.project.getProject().author && app.project.getProject().author.length > 0) { - doc += '\n@author ' + app.project.getProject().author + var doc = elem.documentation.trim(); + if ( + app.project.getProject().author && + app.project.getProject().author.length > 0 + ) { + doc += "\n@author " + app.project.getProject().author; } - this.writeDoc(codeWriter, doc, options, imports, curPackage) + this.writeDoc(codeWriter, doc, options, imports, curPackage); // Modifiers - var _modifiers = this.getModifiers(elem) - if (_modifiers.includes('abstract') !== true && elem.operations.some(function (op) { return op.isAbstract === true })) { - _modifiers.push('abstract') + var _modifiers = this.getModifiers(elem); + if ( + _modifiers.includes("abstract") !== true && + elem.operations.some(function (op) { + return op.isAbstract === true; + }) + ) { + _modifiers.push("abstract"); } if (_modifiers.length > 0) { - terms.push(_modifiers.join(' ')) + terms.push(_modifiers.join(" ")); } // AnnotationType - terms.push('@interface') - terms.push(elem.name) + terms.push("@interface"); + terms.push(elem.name); - codeWriter.writeLine(terms.join(' ') + ' {') - codeWriter.writeLine() - codeWriter.indent() + codeWriter.writeLine(terms.join(" ") + " {"); + codeWriter.writeLine(); + codeWriter.indent(); // Member Variables for (i = 0, len = elem.attributes.length; i < len; i++) { - this.writeMemberVariable(codeWriter, elem.attributes[i], options, imports, curPackage) - codeWriter.writeLine() + this.writeMemberVariable( + codeWriter, + elem.attributes[i], + options, + imports, + curPackage, + ); + codeWriter.writeLine(); } // Methods for (i = 0, len = elem.operations.length; i < len; i++) { - this.writeMethod(codeWriter, elem.operations[i], elem, options, true, true, elem, imports, curPackage) - codeWriter.writeLine() + this.writeMethod( + codeWriter, + elem.operations[i], + elem, + options, + true, + true, + elem, + imports, + curPackage, + ); + codeWriter.writeLine(); } // Extends methods - var _extends = this.getSuperClasses(elem) + var _extends = this.getSuperClasses(elem); if (_extends.length > 0) { for (i = 0, len = _extends[0].operations.length; i < len; i++) { - _modifiers = this.getModifiers(_extends[0].operations[i]) - if (_modifiers.includes('abstract') === true) { - this.writeMethod(codeWriter, _extends[0].operations[i], elem, options, false, false, _extends[0], imports, curPackage) - codeWriter.writeLine() + _modifiers = this.getModifiers(_extends[0].operations[i]); + if (_modifiers.includes("abstract") === true) { + this.writeMethod( + codeWriter, + _extends[0].operations[i], + elem, + options, + false, + false, + _extends[0], + imports, + curPackage, + ); + codeWriter.writeLine(); } } } // Inner Definitions for (i = 0, len = elem.ownedElements.length; i < len; i++) { - var def = elem.ownedElements[i] + var def = elem.ownedElements[i]; if (def instanceof type.UMLClass) { - if (def.stereotype === 'annotationType') { - this.writeAnnotationType(codeWriter, def, options, imports, curPackage) + if (def.stereotype === "annotationType") { + this.writeAnnotationType( + codeWriter, + def, + options, + imports, + curPackage, + ); } else { - this.writeClass(codeWriter, def, options, imports, curPackage) + this.writeClass(codeWriter, def, options, imports, curPackage); } - codeWriter.writeLine() + codeWriter.writeLine(); } else if (def instanceof type.UMLInterface) { - this.writeInterface(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeInterface(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } else if (def instanceof type.UMLEnumeration) { - this.writeEnum(codeWriter, def, options, imports, curPackage) - codeWriter.writeLine() + this.writeEnum(codeWriter, def, options, imports, curPackage); + codeWriter.writeLine(); } } - codeWriter.outdent() - codeWriter.writeLine('}') + codeWriter.outdent(); + codeWriter.writeLine("}"); } } @@ -902,9 +1164,9 @@ class JavaCodeGenerator { * @param {string} basePath * @param {Object} options */ -function generate (baseModel, basePath, options) { - var javaCodeGenerator = new JavaCodeGenerator(baseModel, basePath) - javaCodeGenerator.generate(baseModel, basePath, options, null) +function generate(baseModel, basePath, options) { + var javaCodeGenerator = new JavaCodeGenerator(baseModel, basePath); + javaCodeGenerator.generate(baseModel, basePath, options, null); } -exports.generate = generate +exports.generate = generate; diff --git a/codegen-utils.js b/codegen-utils.js index 4eb4eda..0d553bd 100644 --- a/codegen-utils.js +++ b/codegen-utils.js @@ -28,40 +28,40 @@ class CodeWriter { /** * @constructor */ - constructor (indentString) { + constructor(indentString) { /** @member {Array.} lines */ - this.lines = [] + this.lines = []; /** @member {string} indentString */ - this.indentString = indentString || ' ' // default 4 spaces + this.indentString = indentString || " "; // default 4 spaces /** @member {Array.} indentations */ - this.indentations = [] + this.indentations = []; } /** * Indent */ - indent () { - this.indentations.push(this.indentString) + indent() { + this.indentations.push(this.indentString); } /** * Outdent */ - outdent () { - this.indentations.splice(this.indentations.length - 1, 1) + outdent() { + this.indentations.splice(this.indentations.length - 1, 1); } /** * Write a line * @param {string} line */ - writeLine (line) { + writeLine(line) { if (line) { - this.lines.push(this.indentations.join('') + line) + this.lines.push(this.indentations.join("") + line); } else { - this.lines.push('') + this.lines.push(""); } } @@ -69,10 +69,9 @@ class CodeWriter { * Return as all string data * @return {string} */ - getData () { - return this.lines.join('\n') + getData() { + return this.lines.join("\n"); } - } -exports.CodeWriter = CodeWriter +exports.CodeWriter = CodeWriter; diff --git a/main.js b/main.js index 4ff55c5..e3bbe64 100644 --- a/main.js +++ b/main.js @@ -21,25 +21,25 @@ * */ -const codeGenerator = require('./code-generator') -const codeAnalyzer = require('./code-analyzer') +const codeGenerator = require("./code-generator"); +const codeAnalyzer = require("./code-analyzer"); -function getGenOptions () { +function getGenOptions() { return { - javaDoc: app.preferences.get('java.gen.javaDoc'), - useTab: app.preferences.get('java.gen.useTab'), - indentSpaces: app.preferences.get('java.gen.indentSpaces') - } + javaDoc: app.preferences.get("java.gen.javaDoc"), + useTab: app.preferences.get("java.gen.useTab"), + indentSpaces: app.preferences.get("java.gen.indentSpaces"), + }; } -function getRevOptions () { +function getRevOptions() { return { - association: app.preferences.get('java.rev.association'), - publicOnly: app.preferences.get('java.rev.publicOnly'), - typeHierarchy: app.preferences.get('java.rev.typeHierarchy'), - packageOverview: app.preferences.get('java.rev.packageOverview'), - packageStructure: app.preferences.get('java.rev.packageStructure') - } + association: app.preferences.get("java.rev.association"), + publicOnly: app.preferences.get("java.rev.publicOnly"), + typeHierarchy: app.preferences.get("java.rev.typeHierarchy"), + packageOverview: app.preferences.get("java.rev.packageOverview"), + packageStructure: app.preferences.get("java.rev.packageStructure"), + }; } /** @@ -49,36 +49,52 @@ function getRevOptions () { * @param {string} path * @param {Object} options */ -function _handleGenerate (base, path, options) { +async function _handleGenerate(base, path, options) { // If options is not passed, get from preference - options = options || getGenOptions() + options = options || getGenOptions(); // If base is not assigned, popup ElementPicker if (!base) { - app.elementPickerDialog.showDialog('Select a base model to generate codes', null, type.UMLPackage).then(function ({buttonId, returnValue}) { - if (buttonId === 'ok') { - base = returnValue - // If path is not assigned, popup Open Dialog to select a folder - if (!path) { - var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) - if (files && files.length > 0) { - path = files[0] - codeGenerator.generate(base, path, options) + app.elementPickerDialog + .showDialog( + "Select a base model to generate codes", + null, + type.UMLPackage, + ) + .then(async function ({ buttonId, returnValue }) { + if (buttonId === "ok") { + base = returnValue; + // If path is not assigned, popup Open Dialog to select a folder + if (!path) { + var files = await app.dialogs.showOpenDialogAsync( + "Select a folder where generated codes to be located", + null, + null, + { properties: ["openDirectory"] }, + ); + if (files && files.length > 0) { + path = files[0]; + codeGenerator.generate(base, path, options); + } + } else { + codeGenerator.generate(base, path, options); } - } else { - codeGenerator.generate(base, path, options) } - } - }) + }); } else { // If path is not assigned, popup Open Dialog to select a folder if (!path) { - var files = app.dialogs.showOpenDialog('Select a folder where generated codes to be located', null, null, { properties: [ 'openDirectory' ] }) + var files = await app.dialogs.showOpenDialogAsync( + "Select a folder where generated codes to be located", + null, + null, + { properties: ["openDirectory"] }, + ); if (files && files.length > 0) { - path = files[0] - codeGenerator.generate(base, path, options) + path = files[0]; + codeGenerator.generate(base, path, options); } } else { - codeGenerator.generate(base, path, options) + codeGenerator.generate(base, path, options); } } } @@ -89,15 +105,22 @@ function _handleGenerate (base, path, options) { * @param {string} basePath * @param {Object} options */ -function _handleReverse (basePath, options) { +async function _handleReverse(basePath, options) { // If options is not passed, get from preference - options = getRevOptions() + options = getRevOptions(); // If basePath is not assigned, popup Open Dialog to select a folder if (!basePath) { - var files = app.dialogs.showOpenDialog('Select Folder', null, null, { properties: [ 'openDirectory' ] }) + var files = await app.dialogs.showOpenDialogAsync( + "Select Folder", + null, + null, + { + properties: ["openDirectory"], + }, + ); if (files && files.length > 0) { - basePath = files[0] - codeAnalyzer.analyze(basePath, options) + basePath = files[0]; + codeAnalyzer.analyze(basePath, options); } } } @@ -105,14 +128,14 @@ function _handleReverse (basePath, options) { /** * Popup PreferenceDialog with Java Preference Schema */ -function _handleConfigure () { - app.commands.execute('application:preferences', 'java') +function _handleConfigure() { + app.commands.execute("application:preferences", "java"); } -function init () { - app.commands.register('java:generate', _handleGenerate) - app.commands.register('java:reverse', _handleReverse) - app.commands.register('java:configure', _handleConfigure) +function init() { + app.commands.register("java:generate", _handleGenerate); + app.commands.register("java:reverse", _handleReverse); + app.commands.register("java:configure", _handleConfigure); } -exports.init = init +exports.init = init; diff --git a/package.json b/package.json index a04e85a..c27ba3d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "keywords": [ "java" ], - "version": "0.9.5", + "version": "0.9.6", "author": { "name": "Minkyu Lee", "email": "niklaus.lee@gmail.com", @@ -15,6 +15,6 @@ }, "license": "MIT", "engines": { - "staruml": ">=3.0.0" + "staruml": ">=6.0.0" } } From 7b78a20efc97d2a34ff9c09db591077e08b247f1 Mon Sep 17 00:00:00 2001 From: niklauslee Date: Wed, 16 Apr 2025 20:03:49 +0900 Subject: [PATCH 18/18] Fix: Can't generate code for association #35 --- code-generator.js | 35 ++++++++++++++++++++++++----------- package.json | 2 +- 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/code-generator.js b/code-generator.js index a826d89..0f2be75 100644 --- a/code-generator.js +++ b/code-generator.js @@ -48,9 +48,9 @@ function getElemPath(elem, imports, curPackage) { // generate _import as fullpath of owner package var _fullImport = elem.name; var _import = ""; - if (owner != null && owner != curPackage) { + if (owner !== null && owner !== curPackage) { while (owner instanceof type.UMLPackage) { - _import = _fullImport; //ignore final root package that would be view point + _import = _fullImport; // ignore final root package that would be view point _fullImport = owner.name + "." + _fullImport; owner = owner._parent; } @@ -561,7 +561,7 @@ class JavaCodeGenerator { var i; var lines = doc.split("\n"); doc = ""; - for (i = 0, len = lines.length; i < len; i++) { + for (let i = 0, len = lines.length; i < len; i++) { if ( lines[i].lastIndexOf("@param", 0) !== 0 && lines[i].lastIndexOf("@return", 0) !== 0 @@ -589,7 +589,7 @@ class JavaCodeGenerator { terms.push(this.getType(returnParam, imports, curPackage)); } else { if (elem.name === owner.name) { - //constructor has no return + // constructor has no return } else { terms.push("void"); } @@ -737,13 +737,17 @@ class JavaCodeGenerator { ); codeWriter.writeLine(); } + // (from associations) var associations = app.repository.getRelationshipsOf(elem, function (rel) { return rel instanceof type.UMLAssociation; }); - for (i = 0, len = associations.length; i < len; i++) { + for (let i = 0, len = associations.length; i < len; i++) { var asso = associations[i]; - if (asso.end1.reference === elem && asso.end2.navigable === true) { + if ( + asso.end1.reference === elem && + asso.end2.navigable !== "notNavigable" + ) { this.writeMemberVariable( codeWriter, asso.end2, @@ -753,7 +757,10 @@ class JavaCodeGenerator { ); codeWriter.writeLine(); } - if (asso.end2.reference === elem && asso.end1.navigable === true) { + if ( + asso.end2.reference === elem && + asso.end1.navigable !== "notNavigable" + ) { this.writeMemberVariable( codeWriter, asso.end1, @@ -804,12 +811,12 @@ class JavaCodeGenerator { // Interface methods including all super interfaces var _allExtendsSet = new Set(); - var _allExtends = new Array(); + var _allExtends = []; this.collectExtends(elem, _allExtendsSet, _allExtends); // collect methods implemented by all extends to _allImplementsSet to be ignored when writeLine var _allImplementsSet = new Set(); - var _allImplements = new Array(); + var _allImplements = []; if (_allExtends.length > 0) { for (i = 0, len = _allExtends.length; i < len; i++) { this.collectImplements( @@ -930,7 +937,10 @@ class JavaCodeGenerator { }); for (i = 0, len = associations.length; i < len; i++) { var asso = associations[i]; - if (asso.end1.reference === elem && asso.end2.navigable === true) { + if ( + asso.end1.reference === elem && + asso.end2.navigable !== "notNavigable" + ) { this.writeMemberVariable( codeWriter, asso.end2, @@ -940,7 +950,10 @@ class JavaCodeGenerator { ); codeWriter.writeLine(); } - if (asso.end2.reference === elem && asso.end1.navigable === true) { + if ( + asso.end2.reference === elem && + asso.end1.navigable !== "notNavigable" + ) { this.writeMemberVariable( codeWriter, asso.end1, diff --git a/package.json b/package.json index c27ba3d..4b60cae 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "keywords": [ "java" ], - "version": "0.9.6", + "version": "0.9.7", "author": { "name": "Minkyu Lee", "email": "niklaus.lee@gmail.com",