return modelElementCollection.toArray(a);
}
public boolean add(Target t) {
if (referenceSourceCollection.isImmutable()) {
throw new UnsupportedModelOperationException("add()", "collection is immutable");
}
else {
if (!contains(t)) {
performAddOperation(referenceSourceParentElement, t);
}
return true;
}
}
public boolean remove(Object o) {
if (referenceSourceCollection.isImmutable()) {
throw new UnsupportedModelOperationException("remove()", "collection is immutable");
}
else {
ModelUtil.ensureInstanceOf(o, ModelElementInstanceImpl.class);
performRemoveOperation(referenceSourceParentElement, o);
return true;
}
}
public boolean containsAll(Collection<?> c) {
Collection<Target> modelElementCollection = ModelUtil.getModelElementCollection(getView(referenceSourceParentElement), referenceSourceParentElement.getModelInstance());
return modelElementCollection.containsAll(c);
}
public boolean addAll(Collection<? extends Target> c) {
if (referenceSourceCollection.isImmutable()) {
throw new UnsupportedModelOperationException("addAll()", "collection is immutable");
}
else {
boolean result = false;
for (Target o: c) {
result |= add(o);
}
return result;
}
}
public boolean removeAll(Collection<?> c) {
if (referenceSourceCollection.isImmutable()) {
throw new UnsupportedModelOperationException("removeAll()", "collection is immutable");
}
else {
boolean result = false;
for (Object o: c) {
result |= remove(o);
}
return result;
}
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedModelOperationException("retainAll()", "not implemented");
}
public void clear() {
if (referenceSourceCollection.isImmutable()) {
throw new UnsupportedModelOperationException("clear()", "collection is immutable");
}
else {
Collection<DomElement> view = new ArrayList<DomElement>();
for (Source referenceSourceElement : referenceSourceCollection.get(referenceSourceParentElement)) {
view.add(referenceSourceElement.getDomElement());