src/betting_tree.cpp
// Used by the subtree constructor
// This doesn't preserve the reentrancy of the source tree
// It appears we inherit the nonterminal IDs of the source tree, although they may get
// changed by the caller.
Used by the subtree constructor
This doesn't preserve the reentrancy of the source tree
It appears we inherit the nonterminal IDs of the source tree, although they may get
changed by the caller.
Used by the subtree constructor This doesn ' t preserve the reentrancy of the source tree It appears we inherit the nonterminal IDs of the source tree although they may get changed by the caller .
shared_ptr<Node> BettingTree::Clone(Node *old_n, int *num_terminals) {
  shared_ptr<Node> new_n(new Node(old_n));
  if (new_n->Terminal()) {
    new_n->SetTerminalID(*num_terminals);
    ++*num_terminals;
  }
  int num_succs = old_n->NumSuccs();
  for (int s = 0; s < num_succs; ++s) {
    shared_ptr<Node> new_succ(Clone(old_n->IthSucc(s), num_terminals));
    new_n->SetIthSucc(s, new_succ);
  }
  return new_n;
}
shared_ptr < Node > BettingTree :: Clone ( Node * old_n , int * num_terminals ) { shared_ptr < Node > new_n ( new Node ( old_n ) ) ; if ( new_n -> Terminal ( ) ) { new_n -> SetTerminalID ( * num_terminals ) ; ++ * num_terminals ; } int num_succs = old_n -> NumSuccs ( ) ; for ( int s = 0 ; s < num_succs ; ++ s ) { shared_ptr < Node > new_succ ( Clone ( old_n -> IthSucc ( s ) , num_terminals ) ) ; new_n -> SetIthSucc ( s , new_succ ) ; } return new_n ; }
Used by the subtree constructor
This doesn't preserve the reentrancy of the source tree
It appears we inherit the nonterminal IDs of the source tree, although they may get
changed by the caller.
Used by the subtree constructor This doesn ' t preserve the reentrancy of the source tree It appears we inherit the nonterminal IDs of the source tree although they may get changed by the caller .
// Need to reindex the terminal nodes