Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Goubet2013-01-30 13:05:17 -0500
committerLaurent Goubet2013-01-30 13:09:07 -0500
commit374f63ef48fa63d7e536b9f0b0b2c5def2d1f50f (patch)
treee50623594bd4f8866bfbfbba0688dbdde823220b
parent7d3a42abd1d893a0507c0d46bdd6a52bd78ee53a (diff)
downloadorg.eclipse.emf.compare-374f63ef48fa63d7e536b9f0b0b2c5def2d1f50f.tar.gz
org.eclipse.emf.compare-374f63ef48fa63d7e536b9f0b0b2c5def2d1f50f.tar.xz
org.eclipse.emf.compare-374f63ef48fa63d7e536b9f0b0b2c5def2d1f50f.zip
[399361] Don't use a predicate
We don't need the overhead since we always use this internal method with alwaysTrue()...
-rw-r--r--plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/spec/ComparisonSpec.java54
1 files changed, 9 insertions, 45 deletions
diff --git a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/spec/ComparisonSpec.java b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/spec/ComparisonSpec.java
index 1a6c3d16f..3828ab920 100644
--- a/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/spec/ComparisonSpec.java
+++ b/plugins/org.eclipse.emf.compare/src/org/eclipse/emf/compare/internal/spec/ComparisonSpec.java
@@ -11,16 +11,15 @@
package org.eclipse.emf.compare.internal.spec;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.transform;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
import com.google.common.cache.CacheBuilder;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
+import com.google.common.collect.Lists;
+import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.emf.common.util.AbstractEList;
import org.eclipse.emf.common.util.BasicEList;
@@ -35,7 +34,6 @@ import org.eclipse.emf.compare.utils.EqualityHelper;
import org.eclipse.emf.compare.utils.IEqualityHelper;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -46,25 +44,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
* @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
*/
public class ComparisonSpec extends ComparisonImpl {
- /**
- * Converts an inverse reference to its corresponding EObject.
- *
- * @author <a href="mailto:laurent.goubet@obeo.fr">Laurent Goubet</a>
- */
- private static final Function<EStructuralFeature.Setting, EObject> INVERSE_REFERENCES = new Function<EStructuralFeature.Setting, EObject>() {
- /**
- * {@inheritDoc}
- *
- * @see com.google.common.base.Function#apply(java.lang.Object)
- */
- public EObject apply(Setting input) {
- if (input != null) {
- return input.getEObject();
- }
- return null;
- }
- };
-
/** Keeps a reference to our match cross referencer. */
private MatchCrossReferencer matchCrossReferencer;
@@ -143,27 +122,12 @@ public class ComparisonSpec extends ComparisonImpl {
* @return a possibly empty {@link Iterable} of inverse references.
*/
private Iterable<EObject> getInverse(EObject element, ECrossReferenceAdapter adapter) {
- return getInverse(element, adapter, Predicates.<Setting> alwaysTrue());
- }
-
- /**
- * Returns an {@link Iterable} of EObject being inverse references of the given {@code element} stored by
- * the {@code adapter}. It is possible to filter returned EObject by filtering out on {@link Setting cross
- * references}.
- *
- * @param element
- * the target of the search cross references.
- * @param adapter
- * the {@link ECrossReferenceAdapter} to use to look for inverse references.
- * @param settingsFilter
- * a filter of {@link Setting} applied on the output of
- * {@link ECrossReferenceAdapter#getInverseReferences(EObject, boolean)}.
- * @return a possibly empty {@link Iterable} of inverse references.
- */
- private Iterable<EObject> getInverse(EObject element, ECrossReferenceAdapter adapter,
- Predicate<Setting> settingsFilter) {
- final Iterable<EStructuralFeature.Setting> settings = adapter.getInverseReferences(element, false);
- return transform(filter(settings, settingsFilter), INVERSE_REFERENCES);
+ final Collection<EStructuralFeature.Setting> settings = adapter.getInverseReferences(element, false);
+ final List<EObject> eObjects = Lists.newArrayList();
+ for (EStructuralFeature.Setting setting : settings) {
+ eObjects.add(setting.getEObject());
+ }
+ return eObjects;
}
/**

Back to the top