EDU.neu.ccs.demeter.aplib
Class TraversalGraph

java.lang.Object
  |
  +--EDU.neu.ccs.demeter.aplib.TraversalGraph

public class TraversalGraph
extends java.lang.Object


Constructor Summary
TraversalGraph(ClassGraphI cg, StrategyGraphI sg, NameMapI map)
          Compute the traversal graph for the class graph and strategy graph with the given map, which is a partial map from labels in the strategy graph to labels in the class graph.
TraversalGraph(ClassGraphI cg, StrategyGraphI sg, NameMapI map, boolean dbg)
           
 
Method Summary
static TraversalGraph compute(ClassGraphI cg, StrategyGraphI sg, NameMapI map)
          Compute the traversal graph for the class graph and strategy graph with the given map, which is a partial map from labels in the strategy graph to labels in the class graph.
static TraversalGraph compute(ClassGraphI cg, StrategyGraphI sg, NameMapI map, boolean dbg)
           
 java.util.BitSet copiesOfAlternationEdge(java.lang.String source, java.lang.String target)
          A BitSet representing which copies of the given alternation edge are in the traversal graph, or null if there is no such edge.
 java.util.BitSet copiesOfConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target)
          A BitSet representing which copies of the given construction edge are in the traversal graph, or null if there is no such edge.
 java.util.BitSet copiesOfEdge(EdgeI edge)
          A BitSet representing which copies of the given edge are in the traversal graph, or null if there is no such edge.
 java.util.BitSet copiesOfInheritanceEdge(java.lang.String source, java.lang.String target)
          A BitSet representing which copies of the given inheritance edge are in the traversal graph, or null if there is no such edge.
 java.util.BitSet copiesOfVertex(java.lang.String l)
          A BitSet representing which copies of the vertex labeled l are in the traversal graph, or null if there is no such vertex.
static java.lang.String edgeKey(EdgeI edge)
          A unique identifying string for the given edge.
 java.util.Enumeration edges()
          Deprecated. Renamed to getEdges() to comply with bean naming convention.
 EdgeI getAlternationEdge(java.lang.String source, java.lang.String target)
          The given alternation edge, if it's in the traversal graph, or null.
 ClassGraphI getClassGraph()
          The class graph used in computing this traversal graph.
 EdgeI getConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target)
          The given construction edge, if it's in the traversal graph, or null.
 java.util.Enumeration getEdges()
          An enumeration of the edges (EdgeI objects) in the traversal graph.
 EdgeI getInheritanceEdge(java.lang.String source, java.lang.String target)
          The given inheritance edge, if it's in the traversal graph, or null.
 java.util.Enumeration getIntercopyTable(EdgeI edge)
          An enumeration of IntercopyTableEntry objects representing the intercopy table for the given edge.
 java.util.Enumeration getIntercopyTableForAlternationEdge(java.lang.String source, java.lang.String target)
          The intercopy table for the given alternation edge, or null if there is no such edge.
 java.util.Enumeration getIntercopyTableForConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target)
          The intercopy table for the given construction edge, or null if there is no such edge.
 java.util.Enumeration getIntercopyTableForInheritanceEdge(java.lang.String source, java.lang.String target)
          The intercopy table for the given inheritance edge, or null if there is no such edge.
 NameMapI getNameMap()
          The name map from the strategy graph to the class graph.
 java.util.Vector getSourceIndices(java.lang.String l)
          A vector of Integer objects representing the start set of tokens (copy indices) for the source vertex labeled l.
 java.util.Enumeration getSources()
          An enumeration of the labels (Strings) of the source vertices of the traversal graph.
 java.util.BitSet getStartSet(java.lang.String l)
          A BitSet representing the start set of tokens (copy indices) for the source vertex labeled l.
 StrategyGraphI getStrategyGraph()
          The strategy graph used in computing this traversal graph.
 java.util.Enumeration getTargets()
          An enumeration of the labels (Strings) of the target vertices of the traversal graph.
 java.util.Enumeration getVertices()
          An enumeration of the vertex labels (Strings) in the traversal graph.
 boolean hasAlternationEdge(java.lang.String source, java.lang.String target)
          Is the given alternation edge in the traversal graph?
 boolean hasAlternationEdge(java.lang.String source, java.lang.String target, int i)
          Is the ith copy of the given alternation edge in the traversal graph?
 boolean hasAlternationEdge(java.lang.String source, java.lang.String target, int i, int j)
          Is the given alternation edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?
 boolean hasConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target)
          Is the given construction edge in the traversal graph?
 boolean hasConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target, int i)
          Is the ith copy of the given construction edge in the traversal graph?
 boolean hasConstructionEdge(java.lang.String source, java.lang.String name, java.lang.String target, int i, int j)
          Is the given construction edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?
 boolean hasEdge(EdgeI edge)
          Is the given edge in the traversal graph?
 boolean hasEdge(EdgeI edge, int i)
          Is the ith copy of the given edge in the traversal graph? This is equivalent to hasEdge(edge, i, i).
 boolean hasEdge(EdgeI edge, int i, int j)
          Is the given edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?
 boolean hasInheritanceEdge(java.lang.String source, java.lang.String target)
          Is the given inheritance edge in the traversal graph?
 boolean hasInheritanceEdge(java.lang.String source, java.lang.String target, int i)
          Is the ith copy of the given inheritance edge in the traversal graph?
 boolean hasInheritanceEdge(java.lang.String source, java.lang.String target, int i, int j)
          Is the given inheritance edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?
 boolean hasVertex(java.lang.String l)
          Is the vertex labeled l in the traversal graph?
 boolean hasVertex(java.lang.String l, int i)
          Is the ith copy of the vertex labeled l in the traversal graph?
 java.lang.String toString()
          A string representation of the graph.
 java.util.Enumeration vertices()
          Deprecated. Renamed to getVertices() to comply with bean naming convention.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TraversalGraph

