javax.media.j3d
Class BehaviorStructure

java.lang.Object
  extended by javax.media.j3d.J3dStructure
      extended by javax.media.j3d.BehaviorStructure

 class BehaviorStructure
extends J3dStructure

A behavior structure is a object that organizes behaviors, wakeup conditions, and other behavior scheduler entities.


Field Summary
(package private)  int activeWakeupOnFrameCount
           
(package private)  int activeWakeupOnSensorCount
           
(package private)  UnorderList awtEventsBuffer
          Buffers to hold events when user thread is in processStimulus() while this event is receiving.
(package private)  long awtEventTimestamp
           
(package private)  UnorderList behaviorPostBuffer
           
(package private)  IndexedUnorderSet behaviors
          The list of behaviors
(package private)  WakeupIndexedList boundsEntryList
          A list of bounds WakeupOnViewPlatformEntry objects that have seen ViewPlatformEntry
(package private)  WakeupIndexedList boundsExitList
          A list of bounds WakeupOnViewPlatformExit objects that have seen ViewPlatformEntry
(package private)  boolean branchDetach
           
(package private)  int[] clonePostIDBuffer
           
(package private)  WakeupIndexedList currentSensorEntryList
          A list of WakeupOnSensorEntry objects that have seen a sensor
(package private)  WakeupIndexedList currentSensorExitList
          A list of WakeupOnSensorExit objects that have seen a sensor
(package private)  UnorderList pendingBehaviors
           
(package private)  UnorderList physicalEnvironments
           
(package private)  int[] postIDBuffer
           
(package private)  UnorderList[] processList
          An array of process behaviors
(package private)  Point3d ptSensorLoc
           
(package private)  IndexedUnorderSet scheduleList
          An array of schedulable behaviors, use in removeViewPlatform() to go through only active behaviors
(package private)  Vector3d sensorLoc
           
(package private)  Transform3D sensorTransform
           
(package private)  UpdateTargets targets
           
(package private)  boolean transformMsg
           
(package private)  UnorderList transformViewPlatformList
           
(package private)  IndexedUnorderSet viewPlatforms
          The list of view platforms
(package private)  Point3d vpCenter
          A bounds used for getting a view platform scheduling BoundingSphere
(package private)  Point3d vpTransCenter
           
(package private)  WakeupIndexedList wakeupOnActivation
           
(package private)  WakeupIndexedList wakeupOnAWTEvent
          The lists of the WakeupCriterion objects that the behavior scheduler keeps.
(package private)  WakeupIndexedList wakeupOnBehaviorPost
           
(package private)  WakeupIndexedList wakeupOnDeactivation
           
(package private)  WakeupIndexedList wakeupOnElapsedFrames
           
(package private)  WakeupIndexedList wakeupOnSensorEntry
           
(package private)  WakeupIndexedList wakeupOnSensorExit
           
(package private)  WakeupIndexedList wakeupOnViewPlatformEntry
           
(package private)  WakeupIndexedList wakeupOnViewPlatformExit
           
 
Fields inherited from class javax.media.j3d.J3dStructure
messageList, msgList, nMessage, threadData, threadType, universe, updateThread
 
Constructor Summary
BehaviorStructure(VirtualUniverse u)
           
 
Method Summary
(package private)  void activateBehaviors()
           
(package private)  void addSensorEntryCondition(WakeupOnSensorEntry w)
           
(package private)  void addSensorExitCondition(WakeupOnSensorExit w)
           
(package private)  void addToScheduleList(BehaviorRetained behav)
           
(package private)  void addViewPlatform(ViewPlatformRetained vp)
           
(package private)  void addVPEntryCondition(WakeupOnViewPlatformEntry w)
           
(package private)  void addVPExitCondition(WakeupOnViewPlatformExit w)
           
(package private)  void checkSensorEntryExit()
           
(package private)  void cleanup()
          Release resource associate with this structure before GC We need to clear all those IndexedUnorderSet/WakeupIndexedList so that the listIdx associate with IndexedObject reset to -1.
(package private)  void handleAWTEvent()
          This routine takes the awt event list and gives then to the awt event conditions
(package private)  void handleAWTEvent(java.awt.AWTEvent evt)
           
(package private)  void handleBehaviorPost()
          This goes through all of the criteria waiting for Behavior Posts and notifys them.
(package private)  void handleBehaviorPost(Behavior behav, int postid)
           
(package private)  void incElapsedFrames()
          This goes through all of the criteria waiting for Elapsed Frames and notified them.
(package private)  void insertNodes(java.lang.Object[] nodes)
           
(package private)  ViewPlatformRetained intersectVPCenter(Bounds behregion)
          return true if one of ViewPlatforms center intersect behregion
(package private)  boolean intersectVPRegion(Bounds behregion)
          return true if one of ViewPlatforms intersect behregion
(package private)  void notifyActivationCondition(BehaviorRetained behav)
           
(package private)  void notifyDeactivationCondition(BehaviorRetained behav)
           
