diff --git a/index.html b/index.html index 7152f15..16b3fd6 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,7 @@ var N = Walk:0, Instance:0 }, + Create(inMeta) { return { @@ -19,19 +20,10 @@ var N = Link:{} }; }, - Step(inNode, inType, inForward) - { - let connectionGroup = inNode.Link[inType]; - if(!connectionGroup) - { - inNode.Link[inType] = connectionGroup = {Get:[], Set:[]}; - } - return (inForward === undefined || inForward === true) ? connectionGroup.Set : connectionGroup.Get - }, Connect(inNodeMajor, inNodeMinor, inKey) { - N.Step(inNodeMajor, inKey, true ).push(inNodeMinor); - N.Step(inNodeMinor, inKey, false).push(inNodeMajor); + N.Step(inNodeMajor, inKey, true, true).push(inNodeMinor); + N.Step(inNodeMinor, inKey, false, true).push(inNodeMajor); }, Disconnect(inNodeMajor, inNodeMinor, inKey) { @@ -99,6 +91,23 @@ var N = remove(inNodeMinor.Link[inKey].Get, inNodeMajor); } + }, + Step(inNode, inKey, inForward, inForceCreate) + { + let connectionGroup = inNode.Link[inKey]; + if(!connectionGroup) + { + if(inForceCreate) + { + inNode.Link[inKey] = connectionGroup = {Get:[], Set:[]}; + } + else + { + return false; + } + } + return (inForward === undefined || inForward === true) ? connectionGroup.Set : connectionGroup.Get; + }, Walk(inIterator, inNode, inKey, inForward) { @@ -116,9 +125,21 @@ var N = } } } + }, + Path(inArray, inNode, inKey, inForward) + { + var current = inNode; + var direction = inForward||true; + for(let i=0; i +