Skip to content

Commit

Permalink
Extract DAG Vertex to its own Constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Aug 18, 2014
1 parent b9eed2b commit e2cad66
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions packages/ember-application/lib/system/dag.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ function visit(vertex, fn, visited, path) {
function DAG() {
this.names = [];
this.vertices = {};
/**
* DAG Vertex
*
* @class Vertex
* @constructor
*/

function Vertex(name) {
this.name = name;
this.incoming = {};
this.incomingNames = [];
this.hasOutgoing = false;
this.value = null;
}

/**
Expand All @@ -52,9 +65,7 @@ DAG.prototype.add = function(name) {
if (this.vertices.hasOwnProperty(name)) {
return this.vertices[name];
}
var vertex = {
name: name, incoming: {}, incomingNames: [], hasOutgoing: false, value: null
};
var vertex = new Vertex(name);
this.vertices[name] = vertex;
this.names.push(name);
return vertex;
Expand Down

0 comments on commit e2cad66

Please sign in to comment.