info.aduna.gee.spectacle.gee
Class NavigationSpecification

java.lang.Object
  extended by info.aduna.gee.spectacle.gee.NavigationSpecification
Direct Known Subclasses:
JitNavigationSpecification

public class NavigationSpecification
extends Object

Class NavigationSpecification implements a way to specify a hierarchical navigation structure based on a list of sets of content-criteria (labels) or meta-criteria.

Note that the cartesian product (!) of the steps in the levels is the potential navigation. However, a lot of the resulting paths will be empty and those paths will be discarded. As a result, the cartesian product may automatically be pruned to a intuitive tree.

An example will clearify the point. Suppose your objects are "cities" and they are classified by continent and country. Supppose also that your NavigationSpecification reads:

[ [ North-America South-America Europe Asia Africa Australia ] [ ... US ... Netherlands ... ] ]

There is no city that is classified by both North-America and Netherlands. Therefore, the navigation path "North-America > Netherlands", even though is could have existed according to the navigation specification, will not exist in the navigation tree.

An alternative way to phrase this: the navigation tree is the instantiation of the navigation specification, based on the classifications of a set of entities.

Or: the navigation specification contains the schema of the navigation tree.


Field Summary
protected  List _navigationSteps
          The sets of NavigationSteps to apply at each level in the navigation tree.
 
Constructor Summary
NavigationSpecification()
          Construct a new empty NavigationSpecification.
 
Method Summary
 void add(Set navigationSteps)
          Add a set of NavigationSteps, specifying a new level in the tree.
 void addLabelSet(EntityContext context, Set labels)
          Add a label set and use the default 0.0 minimum step selection.
 void addLabelSet(EntityContext context, Set labels, double minimumSelection)
          Add a set of labels, specifying a new level in the tree.
 void allowContentSteps(Map allowed)
          Set, for a set of labels, the labels that may follow it anywhere in the navigation tree.
static NavigationSpecification concat(NavigationSpecification first, NavigationSpecification second)
          Concatenate two NavigationSpecifications.
 void denyContentSteps(Map denied)
          Set, for a set of labels, the labels that may not follow it anywhere in the navigation tree.
 boolean equals(Object other)
          Compare the specified object with this navigation specification for equality.
 Set get(int level)
          Get the set of navigation steps at the specified level.
 Map getAllowContentSteps()
           
 NavigationStep[] getArray(int level)
          Get the basic type array of navigation steps at the specified level.
 int getBreadth(int level)
          Get the number of navigation steps at the specified level (of the specification).
 Set getChildLabels()
          Get the labels used by the most direct children.
 Map getDenyContentSteps()
           
 Map getLabelMap(int level)
          To be used within the Spectacle Server only, when "this" is completely stable!

Note: due to master/slave classifier situations, the Map may NOT be complete, therefore whenever you really find what you mean in the map use it, otherwise, search all values returned by e.g.
 Map getMap(int level)
          To be used within the Spectacle Server only, when "this" is completely stable!

Note: due to master/slave classifier situations, the Map may NOT be complete, therefore whenever you really find what you mean in the map use it, otherwise, search all values returned by e.g.
 List getNavigationSteps()
           
 int hashCode()
           
static Map mergeSetMaps(Map first, Map second)
          Merge two maps of key/set pairs.
 int size()
          Get the number of specification levels, i.e.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_navigationSteps

protected List _navigationSteps
The sets of NavigationSteps to apply at each level in the navigation tree. This field is protected (and not private) for JitNavigationSpecification.

Constructor Detail

NavigationSpecification

public NavigationSpecification()
Construct a new empty NavigationSpecification.

Method Detail

allowContentSteps

public void allowContentSteps(Map allowed)
Set, for a set of labels, the labels that may follow it anywhere in the navigation tree. When a label is a key in this map, all labels not included in the value set are (of course) not allowed to follow it.

Parameters:
allowed - label/set-of-labels pairs

getAllowContentSteps

public Map getAllowContentSteps()
Returns:
label/set-of-labels pairs
See Also:
allowContentSteps(Map)

denyContentSteps

public void denyContentSteps(Map denied)
Set, for a set of labels, the labels that may not follow it anywhere in the navigation tree. When a label is a key in this map, all labels not included in the value set are (of course) allowed to follow it.