(package private)  void processBehaviorTransform(BehaviorRetained behav)
           
(package private)  void processBehXformChanged(UnorderList arrList)
           
(package private)  void processBoundingLeafChanged(java.lang.Object[] users, Bounds bound)
           
(package private)  void processConditionMet(BehaviorRetained behav, java.lang.Boolean checkSchedulingRegion)
           
(package private)  void processMessages(long referenceTime)
          This gets overriden by the structure
(package private)  void processSwitchChanged(J3dMessage m)
           
(package private)  void processTransformChanged(java.lang.Object[] leaf)
           
(package private)  void processViewPlatformTransform(ViewPlatformRetained vp)
           
(package private)  void processVpfXformChanged(UnorderList arrList)
           
(package private)  void reEvaluatePhysicalEnvironments()
           
(package private)  void reEvaluateWakeupCount()
           
(package private)  void removeBehavior(BehaviorRetained behav)
           
(package private)  void removeFromScheduleList(BehaviorRetained behav)
           
(package private)  void removeNodes(J3dMessage m)
          This is used by MasterControl to process any unused message for final cleanup.
(package private)  void removeSensorEntryCondition(WakeupOnSensorEntry w)
           
(package private)  void removeSensorExitCondition(WakeupOnSensorExit w)
           
(package private)  void removeViewPlatform(ViewPlatformRetained vp)
           
(package private)  void removeVPEntryCondition(WakeupCondition w)
           
(package private)  void removeVPExitCondition(WakeupOnViewPlatformExit w)
           
(package private)  void resetConditionMet()
          This prevents wakeupCondition sent out message and sets conditionMet to true, but the BehaviorStructure/BehaviorScheduler is not fast enough to process the message and reset conditionMet to false when view deactivate/unregister.
(package private) static void resetConditionMet(WakeupIndexedList list)
           
(package private)  Sensor sensorIntersect(Bounds behregion)
          return the Senor that intersect with behregion or null
(package private)  void updateVPEntryTransformRegion(BehaviorRetained behav)
           
(package private)  void updateVPExitTransformRegion(BehaviorRetained behav)
           
 
Methods inherited from class javax.media.j3d.J3dStructure
addMessage, clearMessages, getMessages, getNumMessage, getUpdateThreadData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

behaviors

IndexedUnorderSet behaviors
The list of behaviors


viewPlatforms

IndexedUnorderSet viewPlatforms
The list of view platforms


scheduleList

IndexedUnorderSet scheduleList
An array of schedulable behaviors, use in removeViewPlatform() to go through only active behaviors


processList

UnorderList[] processList
An array of process behaviors


vpCenter

Point3d vpCenter
A bounds used for getting a view platform scheduling BoundingSphere


vpTransCenter

Point3d vpTransCenter

boundsEntryList

WakeupIndexedList boundsEntryList
A list of bounds WakeupOnViewPlatformEntry objects that have seen ViewPlatformEntry


boundsExitList

WakeupIndexedList boundsExitList
A list of bounds WakeupOnViewPlatformExit objects that have seen ViewPlatformEntry


currentSensorEntryList

WakeupIndexedList currentSensorEntryList
A list of WakeupOnSensorEntry objects that have seen a sensor


currentSensorExitList

WakeupIndexedList currentSensorExitList
A list of WakeupOnSensorExit objects that have seen a sensor


wakeupOnAWTEvent

WakeupIndexedList wakeupOnAWTEvent
The lists of the WakeupCriterion objects that the behavior scheduler keeps.


wakeupOnActivation

WakeupIndexedList wakeupOnActivation

wakeupOnDeactivation

WakeupIndexedList wakeupOnDeactivation

wakeupOnBehaviorPost

WakeupIndexedList wakeupOnBehaviorPost

wakeupOnElapsedFrames

WakeupIndexedList wakeupOnElapsedFrames

wakeupOnViewPlatformEntry

WakeupIndexedList wakeupOnViewPlatformEntry

wakeupOnViewPlatformExit

WakeupIndexedList wakeupOnViewPlatformExit

wakeupOnSensorEntry

WakeupIndexedList wakeupOnSensorEntry

wakeupOnSensorExit

WakeupIndexedList wakeupOnSensorExit

transformViewPlatformList

UnorderList transformViewPlatformList

activeWakeupOnFrameCount

int activeWakeupOnFrameCount

activeWakeupOnSensorCount

int activeWakeupOnSensorCount

awtEventsBuffer

UnorderList awtEventsBuffer
Buffers to hold events when user thread is in processStimulus() while this event is receiving. This avoid any lost of event. We did not remove individual element from the following list (except clear()) so the order is still preserve.


postIDBuffer

int[] postIDBuffer

clonePostIDBuffer

int[] clonePostIDBuffer

behaviorPostBuffer

UnorderList behaviorPostBuffer

sensorTransform

Transform3D sensorTransform

sensorLoc

Vector3d sensorLoc

