package jetbrains.mps.baseLanguage.collections.trove.runtime;
/*Generated by MPS */
import java.util.AbstractList;
import java.util.List;
import java.io.Serializable;
import gnu.trove.TShortArrayList;
import java.util.ListIterator;
import java.util.Iterator;
import java.util.Collection;
import java.util.NoSuchElementException;
public class TShortArrayListDecorator extends AbstractList<Short> implements List<Short>, Serializable {
private static final long serialVersionUID = -6388370221310077367L;
private TShortArrayList primList;
public TShortArrayListDecorator() {
}
public TShortArrayListDecorator(TShortArrayList prim) {
this.primList = prim;
}
@Override
protected void removeRange(int fromIdx, int toIdx) {
this.primList.remove(fromIdx, toIdx - fromIdx);
}
@Override
public int hashCode() {
return super.hashCode();
}
@Override
public boolean equals(Object that) {
if (that instanceof TShortArrayListDecorator && this.primList == ((TShortArrayListDecorator) that).primList) {
return true;
}
return super.equals(that);
}
@Override
public List<Short> subList(int fromIdx, int toIdx) {
return new TShortArrayListDecorator(this.primList.subList(fromIdx, toIdx));
}
@Override
public ListIterator<Short> listIterator() {
return new TShortArrayListDecorator.TShortListIterator(0);
}
@Override
public void clear() {
this.primList.clear();
}
@Override
public int lastIndexOf(Object e) {
return this.primList.lastIndexOf(this.unwrap(e));
}
@Override
public int indexOf(Object e) {
return this.primList.indexOf(this.unwrap(e));
}
@Override
public boolean add(Short e) {
this.primList.add(this.unwrap(e));
return true;
}
@Override
public Iterator<Short> iterator() {
return this.listIterator();
}
@Override
public boolean addAll(int idx, Collection<? extends Short> that) {
return super.addAll(idx, that);
}
@Override
public Short remove(int e) {
return this.primList.remove(e);
}
@Override
public void add(int index, Short e) {
this.primList.insert(index, this.unwrap(e));
}
@Override
public Short set(int p0, Short p1) {
return super.set(p0, p1);
}
@Override
public Short get(int index) {
return this.wrap(this.primList.get(index));
}
@Override
public String toString() {
return this.primList.toString();
}
@Override
public boolean retainAll(Collection<?> that) {
return super.retainAll(that);
}
@Override
public boolean removeAll(Collection<?> that) {
return super.removeAll(that);
}
@Override
public boolean addAll(Collection<? extends Short> that) {
return super.addAll(that);
}
@Override
public boolean containsAll(Collection<?> that) {
return super.containsAll(that);
}
@Override
public boolean remove(Object e) {
return (e instanceof Short ? this.removePrim(this.unwrap(e)) : false);
}
@Override
public <T extends Object> T[] toArray(T[] array) {
return super.toArray(array);
}
@Override
public Object[] toArray() {
return super.toArray();
}
@Override
public boolean contains(Object e) {
return (e instanceof Short ? this.primList.contains(this.unwrap(e)) : false);
}
@Override
public boolean isEmpty() {
return this.primList.isEmpty();
}
public int size() {
return this.primList.size();
}
public ListIterator<Short> listIterator(int index) {
return new TShortArrayListDecorator.TShortListIterator(index);
}
protected boolean removePrim(short primValue) {
int idx = this.primList.indexOf(primValue);
if (idx >= 0) {
this.primList.remove(idx);
return true;
}
return false;
}
protected Short wrap(short primValue) {
return Short.valueOf(primValue);
}
protected short unwrap(Object value) {
return ((Short) value).shortValue();
}
public class TShortListIterator implements ListIterator<Short> {
private int nextIdx;
public TShortListIterator(int startAt) {
this.nextIdx = startAt;
}
public void add(Short e) {
throw new UnsupportedOperationException();
}
public void set(Short e) {
throw new UnsupportedOperationException();
}
public void remove() {
TShortArrayListDecorator.this.primList.remove(this.nextIdx);
}
public int previousIndex() {
return this.nextIdx - 1;
}
public int nextIndex() {
return this.nextIdx;
}
public Short previous() {
if (this.nextIdx > 0 && this.nextIdx <= TShortArrayListDecorator.this.primList.size()) {
return TShortArrayListDecorator.this.wrap(TShortArrayListDecorator.this.primList.get(--this.nextIdx));
}
throw new NoSuchElementException();
}
public boolean hasPrevious() {
return this.nextIdx > 0 && this.nextIdx <= TShortArrayListDecorator.this.primList.size();
}
public Short next() {
if (this.nextIdx >= 0 && this.nextIdx < TShortArrayListDecorator.this.primList.size()) {
return TShortArrayListDecorator.this.wrap(TShortArrayListDecorator.this.primList.get(this.nextIdx++));
}
throw new NoSuchElementException();
}
public boolean hasNext() {
return this.nextIdx >= 0 && this.nextIdx < TShortArrayListDecorator.this.primList.size();
}
}
}