1 16 19 20 package org.apache.pluto.portalImpl.om.common.impl; 21 22 import java.io.Serializable ; 23 import java.util.Collection ; 24 import java.util.Iterator ; 25 import java.util.Set ; 26 27 public class UnmodifiableSet implements Set , Serializable { 28 29 private static final long serialVersionUID = 1820017752578914078L; 31 32 protected Set c; 33 34 public UnmodifiableSet(Set c) 35 { 36 if (c == null) { 37 throw new NullPointerException (); 38 } 39 this.c = c; 40 } 41 42 public int size() 43 { 44 return c.size(); 45 } 46 47 public boolean isEmpty() 48 { 49 return c.isEmpty(); 50 } 51 52 public boolean contains(Object o) 53 { 54 return c.contains(o); 55 } 56 57 public Object [] toArray() 58 { 59 return c.toArray(); 60 } 61 62 public Object [] toArray(Object [] a) 63 { 64 return c.toArray(a); 65 } 66 67 public String toString() 68 { 69 return c.toString(); 70 } 71 72 public Iterator iterator() 73 { 74 return new Iterator () 75 { 76 Iterator i = c.iterator(); 77 78 public boolean hasNext() 79 { 80 return i.hasNext(); 81 } 82 83 public Object next() 84 { 85 return i.next(); 86 } 87 88 public void remove() 89 { 90 throw new UnsupportedOperationException (); 91 } 92 }; 93 } 94 95 public boolean add(Object o) 96 { 97 throw new UnsupportedOperationException (); 98 } 99 100 public boolean remove(Object o) 101 { 102 throw new UnsupportedOperationException (); 103 } 104 105 public boolean containsAll(Collection coll) 106 { 107 return c.containsAll(coll); 108 } 109 110 public boolean addAll(Collection coll) 111 { 112 throw new UnsupportedOperationException (); 113 } 114 115 public boolean removeAll(Collection coll) 116 { 117 throw new UnsupportedOperationException (); 118 } 119 120 public boolean retainAll(Collection coll) 121 { 122 throw new UnsupportedOperationException (); 123 } 124 125 public void clear() 126 { 127 throw new UnsupportedOperationException (); 128 } 129 130 public boolean equals(Object o) 131 { 132 return c.equals(o); 133 } 134 135 public int hashCode() 136 { 137 return c.hashCode(); 138 } 139 140 142 149 public Set getModifiableSet() 150 { 151 return c; 152 } 153 } 154 | Popular Tags |