public TraversalGraph(ClassGraphI cg,
                      StrategyGraphI sg,
                      NameMapI map)
Compute the traversal graph for the class graph and strategy graph with the given map, which is a partial map from labels in the strategy graph to labels in the class graph. Labels not in the domain of the map are mapped to themselves. A null map means the identity function.

TraversalGraph

public TraversalGraph(ClassGraphI cg,
                      StrategyGraphI sg,
                      NameMapI map,
                      boolean dbg)
Method Detail

edgeKey

public static java.lang.String edgeKey(EdgeI edge)
A unique identifying string for the given edge.

vertices

public java.util.Enumeration vertices()
Deprecated. Renamed to getVertices() to comply with bean naming convention.
An enumeration of the vertex labels (Strings) in the traversal graph.

getVertices

public java.util.Enumeration getVertices()
An enumeration of the vertex labels (Strings) in the traversal graph.

hasVertex

public boolean hasVertex(java.lang.String l)
Is the vertex labeled l in the traversal graph?

hasVertex

public boolean hasVertex(java.lang.String l,
                         int i)
Is the ith copy of the vertex labeled l in the traversal graph?

copiesOfVertex

public java.util.BitSet copiesOfVertex(java.lang.String l)
A BitSet representing which copies of the vertex labeled l are in the traversal graph, or null if there is no such vertex.

edges

public java.util.Enumeration edges()
Deprecated. Renamed to getEdges() to comply with bean naming convention.
An enumeration of the edges (EdgeI objects) in the traversal graph.

getEdges

public java.util.Enumeration getEdges()
An enumeration of the edges (EdgeI objects) in the traversal graph.

hasEdge

public boolean hasEdge(EdgeI edge)
Is the given edge in the traversal graph?

hasEdge

public boolean hasEdge(EdgeI edge,
                       int i)
Is the ith copy of the given edge in the traversal graph? This is equivalent to hasEdge(edge, i, i).

hasEdge

public boolean hasEdge(EdgeI edge,
                       int i,
                       int j)
Is the given edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?

copiesOfEdge

public java.util.BitSet copiesOfEdge(EdgeI edge)
A BitSet representing which copies of the given edge are in the traversal graph, or null if there is no such edge.

getIntercopyTable

public java.util.Enumeration getIntercopyTable(EdgeI edge)
An enumeration of IntercopyTableEntry objects representing the intercopy table for the given edge. If {i, j} is in the enumeration, then there is a copy of the given edge in the traversal graph that goes from the ith copy of its source vertex to the jth copy of its target vertex. This does not include {i, i} copies [use hasEdge(edge, i) for that]. Return null if the edge is not in the traversal graph at all.
See Also:
IntercopyTableEntry

hasConstructionEdge

public boolean hasConstructionEdge(java.lang.String source,
                                   java.lang.String name,
                                   java.lang.String target)
Is the given construction edge in the traversal graph?

hasConstructionEdge

public boolean hasConstructionEdge(java.lang.String source,
                                   java.lang.String name,
                                   java.lang.String target,
                                   int i)
Is the ith copy of the given construction edge in the traversal graph?

hasConstructionEdge

public boolean hasConstructionEdge(java.lang.String source,
                                   java.lang.String name,
                                   java.lang.String target,
                                   int i,
                                   int j)
Is the given construction edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?

copiesOfConstructionEdge

