Xj3D VRML/X3D Code API

org.web3d.vrml.nodes.runtime
Interface RouteManager

All Known Implementing Classes:
DefaultRouteManager

public interface RouteManager

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 routes. That is left to the caller code. Once the processRoutes() method is called, it will loop through all available routes 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.

Routes are added to a particular execution space. Each space represents an encapsulated world, such as a proto or inline. The route manager is expected to be able to deal with these individual spaces, and keep them separate. Thus, when the execution space is no longer referenced, the associated routes and scripts are to be removed and their outputs no longer processed.

Implementation is not particularly efficient in this version...

Version:
$Revision: 1.10 $
Author:
Justin Couch

Method Summary
 void addRoute(VRMLExecutionSpace space, ROUTE route)
          Add a route object to the system.
 void addRoute(VRMLExecutionSpace space, VRMLNodeType srcNode, int srcIndex, VRMLNodeType destNode, int destIndex)
          Add a route to the system.
 void addSpace(VRMLExecutionSpace space)
          Add an execution space to the system.
 void clear()
          Clear all the routes currently being managed here.
 boolean processRoutes(double timestamp)
          Process all of the available routes until there are no more to process.
 void removeRoute(VRMLExecutionSpace space, ROUTE route)
          Remove a route object from the system.
 void removeRoute(VRMLExecutionSpace space, VRMLNodeType srcNode, int srcIndex, VRMLNodeType destNode, int destIndex)
          Remove a route from the system.
 void removeSpace(VRMLExecutionSpace space)
          Remove an execution space to the system.
 void setErrorReporter(ErrorReporter reporter)
          Register an error reporter with the manager so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.
 void setRouterFactory(RouterFactory fac)
          Set the factory needed to create new router instances for a new execution space.
 void updateRoutes()
          Notification that the route manager should now propogate all added and removed routes from this list into the core evaluatable space.
 void updateSpaces()
          Notification that the route manager should now propogate all added and removed spaces from this list into the core evaluatable system.
 

Method Detail

setErrorReporter

public void setErrorReporter(ErrorReporter reporter)
Register an error reporter with the manager 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

setRouterFactory

public void setRouterFactory(RouterFactory fac)
Set the factory needed to create new router instances for a new execution space. If the reference is null, then this clears the current factory so that we don't accept sub-space handling.

Parameters:
fac - The factory instance to use

processRoutes

public boolean processRoutes(double timestamp)
Process all of the available routes until there are no more to process. This method will not return until all routes have been processed.

Parameters:
timestamp - The timestamp for when these routes should be executed
Returns:
false No event outs needed processing this call

addRoute

public void addRoute(VRMLExecutionSpace space,
                     VRMLNodeType srcNode,
                     int srcIndex,
                     VRMLNodeType destNode,
                     int destIndex)
Add a route to the system. If the route exists in the system, this silently ignores the request. If the space reference is null then

Parameters:
space - The execution space for the route
srcNode - The source node of the route
srcIndex - The index of the source field
destNode - The destination node of the route
destIndex - The index of the destination field

addRoute

public void addRoute(VRMLExecutionSpace space,
                     ROUTE route)
Add a route object to the system. If the route exists in the system, this silently ignores the request.

Parameters:
space - The execution space for the route
route - The object to add

removeRoute

public void removeRoute(VRMLExecutionSpace space,
                        VRMLNodeType srcNode,
                        int srcIndex,
                        VRMLNodeType destNode,
                        int destIndex)
Remove a route from the system. If the route does not exist in the system, this silently ignores the request.

Parameters:
space - The execution space for the route
srcNode - The source node of the route
srcIndex - The index of the source field
destNode - The destination node of the route
destIndex - The index of the destination field

removeRoute

public void removeRoute(VRMLExecutionSpace space,
                        ROUTE route)
Remove a route object from the system. If the route does not exist in the system, this silently ignores the request.

Parameters:
space - The execution space for the route
route - The object to remove

addSpace

public void addSpace(VRMLExecutionSpace space)
Add an execution space to the system. This will add all its routes and any contained spaces such as protos and inlines. If this space has already been added, the request will be ignored.

Parameters:
space - The execution space to add

removeSpace

public void removeSpace(VRMLExecutionSpace space)
Remove an execution space to the system. This will add all its routes and any contained spaces such as protos and inlines. If this request has not been added it will be ignored.

Parameters:
space - The execution space to add

updateSpaces

public void updateSpaces()
Notification that the route manager should now propogate all added and removed spaces from this list into the core evaluatable system. It should call the normal addRoute method of the space and not directly propogate the route modifications immediately. They should wait for the separate updateRoutes() call.


updateRoutes

public void updateRoutes()
Notification that the route manager should now propogate all added and removed routes from this list into the core evaluatable space.


clear

public void clear()
Clear all the routes currently being managed here. The space this router represents is being deleted.


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium