JAL-2344 use .equals() to compare FileFormatI objects
[jalview.git] / src / jalview / datamodel / PDBEntry.java
index db792e2..37dfdbf 100755 (executable)
@@ -34,9 +34,30 @@ public class PDBEntry
 
   public enum Type
   {
-    PDB, FILE
+    // TODO is FILE needed; if not is this needed or can we
+    // use FileFormatI for PDB, MMCIF?
+    PDB("pdb", "xml"), MMCIF("mmcif", "mmcif"), FILE("?", "?");
+    String ext;
+
+    String format;
+
+    private Type(String fmt, String ex)
+    {
+      format = fmt;
+      ext = ex;
+    }
+
+    public String getFormat()
+    {
+      return format;
+    }
+    public String getExtension()
+    {
+      return ext;
+    }
   }
-  Hashtable properties;
+
+  Hashtable<String, String> properties;
 
   /*
    * (non-Javadoc)
@@ -55,9 +76,8 @@ public class PDBEntry
       return true;
     }
     PDBEntry o = (PDBEntry) obj;
-    return
-    (type == o.type || (type != null && o.type != null && o.type
-                    .equals(type)))
+    return (type == o.type || (type != null && o.type != null && o.type
+            .equals(type)))
             && (id == o.id || (id != null && o.id != null && o.id
                     .equalsIgnoreCase(id)))
             && (chainCode == o.chainCode || (chainCode != null
@@ -66,7 +86,7 @@ public class PDBEntry
             && (properties == o.properties || (properties != null
                     && o.properties != null && properties
                       .equals(o.properties)));
-    
+
   }
 
   /**
@@ -86,7 +106,7 @@ public class PDBEntry
   // this.file = filePath;
   // this.id = pdbId;
   // }
-  
+
   public PDBEntry(String pdbId, String chain, PDBEntry.Type type,
           String filePath)
   {
@@ -127,6 +147,7 @@ public class PDBEntry
   {
     this.type = t;
   }
+
   public void setType(PDBEntry.Type type)
   {
     this.type = type == null ? null : type.toString();
@@ -152,7 +173,7 @@ public class PDBEntry
     this.properties = property;
   }
 
-  public Hashtable getProperty()
+  public Hashtable<String, String> getProperty()
   {
     return properties;
   }
@@ -167,4 +188,9 @@ public class PDBEntry
     this.chainCode = chainCode;
   }
 
+  @Override
+  public String toString()
+  {
+    return id;
+  }
 }