Implement BugCollection.hashCode()
[cfb.git] / prod / net / jaekl / cfb / xml / BugCollection.java
index d906ff983f9bb5b50c98d8b0c9ea512567b3c8e3..168c8f1c5787935a5c6badab052d291c2d1e74b0 100644 (file)
@@ -2,7 +2,10 @@ package net.jaekl.cfb.xml;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
 
+import net.jaekl.cfb.util.Util;
 import net.jaekl.qd.xml.ParseResult;
 import net.jaekl.qd.xml.XmlParseException;
 
@@ -19,8 +22,8 @@ public class BugCollection extends ParseResult {
                m_bugs = new ArrayList<BugInstance>();
        }
        
-       public int size() { return m_bugs.size(); }
-       public BugInstance get(int idx) { return m_bugs.get(idx); }
+       public List<BugInstance> getBugs() { return Collections.unmodifiableList(m_bugs); }
+       public void add(BugInstance bug) { m_bugs.add(bug); }
        
        @Override
        public void endContents(String uri, String localName, String qName,     String chars) 
@@ -50,4 +53,21 @@ public class BugCollection extends ParseResult {
                }
        }
 
+       @Override
+       public boolean equals(Object obj) {
+               if (null == obj) {
+                       return false;
+               }
+               if (! (obj instanceof BugCollection)) {
+                       return false;
+               }
+               BugCollection other = (BugCollection)obj;
+               
+               return Util.listsAreEqual(this.m_bugs, other.m_bugs);
+       }
+       
+       @Override
+       public int hashCode() {
+               return Util.objHashCode(m_bugs);
+       }
 }