Project

Profile

Help

Bug #1611

closed

Instance construction and use of a java.util.ArrayList

Added by Roger Martin over 12 years ago. Updated over 11 years ago.

Status:
Won't fix
Priority:
Low
Assignee:
-
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2012-08-21
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hi,

Bringing this specific here.

I'm using saxonb9-1-0-8j with jdk1.7.0_05 on Unbuntu 12.04 (64 bit) and Windows 7 (Home Premium 64 bit)

Attempting to use a java.util.ArrayList for going to another class needing a Java array. But first:

...in namespace area...

xmlns:KabschAlignment="java:org.openscience.cdk.geometry.alignment.KabschAlignment"

             xmlns:cdkatom="java:org.openscience.cdk.Atom"

             xmlns:Point3d="java:javax.vecmath.Point3d"

             xmlns:ArrayList="java:java.util.ArrayList"

             xmlns:date="java:java.util.Date"

.......

further along

.......

<xsl:variable name="primary-atom-list" select="ArrayList:new()"/>

<xsl:for-each select="./cml:molecule/cml:molecule/cml:atomArray/*">

<xsl:value-of select="ArrayList:add($primary-atom-list, cdkatom:new(@elementType, Point3d:new(@x3, @y3, @z3)))[string(.)='never']"/>

</xsl:for-each>

xsl:comment

xsl:text size: </xsl:text>

<xsl:value-of select="ArrayList:size($primary-atom-list)"/>

</xsl:comment>

.......

the size as printed in the comment is zero. I've tried primitive content in place of the cdkatom for ArrayList and get same zero. Tried it with jdk1.6 and it is the same.

Could it be Java Generics?

with xmlns:ArrayList="java:java.util.ArrayList" this can be tried in about any xsl. Then use the add on an instance variable and check to see if the list has any elements.

Is there another way to get an array of objects put together to pass to a java based algorithm?

Please register to edit this issue

Also available in: Atom PDF