Пример #1
0
  void executeSequence(boolean stopAtFirstMapping) {
    isomorphismFound = false;
    stack.clear();

    // Initial nodes
    QuerySequenceElement el = sequence.get(0);
    for (int k = 0; k < target.getAtomCount(); k++) {
      IAtom at = target.getAtom(k);
      if (el.center.matches(at)) {
        Node node = new Node();
        node.sequenceElNum = 0;
        node.nullifyAtoms(query.getAtomCount());
        node.atoms[el.centerNum] = at;
        stack.push(node);
      }
    }

    // Expanding the tree of all possible mappings
    if (stopAtFirstMapping) {
      while (!stack.isEmpty()) {
        expandNode(stack.pop());
        if (isomorphismFound) break;
      }
    } else {
      while (!stack.isEmpty()) expandNode(stack.pop());
    }
  }
Пример #2
0
  void executeSequenceAtPos(int pos) {
    isomorphismFound = false;
    stack.clear();

    // Initial node
    QuerySequenceElement el = sequence.get(0);
    IAtom at = target.getAtom(pos);
    if (el.center.matches(at)) {
      Node node = new Node();
      node.sequenceElNum = 0;
      node.nullifyAtoms(query.getAtomCount());
      node.atoms[el.centerNum] = at;
      stack.push(node);
    }

    // Expanding the tree of all possible mappings
    while (!stack.isEmpty()) {
      expandNode(stack.pop());
      if (isomorphismFound) break;
    }
  }