@Override public int size() { return delegate.size(); }
private void addToList(EStructuralFeature eStructuralFeature, int index, AbstractEList list, EObject referencedObject) throws DeserializeException { EClass referenceEClass = referencedObject.eClass(); if (((EClass) eStructuralFeature.getEType()).isSuperTypeOf(referenceEClass)) { while (list.size() <= index) { list.addUnique(referencedObject); } } else { throw new DeserializeException(-1, referenceEClass.getName() + " cannot be stored in " + eStructuralFeature.getName()); } }
ListWaitingObject listWaitingObject = (ListWaitingObject)waitingObject; if (((EClass) waitingObject.getEReference().getEType()).isSuperTypeOf(eObject.eClass())) { while (list.size() <= listWaitingObject.getIndex()) { EObject create = ec.getEPackage().getEFactoryInstance().create(eObject.eClass()); ((IdEObjectImpl)create).setOid(-2);
/** * Returns a hash code computed from each object's hash code. * @return a hash code. */ @Override public int hashCode() { int hashCode = 1; for (int i = 0, size = size(); i < size; ++i) { Object object = primitiveGet(i); hashCode = 31 * hashCode + (object == null ? 0 : object.hashCode()); } return hashCode; }
/** * Returns a string of the form <code>"[object1, object2]"</code>. * @return a string of the form <code>"[object1, object2]"</code>. */ @Override public String toString() { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("["); for (int i = 0, size = size(); i < size; ) { stringBuffer.append(String.valueOf(primitiveGet(i))); if (++i < size) { stringBuffer.append(", "); } } stringBuffer.append("]"); return stringBuffer.toString(); }
/** * Returns a read-only list iterator advanced to the given index that does not {@link #resolve resolve} objects. * This implementation allocates a {@link NonResolvingEListIterator}. * @param index the starting index. * @return a read-only list iterator advanced to the index. * @exception IndexOutOfBoundsException if the index isn't within the size range. */ protected ListIterator<E> basicListIterator(int index) { int size = size(); if (index < 0 || index > size) throw new BasicIndexOutOfBoundsException(index, size); return new NonResolvingEListIterator<E>(index); }
/** * Returns the object at the index without {@link #resolve resolving} it. * @param index the position in question. * @return the object at the index. * @exception IndexOutOfBoundsException if the index isn't within the size range. * @see #resolve * @see #get */ protected E basicGet(int index) { int size = size(); if (index >= size) throw new BasicIndexOutOfBoundsException(index, size); return primitiveGet(index); }
/** * Removes each object of the collection from the list and returns whether any object was actually contained by the list. * @param collection the collection of objects to be removed. * @return whether any object was actually contained by the list. */ @Override public boolean removeAll(Collection<?> collection) { boolean modified = false; for (int i = size(); --i >= 0; ) { if (collection.contains(primitiveGet(i))) { remove(i); modified = true; } } return modified; }
/** * Returns a list iterator advanced to the given index. * This implementation allocates a {@link AbstractEList.EListIterator}. * @param index the starting index. * @return a list iterator advanced to the index. * @see AbstractEList.EListIterator * @exception IndexOutOfBoundsException if the index isn't within the size range. */ @Override public ListIterator<E> listIterator(int index) { int size = size(); if (index < 0 || index > size) throw new BasicIndexOutOfBoundsException(index, size); return new EListIterator<E>(index); }
/** * Removes from the list each object not contained by the collection * and returns whether any object was actually removed. * This delegates to {@link #remove(int) remove(int)} * in the case that it finds an object that isn't retained. * @param collection the collection of objects to be retained. * @return whether any object was actually removed. */ @Override public boolean retainAll(Collection<?> collection) { boolean modified = false; for (int i = size(); --i >= 0; ) { if (!collection.contains(primitiveGet(i))) { remove(i); modified = true; } } return modified; }
/** * Throws an exception. * @exception UnsupportedOperationException always because it's not supported. */ @Override public void set(E1 object) { throw new UnsupportedOperationException(); }
int size = size(); if (list.size() != size)
/** * Adds the object at the given index in the list. * If {@link #isUnique uniqueness} is required, * duplicates will be ignored. * This implementation delegates to {@link #addUnique(int, Object) addUnique(int, E)} * after uniqueness checking. * @param object the object to be added. * @exception IllegalArgumentException if {@link #isUnique uniqueness} is required, * and the object is a duplicate. * @see #addUnique(int, Object) */ @Override public void add(int index, E object) { int size = size(); if (index > size) throw new BasicIndexOutOfBoundsException(index, size); if (isUnique() && contains(object)) { throw new IllegalArgumentException("The 'no duplicates' constraint is violated"); } addUnique(index, object); }
/** * Adds each object of the collection at each successive index in the list * and returns whether any objects were added. * If {@link #isUnique uniqueness} is required, * duplicates will be {@link #getNonDuplicates removed} from the collection, * which could even result in an empty collection. * This implementation delegates to {@link #addAllUnique(int, Collection) addAllUnique(int, Collection)} * after uniqueness checking. * @param index the index at which to add. * @param collection the collection of objects to be added. * @return whether any objects were added. * @see #addAllUnique(int, Collection) */ @Override public boolean addAll(int index, Collection<? extends E> collection) { int size = size(); if (index > size) throw new BasicIndexOutOfBoundsException(index, size); if (isUnique()) { collection = getNonDuplicates(collection); } return addAllUnique(index, collection); }