----- Original Message -----
Sent: Thursday, March 02, 2006 10:23
AM
Subject: RE: [x3d-public] Checking node
type
>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)
avast!
Antivirus: Outbound message clean.
Virus Database (VPS): 0609-1,
01/03/2006
Tested on: 2/3/2006 10:23:26 ðì
avast! -
copyright (c) 1988-2005 ALWIL Software.