Parameters:
denied - label/set-of-labels pairs

getDenyContentSteps

public Map getDenyContentSteps()
Returns:
label/set-of-labels pairs
See Also:
denyContentSteps(Map)

equals

public boolean equals(Object other)
Compare the specified object with this navigation specification for equality.

Overrides:
equals in class Object
Returns:
true if equal, false otherwise

hashCode

public int hashCode()
Overrides:
hashCode in class Object
Returns:
the hash code for this object

getBreadth

public int getBreadth(int level)
Get the number of navigation steps at the specified level (of the specification). Note: for the actual number of steps, consult the NavigationTree.

Parameters:
level - the level (0 based)
Returns:
the breadth at the specified level

size

public int size()
Get the number of specification levels, i.e. the depth (of the specification). Note: for the actual depth of the navigation, consult the NavigationTree.

Returns:
the depth

get

public Set get(int level)
Get the set of navigation steps at the specified level.

Parameters:
level - the level (0 based)
Returns:
the Set of NavigationSteps at the specified level or null

getArray

public NavigationStep[] getArray(int level)
Get the basic type array of navigation steps at the specified level. To be used within the Spectacle Server only, when "this" is completely stable!

Parameters:
level - the level (0 based)
Returns:
the Array of NavigationSteps at the specified level or null

getMap

public Map getMap(int level)
To be used within the Spectacle Server only, when "this" is completely stable!

Note: due to master/slave classifier situations, the Map may NOT be complete, therefore whenever you really find what you mean in the map use it, otherwise, search all values returned by e.g. getArray()!

Furthermore, the "slash" replacement of Spectacle may be an other reason why you can't lookup in the map. Still it's worth a try, because on average, 99% of all names are instantly found, so there is a big performance benefit in it.

Parameters:
level - the level (0 based)
Returns:
a (incomplete!) map of name/NavigationStep pairs at the specified level or null

getLabelMap

public Map getLabelMap(int level)
To be used within the Spectacle Server only, when "this" is completely stable!

Note: due to master/slave classifier situations, the Map may NOT be complete, therefore whenever you really find what you mean in the map use it, otherwise, search all values returned by e.g. getArray()!

Furthermore, the "slash" replacement of Spectacle may be an other reason why you can't lookup in the map. Still it's worth a try, because on average, 99% of all names are instantly found, so there is a big performance benefit in it.

Returns:
a map of (SOME OF) the name/label pairs at the specified level or null

addLabelSet

public void addLabelSet(EntityContext context,
                        Set labels)
Add a label set and use the default 0.0 minimum step selection.

See Also:
addLabelSet(EntityContext, Set, double)

addLabelSet

public void addLabelSet(EntityContext context,
                        Set labels,
                        double minimumSelection)
Add a set of labels, specifying a new level in the tree.

Parameters:
context - the entity context, which is used to determine the symbolic value of each label
labels - the set of labels to add
minimumSelection - the minimum step selection rate to apply for each label
See Also:
EntityContext, ContentNavigationStep

add

public void add(Set navigationSteps)
Add a set of NavigationSteps, specifying a new level in the tree.

Parameters:
navigationSteps - the set of NavigationSteps.
See Also:
ContentNavigationStep, MetaNavigationStep

getChildLabels

public Set getChildLabels()
Get the labels used by the most direct children. To be used within the Spectacle Server only.


concat

public static NavigationSpecification concat(NavigationSpecification first,
                                             NavigationSpecification second)
Concatenate two NavigationSpecifications.

Parameters:
first - a NavigationSpecification
second - a NavigationSpecification
Returns:
the concatenation of the two NavigationSpecifications

mergeSetMaps

public static Map mergeSetMaps(Map first,
                               Map second)
Merge two maps of key/set pairs. For corresponding keys, add the corresponding sets.

Parameters:
first - map of key/set pairs or null
second - map of key/set pairs or null
Returns:
a map of key/set pairs or null (when both arguments are null)

getNavigationSteps

public List getNavigationSteps()
Returns:
the list of sets of navigation steps


Copyright © 1997-2008 Aduna. All Rights Reserved.