blob: 43a87b5d63f211710df79a18d88a71f91484ecae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
"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 random_node_name() {
return Math.random().toString(36).substring(2, 10);
}
function Node() {
}
function create_node__set_random_id(node_spec) {
if (undefined == node_spec) {
node_spec = {};
}
var ret = new Node();
ret.id = random_id();
ret.name = node_spec.name;
ret.type = node_spec.type;
ret.state = node_spec.state;
ret.status = node_spec.status;
ret.url = node_spec.url;
ret.start = node_spec.start;
ret.end = node_spec.end;
return ret;
}
function create_link__set_random_id(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 {
random_node_name : random_node_name,
create_node__set_random_id : create_node__set_random_id,
create_link__set_random_id : create_link__set_random_id,
};
});
|