Package org.xj3d.impl.core.eventmodel
Class SimpleRouter
java.lang.Object
org.xj3d.impl.core.eventmodel.SimpleRouter
- All Implemented Interfaces:
Router
The manager of route information for both static and runtime systems.
The implementation provides a one-shot route processing mechanism. It does not continuously evaluate routeSet. That is left to the caller code. Once the processRoutes() method is called, it will loop through all available routeSet until none of them have any changed values to send. At this point it will return and wait until the next time it is called.
This implementation does not deal correctly with fan-out of events. This is a simple manager for this reason. The reason for this is that we've decided to optimise for speed for scenes that you know only have a single ROUTE from any given eventOut to another eventIn, which is the majority of scenes.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
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 routeSet until there are no more to process.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.
-
Constructor Details
-
SimpleRouter
public SimpleRouter()Create and initialise a route manager instance
-
-
Method Details
-
setErrorReporter
public 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.- Specified by:
setErrorReporter
in interfaceRouter
- Parameters:
reporter
- The instance to use or null
-
processRoutes
public boolean processRoutes(double timestamp) Process all of the available routeSet until there are no more to process. This method will not return until all routeSet have been processed.- Specified by:
processRoutes
in interfaceRouter
- Parameters:
timestamp
- The timestamp for when these routeSet 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. -
addRoutes
-
removeRoute
Remove a route from the system. If the route does not exist in the system, this silently ignores the request.- Specified by:
removeRoute
in interfaceRouter
- 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
public void updateRoutes()Description copied from interface:Router
Notification that the route manager should now propagate all added and removed routes from this list into the core evaluatable space.- Specified by:
updateRoutes
in interfaceRouter
-
clear
-