Changeset 4464
- Timestamp:
- 2003-06-03T16:22:45+12:00 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/collection/Collection.java
r4439 r4464 166 166 return get(BUILT); 167 167 } 168 169 /** Determine the number of documents and folders in this collection. */ 170 public int getCount() { 171 return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), true, true); 172 } 173 168 174 /** Calculates the number of documents in this collection. */ 169 175 public int getDocumentCount() { 170 return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), false );176 return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), false, true); 171 177 } 172 178 /** Retrieve the description of this collection. … … 242 248 /** Counts the number of folders used in the current record set. */ 243 249 public int getFolderCount() { 244 return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), true );250 return getCount((TreeNode)Gatherer.c_man.getRecordSet().getRoot(), true, false); 245 251 } 246 252 /** Determine if this collection has had an import action run upon it since the last major change. … … 382 388 383 389 /** Count either documents or folders, depending on the state of the given boolean. */ 384 private int getCount(TreeNode node, boolean folders) {390 private int getCount(TreeNode node, boolean count_folders, boolean count_files) { 385 391 int count = 0; 386 392 File file = ((FileNode)node).getFile(); 387 if(file.isFile() && !folders) {393 if(file.isFile() && count_files) { 388 394 count++; 389 395 } 390 else if(file.isDirectory() && folders) {396 else if(file.isDirectory() && count_folders) { 391 397 count++; 392 398 } 393 399 for(int i = 0; i < node.getChildCount(); i++) { 394 count = count + getCount(node.getChildAt(i), folders);400 count = count + getCount(node.getChildAt(i), count_folders, count_files); 395 401 } 396 402 return count;
Note:
See TracChangeset
for help on using the changeset viewer.