public SemiTagTree clone() { SemiTagTree newtree = new SemiTagTree(); Hashtable<SemiTagNode, SemiTagNode> dup = new Hashtable<SemiTagNode, SemiTagNode>(); for (SemiTagNode hn : allnodes) dup.put(hn, new SemiTagNode()); for (SemiTagNode hn : allnodes) { SemiTagNode shadow = dup.get(hn); for (SemiTagEdge p : hn.inegdes) shadow.inegdes.add(new SemiTagEdge(dup.get(p.source), dup.get(p.target), p.methodsig)); for (SemiTagEdge s : hn.outegdes) shadow.outegdes.add(new SemiTagEdge(dup.get(s.source), dup.get(s.target), s.methodsig)); shadow.Value = hn.Value.clone(); shadow.status = hn.status; shadow.gene = hn.gene; shadow.sigs = hn.sigs; } for (SemiTagNode hn : heads) newtree.heads.add(dup.get(hn)); for (SemiTagNode hn : tails) newtree.tails.add(dup.get(hn)); for (SemiTagNode hn : allnodes) newtree.allnodes.add(dup.get(hn)); return newtree; }
public void mark(String s) { for (SemiTagNode n : allnodes) { n.sigs = new HashSet<String>(); n.sigs.add(s); } }