/** * Convenience method added to allow subclasses to modify the default * implementation for the scenario in which an element was added to the * monitored list. */ protected void createAddListChange(CDOList oldList, Object newObject, int index) { oldList.add(index, newObject); }
public int size(EStructuralFeature feature) { CDOList list = getList(feature); return list.size(); }
public void createListChanges(CDOList oldList, CDOList newList) { int oldListSize = oldList.size(); int newListSize = newList.size(); Object oldValue = oldList.get(i); Object newValue = newList.get(j); if (equal(oldValue, newValue)) { createAddListChange(oldList, newList.get(j), oldListSize); ++oldListSize;
if (list.contains(addFeatureDelta.getValue())) { featureIterator.remove(); continue; list.add(addFeatureDelta.getValue()); ((CDOAddFeatureDeltaImpl)addFeatureDelta).setIndex(list.size() - 1); if (originalRemoveIndex >= list.size() || differentValue(removeFeatureDelta.getValue(), list, originalRemoveIndex)) adjustedRemoveIndex = list.indexOf(removeFeatureDelta.getValue()); if (adjustedRemoveIndex > 0) list.remove(adjustedRemoveIndex); ((CDORemoveFeatureDeltaImpl)removeFeatureDelta).setIndex(adjustedRemoveIndex); list.remove(originalRemoveIndex); if (moveFeatureDelta.getOldPosition() >= list.size()) ((CDOMoveFeatureDeltaImpl)moveFeatureDelta).setOldPosition(list.size() - 1); list.move(moveFeatureDelta.getNewPosition(), moveFeatureDelta.getOldPosition()); Iterator<Object> iterator = list.iterator();
public boolean isEmpty(EStructuralFeature feature) { CDOList list = getList(feature); return list.isEmpty(); }
private boolean differentValue(Object value, CDOList list, int index) { return !value.equals(list.get(index)); }
/** * Convenience method added to allow subclasses to modify the default * implementation for the scenario in which an element was removed from the * monitored list. */ protected void createRemoveListChange(CDOList oldList, Object oldObject, int index) { oldList.remove(index); } }
public boolean contains(EStructuralFeature feature, Object value) { CDOList list = getList(feature); return list.contains(value); }
public Object move(EStructuralFeature feature, int targetIndex, int sourceIndex) { CDOList list = getList(feature); return list.move(targetIndex, sourceIndex); }
/** * @since 4.0 */ public void resolveAllElementProxies(CDORevision revision) { InternalCDORevision internalRevision = (InternalCDORevision)revision; if (!internalRevision.isUnchunked()) { CDOCollectionLoadingPolicy policy = options().getCollectionLoadingPolicy(); for (EReference reference : internalRevision.getClassInfo().getAllPersistentReferences()) { if (reference.isMany()) { CDOList list = internalRevision.getList(reference); for (Iterator<Object> it = list.iterator(); it.hasNext();) { Object element = it.next(); if (element instanceof CDOElementProxy) { policy.resolveAllProxies(internalRevision, reference); break; } } } } internalRevision.setUnchunked(); } }
public int indexOf(EStructuralFeature feature, Object value) { CDOList list = getList(feature); return list.indexOf(value); }
public boolean isSet(InternalEObject eObject, EStructuralFeature feature) { synchronized (view) { InternalCDOObject cdoObject = getCDOObject(eObject); if (TRACER.isEnabled()) { TRACER.format("isSet({0}, {1})", cdoObject, feature); //$NON-NLS-1$ } if (!feature.isUnsettable()) { if (feature.isMany()) { InternalCDORevision revision = getRevisionForReading(cdoObject); CDOList list = revision.getList(feature); return list != null && !list.isEmpty(); } Object value = eObject.eGet(feature); Object defaultValue = feature.getDefaultValue(); return !ObjectUtil.equals(value, defaultValue); } // TODO This get() may not work for lists, see above Object value = get(eObject, feature, NO_INDEX); return value != null; } }
public Object get(EStructuralFeature feature, int index) { if (feature.isMany() && index != EStore.NO_INDEX) { CDOList list = getList(feature); return list.get(index); } return getValue(feature); }
public Object remove(EStructuralFeature feature, int index) { CDOList list = getList(feature); return list.remove(index); }
if (value instanceof CDOObject && value == referencedObject || // value instanceof CDOID && value.equals(referencedOID) || // value instanceof CDOList && ((CDOList)value).contains(referencedOID))
public void apply(CDORevision revision) { ((InternalCDORevision)revision).getList(getFeature()).move(newPosition, oldPosition); }
for (Iterator<Object> it = list.iterator(); it.hasNext();)
public int getOriginSize() { EStructuralFeature feature = featureDelta.getFeature(); InternalCDORevision cleanRevision = cleanRevisions.get(object); if (cleanRevision == null) { // Clean revision has *not yet* been registered, in this case the object revision *is still clean* cleanRevision = revision; } CDOList list = cleanRevision.getList(feature); return list.size(); } });