public override void InsertRowCols(Dictionary<Expr, Adjusted<Expr>> adjusted, Sheet modSheet, bool thisSheet, int R, int N, int r, bool doRows) { Adjusted<Expr> ae; if (adjusted.ContainsKey(e) && r < adjusted[e].upper) { // There is a valid cached adjusted expression ae = adjusted[e]; } else { // Compute a new adjusted expression and insert into the cache ae = e.InsertRowCols(modSheet, thisSheet, R, N, r, doRows); Console.WriteLine("Making new adjusted at rowcol " + r + "; upper = " + ae.upper); if (ae.same) { // For better sharing, reuse unadjusted e if same ae = new Adjusted<Expr>(e, ae.upper, ae.same); Console.WriteLine("Reusing expression"); } adjusted[e] = ae; } Debug.Assert(r < ae.upper, "Formula.InsertRowCols"); e = ae.e; }
public override void InsertRowCols(Dictionary <Expr, Adjusted <Expr> > adjusted, Sheet modSheet, bool thisSheet, int R, int N, int r, bool doRows) { Adjusted <Expr> ae; if (adjusted.ContainsKey(e) && r < adjusted[e].upper) { // There is a valid cached adjusted expression ae = adjusted[e]; } else { // Compute a new adjusted expression and insert into the cache ae = e.InsertRowCols(modSheet, thisSheet, R, N, r, doRows); Console.WriteLine("Making new adjusted at rowcol " + r + "; upper = " + ae.upper); if (ae.same) // For better sharing, reuse unadjusted e if same { ae = new Adjusted <Expr>(e, ae.upper, ae.same); Console.WriteLine("Reusing expression"); } adjusted[e] = ae; } Debug.Assert(r < ae.upper, "Formula.InsertRowCols"); e = ae.e; }
public override Adjusted <Expr> InsertRowCols(Sheet modSheet, bool thisSheet, int R, int N, int r, bool doRows) { if (sheet == modSheet || sheet == null && thisSheet) { Adjusted <RARef> adj = raref.InsertRowCols(R, N, r, doRows); return(new Adjusted <Expr>(new CellRef(sheet, adj.e), adj.upper, adj.same)); } else { return(new Adjusted <Expr>(this)); } }
public override Adjusted <Expr> InsertRowCols(Sheet modSheet, bool thisSheet, int R, int N, int r, bool doRows) { Expr[] newEs = new Expr[es.Length]; int upper = int.MaxValue; bool same = true; for (int i = 0; i < es.Length; i++) { Adjusted <Expr> ae = es[i].InsertRowCols(modSheet, thisSheet, R, N, r, doRows); upper = Math.Min(upper, ae.upper); same = same && ae.same; newEs[i] = ae.e; } return(new Adjusted <Expr>(new FunCall(function, newEs), upper, same)); }
public override Adjusted <Expr> InsertRowCols(Sheet modSheet, bool thisSheet, int R, int N, int r, bool doRows) { if (sheet == modSheet || sheet == null && thisSheet) { Adjusted <RARef> ulNew = ul.InsertRowCols(R, N, r, doRows), lrNew = lr.InsertRowCols(R, N, r, doRows); int upper = Math.Min(ulNew.upper, lrNew.upper); return(new Adjusted <Expr>(new CellArea(sheet, ulNew.e, lrNew.e), upper, ulNew.same && lrNew.same)); } else { return(new Adjusted <Expr>(this)); } }