Package org.xj3d.core.eventmodel
Interface Router
- All Known Implementing Classes:
ListsRouter
,SimpleRouter
public interface Router
A runtime evaluator of routes for a single execution space.
The implementation provides a one-shot route processing mechanism. It does not continuously evaluate routes. That is left to the caller code. Once the processRoutes() method is called, it will loop through all available routes exactly once and return to the caller. This is to conform with the requirements of the event cascade processing defined in the VRML spec.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRoute
(VRMLNodeType srcNode, int srcIndex, VRMLNodeType destNode, int destIndex) Add a route to the system.void
A request to bulk add routes to this router.void
clear()
Clear all the routes currently being managed here.boolean
processRoutes
(double timestamp) Process all of the available routes once, now.void
removeRoute
(VRMLNodeType srcNode, int srcIndex, VRMLNodeType destNode, int destIndex) Remove a route from the system.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.void
Notification that the route manager should now propagate all added and removed routes from this list into the core evaluatable space.
-
Method Details
-
setErrorReporter
void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Parameters:
reporter
- The instance to use or null
-
processRoutes
boolean processRoutes(double timestamp) Process all of the available routes once, now. This method will not return until all routes have been processed. Implied in this behaviour is the loop-breaking rule handling. There is no explicit direction that the timestamp has changed, but the implementation should also keep track of which eventOuts have already sent an event for this frame and make sure they do not send any further values/routes. It should only perform the routing processing at this point. Calling eventsProcessed() on scripts is left to a later call.- Parameters:
timestamp
- The timestamp for when these routes should be executed- Returns:
- false No event outs needed processing this call
-
addRoute
Add a route to the system. If the route exists in the system, this silently ignores the request. IAW the spec, this should buffer the actual add operation until the updateRoutes() method is called. If the destination of the route is a script, it should automatically add it to the internal queue for dealing with eventsProcessed methods.- Parameters:
srcNode
- The source node of the routesrcIndex
- The index of the source fielddestNode
- The destination node of the routedestIndex
- The index of the destination field
-
addRoutes
-
removeRoute
Remove a route from the system. If the route does not exist in the system, this silently ignores the request. IAW the spec, this should buffer the actual add operation until the updateRoutes() method is called.- Parameters:
srcNode
- The source node of the routesrcIndex
- The index of the source fielddestNode
- The destination node of the routedestIndex
- The index of the destination field
-
updateRoutes
void updateRoutes()Notification that the route manager should now propagate all added and removed routes from this list into the core evaluatable space. -
clear
void clear()Clear all the routes currently being managed here. The space this router represents is being deleted.
-