Class BaseNode
- All Implemented Interfaces:
X3DNode
- Direct Known Subclasses:
SAIAnchor
,SAIAppearance
,SAIAudioClip
,SAIBackground
,SAIBallJoint
,SAIBillboard
,SAIBooleanFilter
,SAIBooleanSequencer
,SAIBooleanToggle
,SAIBooleanTrigger
,SAIBox
,SAICADAssembly
,SAICADFace
,SAICADLayer
,SAICADPart
,SAICollidableOffset
,SAICollidableShape
,SAICollision
,SAICollisionCollection
,SAICollisionSensor
,SAICollisionSpace
,SAIColor
,SAIColorInterpolator
,SAIColorRGBA
,SAICone
,SAIContact
,SAICoordinate
,SAICoordinateInterpolator
,SAICoordinateInterpolator2D
,SAICylinder
,SAICylinderSensor
,SAIDirectionalLight
,SAIDISEntityManager
,SAIDISEntityTypeMapping
,SAIDoubleAxisHingeJoint
,SAIElevationGrid
,SAIEspduTransform
,SAIExplosionEmitter
,SAIExtrusion
,SAIFog
,SAIFogCoordinate
,SAIFontStyle
,SAIGeoCoordinate
,SAIGeoElevationGrid
,SAIGeoLocation
,SAIGeoLOD
,SAIGeoMetadata
,SAIGeoOrigin
,SAIGeoPositionInterpolator
,SAIGeoTouchSensor
,SAIGeoTransform
,SAIGeoViewpoint
,SAIGravityPhysicsModel
,SAIGroup
,SAIHAnimDisplacer
,SAIHAnimHumanoid
,SAIHAnimJoint
,SAIHAnimSegment
,SAIHAnimSite
,SAIImageTexture
,SAIIndexedFaceSet
,SAIIndexedLineSet
,SAIIndexedTriangleFanSet
,SAIIndexedTriangleSet
,SAIIndexedTriangleStripSet
,SAIInline
,SAIIntegerSequencer
,SAIIntegerTrigger
,SAIKeySensor
,SAILinePickSensor
,SAILineProperties
,SAILineSet
,SAILoadSensor
,SAILocalFog
,SAILOD
,SAIMaterial
,SAIMetadataDouble
,SAIMetadataFloat
,SAIMetadataInteger
,SAIMetadataSet
,SAIMetadataString
,SAIMotorJoint
,SAIMultiTexture
,SAIMultiTextureCoordinate
,SAIMultiTextureTransform
,SAINavigationInfo
,SAINormal
,SAINormalInterpolator
,SAIOrientationInterpolator
,SAIOrthoViewpoint
,SAIParticleSystem
,SAIPickableGroup
,SAIPixelTexture
,SAIPlaneSensor
,SAIPointEmitter
,SAIPointLight
,SAIPointPickSensor
,SAIPointSet
,SAIPolyline2D
,SAIPolylineEmitter
,SAIPolypoint2D
,SAIPositionInterpolator
,SAIPositionInterpolator2D
,SAIPrimitivePickSensor
,SAIProximitySensor
,SAIQuadSet
,SAIRectangle2D
,SAIRigidBodyCollection
,SAIScalarInterpolator
,SAIScript
,SAIShape
,SAISingleAxisHingeJoint
,SAISliderJoint
,SAISound
,SAISphere
,SAISphereSensor
,SAISpotLight
,SAIStaticGroup
,SAIStringSensor
,SAISwitch
,SAIText
,SAITextureBackground
,SAITextureCoordinate
,SAITextureCoordinateGenerator
,SAITextureProperties
,SAITextureTransform
,SAITimeSensor
,SAITimeTrigger
,SAITouchSensor
,SAITransform
,SAITriangleFanSet
,SAITriangleSet
,SAITriangleSet2D
,SAITriangleStripSet
,SAITwoSidedMaterial
,SAIUniversalJoint
,SAIViewpoint
,SAIVisibilitySensor
,SAIVolumePickSensor
,SAIWindPhysicsModel
,SAIWorldInfo
May be used as a standalone node, or extended with the abstract data types defined by higher levels of the SAI conformance.
- Version:
- $Revision: 1.17 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Flag for determining the read/write timing abilityprotected ReferenceQueue
<X3DField> Reference queue used for keeping track of field object instancesprotected Map
<String, SoftReference<X3DField>> Map containing the field name as key and a SoftReference instance that points to the field object.protected VRMLNodeType
This is the real node that this object represents -
Constructor Summary
ConstructorsConstructorDescriptionBaseNode
(VRMLNodeType node, ReferenceQueue<X3DField> refQueue, FieldFactory fac, FieldAccessListener fal, BaseNodeFactory bnf) Create a new basic node implementation. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Convenience method to check if the node may be accessed at this point in time.void
dispose()
Dispose of this node's resources.boolean
Compare this node for equality to another.Get a field for this node.Get the list of fields that this node contains.Get the metadata object associated with this node.Get the type of this node.int[]
Get the basic categorisation type(s) of this node.int
hashCode()
Generate the hashcode for this object.boolean
Check to see if this node has completed its setup either by being directly informed of it or through implicit measures (see the specification for details).void
realize()
Notify this node that its setup stage is now complete.void
setMetadata
(X3DMetadataObject node) Set the Metadata object that belongs to this node.toString()
Generate a string version of this node's representation.
-
Field Details
-
realNode
This is the real node that this object represents -
fieldRefMap
Map containing the field name as key and a SoftReference instance that points to the field object. The weak reference is used so that fields can be removed automatically by Java if no longer referenced by user code. -
fieldQueue
Reference queue used for keeping track of field object instances -
accessPermitted
protected boolean accessPermittedFlag for determining the read/write timing ability
-
-
Constructor Details
-
BaseNode
public BaseNode(VRMLNodeType node, ReferenceQueue<X3DField> refQueue, FieldFactory fac, FieldAccessListener fal, BaseNodeFactory bnf) Create a new basic node implementation.- Parameters:
node
- The source node this is wrappingrefQueue
- The queue used for dealing with field referencesfac
- Factory used to create field wrappersfal
- The access listener for propagating s2 requestsbnf
- The factory used to create node wrappers
-
-
Method Details
-
setMetadata
Set the Metadata object that belongs to this node. If the object instance is null, then it clears the currently set node instance.- Specified by:
setMetadata
in interfaceX3DNode
- Parameters:
node
- The new node instance to use- Throws:
InvalidNodeException
-
getMetadata
Get the metadata object associated with this node. If none is set, it will return null.- Specified by:
getMetadata
in interfaceX3DNode
- Returns:
- The metadata object instance or null
- Throws:
InvalidNodeException
-
getNodeName
Get the type of this node. The string returned should be the name of the VRML node or the name of the proto instance this node represents.- Specified by:
getNodeName
in interfaceX3DNode
- Returns:
- The type of this node.
- Throws:
InvalidNodeException
- The node has had it's resources disposed of
-
getFieldDefinitions
Get the list of fields that this node contains. This will return one definition for each field regardless of whether it is eventIn/Out, exposedField or field access type.- Specified by:
getFieldDefinitions
in interfaceX3DNode
- Returns:
- The definitions for all fields of this node
- Throws:
InvalidNodeException
- The node has had it's resources disposed of
-
realize
Notify this node that its setup stage is now complete. This will cause all its fields to become non-writable, leaving only eventIns and exposedFields writable. A user is not required to call this method as it will be implicitly called immediately this node is added to any other node. Any call after the first is ignored.- Specified by:
realize
in interfaceX3DNode
- Throws:
InvalidNodeException
- The node has had it's resources disposed of
-
isRealized
Check to see if this node has completed its setup either by being directly informed of it or through implicit measures (see the specification for details).- Specified by:
isRealized
in interfaceX3DNode
- Returns:
- true if this node has completed the setup stage, false otherwise
- Throws:
InvalidNodeException
- The node has had it's resources disposed of
-
getNodeType
Get the basic categorisation type(s) of this node. The types values are provided in the array of values. There is no specific order of the returned types. It is expected that most node types, which only descend from a single parent type would return an array of length 1. The returned value(s) should be the most derived type applicable for that node. For example, a Material node should return MaterialNodeType value, not AppearanceChildNodeType value.- Specified by:
getNodeType
in interfaceX3DNode
- Returns:
- The primary type(s) of this node
- Throws:
InvalidNodeException
- The node has had it's resources disposed of
-
getField
Get a field for this node.If the basic field required is an exposedField you can use either the standard name (such as translation) or you can use the set_ / _changed modifier (such as set_translation). If the field asked for is of field access type then an object is returned that cannot be read or written to. However, this allows the option for building editor type applications that may permit reading and writing of field access types when not running the VRML event model.
- Specified by:
getField
in interfaceX3DNode
- Parameters:
name
- The name of the field that is required- Returns:
- A reference to the field requested.
- Throws:
InvalidFieldException
- The named field does not exist for this node.InvalidNodeException
- The node has had it's resources disposed of
-
dispose
Dispose of this node's resources. This is used to indicate to the browser that the java side of the application does not require the resources represented by this node. The browser is now free to do what it likes with the node.This in no way implies that the browser is to remove this node from the scene graph, only that the java code is no longer interested in this particular node through this reference.
Once this method has been called, any further calls to methods of this instance of the class is shall generate an InvalidNodeException.
- Specified by:
dispose
in interfaceX3DNode
- Throws:
InvalidNodeException
- The node is no longer valid and can't be disposed of again.
-
hashCode
public int hashCode()Generate the hashcode for this object. In order to allow this node to be used as a key lookup in a hashMap, we want to override this to make sure that we compare against the real node that we're wrapping. In doing so, we're maintaining the contract required by Java as the equals() method compares for the same thing. -
equals
Compare this node for equality to another. To do this, we want to see if they're representing the same base internal node instance. If they are (through using the reference comparison), then return true; -
toString
Generate a string version of this node's representation.- Overrides:
toString
in classObject
- Returns:
- A String representation of this node
- Throws:
InvalidNodeException
-
checkAccess
protected void checkAccess()Convenience method to check if the node may be accessed at this point in time. If it is not, it will throw an exception appropriate to the situation.- Throws:
InvalidNodeException
- The node handle is no longer validInvalidOperationTimingException
- Can't access the node at this point in time
-