1 19 20 package org.netbeans.api.convertor.store; 21 22 import java.util.ArrayList ; 23 import java.util.Collection ; 24 import org.netbeans.api.convertor.book.Book; 25 import org.netbeans.api.convertor.dvd.DVD; 26 27 28 32 public class Store { 33 34 public Collection books; 35 public Collection dvds; 36 37 public Store() { 38 books = new ArrayList (); 39 dvds = new ArrayList (); 40 } 41 42 public Store(Collection books, Collection dvds) { 43 this.books = books; 44 this.dvds = dvds; 45 } 46 47 public boolean equals(Object o) { 48 if (!(o instanceof Store)) { 49 return false; 50 } 51 Store s = (Store)o; 52 return books.equals(s.books) && 53 dvds.equals(s.dvds); 54 } 55 56 public void addBook(Book b) { 57 books.add(b); 58 } 59 60 public void addDVD(DVD d) { 61 dvds.add(d); 62 } 63 64 public int hashCode() { 65 return 125; 67 } 68 69 public String toString() { 70 return "Store[dvds="+dvds+", books="+books+"]"+super.toString(); 71 } 72 73 } 74 | Popular Tags |