Java Reference
In-Depth Information
Wakeup condItIon and crIterIon
As discussed in the last section, a behavior is active and will be able to receive a trigger-
ing stimulus if its scheduling bound is able to intersect with the activation volume of the
ViewPlatform. When this happens, the occurrence of one or more of the defined wakeup
stimuli will cause the system to invoke the relevant parts of the processStimulus() method,
resulting in changes in the Java 3D world.
A variety of stimuli can be defined to correspond to the detection of associated user
actions or system events. Technically, this is done through specifying the wakeup stimuli
in terms of appropriate descendants of the WakeupCondition class.
WakeupCondition is an abstract class that provides the foundation of all the wakeup
classes in Java 3D. Under this abstract class, there are five important extended classes. The
first four allow multiple wakeup conditions to be composed in a single wakeup condition,
while the last one corresponds to WakeupCriterion, which is an abstract method for 14
specific wakeup criterion classes.
As summarized in Figure 5, two important methods are provided for the WakeupCondi-
tion class. The first one, allElemnts, returns an enumeration list of all the wakeup criteria
for a WakeupCondition object. The other, triggeredElements, provides information on the
specific wakeup criterion that has resulted in the triggering of the behavior. Obviously, this
method will be most useful in decoding the event that has led to the running of a process-
Stimulus method of a behavior.
On the other hand, WakeupCriterion is an abstract class for 14 specific wakeup criterion
classes. Under this abstract class, only one method, hasTriggered, is provided. Figure 6
gives a summary for this as well as the specific wakeup events under WakeupCriterion.
Note that since the functionality of the hasTriggered method can be captured under the
triggeredElements method of WakeupCondition, the former method is often not used in
program development.
Figure 5. WakeupCondition and methods
WakeupCondition()
// Constructor for creating a WakeupCondition object.
Enumeration allElements()
// Method that returns an enumeration of all WakeupCriterion objects.
Enumeration triggeredElements()
// Method that returns an enumeration of all triggered WakeupCriterion objects
Search WWH ::




Custom Search