markIncomesAsPassed method

void markIncomesAsPassed(
  1. Matrix mtx,
  2. NodeOutput item
)

Implementation

void markIncomesAsPassed(Matrix mtx, NodeOutput item) {
  item.renderIncomes.forEach((String incomeId) {
    var found = mtx.findNode((NodeOutput n) {
      return n.id == incomeId;
    });
    if (found == null) throw "income $incomeId not found on matrix";
    var coords = found.coords, income = found.item;
    income.childrenOnMatrix =
        min((income.childrenOnMatrix ?? 0) + 1, income.next.length);
    mtx.insert(coords[0], coords[1], income);
  });
  return;
}