1 18 19 package org.apache.tools.ant.types; 20 21 import java.util.Iterator ; 22 import org.apache.tools.ant.DirectoryScanner; 23 import org.apache.tools.ant.types.resources.FileResourceIterator; 24 25 31 public class DirSet extends AbstractFileSet implements ResourceCollection { 32 33 36 public DirSet() { 37 super(); 38 } 39 40 44 protected DirSet(DirSet dirset) { 45 super(dirset); 46 } 47 48 53 public Object clone() { 54 if (isReference()) { 55 return ((DirSet) getRef(getProject())).clone(); 56 } else { 57 return super.clone(); 58 } 59 } 60 61 66 public Iterator iterator() { 67 if (isReference()) { 68 return ((DirSet) getRef(getProject())).iterator(); 69 } 70 return new FileResourceIterator(getDir(getProject()), 71 getDirectoryScanner(getProject()).getIncludedDirectories()); 72 } 73 74 79 public int size() { 80 if (isReference()) { 81 return ((DirSet) getRef(getProject())).size(); 82 } 83 return getDirectoryScanner(getProject()).getIncludedDirsCount(); 84 } 85 86 91 public boolean isFilesystemOnly() { 92 return true; 93 } 94 95 100 public String toString() { 101 DirectoryScanner ds = getDirectoryScanner(getProject()); 102 String [] dirs = ds.getIncludedDirectories(); 103 StringBuffer sb = new StringBuffer (); 104 105 for (int i = 0; i < dirs.length; i++) { 106 if (i > 0) { 107 sb.append(';'); 108 } 109 sb.append(dirs[i]); 110 } 111 return sb.toString(); 112 } 113 114 } 115 | Popular Tags |