public CowSubList(CopyOnWriteArrayList <E> _enclosing, object[] expectedElements, int from, int to) { this._enclosing = _enclosing; this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(expectedElements , from, to); }
public override bool containsAll <_T0>(java.util.Collection <_T0> collection) { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; object[] snapshot = this._enclosing.elements; slice.checkConcurrentModification(snapshot); return(java.util.concurrent.CopyOnWriteArrayList <E> .containsAll(collection, snapshot , slice.from, slice.to)); }
public override E get(int index) { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; object[] snapshot = this._enclosing.elements; slice.checkElementIndex(index); slice.checkConcurrentModification(snapshot); return((E)snapshot[index + slice.from]); }
public override void clear() { lock (this._enclosing) { this.slice.checkConcurrentModification(this._enclosing.elements); this._enclosing.removeRange(this.slice.from, this.slice.to); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.from); } }
public override int lastIndexOf(object @object) { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; object[] snapshot = this._enclosing.elements; slice.checkConcurrentModification(snapshot); int result = java.util.concurrent.CopyOnWriteArrayList <E> .lastIndexOf(@object, snapshot , slice.from, slice.to); return((result != -1) ? (result - slice.from) : -1); }
public override void add(int index, E @object) { lock (this._enclosing) { this.slice.checkPositionIndex(index); this.slice.checkConcurrentModification(this._enclosing.elements); this._enclosing.add(index + this.slice.from, @object); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.to + 1); } }
public override java.util.List <E> subList(int from, int to) { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; if (from < 0 || from > to || to > this.size()) { throw new System.IndexOutOfRangeException("from=" + from + ", to=" + to + ", list size=" + this.size()); } return(new java.util.concurrent.CopyOnWriteArrayList <E> .CowSubList(this._enclosing , slice.expectedElements, slice.from + from, slice.from + to)); }
public override java.util.ListIterator <E> listIterator(int index) { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; object[] snapshot = this._enclosing.elements; slice.checkPositionIndex(index); slice.checkConcurrentModification(snapshot); java.util.concurrent.CopyOnWriteArrayList.CowIterator <E> result = new java.util.concurrent.CopyOnWriteArrayList .CowIterator <E>(snapshot, slice.from, slice.to); result.index = slice.from + index; return(result); }
public override E remove(int index) { lock (this._enclosing) { this.slice.checkElementIndex(index); this.slice.checkConcurrentModification(this._enclosing.elements); E removed = this._enclosing.remove(this.slice.from + index); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.to - 1); return(removed); } }
public override bool retainAll <_T0>(java.util.Collection <_T0> collection) { lock (this._enclosing) { this.slice.checkConcurrentModification(this._enclosing.elements); int removed = this._enclosing.removeOrRetain(collection, true, this.slice.from, this .slice.to); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.to - removed); return(removed != 0); } }
public override E set(int index, E @object) { lock (this._enclosing) { this.slice.checkElementIndex(index); this.slice.checkConcurrentModification(this._enclosing.elements); E result = this._enclosing.set(index + this.slice.from, @object); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.to); return(result); } }
public override bool addAll <_T0>(int index, java.util.Collection <_T0> collection) { lock (this._enclosing) { this.slice.checkPositionIndex(index); this.slice.checkConcurrentModification(this._enclosing.elements); int oldSize = this._enclosing.elements.Length; bool result = this._enclosing.addAll(index + this.slice.from, collection); this.slice = new java.util.concurrent.CopyOnWriteArrayList.Slice(this._enclosing. elements, this.slice.from, this.slice.to + (this._enclosing.elements.Length - oldSize )); return(result); } }
public override bool isEmpty() { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; return(slice.from == slice.to); }
public override int size() { java.util.concurrent.CopyOnWriteArrayList.Slice slice = this.slice; return(slice.to - slice.from); }