peterreilly 2003/08/15 01:40:37
Modified: src/main/org/apache/tools/ant ComponentHelper.java
AntTypeDefinition.java
Log:
move same definition to AntTypeDefinition
Revision Changes Path
1.24 +1 -9 ant/src/main/org/apache/tools/ant/ComponentHelper.java
Index: ComponentHelper.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/ComponentHelper.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ComponentHelper.java 13 Aug 2003 14:46:15 -0000 1.23
+++ ComponentHelper.java 15 Aug 2003 08:40:37 -0000 1.24
@@ -651,15 +651,7 @@
if (!validDefinition(def) || !validDefinition(old)) {
return validDefinition(def) == validDefinition(old);
}
-
- if (!(old.getTypeClass(project).equals(def.getTypeClass(project)))) {
- return false;
- }
- if (!(old.getExposedClass(project).equals(
- def.getExposedClass(project)))) {
- return false;
- }
- return true;
+ return def.sameDefinition(old, project);
}
1.5 +22 -2 ant/src/main/org/apache/tools/ant/AntTypeDefinition.java
Index: AntTypeDefinition.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/AntTypeDefinition.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AntTypeDefinition.java 13 Aug 2003 12:45:41 -0000 1.4
+++ AntTypeDefinition.java 15 Aug 2003 08:40:37 -0000 1.5
@@ -54,6 +54,7 @@
package org.apache.tools.ant;
+
/**
* This class contains all the information
* on a particular ant type,
@@ -217,7 +218,7 @@
* @return the created object
*/
public Object create(Project project) {
- return icreate(project);
+ return icreate(project);
}
/**
@@ -326,5 +327,24 @@
"Could not create type " + name + " due to " + t, t);
}
}
-}
+ /**
+ * Equality method for this definition
+ *
+ * @param other another definition
+ * @param project the project the definition
+ * @return true if the definitions are the same
+ */
+ public boolean sameDefinition(AntTypeDefinition other, Project project) {
+ if (other == null) {
+ return false;
+ }
+ if (other.getClass() != this.getClass()) {
+ return false;
+ }
+ if (!(other.getTypeClass(project).equals(getTypeClass(project)))) {
+ return false;
+ }
+ return
other.getExposedClass(project).equals(getExposedClass(project));
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]