1 8 9 package net.sourceforge.chaperon.model.symbol; 10 11 import java.io.Serializable ; 12 13 19 public abstract class Symbol implements Serializable 20 { 21 22 String name = null; 23 24 29 public Symbol(String name) 30 { 31 if ((name==null) || (name.length()==0)) 32 throw new IllegalArgumentException ("Name for symbol is invalid"); 33 34 this.name = name; 35 } 36 37 42 public String getName() 43 { 44 return name; 45 } 46 47 52 public String toString() 53 { 54 return name; 55 } 56 57 62 public int hashCode() 63 { 64 return name.hashCode(); 65 } 66 67 74 public boolean equals(Object o) 75 { 76 if ((o!=null) && (o instanceof Symbol)) 77 { 78 Symbol symbol = (Symbol)o; 79 80 return symbol.name.equals(name); 81 } 82 83 return false; 84 } 85 } 86 | Popular Tags |