getLowestYAmongIncomes method

int getLowestYAmongIncomes(
  1. NodeOutput item,
  2. Matrix mtx
)

Implementation

int getLowestYAmongIncomes(NodeOutput item, Matrix mtx) {
  final incomes = item.passedIncomes;
  if (incomes.length == 0) {
    return 0;
  }
  return incomes.map((String id) {
    List<int>? coords = mtx.find((NodeOutput itm) {
      return itm.id == id;
    });
    if (coords?.length != 2)
      throw "cannot find coordinates for passed income: $id";
    return coords![1];
  }).reduce(min);
}