Mercurial > hg > digilib-old
diff servlet/src/digilib/io/DocuDirent.java @ 271:d3abaf38fb5f
Servlet version 1.21b3
- searching in directories got faster (real binarySearch now!)
- cached file lists get disposed
- some code cleaning (Map types instead of HashMap)
author | robcast |
---|---|
date | Tue, 12 Oct 2004 16:06:43 +0200 |
parents | beed92ee6022 |
children | 2188086cd143 |
line wrap: on
line diff
--- a/servlet/src/digilib/io/DocuDirent.java Tue Oct 12 16:06:43 2004 +0200 +++ b/servlet/src/digilib/io/DocuDirent.java Tue Oct 12 16:06:43 2004 +0200 @@ -23,7 +23,7 @@ package digilib.io; import java.io.File; -import java.util.HashMap; +import java.util.Map; import org.apache.log4j.Logger; @@ -33,12 +33,12 @@ * @author casties * */ -public abstract class DocuDirent { +public abstract class DocuDirent implements Comparable { /** the file class of this file */ protected static int fileClass = FileOps.CLASS_NONE; /** HashMap with metadata */ - protected HashMap fileMeta = null; + protected Map fileMeta = null; /** Is the Metadata valid */ protected boolean metaChecked = false; /** the parent directory */ @@ -73,11 +73,11 @@ XMLMetaLoader ml = new XMLMetaLoader(); try { // read meta file - HashMap meta = ml.loadURL(mf.getAbsolutePath()); + Map meta = ml.loadURL(mf.getAbsolutePath()); if (meta == null) { return; } - fileMeta = (HashMap) meta.get(getName()); + fileMeta = (Map) meta.get(getName()); } catch (Exception e) { Logger.getLogger(this.getClass()).warn("error reading file .meta", e); } @@ -121,7 +121,7 @@ * * @return HashMap */ - public HashMap getFileMeta() { + public Map getFileMeta() { return fileMeta; } @@ -131,7 +131,7 @@ * @param fileMeta * The fileMeta to set */ - public void setFileMeta(HashMap fileMeta) { + public void setFileMeta(Map fileMeta) { this.fileMeta = fileMeta; } @@ -149,4 +149,12 @@ return fileClass; } + /** Comparator using the file name. + * + * @see java.lang.Comparable#compareTo(java.lang.Object) + */ + public int compareTo(Object arg0) { + return (getName().compareTo(arg0)); + } + }