From 22c032f9bf222de58c3923f769d67c4274034871 Mon Sep 17 00:00:00 2001 From: LV-426 Date: Thu, 13 Nov 2014 17:06:47 +0200 Subject: rename model/model -> model/core --- scripts/model/core.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/model/graph.js | 4 +-- scripts/model/model.js | 71 -------------------------------------------------- 3 files changed, 73 insertions(+), 73 deletions(-) create mode 100644 scripts/model/core.js delete mode 100644 scripts/model/model.js (limited to 'scripts/model') diff --git a/scripts/model/core.js b/scripts/model/core.js new file mode 100644 index 00000000..39b5f0be --- /dev/null +++ b/scripts/model/core.js @@ -0,0 +1,71 @@ +"use strict" + +/** + * core model module - currently unused + */ +define([], function() { + + /** + * return a random id + */ + var random_id = function() { + return Math.random().toString(36).substring(2); + } + + function Node() { + } + + this.create_node_with_random_id = function(node_spec) { + var ret = new Node(); + ret.id = random_id(); + + ret.name = spec.name; + ret.type = spec.type; + ret.state = spec.state; + ret.status = spec.status; + ret.url = spec.url; + + ret.start = spec.start; + ret.end = spec.end; + + return ret; + } + + this.create_link_with_random_id = function(link_spec) { + var ret = new Link(); + ret.id = random_id(); + } + + /** + * determine if nodes are equal by ID + * + * @param other_node + * @returns {Boolean} + */ + Node.prototype.equlas_by_id = function(other) { + ret = this.id.toLowerCase() == other.id.toLowerCase(); + if (false == ret) { + console.debug(this.id + ' != ' + other.id); + } + return ret; + } + + function Link() { + + } + + /** + * determine if links are equal by ID + * + * @param other_node + * @returns {Boolean} + */ + Link.prototype.equlas_by_id = function(other) { + return this.id.toLowerCase() == other.id.toLowerCase(); + } + + return { + create_node_with_random_id : create_node_with_random_id, + create_link_with_random_id : create_link_with_random_id, + }; +}); diff --git a/scripts/model/graph.js b/scripts/model/graph.js index 389b0abe..820daef0 100644 --- a/scripts/model/graph.js +++ b/scripts/model/graph.js @@ -1,7 +1,7 @@ "use strict" -define(['signal', 'consts', 'util', 'textanalysis','model/util', 'rz_api_backend', 'rz_api_mesh'], -function (signal, consts, util, textanalysis, model_util, rz_api_backend, rz_api_mesh) { +define(['signal', 'consts', 'util', 'textanalysis', 'model/core', 'model/util', 'rz_api_backend', 'rz_api_mesh'], +function (signal, consts, util, textanalysis, model_core, model_util, rz_api_backend, rz_api_mesh) { function Graph(el) { diff --git a/scripts/model/model.js b/scripts/model/model.js deleted file mode 100644 index 39b5f0be..00000000 --- a/scripts/model/model.js +++ /dev/null @@ -1,71 +0,0 @@ -"use strict" - -/** - * core model module - currently unused - */ -define([], function() { - - /** - * return a random id - */ - var random_id = function() { - return Math.random().toString(36).substring(2); - } - - function Node() { - } - - this.create_node_with_random_id = function(node_spec) { - var ret = new Node(); - ret.id = random_id(); - - ret.name = spec.name; - ret.type = spec.type; - ret.state = spec.state; - ret.status = spec.status; - ret.url = spec.url; - - ret.start = spec.start; - ret.end = spec.end; - - return ret; - } - - this.create_link_with_random_id = function(link_spec) { - var ret = new Link(); - ret.id = random_id(); - } - - /** - * determine if nodes are equal by ID - * - * @param other_node - * @returns {Boolean} - */ - Node.prototype.equlas_by_id = function(other) { - ret = this.id.toLowerCase() == other.id.toLowerCase(); - if (false == ret) { - console.debug(this.id + ' != ' + other.id); - } - return ret; - } - - function Link() { - - } - - /** - * determine if links are equal by ID - * - * @param other_node - * @returns {Boolean} - */ - Link.prototype.equlas_by_id = function(other) { - return this.id.toLowerCase() == other.id.toLowerCase(); - } - - return { - create_node_with_random_id : create_node_with_random_id, - create_link_with_random_id : create_link_with_random_id, - }; -}); -- cgit v1.3.1