@Override public void clear() { if (!modified) { list = new ResizingArrayList<T>(); modified = true; } else { list.clear(); } }
@Override public boolean addAll(Collection<? extends T> c) { return addAll(size, c); }
public void add(int index, T element) { rangeCheck(index, true); modCount++; ensureCapacity(size+1); System.arraycopy(elementData, index, elementData, index + 1, size - index); elementData[index] = element; size++; }
public T set(int index, T element) { rangeCheck(index, false); T old = (T) elementData[index]; elementData[index] = element; return old; }
@Override public T remove(int index) { T oldValue = get(index); modCount++; int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(elementData, index+1, elementData, index, numMoved); } elementData[--size] = null; int halfLength = elementData.length/2; if (size <= halfLength && elementData.length > MIN_SHRINK_SIZE) { int newSize = Math.max(halfLength*99/70, MIN_SHRINK_SIZE); Object[] next = new Object[newSize]; System.arraycopy(elementData, 0, next, 0, size); elementData = next; } return oldValue; }
public T set(int index, T element) { rangeCheck(index, false); T old = (T) elementData[index]; elementData[index] = element; return old; }
@Override public T remove(int index) { T oldValue = get(index); modCount++; int numMoved = size - index - 1; if (numMoved > 0) { System.arraycopy(elementData, index+1, elementData, index, numMoved); } elementData[--size] = null; int halfLength = elementData.length/2; if (size <= halfLength && elementData.length > MIN_SHRINK_SIZE) { int newSize = Math.max(halfLength*99/70, MIN_SHRINK_SIZE); Object[] next = new Object[newSize]; System.arraycopy(elementData, 0, next, 0, size); elementData = next; } return oldValue; }
@Override public void clear() { if (!modified) { list = new ResizingArrayList<T>(); modified = true; } else { list.clear(); } }
public void add(int index, T element) { rangeCheck(index, true); modCount++; ensureCapacity(size+1); System.arraycopy(elementData, index, elementData, index + 1, size - index); elementData[index] = element; size++; }
@Override public T get(int index) { rangeCheck(index, false); return (T) elementData[index]; }
@Override public boolean addAll(Collection<? extends T> c) { return addAll(size, c); }
SPage(STree stree, boolean leaf) { this.stree = stree; this.id = counter.getAndIncrement(); stree.pages.put(this.id, this); this.values = new ResizingArrayList<List<?>>(); if (!leaf) { children = new ResizingArrayList<SPage>(); } }
@Override public boolean addAll(int index, Collection<? extends T> c) { rangeCheck(index, true); modCount++; int numNew = c.size(); ensureCapacity(size + numNew); for (T t : c) { elementData[index++] = t; } size += numNew; return numNew != 0; }
@Override public T get(int index) { rangeCheck(index, false); return (T) elementData[index]; }
SPage(STree stree, boolean leaf) { this.stree = stree; this.id = counter.getAndIncrement(); stree.pages.put(this.id, this); this.values = new ResizingArrayList<List<?>>(); if (!leaf) { children = new ResizingArrayList<SPage>(); } }
@Override public boolean addAll(int index, Collection<? extends T> c) { rangeCheck(index, true); modCount++; int numNew = c.size(); ensureCapacity(size + numNew); for (T t : c) { elementData[index++] = t; } size += numNew; return numNew != 0; }
@Override public void clear() { if (!modified) { list = new ResizingArrayList<T>(); modified = true; } else { list.clear(); } }
SPage(STree stree, boolean leaf) { this.stree = stree; this.id = counter.getAndIncrement(); stree.pages.put(this.id, this); this.values = new ResizingArrayList<List<?>>(); if (!leaf) { children = new ResizingArrayList<SPage>(); } }
public void addTuple(List<?> tuple) throws TeiidComponentException { if (isLobs()) { lobManager.updateReferences(tuple, ReferenceMode.CREATE); } this.rowCount++; if (batchBuffer == null) { batchBuffer = new ResizingArrayList<List<?>>(batchSize/4); } batchBuffer.add(tuple); if (batchBuffer.size() == batchSize) { saveBatch(false); } }
public SPage clone(STree tree) { try { if (this.managedBatch != null && trackingObject == null) { this.trackingObject = new Object(); CleanupReference managedBatchReference = new CleanupReference(trackingObject, managedBatch, stree.getBatchManager(children == null).getBatchManagerReference()); REFERENCES.put(managedBatch, managedBatchReference); } SPage clone = (SPage) super.clone(); clone.stree = tree; if (children != null) { clone.children = new ResizingArrayList<SPage>(children); } if (values != null) { clone.values = new ResizingArrayList<List<?>>(values); } return clone; } catch (CloneNotSupportedException e) { throw new TeiidRuntimeException(QueryPlugin.Event.TEIID30038, e); } }