Code consistency

Hi !
I was rapidly skimming through xith’s code and noticed two little things :
1- Strange code for OOP in Node
For instance the updateBounds method has code like "
if (this instanceof Shape3D)
{
xxxx
vworldBounds.set(bounds);
vworldBounds.transform(getLocalToVworld());
}
else if (this instanceof Shape3D)
{
yyyy
vworldBounds.set(bounds);
vworldBounds.transform(getLocalToVworld());
}
else
{

}

wouldn’t it be better to have a method like
protected Bounds computeBounds ()
{
return bounds;
}
as default implementation, and override it in Shape3D and Group?

The implementation of updateBounds would then become:
{

bounds = computeBounds ();
vworldBounds.set(bounds);
vworldBounds.transform(getLocalToVworld());
}
without all these instanceof.
2- Use of old Enumeration
The enumeration class is a sad legacy from JDK1.1, why use it in xith? I know it is not to make it compatible with old JDKs, as classes from the new collection API such as List, ArrayList, etc… are used consistently in xith.
Moreover, you are forced to use wrappers around iterators (ListEnumeration) to be compatible.
Why not use Iterator?

I don’t mean to offend anybody with this post, and I would be happy to make the cleaning myself if it is of interest to the developpers.

Guillaume

Enumeration stuff: I had not seen that Java3D used that, so I guess it is for API compatibility.
Still, I find it quite annoying to use that.
Couldn’t we have a deprecated “Enumeration getAllChildren ()”, and a “Iterator getChildrenIterator ()” method?

valid points - please feel free to submit a diff of the patched files to IssueZilla :wink: :slight_smile:

Will.