Code example for TreeMap

Methods: clearvalues

0
    /* package-private for now */ Iterator getResourceFiles(Project project) {
        if (src == null) {
            return new FileResourceIterator(project, getBasedir(), getIncludedFiles());
        } 
        scanme(); 
        return matchFileEntries.values().iterator();
    } 
 
    /** 
     * Get the set of Resources that represent directories. 
     * @param project since Ant 1.8 
     * @return an Iterator of Resources. 
     * @since Ant 1.7 
     */ 
    /* package-private for now */  Iterator getResourceDirectories(Project project) {
        if (src == null) {
            return new FileResourceIterator(project, getBasedir(), getIncludedDirectories());
        } 
        scanme(); 
        return matchDirEntries.values().iterator();
    } 
 
    /** 
     * Initialize DirectoryScanner data structures. 
     */ 
    public void init() { 
        if (includes == null) { 
            // No includes supplied, so set it to 'matches all' 
            includes = new String[1];
            includes[0] = "**"; 
        } 
        if (excludes == null) { 
            excludes = new String[0];
        } 
    } 
 
    /** 
     * Matches a jar entry against the includes/excludes list, 
     * normalizing the path separator. 
     * 
     * @param path the (non-null) path name to test for inclusion 
     * 
     * @return <code>true</code> if the path should be included 
     *         <code>false</code> otherwise. 
     */ 
    public boolean match(String path) {
        String vpath = path.replace('/', File.separatorChar).
            replace('\\', File.separatorChar);
        return isIncluded(vpath) && !isExcluded(vpath);
    } 
 
    /** 
     * Get the named Resource. 
     * @param name path name of the file sought in the archive 
     * @return the resource 
     * @since Ant 1.5.2 
     */ 
    public Resource getResource(String name) {
        if (src == null) {
            return super.getResource(name);
        } 
        if (name.equals("")) {
            // special case in ZIPs, we do not want this thing included 
            return new Resource("", true, Long.MAX_VALUE, true);
        } 
        // first check if the archive needs to be scanned again 
        scanme(); 
        if (fileEntries.containsKey(name)) {
            return (Resource) fileEntries.get(name);
        } 
        name = trimSeparator(name);
 
        if (dirEntries.containsKey(name)) {
            return (Resource) dirEntries.get(name);
        } 
        return new Resource(name);
    } 
 
    /** 
     * Fills the file and directory maps with resources read from the archive. 
     * 
     * @param archive the archive to scan. 
     * @param encoding encoding used to encode file names inside the archive. 
     * @param fileEntries Map (name to resource) of non-directory 
     * resources found inside the archive. 
     * @param matchFileEntries Map (name to resource) of non-directory 
     * resources found inside the archive that matched all include 
     * patterns and didn't match any exclude patterns. 
     * @param dirEntries Map (name to resource) of directory 
     * resources found inside the archive. 
     * @param matchDirEntries Map (name to resource) of directory 
     * resources found inside the archive that matched all include 
     * patterns and didn't match any exclude patterns. 
     */ 
    protected abstract void fillMapsFromArchive(Resource archive,
                                                String encoding,
                                                Map fileEntries,
                                                Map matchFileEntries,
                                                Map dirEntries,
                                                Map matchDirEntries);
 
    /** 
     * if the datetime of the archive did not change since 
     * lastScannedResource was initialized returns immediately else if 
     * the archive has not been scanned yet, then all the zip entries 
     * are put into the appropriate tables. 
     */ 
    private void scanme() { 
        if (!src.isExists() && !errorOnMissingArchive) {
            return; 
        } 
 
        //do not use a FileResource b/c it pulls File info from the filesystem: 
        Resource thisresource = new Resource(src.getName(),
                                             src.isExists(),
                                             src.getLastModified());
        // spare scanning again and again 
        if (lastScannedResource != null
            && lastScannedResource.getName().equals(thisresource.getName())
            && lastScannedResource.getLastModified()
            == thisresource.getLastModified()) {
            return; 
        } 
        init(); 
 
        fileEntries.clear();
        dirEntries.clear();
        matchFileEntries.clear();
        matchDirEntries.clear();
        fillMapsFromArchive(src, encoding, fileEntries, matchFileEntries,
                            dirEntries, matchDirEntries);
 
        // record data about the last scanned resource 
Contextual code suggestions in your IDE  Get Codota for Java