debugging

This commit is contained in:
TreetopFlyer 2021-05-28 20:52:56 -04:00
parent 0b3308ebfd
commit 30ac8d0d00

View File

@ -148,11 +148,20 @@ var N =
if(next.ID.Walk !== N.ID.Walk)
{
next.ID.Walk = N.ID.Walk;
//console.log("processing", next.Meta)
let results = inIterator(next);
if(results !== false)
{
N.Walk(inIterator, next, inKey, inForward, inTerminal);
}
else
{
//console.log("routine exited");
}
}
else
{
//console.log("id collision");
}
}
},
@ -198,7 +207,11 @@ var Pivot =
// - optional traversal depth, defaults to 0
let depth = inDepth||0;
let uniques = {};
let indexPivot = inPivotIndicies[depth]
let indexPivot = inPivotIndicies[depth];
if(!inParent.Meta.Leaves)
{
console.log("problem")
}
inParent.Meta.Leaves.forEach((inLeaf)=>
{
let row = inLeaf.Meta.Row; // shorthand for the raw "CSV" row in the leaf Node's Meta
@ -233,8 +246,9 @@ var Pivot =
match.Leaves.push(inLeaf);
});
// get the leaves out of the parent, at this point they have been re-distributed to the children
delete inParent.Meta.Leaves;
var iterator;
let iterator = () => {};
if(depth >= inPivotIndicies.length-1)
{
iterator = inLastBranch =>
@ -244,11 +258,15 @@ var Pivot =
// collect modifiers effecting leaves
let modifiers = [];
let collectModifier = n => modifiers.push(n);
let connectModifiers = n => modifiers.forEach(inModifier => N.Connect(inModifier, n, "ModifyOut", true));
let connectModifiers = n =>
{
modifiers.forEach(inModifier => N.Connect(inModifier, n, "ModifyOut", true));
};
N.Walk(collectModifier, inLeaf, "ModifyAt", false);
N.Walk(collectModifier, inLeaf, "ModifyDown", false);
if(modifiers.length)
{
// apply them to the branch
@ -256,20 +274,38 @@ var Pivot =
connectModifiers(inLastBranch);
// also walk them up and connect, but with "check unique" enabled
console.log("walking modifiers up from", inLastBranch.Meta.Label);
N.ID.Walk++;
N.Walk(connectModifiers, inLastBranch, "Hierarchy", false);
/*
N.Walk((n)=>
{
console.log("going up", n);
}
, inLastBranch, "Hierarchy", false);
*/
}
// lastly connect the leaf to the branch
N.Connect(inLastBranch, inLeaf, "Leaf");
});
delete inLastBranch.Meta.Leaves;
}
}
else
{
iterator = child => Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1);
iterator = child => {
if(child.Meta.Label == "b")
{
console.log("at b for some reason");
}
Pivot.Pivot(inRoot, child, inPivotIndicies, inSumIndicies, depth+1);
};
}
N.Walk(iterator, inParent, "Hierarchy");
return inParent;
},
Create(inPivotIndicies, inSumIndicies)
@ -741,10 +777,19 @@ const Render = () => render(h(ElRoot), document.querySelector("#app"));
Render();
Pivot.Create([1, 2], [3, 4]);
let pivot = N.Path([0], Pivot.Root, "Pivot");
let node = N.Path([0, 1], pivot, "Hierarchy");
Pivot.Modify(node);
Pivot.Create([2, 1], [3, 4]);
Render();
</script>
<!-- testing area -->
<script>
/*
let ModificationPull = (inDAG) =>
{
let collect = inArray => n => { n.Meta.Tweak.forEach((t, i)=>{ inArray[n.Meta.Indicies[i]] += t; }); };
@ -769,5 +814,6 @@ Render();
let results = ModificationPull(dag1);
console.log(results);
*/
</script>