renaming
This commit is contained in:
parent
0fad43c6dc
commit
f938bbaa2e
34
index.html
34
index.html
@ -9,10 +9,13 @@ var N = {
|
|||||||
Parents:[],
|
Parents:[],
|
||||||
WalkID:0,
|
WalkID:0,
|
||||||
|
|
||||||
RecieveAddition:[],
|
GetUpward:[],
|
||||||
RecieveMultiplication:[],
|
GetDownward:[],
|
||||||
GiveAddition:[],
|
GetOutside:[],
|
||||||
GiveMultiplication:[]
|
|
||||||
|
SetUpward:[],
|
||||||
|
SetDownward:[],
|
||||||
|
SetOutside:[]
|
||||||
};
|
};
|
||||||
inChildren.forEach( inChild => N.Connect(output, "Children", inChild, "Parents") );
|
inChildren.forEach( inChild => N.Connect(output, "Children", inChild, "Parents") );
|
||||||
return output;
|
return output;
|
||||||
@ -24,7 +27,12 @@ var N = {
|
|||||||
},
|
},
|
||||||
Disconnect:(inParent, inParentRefs, inChild, inChildRefs) =>
|
Disconnect:(inParent, inParentRefs, inChild, inChildRefs) =>
|
||||||
{
|
{
|
||||||
//inParent[inParentRefs]
|
let checkRemove = (inArray, inMember) =>
|
||||||
|
{
|
||||||
|
inArray.findIndex( (inMember, inIndex, inArray) => (inMember === match) ? inArray.splice(inIndex, 1) : false );
|
||||||
|
};
|
||||||
|
checkRemove(inParent[inParentRefs], inChild);
|
||||||
|
checkRemove(inChild[inChildRefs], inParent);
|
||||||
},
|
},
|
||||||
Walk:(inNode, inKey, inIterator, inWalkID) =>
|
Walk:(inNode, inKey, inIterator, inWalkID) =>
|
||||||
{
|
{
|
||||||
@ -43,21 +51,23 @@ var N = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Modify(inNode, inAmount)
|
Modify(inNode)
|
||||||
{
|
{
|
||||||
inNode.WalkID = "tweak-"+Math.random();
|
inNode.WalkID = "tweak-"+Math.random();
|
||||||
|
|
||||||
let leaves = [];
|
let leaves = [];
|
||||||
let gatherAddition = n => N.Connect(inNode, "GiveAddition", n, "RecieveAddition");
|
let gatherUp = n => N.Connect(inNode, "SetUpward", n, "GetUpward");
|
||||||
let gatherMultiply = n =>
|
let gatherDown = n =>
|
||||||
{
|
{
|
||||||
N.Connect(inNode, "GiveMultiplication", n, "RecieveMultiplication");
|
N.Connect(inNode, "SetDownward", n, "GetDownward");
|
||||||
n.Children.length == 0 ? leaves.push(n) : null;
|
n.Children.length == 0 ? leaves.push(n) : null;
|
||||||
};
|
};
|
||||||
|
let gatherOut = n => N.Connect(inNode, "SetOutside", n, "GetOutside");
|
||||||
|
|
||||||
N.Walk(inNode, "Parents", gatherAddition, inNode.WalkID);
|
N.Walk(inNode, "Parents", gatherUp, inNode.WalkID);
|
||||||
N.Walk(inNode, "Children", gatherMultiply, inNode.WalkID);
|
N.Connect(inNode, "SetDownward", inNode, "GetDownward");
|
||||||
leaves.forEach(leaf=>N.Walk(leaf, "Parents", gatherAddition, inNode.WalkID));
|
N.Walk(inNode, "Children", gatherDown, inNode.WalkID);
|
||||||
|
leaves.forEach(leaf=>N.Walk(leaf, "Parents", gatherOut, inNode.WalkID));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user