Changeset 6351
- Timestamp:
- 2004-01-06T11:47:14+13:00 (20 years ago)
- Location:
- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java
r6288 r6351 59 59 child.setParent(this); 60 60 61 /* 61 62 if (this.id == null) { 62 63 System.out.println(child.id.toString() + " added to root"); … … 65 66 System.out.println(child.id.toString() + " added to " + this.id); 66 67 } 68 */ 67 69 } 68 70 -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/GS2HierarchyClassifier.java
r6288 r6351 157 157 this.hierarchy = handler.getHierarchy(); 158 158 this.fields = new ArrayList(); 159 System.out.println("loaded hierarchy for "+ file.toString());159 // System.out.println("loaded hierarchy for "+ file.toString()); 160 160 this.database = null; 161 161 } … … 246 246 } 247 247 248 System.out.println("Matching " + values.get(0).toString());248 // System.out.println("Matching " + values.get(0).toString()); 249 249 250 250 if (documentID == null) { -
trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/HierarchyClassifier.java
r6104 r6351 40 40 class HierarchyNode 41 41 { String descriptor; // the textual descriptor used on screen or long-hand 42 String name; // the index number, letter assignment or other item42 String path; // the index number, letter assignment or other item 43 43 // used to identify the position of the item in the 44 44 // hierarchy 45 String id;// an identifier used by the GLI for maintenance45 String name; // an identifier used by the GLI for maintenance 46 46 // purposes; this plays no active role in the 47 47 // rebuilding process (at the moment) … … 58 58 { this.descriptor = null; 59 59 this.name = null; 60 this. id= null;60 this.path = null; 61 61 this.childNodes = new ArrayList(); 62 62 this.childDocs = new ArrayList(); … … 85 85 } 86 86 87 public void set ID(String id)88 { this. id = id;87 public void setPath(String path) 88 { this.path = path; 89 89 } 90 90 … … 134 134 { StringBuffer description; 135 135 StringBuffer name; 136 StringBuffer id;136 StringBuffer path; 137 137 StringBuffer match; 138 138 boolean inElement; 139 139 HierarchyNode rootNode = null; 140 140 HierarchyNode currentNode = null; 141 List rootNodes = null; 141 142 142 143 HierarchyHandler() … … 145 146 this.name = null; 146 147 this.description = null; 147 this. id= null;148 this.path = null; 148 149 this.match = null; 150 this.rootNodes = new ArrayList(); 149 151 } 150 152 … … 155 157 156 158 // Initialise the tree 157 if (currentNode == null) 158 { if (this.rootNode == null) // which it should be 159 { this.rootNode = node; 160 } 161 else // insert a new root node, and set this as the peer 162 // of the original root... 163 { HierarchyNode newRoot = new HierarchyNode(); 164 newRoot.addChild(this.rootNode); 165 newRoot.addChild(node); 166 this.rootNode = newRoot; 167 } 159 if (this.currentNode == null) 160 { this.rootNode = node; 168 161 } 169 162 // Add the node … … 176 169 { this.name = new StringBuffer(); 177 170 } 178 else if (localName.equals(" ID"))179 { this. id= new StringBuffer();171 else if (localName.equals("Path")) 172 { this.path = new StringBuffer(); 180 173 } 181 174 else if (localName.equals("Description")) … … 192 185 public void endElement(String URI, String localName, String qName) 193 186 { if (localName.equals("Classification")) 194 { this.currentNode = this.currentNode.getParent(); 187 { if (this.currentNode.getParent() == null) { 188 this.rootNodes.add(this.currentNode); 189 } 190 this.currentNode = this.currentNode.getParent(); 195 191 } 196 192 else if (localName.equals("Name")) … … 198 194 this.name = null; 199 195 } 200 else if (localName.equals(" ID"))201 { this.currentNode.set ID(XMLTools.cleanString(this.id.toString()));202 this. id= null;196 else if (localName.equals("Path")) 197 { this.currentNode.setPath(XMLTools.cleanString(this.path.toString())); 198 this.path = null; 203 199 } 204 200 else if (localName.equals("Description")) … … 217 213 public void characters(char c[], int start, int length) 218 214 { String string = new String(c, start, length); 219 if (this. id!= null)220 { this. id.append(string);215 if (this.path != null) 216 { this.path.append(string); 221 217 } 222 218 else if (this.name != null) … … 238 234 private HierarchyNode hierarchy; 239 235 private List fields; 240 241 public HierarchyClassifier(File basefile, List fields) 236 private String sort; 237 238 public HierarchyClassifier(File basefile, List fields, String sort) 242 239 { 243 240 try … … 253 250 this.hierarchy = handler.getHierarchy(); 254 251 this.fields = fields; 252 this.sort = sort; 255 253 } 256 254 catch (SAXException saxException)
Note:
See TracChangeset
for help on using the changeset viewer.