processOrSkipNodeOnMatrix method

bool processOrSkipNodeOnMatrix(
  1. NodeOutput item,
  2. State state
)

Implementation

bool processOrSkipNodeOnMatrix(NodeOutput item, State state) {
  var mtx = state.mtx;
  var queue = state.queue;
  if (item.passedIncomes.length != 0) {
    state.y = this.getLowestYAmongIncomes(item, mtx);
  }
  bool hasLoops = this.hasLoops(item);
  List<LoopNode> loopNodes = [];
  if (hasLoops) {
    loopNodes = this.handleLoopEdges(item, state);
  }
  bool needsLoopSkip = hasLoops && loopNodes.length == 0;
  if (mtx.hasVerticalCollision(state.x, state.y) || needsLoopSkip) {
    queue.push(item);
    return false;
  }
  this.insertOrSkipNodeOnMatrix(item, state, false);
  if (loopNodes.length != 0) {
    insertLoopEdges(item, state, loopNodes);
  }
  return true;
}