1 22 23 package org.xquark.xpath; 24 25 import java.util.*; 26 27 34 public class XTree 35 { 36 private static final String RCSRevision = "$Revision: 1.1 $"; 37 private static final String RCSName = "$Name: $"; 38 39 protected XTreeNode root; 40 41 protected HashMap locationNodeMap = new HashMap(); 42 43 48 public XTreeNode getRoot() 49 { 50 return root; 51 } 52 53 58 void setRoot(XTreeNode root) 59 { 60 this.root = root; 61 } 62 63 68 public void remove(PathExpr location) 69 { 70 throw new UnsupportedOperationException ("Not implemented yet."); 71 } 72 73 81 public XTreeNode getNode(PathExpr location) 82 { 83 int hash = location.hashCode(); 84 return (XTreeNode) locationNodeMap.get(location); 85 } 86 87 91 public Collection getNodeSet(ArrayList location) 92 { 93 return prune(location); 94 } 95 96 102 public final Collection prune(ArrayList location) 103 { 104 return root.prune(location); 105 } 106 107 116 public final Collection pruneGroup(ArrayList location) 117 { 118 return root.pruneGroup(location); 119 } 120 121 125 public Iterator iterator() 126 { 127 return new XTreeIterator(this); 128 } 129 130 136 public XTreeNode register(XTreeNode node) 137 { 138 PathExpr path = node.getLocation(); 139 if (path != null) 140 locationNodeMap.put(path, node); 141 return node; 142 } 143 144 148 public String toString() 149 { 150 return getRoot().toString(0); 151 } 152 } 153 | Popular Tags |