dk.brics.jwig.analysis.summarygraph
Class Node

java.lang.Object
  |
  +--dk.brics.jwig.analysis.summarygraph.Node

public class Node
extends Object

Node (associated with a constant template).


Constructor Summary
Node(Object key, Template xml, Object origin)
          Constructs new XML node.
 
Method Summary
 void addAllOpenGaps()
          Adds all present gaps as "maybe open".
 boolean addOpenGap(String gap)
          Adds "maybe open" gap.
 void addStringEdge(StringEdge e)
          Adds string edge.
 void addTemplateEdge(TemplateEdge e)
          Adds template edge.
 Object clone()
          Clones node.
 Object getKey()
          Returns key.
 Set getOpenGaps()
          Get "maybe open" gaps.
 Object getOrigin()
          Returns origin object.
 Collection getReverseEdges()
          Returns collection of locations of gaps with edges to this node.
 Collection getStringEdges()
          Returns all string edges.
 Template getTemplate()
          Returns XML template of this node.
 Collection getTemplateEdges()
          Returns all template edges.
 StringEdge lookupStringEdge(String gap)
          Finds string edge with given gap name.
 TemplateEdge lookupTemplateEdge(Node to, String gap)
          Finds template edge with given destination and gap name.
 Collection lookupTemplateEdges(String gap)
          Finds template edges with given gap name.
 boolean removeOpenGap(String gap)
          Removes "maybe open" gap.
 String toString()
          Returns name of this node.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(Object key,
            Template xml,
            Object origin)
Constructs new XML node.

Parameters:
key - unique key, no two nodes in a graph should have the same key
xml - an XML template (no two nodes in a summary graph may have identical templates)
origin - object describing the XML template
Method Detail

addAllOpenGaps

public void addAllOpenGaps()
Adds all present gaps as "maybe open".


addOpenGap

public boolean addOpenGap(String gap)
Adds "maybe open" gap.

Parameters:
gap - gap name

addStringEdge

public void addStringEdge(StringEdge e)
Adds string edge. If the node already contains an string edge with the given gap name, the new edge is merged into the old one by adding the origin and labels.


addTemplateEdge

public void addTemplateEdge(TemplateEdge e)
Adds template edge. The destination node of the edge should be in the same graph as this node. If the node already contains an template edge with the given destination node and gap name, the new edge is merged into the old one by adding the origins.


clone

public Object clone()
Clones node. The cloning is shallow for edges.

Overrides:
clone in class Object
Returns:
new Node object

getKey

public Object getKey()
Returns key.


getOpenGaps

public Set getOpenGaps()
Get "maybe open" gaps.

Returns:
Set of open gaps (should not be modified by the caller)

getOrigin

public Object getOrigin()
Returns origin object.

Returns:
origin

getReverseEdges

public Collection getReverseEdges()
Returns collection of locations of gaps with edges to this node.


getStringEdges

public Collection getStringEdges()
Returns all string edges.

Returns:
collection of outgoing string edges from this node

getTemplate

public Template getTemplate()
Returns XML template of this node.

Returns:
template

getTemplateEdges

public Collection getTemplateEdges()
Returns all template edges.

Returns:
collection of outgoing template edges from this node

lookupStringEdge

public StringEdge lookupStringEdge(String gap)
Finds string edge with given gap name.

Parameters:
gap - gap name
Returns:
string edge, null if no such edge exists from this node (which is equivalent to having an edge labeled with the empty set of strings)

lookupTemplateEdge

public TemplateEdge lookupTemplateEdge(Node to,
                                       String gap)
Finds template edge with given destination and gap name.

Parameters:
to - destination
gap - gap name
Returns:
template edge, null if no such edge exists from this node

lookupTemplateEdges

public Collection lookupTemplateEdges(String gap)
Finds template edges with given gap name.

Parameters:
gap - gap name
Returns:
collection of template edges

removeOpenGap

public boolean removeOpenGap(String gap)
Removes "maybe open" gap.

Parameters:
gap - gap name

toString

public String toString()
Returns name of this node.

Overrides:
toString in class Object


Copyright © 2002 Anders Møller.