dk.brics.jwig.analysis.summarygraph
Class Graph

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

public class Graph
extends Object

Summary graph (associated with an XML variable at a program point).


Constructor Summary
Graph()
          Constructs empty graph.
Graph(Document d)
          Constructs graph from JDOM XML document.
 
Method Summary
 boolean addClosedAttributeGap(String gap)
          Adds "maybe closed" attribute gap.
 boolean addClosedTemplateGap(String gap)
          Adds "maybe closed" template gap.
 void addNode(Node n)
          Adds node to this graph.
 boolean addOpenAttributeGap(String gap)
          Adds "maybe open" attribute gap.
 boolean addOpenTemplateGap(String gap)
          Adds "maybe open" template gap.
 void addRoot(Node n)
          Adds root node to this graph.
 Object clone()
          Clones this graph.
 Map getAutomata()
          Returns automata constructed by toXML(String).
 HashSet getClosedAttributeGaps()
          Returns set of maybe closed attribute gaps.
 HashSet getClosedTemplateGaps()
          Returns set of maybe closed template gaps.
 Collection getNodes()
          Returns collection of all nodes.
 HashSet getOpenAttributeGaps()
          Returns set of maybe open attribute gaps.
 HashSet getOpenTemplateGaps()
          Returns set of maybe open template gaps.
 Collection getRoots()
          Returns collection of root nodes.
 Node lookupNode(Object key)
          Finds node.
 boolean removeClosedAttributeGap(String gap)
          Removes "maybe closed" attribute gap.
 boolean removeClosedTemplateGap(String gap)
          Removes "maybe closed" template gap.
 boolean removeOpenAttributeGap(String gap)
          Removes "maybe open" attribute gap.
 boolean removeOpenTemplateGap(String gap)
          Removes "maybe open" template gap.
 void setReverseEdges()
          Initialized reverse edges.
 String toDot()
          Returns Graphviz Dot representation of this summary graph.
 Document toXML(String url_prefix)
          Returns XML JDOM representation of this summary graph.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph

public Graph()
Constructs empty graph.


Graph

public Graph(Document d)
      throws IOException,
             OptionalDataException,
             ClassCastException,
             ClassNotFoundException,
             InvalidClassException
Constructs graph from JDOM XML document.

Parameters:
d - XML document
Method Detail

addClosedAttributeGap

public boolean addClosedAttributeGap(String gap)
Adds "maybe closed" attribute gap.

Parameters:
gap - gap name

addClosedTemplateGap

public boolean addClosedTemplateGap(String gap)
Adds "maybe closed" template gap.

Parameters:
gap - gap name

addNode

public void addNode(Node n)
Adds node to this graph.


addOpenAttributeGap

public boolean addOpenAttributeGap(String gap)
Adds "maybe open" attribute gap.

Parameters:
gap - gap name

addOpenTemplateGap

public boolean addOpenTemplateGap(String gap)
Adds "maybe open" template gap.

Parameters:
gap - gap name

addRoot

public void addRoot(Node n)
Adds root node to this graph. The root must already be added as a node. Attempts to add an already existing root are ignored.


clone

public Object clone()
Clones this graph. The cloning is shallow for the XML templates (but deep for template edges, string edges, and gap presence).

Overrides:
clone in class Object
Returns:
new Graph object

getAutomata

public Map getAutomata()
Returns automata constructed by toXML(String).

Returns:
map from serialized Automaton objects to URLs

getClosedAttributeGaps

public HashSet getClosedAttributeGaps()
Returns set of maybe closed attribute gaps.

Returns:
set of gap names

getClosedTemplateGaps

public HashSet getClosedTemplateGaps()
Returns set of maybe closed template gaps.

Returns:
set of gap names

getNodes

public Collection getNodes()
Returns collection of all nodes.

Returns:
all nodes

getOpenAttributeGaps

public HashSet getOpenAttributeGaps()
Returns set of maybe open attribute gaps.

Returns:
set of gap names

getOpenTemplateGaps

public HashSet getOpenTemplateGaps()
Returns set of maybe open template gaps.

Returns:
set of gap names

getRoots

public Collection getRoots()
Returns collection of root nodes.

Returns:
root nodes

lookupNode

public Node lookupNode(Object key)
Finds node.

Parameters:
key - key object
Returns:
node node with given key, null if not found

removeClosedAttributeGap

public boolean removeClosedAttributeGap(String gap)
Removes "maybe closed" attribute gap.

Parameters:
gap - gap name

removeClosedTemplateGap

public boolean removeClosedTemplateGap(String gap)
Removes "maybe closed" template gap.

Parameters:
gap - gap name

removeOpenAttributeGap

public boolean removeOpenAttributeGap(String gap)
Removes "maybe open" attribute gap.

Parameters:
gap - gap name

removeOpenTemplateGap

public boolean removeOpenTemplateGap(String gap)
Removes "maybe open" template gap.

Parameters:
gap - gap name

setReverseEdges

public void setReverseEdges()
Initialized reverse edges. Must be called before Node.getReverseEdges is used. It is assumed that all nodes with outgoing edges are reachable from a root.


toDot

public String toDot()
Returns Graphviz Dot representation of this summary graph.


toXML

public Document toXML(String url_prefix)
Returns XML JDOM representation of this summary graph. String type automata are obtained subsequently using getAutomata().

Parameters:
url_prefix - prefix for automaton URLs
Returns:
XML document


Copyright © 2002 Anders Møller.