1 package org.jboss.cache.data; 2 3 6 public class Course implements java.io.Serializable { 7 protected String title; 8 protected String instructor; 9 protected String room; 10 11 public void setTitle(String title) 12 { 13 this.title = title; 14 } 15 16 public String getTitle() 17 { 18 return this.title; 19 } 20 21 public void setRoom(String room) 22 { 23 this.room = room; 24 } 25 26 public String getRoom() 27 { 28 return this.room; 29 } 30 31 public void setInstructor(String instructor) 32 { 33 this.instructor = instructor; 34 } 35 36 public String getInstructor() 37 { 38 return instructor; 39 } 40 41 public String toString() 42 { 43 StringBuffer buf = new StringBuffer (); 44 buf.append("{Title = " +title).append(", Instructor = " + instructor).append(", Room = " +room + "}\n"); 45 46 return buf.toString(); 47 } 48 49 public boolean equals(Object other) 50 { 51 if (this == other) 52 return true; 53 54 if (other instanceof Course) { 55 String otherTitle = ((Course) other).getTitle(); 56 return (title == otherTitle || (title != null && title.equals(otherTitle))); 57 } 58 59 return false; 60 } 61 62 public int hashCode() 63 { 64 return title == null ? 0 : title.hashCode(); 65 } 66 } 67 | Popular Tags |