public java.util.BitSet copiesOfConstructionEdge(java.lang.String source,
                                                 java.lang.String name,
                                                 java.lang.String target)
A BitSet representing which copies of the given construction edge are in the traversal graph, or null if there is no such edge.

getIntercopyTableForConstructionEdge

public java.util.Enumeration getIntercopyTableForConstructionEdge(java.lang.String source,
                                                                  java.lang.String name,
                                                                  java.lang.String target)
The intercopy table for the given construction edge, or null if there is no such edge.

getConstructionEdge

public EdgeI getConstructionEdge(java.lang.String source,
                                 java.lang.String name,
                                 java.lang.String target)
The given construction edge, if it's in the traversal graph, or null.

hasAlternationEdge

public boolean hasAlternationEdge(java.lang.String source,
                                  java.lang.String target)
Is the given alternation edge in the traversal graph?

hasAlternationEdge

public boolean hasAlternationEdge(java.lang.String source,
                                  java.lang.String target,
                                  int i)
Is the ith copy of the given alternation edge in the traversal graph?

hasAlternationEdge

public boolean hasAlternationEdge(java.lang.String source,
                                  java.lang.String target,
                                  int i,
                                  int j)
Is the given alternation edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?

copiesOfAlternationEdge

public java.util.BitSet copiesOfAlternationEdge(java.lang.String source,
                                                java.lang.String target)
A BitSet representing which copies of the given alternation edge are in the traversal graph, or null if there is no such edge.

getIntercopyTableForAlternationEdge

public java.util.Enumeration getIntercopyTableForAlternationEdge(java.lang.String source,
                                                                 java.lang.String target)
The intercopy table for the given alternation edge, or null if there is no such edge.

getAlternationEdge

public EdgeI getAlternationEdge(java.lang.String source,
                                java.lang.String target)
The given alternation edge, if it's in the traversal graph, or null.

hasInheritanceEdge

public boolean hasInheritanceEdge(java.lang.String source,
                                  java.lang.String target)
Is the given inheritance edge in the traversal graph?

hasInheritanceEdge

public boolean hasInheritanceEdge(java.lang.String source,
                                  java.lang.String target,
                                  int i)
Is the ith copy of the given inheritance edge in the traversal graph?

hasInheritanceEdge

public boolean hasInheritanceEdge(java.lang.String source,
                                  java.lang.String target,
                                  int i,
                                  int j)
Is the given inheritance edge from the ith copy of its source vertex to the jth copy of its target vertex in the traversal graph?

copiesOfInheritanceEdge

public java.util.BitSet copiesOfInheritanceEdge(java.lang.String source,
                                                java.lang.String target)
A BitSet representing which copies of the given inheritance edge are in the traversal graph, or null if there is no such edge.

getIntercopyTableForInheritanceEdge

public java.util.Enumeration getIntercopyTableForInheritanceEdge(java.lang.String source,
                                                                 java.lang.String target)
The intercopy table for the given inheritance edge, or null if there is no such edge.

getInheritanceEdge

public EdgeI getInheritanceEdge(java.lang.String source,
                                java.lang.String target)
The given inheritance edge, if it's in the traversal graph, or null.

getClassGraph

public ClassGraphI getClassGraph()
The class graph used in computing this traversal graph.

getStrategyGraph

public StrategyGraphI getStrategyGraph()
The strategy graph used in computing this traversal graph.

getNameMap

public NameMapI getNameMap()
The name map from the strategy graph to the class graph.

getSources

public java.util.Enumeration getSources()
An enumeration of the labels (Strings) of the source vertices of the traversal graph.

getTargets

public java.util.Enumeration getTargets()
An enumeration of the labels (Strings) of the target vertices of the traversal graph.

getSourceIndices

public java.util.Vector getSourceIndices(java.lang.String l)
A vector of Integer objects representing the start set of tokens (copy indices) for the source vertex labeled l.

getStartSet

public java.util.BitSet getStartSet(java.lang.String l)
A BitSet representing the start set of tokens (copy indices) for the source vertex labeled l.

compute

public static TraversalGraph compute(ClassGraphI cg,
                                     StrategyGraphI sg,
                                     NameMapI map)
Compute the traversal graph for the class graph and strategy graph with the given map, which is a partial map from labels in the strategy graph to labels in the class graph. Labels not in the domain of the map are mapped to themselves. A null map means the identity function.

compute

public static TraversalGraph compute(ClassGraphI cg,
                                     StrategyGraphI sg,
                                     NameMapI map,
                                     boolean dbg)

toString

public java.lang.String toString()
A string representation of the graph. Print all marked edges, with marks, and intercopy tables.
Overrides:
toString in class java.lang.Object