summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-11-01 15:14:39 (EDT)
committerEike Stepper2007-11-01 15:14:39 (EDT)
commit0de5ce47f5d9e9ae5d28541aa288f84d3cf27c85 (patch)
tree7b8475a00fd4ebe372c0abd3d0e71bf2b750ea87
parent6f236fe7784d3f9db727ae0f20b77e6fd93ef9c4 (diff)
downloadcdo-0de5ce47f5d9e9ae5d28541aa288f84d3cf27c85.zip
cdo-0de5ce47f5d9e9ae5d28541aa288f84d3cf27c85.tar.gz
cdo-0de5ce47f5d9e9ae5d28541aa288f84d3cf27c85.tar.bz2
[208468] Implement generic CDOStore.toArray()
https://bugs.eclipse.org/bugs/show_bug.cgi?id=208468
-rw-r--r--plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
index bb693f2..608fb91 100644
--- a/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
+++ b/plugins/org.eclipse.emf.cdo/src/org/eclipse/emf/internal/cdo/CDOStore.java
@@ -10,16 +10,13 @@
**************************************************************************/
package org.eclipse.emf.internal.cdo;
-import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Set;
-
import org.eclipse.emf.cdo.internal.protocol.model.CDOFeatureImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl;
import org.eclipse.emf.cdo.internal.protocol.revision.CDORevisionImpl.MoveableList;
import org.eclipse.emf.cdo.protocol.CDOID;
import org.eclipse.emf.cdo.protocol.model.CDOFeature;
import org.eclipse.emf.cdo.protocol.revision.CDOReferenceProxy;
+
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -28,8 +25,13 @@ import org.eclipse.emf.ecore.InternalEObject.EStore;
import org.eclipse.emf.internal.cdo.bundle.OM;
import org.eclipse.emf.internal.cdo.util.FSMUtil;
import org.eclipse.emf.internal.cdo.util.ModelUtil;
+
import org.eclipse.net4j.internal.util.om.trace.ContextTracer;
+import java.text.MessageFormat;
+import java.util.HashSet;
+import java.util.Set;
+
/**
* @author Eike Stepper
*/
@@ -308,10 +310,15 @@ public final class CDOStore implements EStore
return result;
}
- public <T> T[] toArray(InternalEObject eObject, EStructuralFeature eFeature, T[] array)
+ public <T> T[] toArray(InternalEObject eObject, EStructuralFeature eFeature, T[] a)
{
- // TODO Implement method CDOStore.toArray()
- throw new UnsupportedOperationException("Not yet implemented");
+ Object[] array = toArray(eObject, eFeature);
+ int size = array.length;
+
+ if (a.length < size) a = (T[])java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), size);
+ System.arraycopy(array, 0, a, 0, size);
+ if (a.length > size) a[size] = null;
+ return a;
}
public Object set(InternalEObject eObject, EStructuralFeature eFeature, int index, Object value)