sk.uniba.euromath.gene.exportgraph
Class NewNodeGraphBuilder

java.lang.Object
  extended by sk.uniba.euromath.gene.exportgraph.NewNodeGraphBuilder

 class NewNodeGraphBuilder
extends Object

Implements the functionality of newGraph() method. Thread-unsafe.

First, a special oriented graph is built from the exporter list. This graph must reflect the fact that some exporter may produce multiple namespaces and for each namespace there must be a path in graph, connecting this exporter with required result. To achieve that, edges in our graph shall not be marked by single namespace. Instead, each edge receive a set of namespaces, that are produced by this exporter.

Each vertex is associated with two values:

Every edge E leaving vertex V is associated with a set Ens computed by this formula:
all namespaces entering V - namespace that VE accepts + all namespaces that VE produces
We thus pretend that exporter is able to process any namespace - however it leaves other namespaces untouched. Let edge E enter vertex V. The following must be true:

The graph'll contain edges for each possible set of namespaces, and vertexes for each edge and exporter.

Next, a path with lowest weight will be constructed. The path will connects two points:

Weight is computed from the path length and exporter priority: a node with higher path length has higher weight. If the path lengths are equal then node with lower exporter priority has higher weight.

Algorithm works as follows: for each Vs all neighbour vertexes N are found and their weight is computed. This algorithm is then applied on N etc., until Vt is found. A path is constructed as follows: take Vt and a set of vertexes which are connected to Vt and the edge points towards Vt. Select a vertex with lowest weight from this set - this vertex is a part of the path. Now construct a set of vertexes connected to this vertex etc, until one of Vs is found. If there are multiple vertexes with same weight in this set then we have found two (or more) paths.

Author:
Martin Vysny

Constructor Summary
NewNodeGraphBuilder(Set<String> forbidden, Set<ExporterInfo> preferred, String sourceNamespace, EnumSet<ResultEnum> provides, INamespaceAcceptor requires)
          Constructs instance of the graph builder.
 
Method Summary
(package private)  GraphNode newNodeGraph()
          Creates new node graph, using parameters given to the object in constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewNodeGraphBuilder

NewNodeGraphBuilder(Set<String> forbidden,
                    Set<ExporterInfo> preferred,
                    String sourceNamespace,
                    EnumSet<ResultEnum> provides,
                    INamespaceAcceptor requires)
Constructs instance of the graph builder.

Parameters:
forbidden - Forbidden namespaces. They must not be present in the final graph.
preferred - Sets priority of this exporter to 200, regardless of previous priority.
sourceNamespace - the source namespace of the document that'll be transformed.
provides - in which format the document is available.
requires - these namespaces is coordinator able to process.
Method Detail

newNodeGraph

GraphNode newNodeGraph()
Creates new node graph, using parameters given to the object in constructor.

Returns:
new graph, or null if no graph can be constructed.


Copyright 2003-2003-2006 null. All Rights Reserved.