sk.uniba.euromath.gene.exportgraph
Class GraphNode

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

public final class GraphNode
extends Object

Represents a single node in the exporter graph. The path may be extended by attaching nodes, however node compatibility must be kept. Equal only to itself.

Author:
Martin Vysny

Field Summary
 ExporterInfo info
          Exporter that this node represents.
 String targetNamespace
          If info is null then this represents a namespace of the source document fragment.
 
Method Summary
 void attachNode(GraphNode node)
          Attaches given node to the followers of this node (creates an edge oriented from this node to given node).
static void checkCompatibility(GraphNode prev, GraphNode next)
          Checks compatibility of these two nodes.
static void checkCompatibility(Set<String> ns, EnumSet<ResultEnum> nsTypes, GraphNode next)
          Checks compatibility of a node.
 boolean equals(Object obj)
           
 Set<String> getResultNamespaces()
          Returns all namespaces for which a child node is registered.
 EnumSet<ResultEnum> getResultTypes()
          Returns supported result types.
 Set<String> getTargets()
          Returns all namespaces that this node can produce.
 List<GraphNode> getTargets(String namespaceUri)
          Returns an unmodifiable list of nodes that may process given namespace.
 boolean hasFollowers()
          Checks if this node has at least one follower node.
 int hashCode()
           
 boolean isAscendantOf(GraphNode other)
          Checks if there is a follower path from this node to the other node.
 boolean isSourceNode()
          Checks if this graph node is a source node (intended to read data directly from the document).
static GraphNode newExporterNode(ExporterInfo info)
          Returns node that represents an exporter.
static GraphNode newSourceNode(String namespace)
          Returns node that represents a document source.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

info

public final ExporterInfo info
Exporter that this node represents. null if the node represents a source document fragment.


targetNamespace

public final String targetNamespace
If info is null then this represents a namespace of the source document fragment.

Method Detail

newExporterNode

public static GraphNode newExporterNode(ExporterInfo info)
Returns node that represents an exporter.

Parameters:
info - exporter info
Returns:
node instance.

newSourceNode

public static GraphNode newSourceNode(String namespace)
Returns node that represents a document source.

Parameters:
namespace - namespace of the document fragment.
Returns:
node instance.

attachNode

public void attachNode(GraphNode node)
Attaches given node to the followers of this node (creates an edge oriented from this node to given node). Node must be compatible with this node.

Parameters:
node - node to attach.

checkCompatibility

public static void checkCompatibility(Set<String> ns,
                                      EnumSet<ResultEnum> nsTypes,
                                      GraphNode next)
Checks compatibility of a node. next must accept at least one namespace ns and next's source must be compatible with nsTypes.

Parameters:
ns - namespaces produced by previous node.
nsTypes - all kinds of output that previous node is able to produce.
next - a node that'll be linked to the previous node.

checkCompatibility

public static void checkCompatibility(GraphNode prev,
                                      GraphNode next)
Checks compatibility of these two nodes. next must accept namespace produced by prev, and next's source must be compatible with prev's source.

Parameters:
prev - previous node
next - a node that'll be linked to the previous node.

toString

public String toString()
Overrides:
toString in class Object

getTargets

public List<GraphNode> getTargets(String namespaceUri)
Returns an unmodifiable list of nodes that may process given namespace.

Parameters:
namespaceUri - the result namespace of this node.
Returns:
list of nodes that may process given namespace, or null if no nodes were registered.

getResultNamespaces

public Set<String> getResultNamespaces()
Returns all namespaces for which a child node is registered.

Returns:
set of namespace URIs.

getTargets

public Set<String> getTargets()
Returns all namespaces that this node can produce.

Returns:
Returns info.targets (or targetNamespace if info is null)

getResultTypes

public EnumSet<ResultEnum> getResultTypes()
Returns supported result types.

Returns:
info.resultTypes or ResultEnum.DOM if info is null.

equals

public final boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object

isSourceNode

public final boolean isSourceNode()
Checks if this graph node is a source node (intended to read data directly from the document).

Returns:
true if this is source node.

hasFollowers

public final boolean hasFollowers()
Checks if this node has at least one follower node.

Returns:
true if getResultNamespaces() returns a non-empty collection.

isAscendantOf

public final boolean isAscendantOf(GraphNode other)
Checks if there is a follower path from this node to the other node.

Parameters:
other - the possible descendant of this node.
Returns:
true if other node is descendant of this node.


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