Permalink
Browse files

Journal: Fix typo and missing implementation for changeEdge

  • Loading branch information...
1 parent 4d17653 commit c6a2b594b4eec8934ec81c95ba933f6c4486c598 @jonnor jonnor committed Feb 26, 2014
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/lib/Journal.coffee
View
@@ -118,8 +118,8 @@ class Journal extends EventEmitter
@appendCommand 'addEdge', edge
@graph.on 'removeEdge', (edge) =>
@appendCommand 'removeEdge', edge
- @graph.on 'changeEdge', (edge) =>
- @appendCommand 'removeEdge', edge
+ @graph.on 'changeEdge', (edge, oldMeta) =>
+ @appendCommand 'changeEdge', {from: edge.from, to: edge.to, new: edge.metadata, old: oldMeta}
@graph.on 'addInitial', (iip) =>
@appendCommand 'addInitial', iip
@graph.on 'removeInitial', (iip) =>
@@ -197,6 +197,7 @@ class Journal extends EventEmitter
when 'changeNode' then @graph.setNodeMetadata a.id, calculateMeta(a.old, a.new)
when 'addEdge' then @graph.addEdge a.from.node, a.from.port, a.to.node, a.to.port
when 'removeEdge' then @graph.removeEdge a.from.node, a.from.port, a.to.node, a.to.port
+ when 'changeEdge' then @graph.setEdgeMetadata a.from.node, a.from.port, a.to.node, a.to.port, calculateMeta(a.old, a.new)
when 'addInitial' then @graph.addInitial a.from.data, a.to.node, a.to.port
when 'removeInitial' then @graph.removeInitial a.to.node, a.to.port
when 'startTransaction' then null
@@ -224,6 +225,7 @@ class Journal extends EventEmitter
when 'changeNode' then @graph.setNodeMetadata a.id, calculateMeta(a.new, a.old)
when 'addEdge' then @graph.removeEdge a.from.node, a.from.port, a.to.node, a.to.port
when 'removeEdge' then @graph.addEdge a.from.node, a.from.port, a.to.node, a.to.port
+ when 'changeEdge' then @graph.setEdgeMetadata a.from.node, a.from.port, a.to.node, a.to.port, calculateMeta(a.new, a.old)
when 'addInitial' then @graph.removeInitial a.to.node, a.to.port
when 'removeInitial' then @graph.addInitial a.from.data, a.to.node, a.to.port
when 'startTransaction' then null

0 comments on commit c6a2b59

Please sign in to comment.