Ejemplo n.º 1
0
  void UpdateArrow(const Arrow &a) {
    if (status_by_arrow.count(a) > 0)
      return;

    int node2 = ArrowEnd(a);

    Status status = statii.at(a.first);

    bool found_reverse = false;
    for (const auto &ia : incoming_arrows.at(a.first)) {
      assert(ArrowEnd(ia) == a.first);
      //cout << "  ia " << ia << " " << ArrowEnd(ia) << endl;
      if (ia.first == node2) {
        found_reverse = true;
        continue;
      }
      UpdateArrow(ia);
      status.Merge(status_by_arrow.at(ia));
    }
    // cout << "UA " << a << " " << node2 << endl;

    assert(!incoming_arrows.at(a.first).empty());  // todo: remove in non-tree case
    if (!incoming_arrows.at(a.first).empty())
      assert(found_reverse);

    status_by_arrow[a] = status.Translate(a.second, dfa);
  }