cvs commit: jakarta-bcel/src/java/org/apache/bcel/util ClassPath.java

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
mdahm       2002/06/06 04:32:55

  Modified:    src/java/org/apache/bcel/util ClassPath.java
  Log:
  Remember class path, toString()
  
  Revision  Changes    Path
  1.4       +26 -2     jakarta-bcel/src/java/org/apache/bcel/util/ClassPath.java
  
  Index: ClassPath.java
  ===================================================================
  RCS file: /home/cvs/jakarta-bcel/src/java/org/apache/bcel/util/ClassPath.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClassPath.java	14 Dec 2001 18:44:29 -0000	1.3
  +++ ClassPath.java	6 Jun 2002 11:32:55 -0000	1.4
  @@ -62,16 +62,21 @@
    * Responsible for loading (class) files from the CLASSPATH. Inspired by
    * sun.tools.ClassPath.
    *
  - * @version $Id: ClassPath.java,v 1.3 2001/12/14 18:44:29 mdahm Exp $
  + * @version $Id: ClassPath.java,v 1.4 2002/06/06 11:32:55 mdahm Exp $
    * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
    */
   public class ClassPath {
  +  public static final ClassPath SYSTEM_CLASS_PATH = new ClassPath();
  +
     private PathEntry[] paths;
  +  private String      class_path;
   
     /**
      * Search for classes in given path.
      */
     public ClassPath(String class_path) {
  +    this.class_path = class_path;
  +
       ArrayList vec = new ArrayList();
   
       for(StringTokenizer tok=new StringTokenizer(class_path,
  @@ -102,11 +107,30 @@
   
     /**
      * Search for classes in CLASSPATH.
  +   * @deprecated Use SYSTEM_CLASS_PATH constant
      */
     public ClassPath() {
       this(getClassPath());
     }
   
  +  /** @return used class path string
  +   */
  +  public String toString() {
  +    return class_path;
  +  }
  +  
  +  public int hashCode() {
  +    return class_path.hashCode();
  +  }
  +
  +  public boolean equals(Object o) {
  +    if(o instanceof ClassPath) {
  +      return class_path.equals(((ClassPath)o).class_path);
  +    }
  +
  +    return false;
  +  }
  +
     private static final void getPathComponents(String path, ArrayList list) {
       if(path != null) {
         StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);
  @@ -162,7 +186,7 @@
   	buf.append(File.pathSeparatorChar);
       }
   
  -    return buf.toString();
  +    return buf.toString().intern();
     }
   
     /**
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.