public UniformCmd ( bool eqSkip ) : int | ||
eqSkip | bool | when set to |
Результат | int |
/// <summary> /// Reduce the trie using Lift-Up reduction. /// <para> /// The Lift-Up reduction propagates all leaf-values (patch commands), where /// possible, to higher levels which are closer to the root of the trie. /// </para> /// </summary> /// <param name="in">the Row to consider when optimizing</param> /// <param name="nodes">contains the patch commands</param> public void LiftUp(Row @in, IList <Row> nodes) { IEnumerator <Cell> i = @in.cells.Values.GetEnumerator(); for (; i.MoveNext();) { Cell c = i.Current; if (c.@ref >= 0) { Row to = nodes[c.@ref]; int sum = to.UniformCmd(changeSkip); if (sum >= 0) { if (sum == c.cmd) { if (changeSkip) { if (c.skip != to.uniformSkip + 1) { continue; } c.skip = to.uniformSkip + 1; } else { c.skip = 0; } c.cnt += to.uniformCnt; c.@ref = -1; } else if (c.cmd < 0) { c.cnt = to.uniformCnt; c.cmd = sum; c.@ref = -1; if (changeSkip) { c.skip = to.uniformSkip + 1; } else { c.skip = 0; } } } } } }
/// <summary> /// Reduce the trie using Lift-Up reduction. /// <para> /// The Lift-Up reduction propagates all leaf-values (patch commands), where /// possible, to higher levels which are closer to the root of the trie. /// </para> /// </summary> /// <param name="in">the Row to consider when optimizing</param> /// <param name="nodes">contains the patch commands</param> public void LiftUp(Row @in, IList <Row> nodes) { foreach (Cell c in @in.cells.Values) { if (c.@ref >= 0) { Row to = nodes[c.@ref]; int sum = to.UniformCmd(changeSkip); if (sum >= 0) { if (sum == c.cmd) { if (changeSkip) { if (c.skip != to.uniformSkip + 1) { continue; } c.skip = to.uniformSkip + 1; } else { c.skip = 0; } c.cnt += to.uniformCnt; c.@ref = -1; } else if (c.cmd < 0) { c.cnt = to.uniformCnt; c.cmd = sum; c.@ref = -1; if (changeSkip) { c.skip = to.uniformSkip + 1; } else { c.skip = 0; } } } } } }