2015-10-26 08:03:30 +01:00
|
|
|
|
|
|
|
import * as Logger from '../../logger';
|
|
|
|
var log = new Logger.Log();
|
|
|
|
|
|
|
|
var relations = [];
|
|
|
|
|
2015-10-30 11:34:24 +01:00
|
|
|
let classes;
|
|
|
|
var idCache;
|
|
|
|
if(typeof Map !== 'undefined'){
|
|
|
|
classes = new Map();
|
|
|
|
}
|
2015-10-26 08:03:30 +01:00
|
|
|
// Functions to be run after graph rendering
|
|
|
|
var funs = [];
|
|
|
|
/**
|
|
|
|
* Function called by parser when a node definition has been found
|
|
|
|
* @param id
|
|
|
|
* @param text
|
|
|
|
* @param type
|
|
|
|
* @param style
|
|
|
|
*/
|
2015-10-28 08:12:47 +01:00
|
|
|
exports.addClass = function (id) {
|
|
|
|
console.log('Adding: '+id);
|
2015-10-29 07:49:08 +01:00
|
|
|
if(typeof classes.get(id) === 'undefined'){
|
|
|
|
classes.set(id, {
|
2015-10-28 08:12:47 +01:00
|
|
|
id:id,
|
|
|
|
methods:[]
|
2015-10-29 07:49:08 +01:00
|
|
|
});
|
2015-10-26 08:03:30 +01:00
|
|
|
}
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|
2015-10-26 08:03:30 +01:00
|
|
|
|
2015-10-28 08:12:47 +01:00
|
|
|
exports.clear = function () {
|
|
|
|
relations = [];
|
2015-10-29 07:49:08 +01:00
|
|
|
classes.clear();
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|
2015-10-26 08:03:30 +01:00
|
|
|
|
2015-10-28 08:12:47 +01:00
|
|
|
module.exports.getClass = function (id) {
|
2015-10-29 07:49:08 +01:00
|
|
|
return classes.get(id);
|
|
|
|
};
|
|
|
|
module.exports.getClasses = function (id) {
|
|
|
|
return classes;
|
|
|
|
};
|
|
|
|
|
2015-10-30 10:47:25 +01:00
|
|
|
module.exports.getRelations = function () {
|
2015-10-29 07:49:08 +01:00
|
|
|
return relations;
|
2015-10-28 08:12:47 +01:00
|
|
|
};
|
2015-10-26 08:03:30 +01:00
|
|
|
|
2015-10-28 08:12:47 +01:00
|
|
|
exports.addRelation = function (relation) {
|
|
|
|
console.log('Adding relation: ' + JSON.stringify(relation));
|
|
|
|
exports.addClass(relation.id1);
|
|
|
|
exports.addClass(relation.id2);
|
|
|
|
|
|
|
|
relations.push(relation);
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.addMembers = function (className, MembersArr) {
|
|
|
|
};
|
|
|
|
|
|
|
|
exports.lineType = {
|
|
|
|
LINE:0,
|
|
|
|
DOTTED_LINE:1
|
2015-10-26 08:03:30 +01:00
|
|
|
};
|
|
|
|
|
2015-10-28 08:12:47 +01:00
|
|
|
exports.relationType = {
|
|
|
|
AGGREGATION:0,
|
|
|
|
EXTENSION:1,
|
|
|
|
COMPOSITION:2,
|
|
|
|
DEPENDENCY:3
|
2015-10-26 08:03:30 +01:00
|
|
|
};
|