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.List ; 18 import java.util.ListIterator ; 19 20 import org.eclipse.core.databinding.observable.IChangeListener; 21 import org.eclipse.core.databinding.observable.IStaleListener; 22 import org.eclipse.core.databinding.observable.Realm; 23 import org.eclipse.core.databinding.observable.list.IListChangeListener; 24 import org.eclipse.core.databinding.observable.list.IObservableList; 25 26 29 public class EmptyObservableList implements IObservableList { 30 31 private static final List emptyList = Collections.EMPTY_LIST; 32 33 private Realm realm; 34 35 41 public EmptyObservableList(Realm realm) { 42 this.realm = realm; 43 } 44 45 public void addListChangeListener(IListChangeListener listener) { 46 } 47 48 public void removeListChangeListener(IListChangeListener listener) { 49 } 50 51 public Object getElementType() { 52 return null; 53 } 54 55 public int size() { 56 return 0; 57 } 58 59 public boolean isEmpty() { 60 return true; 61 } 62 63 public boolean contains(Object o) { 64 return false; 65 } 66 67 public Iterator iterator() { 68 return emptyList.iterator(); 69 } 70 71 public Object [] toArray() { 72 return emptyList.toArray(); 73 } 74 75 public Object [] toArray(Object [] a) { 76 return emptyList.toArray(a); 77 } 78 79 public boolean add(Object o) { 80 throw new UnsupportedOperationException (); 81 } 82 83 public boolean remove(Object o) { 84 throw new UnsupportedOperationException (); 85 } 86 87 public boolean containsAll(Collection c) { 88 return c.isEmpty(); 89 } 90 91 public boolean addAll(Collection c) { 92 throw new UnsupportedOperationException (); 93 } 94 95 public boolean retainAll(Collection c) { 96 throw new UnsupportedOperationException (); 97 } 98 99 public boolean removeAll(Collection c) { 100 throw new UnsupportedOperationException (); 101 } 102 103 public void clear() { 104 throw new UnsupportedOperationException (); 105 } 106 107 public void addChangeListener(IChangeListener listener) { 108 } 109 110 public void removeChangeListener(IChangeListener listener) { 111 } 112 113 public void addStaleListener(IStaleListener listener) { 114 } 115 116 public void removeStaleListener(IStaleListener listener) { 117 } 118 119 public boolean isStale() { 120 return false; 121 } 122 123 public void dispose() { 124 } 125 126 public boolean addAll(int index, Collection c) { 127 throw new UnsupportedOperationException (); 128 } 129 130 public Object get(int index) { 131 return emptyList.get(index); 132 } 133 134 public int indexOf(Object o) { 135 return -1; 136 } 137 138 public int lastIndexOf(Object o) { 139 return -1; 140 } 141 142 public ListIterator listIterator() { 143 return emptyList.listIterator(); 144 } 145 146 public ListIterator listIterator(int index) { 147 return emptyList.listIterator(index); 148 } 149 150 public Object remove(int index) { 151 throw new UnsupportedOperationException (); 152 } 153 154 public Object set(int index, Object element) { 155 throw new UnsupportedOperationException (); 156 } 157 158 public List subList(int fromIndex, int toIndex) { 159 return emptyList.subList(fromIndex, toIndex); 160 } 161 162 public void add(int arg0, Object arg1) { 163 throw new UnsupportedOperationException (); 164 } 165 166 public Realm getRealm() { 167 return realm; 168 } 169 170 } 171 | Popular Tags |