Navigator - examples

Printer-friendly versionPrinter-friendly version
How to use the Navigator framework

 

A client which invokes a "navigate" operation on a Navigator may also pass a NavigationStrategy to the Navigator:

new FooNavigator().navigate(bar, new ForwardNavigationStrategy());

Or set the NavigationStrategy into the Navigator if the Navigator shall be reused.

These NavigationStrategies are currently included:

  • DefaultNavigationStrategy (default and fallback, a graph will be traversed in a left recursive descent (depth-first search))
  • ForwardNavigationStrategy (a graph will be traversed strictly forward, that is, between a next navigable and the root navigable must be more nodes in the shortest connection, than between the current navigable and the root navigable, to traverse that next navigable)
  • RadiusNavigationStrategy (a graph will be traversed expanding from radius to radius, from the root navigable until the outside radius (breadth-first search))

 

These strategies are already incorporated by (additional) Navigator generalizations: ForwardNavigatorBase and RadiusNavigatorBase.

We can extend these strategies to implement easily own advanced strategies e.g. the classical function to find the shortest or best way in a graph without navigating the entire graph, or the like.

 

The Navigator framework provides also logbooks with a dual use: for the Navigators to change or expand the navigations and for the clients which invoke the Navigators to get information about the navigations. The former means we can really navigate freely on and to all Navigables known to the Navigator or rather his logbook (discovered nodes), while the latter means we can validate a navigation or output a navigation for analysis or reuse the information for other navigations and processes. That may sound unnecessary, but if it comes to really complex navigations, also nested navigations are possible, then the information provided by the logbook will come in handy for analysis of unexpected behavior - we should not underestimate the possible complexity of navigations!

 

Discover more possibilities with the Navigator framework!

 

 

Pages