ptSensorLoc

Point3d ptSensorLoc

physicalEnvironments

UnorderList physicalEnvironments

pendingBehaviors

UnorderList pendingBehaviors

branchDetach

boolean branchDetach

awtEventTimestamp

long awtEventTimestamp

transformMsg

boolean transformMsg

targets

UpdateTargets targets
Constructor Detail

BehaviorStructure

BehaviorStructure(VirtualUniverse u)
Method Detail

processMessages

void processMessages(long referenceTime)
Description copied from class: J3dStructure
This gets overriden by the structure

Specified by:
processMessages in class J3dStructure

insertNodes

void insertNodes(java.lang.Object[] nodes)

activateBehaviors

void activateBehaviors()

addViewPlatform

void addViewPlatform(ViewPlatformRetained vp)

removeNodes

void removeNodes(J3dMessage m)
Description copied from class: J3dStructure
This is used by MasterControl to process any unused message for final cleanup. DON'T decrememt message count in the method, as it is done by MasterControl.

Specified by:
removeNodes in class J3dStructure

removeViewPlatform

void removeViewPlatform(ViewPlatformRetained vp)

removeBehavior

void removeBehavior(BehaviorRetained behav)

handleAWTEvent

void handleAWTEvent(java.awt.AWTEvent evt)

handleAWTEvent

void handleAWTEvent()
This routine takes the awt event list and gives then to the awt event conditions


handleBehaviorPost

void handleBehaviorPost(Behavior behav,
                        int postid)

handleBehaviorPost

void handleBehaviorPost()
This goes through all of the criteria waiting for Behavior Posts and notifys them.


incElapsedFrames

void incElapsedFrames()
This goes through all of the criteria waiting for Elapsed Frames and notified them.


removeVPEntryCondition

void removeVPEntryCondition(WakeupCondition w)

addVPEntryCondition

void addVPEntryCondition(WakeupOnViewPlatformEntry w)

removeVPExitCondition

void removeVPExitCondition(WakeupOnViewPlatformExit w)

addVPExitCondition

void addVPExitCondition(WakeupOnViewPlatformExit w)

removeSensorEntryCondition

void removeSensorEntryCondition(WakeupOnSensorEntry w)

addSensorEntryCondition

void addSensorEntryCondition(WakeupOnSensorEntry w)

removeSensorExitCondition

void removeSensorExitCondition(WakeupOnSensorExit w)

addSensorExitCondition

void addSensorExitCondition(WakeupOnSensorExit w)

processConditionMet

void processConditionMet(BehaviorRetained behav,
                         java.lang.Boolean checkSchedulingRegion)

processBehXformChanged

final void processBehXformChanged(UnorderList arrList)

processVpfXformChanged

final void processVpfXformChanged(UnorderList arrList)

processTransformChanged

final void processTransformChanged(java.lang.Object[] leaf)

processBehaviorTransform

final void processBehaviorTransform(BehaviorRetained behav)

processViewPlatformTransform

void processViewPlatformTransform(ViewPlatformRetained vp)

updateVPEntryTransformRegion

void updateVPEntryTransformRegion(BehaviorRetained behav)

updateVPExitTransformRegion

void updateVPExitTransformRegion(BehaviorRetained behav)

reEvaluatePhysicalEnvironments

void reEvaluatePhysicalEnvironments()

checkSensorEntryExit

void checkSensorEntryExit()

sensorIntersect

Sensor sensorIntersect(Bounds behregion)
return the Senor that intersect with behregion or null


intersectVPRegion

final boolean intersectVPRegion(Bounds behregion)
return true if one of ViewPlatforms intersect behregion


intersectVPCenter

final ViewPlatformRetained intersectVPCenter(Bounds behregion)
return true if one of ViewPlatforms center intersect behregion


notifyDeactivationCondition

void notifyDeactivationCondition(BehaviorRetained behav)

notifyActivationCondition

void notifyActivationCondition(BehaviorRetained behav)

processSwitchChanged

void processSwitchChanged(J3dMessage m)

processBoundingLeafChanged

void processBoundingLeafChanged(java.lang.Object[] users,
                                Bounds bound)

removeFromScheduleList

final void removeFromScheduleList(BehaviorRetained behav)

addToScheduleList

final void addToScheduleList(BehaviorRetained behav)

resetConditionMet

void resetConditionMet()
This prevents wakeupCondition sent out message and sets conditionMet to true, but the BehaviorStructure/BehaviorScheduler is not fast enough to process the message and reset conditionMet to false when view deactivate/unregister.


resetConditionMet

static void resetConditionMet(WakeupIndexedList list)

reEvaluateWakeupCount

void reEvaluateWakeupCount()

cleanup

void cleanup()
Description copied from class: J3dStructure
Release resource associate with this structure before GC We need to clear all those IndexedUnorderSet/WakeupIndexedList so that the listIdx associate with IndexedObject reset to -1.

Specified by:
cleanup in class J3dStructure


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.