Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/util/DefinitionSignature.java34
1 files changed, 27 insertions, 7 deletions
diff --git a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/util/DefinitionSignature.java b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/util/DefinitionSignature.java
index 53ad10e61..b9b424829 100644
--- a/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/util/DefinitionSignature.java
+++ b/plugins/org.eclipse.gmf.xpand/src/org/eclipse/gmf/internal/xpand/util/DefinitionSignature.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * Copyright (c) 2007, 2009 Borland Software Corporation
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -14,13 +14,17 @@ package org.eclipse.gmf.internal.xpand.util;
import java.util.Arrays;
import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.gmf.internal.xpand.model.XpandDefinition;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.gmf.internal.xpand.model.ExecutionContext;
+import org.eclipse.gmf.internal.xpand.model.XpandDefinition;
+import org.eclipse.ocl.TypeResolver;
final class DefinitionSignature {
private final String myName;
private final EClassifier myType;
private final EClassifier[] myArgs;
+ private TypeResolver<EClassifier, EOperation, EStructuralFeature> myTypeResolver;
public static DefinitionSignature create(ExecutionContext ctx, XpandDefinition def) {
if (def == null || ctx == null) {
@@ -38,28 +42,44 @@ final class DefinitionSignature {
}
args[i] = nextArg;
}
- return new DefinitionSignature(def.getName(), type, args);
+ return new DefinitionSignature(def.getName(), type, args, ctx.getOCLEnvironment().getTypeResolver());
}
-
- private DefinitionSignature(String name, EClassifier type, EClassifier[] args) {
+
+ private DefinitionSignature(String name, EClassifier type, EClassifier[] args, TypeResolver<EClassifier, EOperation, EStructuralFeature> typeResolver) {
myName = name;
myType = type;
myArgs = args;
+ myTypeResolver = typeResolver;
assert myName != null;
assert myArgs != null;
for (EClassifier nextArg : myArgs) {
assert nextArg != null;
}
+ assert myTypeResolver != null;
}
+
public boolean equals(Object o) {
if (o instanceof DefinitionSignature) {
DefinitionSignature that = (DefinitionSignature) o;
- return this.myName.equals(that.myName) && ((this.myType == null && that.myType == null) || this.myType.equals(that.myType)) && Arrays.equals(this.myArgs, that.myArgs);
+ return this.myName.equals(that.myName) && ((this.myType == null && that.myType == null) || this.myType.equals(resolve(that.myType))) && Arrays.equals(this.myArgs, resolve(that.myArgs));
}
return false;
}
+
+ private EClassifier resolve(EClassifier classifier) {
+ return myTypeResolver.resolve(classifier);
+ }
+
+ private EClassifier[] resolve(EClassifier[] classifiers) {
+ EClassifier[] result = new EClassifier[classifiers.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = resolve(classifiers[i]);
+ }
+ return result;
+ }
+
@Override
public int hashCode() {
- return myName.hashCode() + (myType == null ? 0 : 17*myType.hashCode()) + 31*Arrays.hashCode(myArgs);
+ return myName.hashCode();
}
}

Back to the top