1 package org.bsf.smartValueObject.container; 2 3 import org.bsf.smartValueObject.container.AbstractSmartContainer; 4 import org.bsf.smartValueObject.Versionable; 5 6 import java.util.Set ; 7 import java.util.Iterator ; 8 import java.util.Collection ; 9 10 16 public class SmartSet extends AbstractSmartContainer implements Set { 17 18 private Set set; 19 20 25 public SmartSet(Set s, Versionable v) { 26 super(v); 27 this.set = s; 28 } 29 30 protected boolean addToContainer(Object o) { 31 return set.add(o); 32 } 33 34 protected Object addToContainer(Object key, Object o) { 35 throw new UnsupportedOperationException (); 36 } 37 38 protected Object getFromContainer(Object key) { 39 throw new UnsupportedOperationException (); 40 } 41 42 protected boolean removeFromContainer(Object o) { 43 return set.remove(o); 44 } 45 46 protected Object removeKeyFromContainer(Object key) { 47 throw new UnsupportedOperationException (); 48 } 49 50 protected boolean containerContains(Object o) { 51 return set.contains(o); 52 } 53 54 protected boolean containerContainsKey(Object key) { 55 throw new UnsupportedOperationException (); 56 } 57 58 protected int containerSize() { 59 return set.size(); 60 } 61 62 protected Iterator containerIterator() { 63 return set.iterator(); 64 } 65 66 protected void containerClear() { 67 set.clear(); 68 } 69 70 protected Object [] toObjectArray() { 71 return set.toArray(); 72 } 73 74 public boolean remove(Object o) { 75 return removeObject(o); 76 } 77 78 public boolean containsAll(Collection c) { 79 return false; 80 } 81 82 public boolean addAll(Collection c) { 83 return false; 84 } 85 86 public boolean retainAll(Collection c) { 87 return false; 88 } 89 90 public boolean removeAll(Collection c) { 91 return false; 92 } 93 94 public Iterator getIterator() { 95 return this.set.iterator(); 96 } 97 98 public Object getContainer() { 99 return set; 100 } 101 102 public String toString() { 103 return "SmartSet [" + set.toString() + "]"; 104 } 105 } 106 | Popular Tags |