1 11 12 package org.eclipse.core.internal.databinding.observable; 13 14 import java.util.Collection ; 15 import java.util.Collections ; 16 import java.util.Iterator ; 17 import java.util.Set ; 18 19 import org.eclipse.core.databinding.observable.IChangeListener; 20 import org.eclipse.core.databinding.observable.IStaleListener; 21 import org.eclipse.core.databinding.observable.Realm; 22 import org.eclipse.core.databinding.observable.set.IObservableSet; 23 import org.eclipse.core.databinding.observable.set.ISetChangeListener; 24 25 28 public class EmptyObservableSet implements IObservableSet { 29 30 private static final Set emptySet = Collections.EMPTY_SET; 31 32 private Realm realm; 33 34 40 public EmptyObservableSet(Realm realm) { 41 this.realm = realm; 42 } 43 44 public void addSetChangeListener(ISetChangeListener listener) { 45 } 46 47 public void removeSetChangeListener(ISetChangeListener listener) { 48 } 49 50 public Object getElementType() { 51 return null; 52 } 53 54 public int size() { 55 return 0; 56 } 57 58 public boolean isEmpty() { 59 return true; 60 } 61 62 public boolean contains(Object o) { 63 return false; 64 } 65 66 public Iterator iterator() { 67 return emptySet.iterator(); 68 } 69 70 public Object [] toArray() { 71 return emptySet.toArray(); 72 } 73 74 public Object [] toArray(Object [] a) { 75 return emptySet.toArray(a); 76 } 77 78 public boolean add(Object o) { 79 throw new UnsupportedOperationException (); 80 } 81 82 public boolean remove(Object o) { 83 throw new UnsupportedOperationException (); 84 } 85 86 public boolean containsAll(Collection c) { 87 return c.isEmpty(); 88 } 89 90 public boolean addAll(Collection c) { 91 throw new UnsupportedOperationException (); 92 } 93 94 public boolean retainAll(Collection c) { 95 throw new UnsupportedOperationException (); 96 } 97 98 public boolean removeAll(Collection c) { 99 throw new UnsupportedOperationException (); 100 } 101 102 public void clear() { 103 throw new UnsupportedOperationException (); 104 } 105 106 public void addChangeListener(IChangeListener listener) { 107 } 108 109 public void removeChangeListener(IChangeListener listener) { 110 } 111 112 public void addStaleListener(IStaleListener listener) { 113 } 114 115 public void removeStaleListener(IStaleListener listener) { 116 } 117 118 public boolean isStale() { 119 return false; 120 } 121 122 public void dispose() { 123 } 124 125 public Realm getRealm() { 126 return realm; 127 } 128 129 } 130 | Popular Tags |