/Users/lyon/j4p/src/collections/arrayList/Party.java

1    /* 
2     * Party.java 
3     * 
4     * Created on December 4, 2002 
5     */ 
6     
7    package collections.arrayList; 
8     
9    /** 
10    * A Dinner Party object. 
11    * @author Thomas Rowland 
12    */ 
13   public class Party { 
14    
15       private String partyName; 
16       private int partySize; 
17    
18       public Party(String name, int size) { 
19           partyName = name; 
20           partySize = size; 
21       } 
22    
23       public Party(String name) { 
24           partyName = name; 
25       } 
26    
27       public boolean equals(Object o) { 
28           if (o != null && o.getClass() == this.getClass()) { 
29               Party p = (Party) o; 
30               return (p.getName().equals(partyName)); 
31           } 
32           return false; 
33       } 
34    
35       public int hashCode() { 
36           return partyName.hashCode(); 
37       } 
38    
39       public String getName() { 
40           return partyName; 
41       } 
42    
43       public int getPartySize() { 
44           return partySize; 
45       } 
46    
47       public String toString() { 
48           return partyName + ", party of " + partySize; 
49       } 
50   } 
51