32 package eu.mihosoft.vrl.v3d.ext.openjfx.importers.obj;
35 import java.util.AbstractList;
36 import java.util.Arrays;
37 import java.util.Collection;
38 import java.util.Collections;
39 import java.util.ConcurrentModificationException;
40 import java.util.Iterator;
41 import java.util.LinkedList;
42 import java.util.List;
43 import java.util.ListIterator;
44 import java.util.NoSuchElementException;
45 import java.util.RandomAccess;
46 import java.util.Vector;
103 implements List<Integer>, RandomAccess, Cloneable, java.io.Serializable {
126 if (initialCapacity < 0) {
127 throw new IllegalArgumentException(
128 "Illegal Capacity: " +
131 this.elementData =
new int[initialCapacity];
149 for (Integer d : c) {
163 if (
size < oldCapacity) {
175 if (minCapacity > 0) {
205 private void grow(
int minCapacity) {
208 int newCapacity = oldCapacity + (oldCapacity >> 1);
209 if (newCapacity - minCapacity < 0)
210 newCapacity = minCapacity;
225 throw new OutOfMemoryError();
269 if (o instanceof Integer) {
270 for (
int i = 0; i <
size; i++) {
288 if (o instanceof Integer) {
289 for (
int i =
size - 1; i >= 0; i--)
303 @SuppressWarnings(
"unchecked")
308 }
catch (CloneNotSupportedException e) {
310 throw new InternalError();
325 Integer[] array =
new Integer[
size];
326 for (
int i = 0; i <
size; i++) {
351 @SuppressWarnings(
"unchecked")
352 @Override public <T> T[]
toArray(T[] a) {
353 if (a.length <
size) {
355 return (T[]) Arrays.copyOf(
toArray(),
size, a.getClass());
369 int[] res =
new int[
size];
382 @SuppressWarnings(
"unchecked") Integer
elementData(
int index) {
393 @Override
public Integer
get(
int index) {
407 @Override
public Integer
set(
int index, Integer element) {
421 @Override
public boolean add(Integer e) {
435 @Override
public void add(
int index, Integer element) {
454 @Override
public Integer
remove(
int index) {
460 int numMoved =
size - index - 1;
480 @Override
public boolean remove(Object o) {
481 if (o instanceof Integer) {
482 for (
int index = 0; index <
size; index++)
502 int numMoved =
size - index - 1;
515 for (
int i = 0; i <
size; i++)
531 @Override
public boolean addAll(Collection<? extends Integer> c) {
532 Object[] a = c.toArray();
533 int numNew = a.length;
552 @Override
public boolean addAll(
int index, Collection<? extends Integer> c) {
555 Object[] a = c.toArray();
556 int numNew = a.length;
559 int numMoved =
size - index;
565 System.arraycopy(a, 0,
elementData, index, numNew);
580 @Override
protected void removeRange(
int fromIndex,
int toIndex) {
582 int numMoved =
size - toIndex;
588 int newSize =
size - (toIndex - fromIndex);
589 while (
size != newSize)
611 if (index >
size || index < 0)
623 return "Index: " + index +
", Size: " +
size;
666 private boolean batchRemove(Collection<?> c,
boolean complement) {
669 boolean modified =
false;
671 for (; r <
size; r++)
685 for (
int i = w; i <
size; i++)
687 modCount +=
size - w;
703 throws java.io.IOException {
705 int expectedModCount = modCount;
706 s.defaultWriteObject();
712 for (
int i = 0; i <
size; i++)
715 if (modCount != expectedModCount) {
716 throw new ConcurrentModificationException();
728 throws java.io.IOException, ClassNotFoundException {
730 s.defaultReadObject();
733 int arrayLength = s.readInt();
737 for (
int i = 0; i <
size; i++)
738 a[i] = (Integer) s.readObject();
753 if (index < 0 || index >
size)
754 throw new IndexOutOfBoundsException(
"Index: " + index);
780 private class Itr implements Iterator<Integer> {
789 int expectedModCount = modCount;
795 return cursor !=
size;
801 @SuppressWarnings(
"unchecked")
802 @Override
public Integer
next() {
803 checkForComodification();
806 throw new NoSuchElementException();
809 throw new ConcurrentModificationException();
817 @Override
public void remove() {
819 throw new IllegalStateException();
820 checkForComodification();
826 expectedModCount = modCount;
827 }
catch (IndexOutOfBoundsException ex) {
828 throw new ConcurrentModificationException();
835 final void checkForComodification() {
836 if (modCount != expectedModCount)
837 throw new ConcurrentModificationException();
842 private class ListItr extends Itr implements ListIterator<Integer> {
878 @SuppressWarnings(
"unchecked")
880 checkForComodification();
883 throw new NoSuchElementException();
886 throw new ConcurrentModificationException();
894 @Override
public void set(Integer e) {
896 throw new IllegalStateException();
897 checkForComodification();
901 }
catch (IndexOutOfBoundsException ex) {
902 throw new ConcurrentModificationException();
909 @Override
public void add(Integer e) {
910 checkForComodification();
917 expectedModCount = modCount;
918 }
catch (IndexOutOfBoundsException ex) {
919 throw new ConcurrentModificationException();
950 @Override
public List<Integer>
subList(
int fromIndex,
int toIndex) {
951 subListRangeCheck(fromIndex, toIndex,
size);
962 static void subListRangeCheck(
int fromIndex,
int toIndex,
int size) {
964 throw new IndexOutOfBoundsException(
"fromIndex = " + fromIndex);
966 throw new IndexOutOfBoundsException(
"toIndex = " + toIndex);
967 if (fromIndex > toIndex)
968 throw new IllegalArgumentException(
969 "fromIndex(" + fromIndex +
970 ") > toIndex(" + toIndex +
")");
1000 int offset,
int fromIndex,
int toIndex) {
1002 this.parentOffset = fromIndex;
1003 this.offset =
offset + fromIndex;
1004 this.size = toIndex - fromIndex;
1013 int[] res =
new int[size];
1021 @Override
public Integer
set(
int index, Integer e) {
1032 @Override
public Integer
get(
int index) {
1049 @Override
public void add(
int index, Integer e) {
1053 this.modCount =
parent.modCount;
1060 @Override
public Integer
remove(
int index) {
1064 this.modCount =
parent.modCount;
1077 this.modCount =
parent.modCount;
1078 this.size -= toIndex - fromIndex;
1084 @Override
public boolean addAll(Collection<? extends Integer> c) {
1085 return addAll(this.size, c);
1091 @Override
public boolean addAll(
int index, Collection<? extends Integer> c) {
1093 int cSize = c.size();
1099 this.modCount =
parent.modCount;
1119 return new ListIterator<Integer>() {
1124 @Override
public boolean hasNext() {
1128 @SuppressWarnings(
"unchecked")
1129 @Override
public Integer next() {
1133 throw new NoSuchElementException();
1136 throw new ConcurrentModificationException();
1141 @Override
public boolean hasPrevious() {
1145 @SuppressWarnings(
"unchecked")
1146 @Override
public Integer previous() {
1150 throw new NoSuchElementException();
1153 throw new ConcurrentModificationException();
1158 @Override
public int nextIndex() {
1162 @Override
public int previousIndex() {
1166 @Override
public void remove() {
1168 throw new IllegalStateException();
1176 }
catch (IndexOutOfBoundsException ex) {
1177 throw new ConcurrentModificationException();
1181 @Override
public void set(Integer e) {
1183 throw new IllegalStateException();
1188 }
catch (IndexOutOfBoundsException ex) {
1189 throw new ConcurrentModificationException();
1193 @Override
public void add(Integer e) {
1202 }
catch (IndexOutOfBoundsException ex) {
1203 throw new ConcurrentModificationException();
1209 throw new ConcurrentModificationException();
1217 @Override
public List<Integer>
subList(
int fromIndex,
int toIndex) {
1218 subListRangeCheck(fromIndex, toIndex, size);
1228 if (index < 0 || index >= this.size)
1238 if (index < 0 || index > this.size)
1249 return "Index: " + index +
", Size: " + this.size;
1257 throw new ConcurrentModificationException();
void removeRange(int fromIndex, int toIndex)
Iterator< Integer > iterator()
void rangeCheck(int index)
void checkForComodification()
final IntegerArrayList parent
String outOfBoundsMsg(int index)
ListIterator< Integer > listIterator(final int index)
void rangeCheckForAdd(int index)
Integer remove(int index)
boolean addAll(int index, Collection<? extends Integer > c)
boolean addAll(Collection<? extends Integer > c)
void add(int index, Integer e)
List< Integer > subList(int fromIndex, int toIndex)
void ensureCapacityInternal(int minCapacity)
transient int[] elementData
boolean addAll(int index, Collection<? extends Integer > c)
void fastRemove(int index)
String outOfBoundsMsg(int index)
void writeObject(java.io.ObjectOutputStream s)
boolean retainAll(Collection<?> c)
Integer remove(int index)
static final int MAX_ARRAY_SIZE
void rangeCheckForAdd(int index)
boolean batchRemove(Collection<?> c, boolean complement)
boolean addAll(Collection<? extends Integer > c)
boolean removeAll(Collection<?> c)
int lastIndexOf(Object o)
ListIterator< Integer > listIterator()
void add(int index, Integer element)
IntegerArrayList(int initialCapacity)
void ensureCapacity(int minCapacity)
static int hugeCapacity(int minCapacity)
Iterator< Integer > iterator()
void grow(int minCapacity)
IntegerArrayList(Collection<? extends Integer > c)
List< Integer > subList(int fromIndex, int toIndex)
ListIterator< Integer > listIterator(int index)
void readObject(java.io.ObjectInputStream s)
boolean contains(Object o)
void rangeCheck(int index)
void removeRange(int fromIndex, int toIndex)
Integer set(int index, Integer element)