You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Gary L Peskin <ga...@firstech.com> on 2000/08/09 08:59:19 UTC

[XALAN-J] Extension function question

Scott et al --

I'm starting to carefully study the extension mechanism in the current
Xalan-J implementation because I'd like to suggest some enhancements.  I
figured I'd better understand what's there now before going further.

One thing is puzzling me and that is the methodKey used for identifying
cached versions of the extension function.  This is implemented in
Xalan1 in org.apache.xalan.xpath.XPath.executeExtension() and in Xalan2
in org.apache.xpath..compiler.Compiler.compileExtension().

In both cases, the methodKey formed is:

	String.valueOf(m_opMap[opPos]) + String.valueOf(((Object)
this).hashCode()))

In essence, this creates a string consisting of two parts.  The first
part represents the opMap entry _immediately following_ the external
function entry.  The second part, obviously, represents the hashCode for
the Xpath or Compiler object.

I'm not sure what good the first part does.  It seems to be like it
should be representing the position of this function call within the
m_opMap array of the XPath (v1) or Compiler (v2) object.  In that case,
the expression should be:

	String.valueOf(opPos) + String.valueOf(((Object) this).hashCode()))

Also, I'm not sure why we have all of the gyrations in part two of the
method key.  Shouldn't the methodKey just be:

	String.valueOf(opPos) + String.valueOf(hashCode()) ?

TIA,
Gary