| 1 19 20 22 package edu.umd.cs.findbugs.graph; 23 24 import java.util.ArrayList ; 25 import java.util.Iterator ; 26 import java.util.Set ; 27 28 32 public class SearchTree <VertexType extends GraphVertex<VertexType>> { 33 34 private VertexType m_vertex; 35 private ArrayList <SearchTree<VertexType>> m_childList; 36 37 40 public SearchTree(VertexType v) { 41 m_vertex = v; 42 m_childList = new ArrayList <SearchTree<VertexType>>(); 43 } 44 45 48 public VertexType getVertex() { 49 return m_vertex; 50 } 51 52 55 public void addChild(SearchTree<VertexType> child) { 56 m_childList.add(child); 57 } 58 59 63 public Iterator <SearchTree<VertexType>> childIterator() { 64 return m_childList.iterator(); 65 } 66 67 71 public void addVerticesToSet(Set <VertexType> set) { 72 set.add(this.m_vertex); 74 75 Iterator <SearchTree<VertexType>> i = childIterator(); 77 while (i.hasNext()) { 78 SearchTree<VertexType> child = i.next(); 79 child.addVerticesToSet(set); 80 } 81 } 82 83 } 84 85 | Popular Tags |