diff options
| author | LV-426 <lv-426@taproot.org.il> | 2014-11-19 03:22:42 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-11-19 23:23:40 +0200 |
| commit | 253f46286559735bbc60126eef721b5cedfabec5 (patch) | |
| tree | f47ac64a972f9d5280863ee58443d0ed18ce6ba0 | |
| parent | d93874113319d07ed36200da85888a92a4257e22 (diff) | |
__addNode improve logging
| -rw-r--r-- | src/model/graph.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/model/graph.js b/src/model/graph.js index b8d47810..28298e58 100644 --- a/src/model/graph.js +++ b/src/model/graph.js @@ -36,17 +36,27 @@ function Graph(el) { * @param notify whether or not a presenter notification will be sent, default = true */ this.__addNode = function(node, notify) { + var existing_node; if (undefined == node.id) { - if (findNodeByName(node.name)){ + existing_node = findNodeByName(node.name) + if (existing_node){ // FIXME handle node-with-equal-name case + console.debug('__addNode: name collision: existing-node.name: \'' + existing_node.name + '\'' + 'new-node.name: \'' + node.name + '\''); return; }else{ node = model_core.create_node__set_random_id(node); - console.debug('__addNode: node id missing, generated: name: ' + node.name + ', id: ' + node.id); + // TODO clean + if ('bubble' == node.type){ + console.debug('__addNode: stamping node id: ' + node.id + ', name: \'' + node.name + '\' (bubble)'); + }else { + console.debug('__addNode: stamping node id: ' + node.id + ', name: \'' + node.name + '\''); + } } } - if (findNode(node.id, null)){ + existing_node = findNode(node.id, null); + if (existing_node){ + console.debug('__addNode: id collision: existing-node.id: \'' + existing_node.id + '\'' + 'new-node.id: \'' + node.id + '\''); return; } @@ -268,7 +278,8 @@ function Graph(el) { if (drop_conjugator_links && name && (name.replace(/ /g,"") === "and")) { state = "temp"; } - if (sourceNode === undefined || targetNode === undefined) { + if (undefined === sourceNode || undefined === targetNode) { + console.log('addLink: undefined src / dst'); return; } if (!found) { |
