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;
104 implements List<Float>, RandomAccess, Cloneable, java.io.Serializable {
127 if (initialCapacity < 0) {
128 throw new IllegalArgumentException(
129 "Illegal Capacity: " +
132 this.elementData =
new float[initialCapacity];
164 if (
size < oldCapacity) {
176 if (minCapacity > 0) {
206 private void grow(
int minCapacity) {
209 int newCapacity = oldCapacity + (oldCapacity >> 1);
210 if (newCapacity - minCapacity < 0)
211 newCapacity = minCapacity;
226 throw new OutOfMemoryError();
270 if (o instanceof Float) {
271 for (
int i = 0; i <
size; i++) {
289 if (o instanceof Float) {
290 for (
int i =
size - 1; i >= 0; i--)
304 @SuppressWarnings(
"unchecked")
309 }
catch (CloneNotSupportedException e) {
311 throw new InternalError();
325 Float[] array =
new Float[
size];
326 for (
int i = 0; i <
size; i++) {
350 @SuppressWarnings(
"unchecked")
351 @Override public <T> T[]
toArray(T[] a) {
352 if (a.length <
size) {
354 return (T[]) Arrays.copyOf(
toArray(),
size, a.getClass());
368 float[] res =
new float[
size];
381 @SuppressWarnings(
"unchecked") Float
elementData(
int index) {
392 @Override
public Float
get(
int index) {
406 @Override
public Float
set(
int index, Float element) {
420 @Override
public boolean add(Float e) {
434 @Override
public void add(
int index, Float element) {
453 @Override
public Float
remove(
int index) {
459 int numMoved =
size - index - 1;
479 @Override
public boolean remove(Object o) {
480 if (o instanceof Float) {
481 for (
int index = 0; index <
size; index++)
501 int numMoved =
size - index - 1;
514 for (
int i = 0; i <
size; i++)
530 @Override
public boolean addAll(Collection<? extends Float> c) {
531 Object[] a = c.toArray();
532 int numNew = a.length;
551 @Override
public boolean addAll(
int index, Collection<? extends Float> c) {
554 Object[] a = c.toArray();
555 int numNew = a.length;
558 int numMoved =
size - index;
564 System.arraycopy(a, 0,
elementData, index, numNew);
579 @Override
protected void removeRange(
int fromIndex,
int toIndex) {
581 int numMoved =
size - toIndex;
587 int newSize =
size - (toIndex - fromIndex);
588 while (
size != newSize)
610 if (index >
size || index < 0)
622 return "Index: " + index +
", Size: " +
size;
665 private boolean batchRemove(Collection<?> c,
boolean complement) {
668 boolean modified =
false;
670 for (; r <
size; r++)
684 for (
int i = w; i <
size; i++)
686 modCount +=
size - w;
702 throws java.io.IOException {
704 int expectedModCount = modCount;
705 s.defaultWriteObject();
711 for (
int i = 0; i <
size; i++)
714 if (modCount != expectedModCount) {
715 throw new ConcurrentModificationException();
727 throws java.io.IOException, ClassNotFoundException {
729 s.defaultReadObject();
732 int arrayLength = s.readInt();
736 for (
int i = 0; i <
size; i++)
737 a[i] = (Float) s.readObject();
752 if (index < 0 || index >
size)
753 throw new IndexOutOfBoundsException(
"Index: " + index);
779 private class Itr implements Iterator<Float> {
788 int expectedModCount = modCount;
794 return cursor !=
size;
800 @SuppressWarnings(
"unchecked")
801 @Override
public Float
next() {
802 checkForComodification();
805 throw new NoSuchElementException();
808 throw new ConcurrentModificationException();
816 @Override
public void remove() {
818 throw new IllegalStateException();
819 checkForComodification();
825 expectedModCount = modCount;
826 }
catch (IndexOutOfBoundsException ex) {
827 throw new ConcurrentModificationException();
834 final void checkForComodification() {
835 if (modCount != expectedModCount)
836 throw new ConcurrentModificationException();
841 private class ListItr extends Itr implements ListIterator<Float> {
877 @SuppressWarnings(
"unchecked")
879 checkForComodification();
882 throw new NoSuchElementException();
885 throw new ConcurrentModificationException();
893 @Override
public void set(Float e) {
895 throw new IllegalStateException();
896 checkForComodification();
900 }
catch (IndexOutOfBoundsException ex) {
901 throw new ConcurrentModificationException();
908 @Override
public void add(Float e) {
909 checkForComodification();
916 expectedModCount = modCount;
917 }
catch (IndexOutOfBoundsException ex) {
918 throw new ConcurrentModificationException();
947 @Override
public List<Float>
subList(
int fromIndex,
int toIndex) {
948 subListRangeCheck(fromIndex, toIndex,
size);
959 static void subListRangeCheck(
int fromIndex,
int toIndex,
int size) {
961 throw new IndexOutOfBoundsException(
"fromIndex = " + fromIndex);
963 throw new IndexOutOfBoundsException(
"toIndex = " + toIndex);
964 if (fromIndex > toIndex)
965 throw new IllegalArgumentException(
966 "fromIndex(" + fromIndex +
967 ") > toIndex(" + toIndex +
")");
997 int offset,
int fromIndex,
int toIndex) {
999 this.parentOffset = fromIndex;
1000 this.offset =
offset + fromIndex;
1001 this.size = toIndex - fromIndex;
1010 float[] res =
new float[size];
1018 @Override
public Float
set(
int index, Float e) {
1029 @Override
public Float
get(
int index) {
1046 @Override
public void add(
int index, Float e) {
1050 this.modCount =
parent.modCount;
1057 @Override
public Float
remove(
int index) {
1061 this.modCount =
parent.modCount;
1074 this.modCount =
parent.modCount;
1075 this.size -= toIndex - fromIndex;
1081 @Override
public boolean addAll(Collection<? extends Float> c) {
1082 return addAll(this.size, c);
1088 @Override
public boolean addAll(
int index, Collection<? extends Float> c) {
1090 int cSize = c.size();
1096 this.modCount =
parent.modCount;
1116 return new ListIterator<Float>() {
1121 @Override
public boolean hasNext() {
1125 @SuppressWarnings(
"unchecked")
1126 @Override
public Float next() {
1130 throw new NoSuchElementException();
1133 throw new ConcurrentModificationException();
1138 @Override
public boolean hasPrevious() {
1142 @SuppressWarnings(
"unchecked")
1143 @Override
public Float previous() {
1147 throw new NoSuchElementException();
1150 throw new ConcurrentModificationException();
1155 @Override
public int nextIndex() {
1159 @Override
public int previousIndex() {
1163 @Override
public void remove() {
1165 throw new IllegalStateException();
1173 }
catch (IndexOutOfBoundsException ex) {
1174 throw new ConcurrentModificationException();
1178 @Override
public void set(Float e) {
1180 throw new IllegalStateException();
1185 }
catch (IndexOutOfBoundsException ex) {
1186 throw new ConcurrentModificationException();
1190 @Override
public void add(Float e) {
1199 }
catch (IndexOutOfBoundsException ex) {
1200 throw new ConcurrentModificationException();
1206 throw new ConcurrentModificationException();
1214 @Override
public List<Float>
subList(
int fromIndex,
int toIndex) {
1215 subListRangeCheck(fromIndex, toIndex, size);
1225 if (index < 0 || index >= this.size)
1235 if (index < 0 || index > this.size)
1246 return "Index: " + index +
", Size: " + this.size;
1254 throw new ConcurrentModificationException();
void checkForComodification()
void rangeCheck(int index)
ListIterator< Float > listIterator(final int index)
void rangeCheckForAdd(int index)
boolean addAll(Collection<? extends Float > c)
final FloatArrayList parent
Iterator< Float > iterator()
boolean addAll(int index, Collection<? extends Float > c)
List< Float > subList(int fromIndex, int toIndex)
void removeRange(int fromIndex, int toIndex)
void add(int index, Float e)
String outOfBoundsMsg(int index)
boolean batchRemove(Collection<?> c, boolean complement)
int lastIndexOf(Object o)
FloatArrayList(Collection<? extends Float > c)
void readObject(java.io.ObjectInputStream s)
void writeObject(java.io.ObjectOutputStream s)
void rangeCheck(int index)
List< Float > subList(int fromIndex, int toIndex)
FloatArrayList(int initialCapacity)
void removeRange(int fromIndex, int toIndex)
String outOfBoundsMsg(int index)
void grow(int minCapacity)
void ensureCapacity(int minCapacity)
boolean contains(Object o)
boolean addAll(Collection<? extends Float > c)
ListIterator< Float > listIterator()
void add(int index, Float element)
void rangeCheckForAdd(int index)
boolean addAll(int index, Collection<? extends Float > c)
void ensureCapacityInternal(int minCapacity)
boolean retainAll(Collection<?> c)
transient float[] elementData
static final int MAX_ARRAY_SIZE
Float set(int index, Float element)
boolean removeAll(Collection<?> c)
Iterator< Float > iterator()
void fastRemove(int index)
static int hugeCapacity(int minCapacity)
ListIterator< Float > listIterator(int index)