|
>What would be an efficient way to check the type of a
node in an X3D scenegraph consisting of X3DNode objects? getNodeName returns a
String which seems to
> me a bit unsuitable towards
this end as it requires string comparisons, also I'm not sure I understand
what getNodeType returns.
see "instanceof"
have to do some testing though to see
if
s.equals(SOME_STRING_CONSTANT)
is faster
note: never use == for string
comparisons in Java, unless you have access to X3D's java class [it's
some interface usually] where the string constants are defined (supposing the
same constants are reused everywhere). That is cause == compares for object
equality, not for content equality in this case (one of the peculiarities of
Java)
---------------- George Birbilis (birbilis@kagi.com) Microsoft MVP J# for 2004-2006 * QuickTime, QTVR, ActiveX, VCL, .NET http://www.kagi.com/birbilis * Robotics PhD student http://www.mech.upatras.gr/~Robotics http://www.mech.upatras.gr/~robgroup |