You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by ga...@apache.org on 2001/04/03 01:32:02 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/extensions MethodResolver.java
garyp 01/04/02 16:32:02
Modified: java/src/org/apache/xalan/extensions MethodResolver.java
Log:
Code cleanup submitted by Art Welch <ar...@EASTPOINT.COM>.
Revision Changes Path
1.20 +6 -27 xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java
Index: MethodResolver.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/MethodResolver.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- MethodResolver.java 2001/02/19 19:40:31 1.19
+++ MethodResolver.java 2001/04/02 23:32:02 1.20
@@ -320,7 +320,7 @@
/**
* Given the name of a method, figure out the resolution of
- * the Java Method
+ * the Java Method.
* @param classObj The Class of the object that should have the method.
* @param name The name of the method to be invoked.
* @return A method that will work to be called as an element.
@@ -338,7 +338,6 @@
Method bestMethod = null;
Method[] methods = classObj.getMethods();
int nMethods = methods.length;
- int bestScore = Integer.MAX_VALUE;
int bestScoreCount = 0;
for(int i = 0; i < nMethods; i++)
{
@@ -348,33 +347,13 @@
{
Class[] paramTypes = method.getParameterTypes();
if ( (paramTypes.length == 2)
- && paramTypes[1].isAssignableFrom(org.apache.xalan.templates.ElemExtensionCall.class) )
+ && paramTypes[1].isAssignableFrom(org.apache.xalan.templates.ElemExtensionCall.class)
+ && paramTypes[0].isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class) )
{
- int score = -1;
- if (paramTypes[0].isAssignableFrom(
- org.apache.xalan.extensions.XSLProcessorContext.class))
- {
- score = 10;
- }
- /*******
- else if (paramTypes[0].isAssignableFrom(
- org.apace.xalan.xslt.XSLProcessorContext.class))
- {
- score = 5;
- }
- ********/
- else
- continue;
-
- if (score < bestScore)
- {
- // System.out.println("Assigning best method: "+method);
+ if ( ++bestScoreCount == 1 )
bestMethod = method;
- bestScore = score;
- bestScoreCount = 1;
- }
- else if (score == bestScore)
- bestScoreCount++;
+ else
+ break;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org