1 19 package org.netbeans.mdr.handlers; 20 21 import java.util.Collection ; 22 import java.util.List ; 23 import java.util.ListIterator ; 24 import org.netbeans.mdr.storagemodel.MdrStorage; 25 26 import org.netbeans.mdr.util.TransactionMutex; 27 28 32 public final class AttrImmutListWrapper extends AttrImmutCollWrapper implements List { 33 34 35 public AttrImmutListWrapper(MdrStorage mdrStorage, FeaturedHandler source, int attrIndex, String attrName) { 36 super(mdrStorage, source, attrIndex, attrName); 37 } 38 39 public AttrImmutListWrapper(MdrStorage mdrStorage, Collection inner) { 40 super(mdrStorage, inner); 41 } 42 43 public List getInnerList() { 44 return (List ) getInnerCollection(); 45 } 46 47 public Object remove(int param) { 48 throw new UnsupportedOperationException (); 49 } 50 51 public ListIterator listIterator(int param) { 52 lock(false); 53 try { 54 return new AttrImmutListIteratorWrapper(getInnerList().listIterator(param)); 55 } finally { 56 unlock(); 57 } 58 } 59 60 public void add(int param, Object obj) { 61 throw new UnsupportedOperationException (); 62 } 63 64 public int indexOf(Object obj) { 65 lock(false); 66 try { 67 return getInnerList().indexOf(obj); 68 } finally { 69 unlock(); 70 } 71 } 72 73 public int lastIndexOf(Object obj) { 74 lock(false); 75 try { 76 return getInnerList().lastIndexOf(obj); 77 } finally { 78 unlock(); 79 } 80 } 81 82 public Object get(int param) { 83 lock(false); 84 try { 85 return getInnerList().get(param); 86 } finally { 87 unlock(); 88 } 89 } 90 91 public Object set(int param, Object obj) { 92 throw new UnsupportedOperationException (); 93 } 94 95 public boolean addAll(int param, Collection collection) { 96 throw new UnsupportedOperationException (); 97 } 98 99 public ListIterator listIterator() { 100 lock(false); 101 try { 102 return new AttrImmutListIteratorWrapper(getInnerList().listIterator()); 103 } finally { 104 unlock(); 105 } 106 } 107 108 public List subList(int param, int param1) { 109 lock(false); 110 try { 111 return new AttrImmutListWrapper(storage, getInnerList().subList(param, param1)); 112 } finally { 113 unlock(); 114 } 115 } 116 117 public boolean equals(Object object) { 118 if (object instanceof List ) { 119 return super.equals(object); 120 } else { 121 return false; 122 } 123 } 124 125 private final class AttrImmutListIteratorWrapper extends AttrImmutIteratorWrapper implements ListIterator { 126 private final ListIterator innerListIterator; 127 128 AttrImmutListIteratorWrapper(ListIterator innerIterator) { 129 super(innerIterator); 130 this.innerListIterator = innerIterator; 131 } 132 133 public int previousIndex() { 134 lock(false); 135 try { 136 return innerListIterator.previousIndex(); 137 } finally { 138 unlock(); 139 } 140 } 141 142 public void set(Object obj) { 143 throw new UnsupportedOperationException (); 144 } 145 146 public int nextIndex() { 147 lock(false); 148 try { 149 return innerListIterator.nextIndex(); 150 } finally { 151 unlock(); 152 } 153 } 154 155 public boolean hasPrevious() { 156 lock(false); 157 try { 158 return innerListIterator.hasPrevious(); 159 } finally { 160 unlock(); 161 } 162 } 163 164 public void add(Object obj) { 165 throw new UnsupportedOperationException (); 166 } 167 168 public Object previous() { 169 lock(false); 170 try { 171 return innerListIterator.previous(); 172 } finally { 173 unlock(); 174 } 175 } 176 } 177 } 178 | Popular Tags |