1 package jfun.yan.element; 2 3 import java.util.Set ; 4 5 import jfun.util.Misc; 6 7 13 public class SetStore<T> implements ElementStore<T> { 14 private final Set <T> set; 15 16 19 public Set getSet() { 20 return set; 21 } 22 23 27 public SetStore(Set <T> set) { 28 this.set = set; 29 } 30 31 public void storeElement(int ind, T obj) { 32 set.add(obj); 33 } 34 35 public boolean equals(Object obj) { 36 if(obj instanceof SetStore){ 37 final SetStore other = (SetStore)obj; 38 return set==other.set; 39 } 40 else return false; 41 } 42 43 public int hashCode() { 44 return System.identityHashCode(set); 45 } 46 47 public String toString() { 48 return Misc.getTypeName(set.getClass()); 49 } 50 51 } 52 | Popular Tags |