joeq.Compiler.Analysis.Primitive
Class PrimitiveMethodSummary.Node

java.lang.Object
  extended by joeq.Compiler.Analysis.Primitive.PrimitiveMethodSummary.Node
All Implemented Interfaces:
Comparable, PrimitiveMethodSummary.Variable, jwutil.io.Textualizable
Direct Known Subclasses:
PrimitiveMethodSummary.CheckCastNode, PrimitiveMethodSummary.ConcreteObjectNode, PrimitiveMethodSummary.ConcreteTypeNode, PrimitiveMethodSummary.OutsideNode, PrimitiveMethodSummary.UnknownTypeNode
Enclosing class:
PrimitiveMethodSummary

public abstract static class PrimitiveMethodSummary.Node
extends Object
implements jwutil.io.Textualizable, Comparable, PrimitiveMethodSummary.Variable


Field Summary
protected  Map accessPathEdges
          Map from fields to sets of outside edges from this node on that field.
protected  Map addedEdges
          Map from fields to sets of inside edges from this node on that field.
 int id
          Unique id number.
protected  Set passedParameters
          Set of passed parameters for this node.
protected  Map predecessors
          Map from fields to sets of predecessors on that field.
static boolean TRACK_REASONS
           
 
Constructor Summary
protected PrimitiveMethodSummary.Node()
           
protected PrimitiveMethodSummary.Node(PrimitiveMethodSummary.Node that)
           
 
Method Summary
 boolean addAccessPathEdge(jq_Field m, PrimitiveMethodSummary.FieldNode n)
          Add the given successor node on the given field to the outside edge set.
 boolean addAccessPathEdges(jq_Field m, Set s)
          Add the given set of successor nodes on the given field to the outside edge set.
 boolean addEdge(jq_Field m, PrimitiveMethodSummary.Node n)
          Add the given successor node on the given field to the inside edge set.
 void addEdge(String edge, jwutil.io.Textualizable t)
           
 boolean addEdges(jq_Field m, Set s)
          Add the given set of successor nodes on the given field to the inside edge set.
static boolean addEdges(Set s, jq_Field f, PrimitiveMethodSummary.Node n)
          Add the given successor node on the given field to the inside edge set of all of the given set of nodes.
 boolean addPredecessor(jq_Field m, PrimitiveMethodSummary.Node n)
          Add the given predecessor node on the given field to the predecessor set.
 int compareTo(Object o)
           
 int compareTo(PrimitiveMethodSummary.Node that)
           
abstract  PrimitiveMethodSummary.Node copy()
          Return a shallow copy of this node.
 Set getAccessPathEdgeFields()
          Return the set of fields that this node has outside edges with.
 Set getAccessPathEdges()
          Return a set of Map.Entry objects corresponding to the outside edges of this node.
 Set getAccessPathEdges(jq_Field m)
           
 void getAccessPathEdges(jq_Field m, Set result)
          Add the nodes that are targets of outside edges on the given field to the given result set.
 Collection getAccessPathEdgeTargets()
          Return the collection of target nodes that this node has inside edges with.
 Set getAllEdges()
           
 Set getAllEdges(jq_Field m)
           
 void getAllEdges(jq_Field m, Set result)
          Add the nodes that are targets of inside edges on the given field to the given result set.
abstract  jq_Type getDeclaredType()
          Return the declared type of this node.
abstract  jq_Method getDefiningMethod()
          Return the method that this node is defined in, null if it doesn't come from a method.
 void getEdges_escaped(jq_Field m, Set result)
          Add the nodes that are targets of inside edges on the given field to the given result set.
 boolean getEscapes()
           
 Set getNonEscapingEdgeFields()
          Return the set of fields that this node has inside edges with.
 Set getNonEscapingEdges()
          Return a set of Map.Entry objects corresponding to the inside edges of this node.
 Set getNonEscapingEdges(jq_Field m)
           
 Collection getNonEscapingEdgeTargets()
          Return the collection of target nodes that this node has inside edges with.
 Set getPassedParameters()
           
 Set getPredecessors()
          Return a set of Map.Entry objects corresponding to the incoming inside edges of this node.
 Collection getPredecessorTargets()
           
 boolean hasAccessPathEdge(jq_Field m, PrimitiveMethodSummary.Node n)
           
 boolean hasAccessPathEdges()
          Returns true if this node has any added outside edges.
 int hashCode()
           
 boolean hasNonEscapingEdge(jq_Field m, PrimitiveMethodSummary.Node n)
           
 boolean hasNonEscapingEdges()
          Returns true if this node has any added inside edges.
 boolean hasPredecessor(jq_Field f, PrimitiveMethodSummary.Node n)
           
 boolean isPassedAsParameter()
           
static int numberOfNodes()
          Maps added edges to the quads that they come from.
 void readEdges(jwutil.collections.IndexMap map, StringTokenizer st)
           
 boolean recordPassedParameter(PrimitiveMethodSummary.PassedParameter cm)
          Record the given passed parameter in the set for this node.
 boolean recordPassedParameter(ProgramLocation m, int paramNum)
          Record the passed parameter of the given method call and argument number in the set for this node.
 boolean removeAccessPathEdge(jq_Field m, PrimitiveMethodSummary.FieldNode n)
          Remove the given successor node on the given field from the outside edge set.
 boolean removeEdge(jq_Field m, PrimitiveMethodSummary.Node n)
          Remove the given successor node on the given field from the inside edge set.
 boolean removePredecessor(jq_Field m, PrimitiveMethodSummary.Node n)
          Remove the given predecessor node on the given field from the predecessor set.
 void replaceBy(Set set, boolean removeSelf)
          Replace this node by the given set of nodes.
 void setEscapes()
           
 String toString_long()
          Return a string representation of the node in long form.
abstract  String toString_short()
          Return a string representation of the node in short form.
 String toString()
           
 void update(HashMap um)
          Update all predecessor and successor nodes with the given update map.
 void write(jwutil.io.Textualizer t)
           
 void writeEdges(jwutil.io.Textualizer t)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

predecessors

protected Map predecessors
Map from fields to sets of predecessors on that field. This only includes inside edges; outside edge predecessors are in FieldNode.


passedParameters

protected Set passedParameters
Set of passed parameters for this node.


addedEdges

protected Map addedEdges
Map from fields to sets of inside edges from this node on that field.


accessPathEdges

protected Map accessPathEdges
Map from fields to sets of outside edges from this node on that field.


id

public final int id
Unique id number.


TRACK_REASONS

public static boolean TRACK_REASONS
Constructor Detail

PrimitiveMethodSummary.Node

protected PrimitiveMethodSummary.Node()

PrimitiveMethodSummary.Node

protected PrimitiveMethodSummary.Node(PrimitiveMethodSummary.Node that)
Method Detail

numberOfNodes

public static int numberOfNodes()
Maps added edges to the quads that they come from. Only used if TRACK_REASONS is true.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public final int compareTo(PrimitiveMethodSummary.Node that)

compareTo

public final int compareTo(Object o)
Specified by:
compareTo in interface Comparable

isPassedAsParameter

public boolean isPassedAsParameter()

getPassedParameters

public Set getPassedParameters()

replaceBy

public void replaceBy(Set set,
                      boolean removeSelf)
Replace this node by the given set of nodes. All inside and outside edges to and from this node are replaced by sets of edges to and from the nodes in the set. The passed parameter set of this node is also added to every node in the given set.


update

public void update(HashMap um)
Update all predecessor and successor nodes with the given update map. Also clones the passed parameter set.


getDeclaredType

public abstract jq_Type getDeclaredType()
Return the declared type of this node.


getDefiningMethod

public abstract jq_Method getDefiningMethod()
Return the method that this node is defined in, null if it doesn't come from a method.


copy

public abstract PrimitiveMethodSummary.Node copy()
Return a shallow copy of this node.


hasPredecessor

public boolean hasPredecessor(jq_Field f,
                              PrimitiveMethodSummary.Node n)

removePredecessor

public boolean removePredecessor(jq_Field m,
                                 PrimitiveMethodSummary.Node n)
Remove the given predecessor node on the given field from the predecessor set. Returns true if that predecessor existed, false otherwise.


addPredecessor

public boolean addPredecessor(jq_Field m,
                              PrimitiveMethodSummary.Node n)
Add the given predecessor node on the given field to the predecessor set. Returns true if that predecessor didn't already exist, false otherwise.


getPredecessors

public Set getPredecessors()
Return a set of Map.Entry objects corresponding to the incoming inside edges of this node.


getPredecessorTargets

public Collection getPredecessorTargets()

recordPassedParameter

public boolean recordPassedParameter(PrimitiveMethodSummary.PassedParameter cm)
Record the given passed parameter in the set for this node. Returns true if that passed parameter didn't already exist, false otherwise.


recordPassedParameter

public boolean recordPassedParameter(ProgramLocation m,
                                     int paramNum)
Record the passed parameter of the given method call and argument number in the set for this node. Returns true if that passed parameter didn't already exist, false otherwise.


removeEdge

public boolean removeEdge(jq_Field m,
                          PrimitiveMethodSummary.Node n)
Remove the given successor node on the given field from the inside edge set. Also removes the predecessor link from the successor node to this node. Returns true if that edge existed, false otherwise.


hasNonEscapingEdge

public boolean hasNonEscapingEdge(jq_Field m,
                                  PrimitiveMethodSummary.Node n)

addEdge

public boolean addEdge(jq_Field m,
                       PrimitiveMethodSummary.Node n)
Add the given successor node on the given field to the inside edge set. Also adds a predecessor link from the successor node to this node. Returns true if that edge didn't already exist, false otherwise.


addEdges

public boolean addEdges(jq_Field m,
                        Set s)
Add the given set of successor nodes on the given field to the inside edge set. The given set is consumed. Also adds predecessor links from the successor nodes to this node. Returns true if the inside edge set changed, false otherwise.


addEdges

public static boolean addEdges(Set s,
                               jq_Field f,
                               PrimitiveMethodSummary.Node n)
Add the given successor node on the given field to the inside edge set of all of the given set of nodes. Also adds predecessor links from the successor node to the given nodes. Returns true if anything was changed, false otherwise.


removeAccessPathEdge

public boolean removeAccessPathEdge(jq_Field m,
                                    PrimitiveMethodSummary.FieldNode n)
Remove the given successor node on the given field from the outside edge set. Also removes the predecessor link from the successor node to this node. Returns true if that edge existed, false otherwise.


hasAccessPathEdge

public boolean hasAccessPathEdge(jq_Field m,
                                 PrimitiveMethodSummary.Node n)

addAccessPathEdge

public boolean addAccessPathEdge(jq_Field m,
                                 PrimitiveMethodSummary.FieldNode n)
Add the given successor node on the given field to the outside edge set. Also adds a predecessor link from the successor node to this node. Returns true if that edge didn't already exist, false otherwise.


addAccessPathEdges

public boolean addAccessPathEdges(jq_Field m,
                                  Set s)
Add the given set of successor nodes on the given field to the outside edge set. The given set is consumed. Also adds predecessor links from the successor nodes to this node. Returns true if the inside edge set changed, false otherwise.


getAllEdges

public final void getAllEdges(jq_Field m,
                              Set result)
Add the nodes that are targets of inside edges on the given field to the given result set.


getAllEdges

public final Set getAllEdges(jq_Field m)

getAllEdges

public final Set getAllEdges()

getNonEscapingEdges

public final Set getNonEscapingEdges(jq_Field m)

getEdges_escaped

public void getEdges_escaped(jq_Field m,
                             Set result)
Add the nodes that are targets of inside edges on the given field to the given result set.


getNonEscapingEdges

public Set getNonEscapingEdges()
Return a set of Map.Entry objects corresponding to the inside edges of this node.


getNonEscapingEdgeFields

public Set getNonEscapingEdgeFields()
Return the set of fields that this node has inside edges with.


getNonEscapingEdgeTargets

public Collection getNonEscapingEdgeTargets()
Return the collection of target nodes that this node has inside edges with.


hasNonEscapingEdges

public boolean hasNonEscapingEdges()
Returns true if this node has any added inside edges.


hasAccessPathEdges

public boolean hasAccessPathEdges()
Returns true if this node has any added outside edges.


getAccessPathEdges

public final Set getAccessPathEdges(jq_Field m)

getAccessPathEdges

public void getAccessPathEdges(jq_Field m,
                               Set result)
Add the nodes that are targets of outside edges on the given field to the given result set.


getAccessPathEdges

public Set getAccessPathEdges()
Return a set of Map.Entry objects corresponding to the outside edges of this node.


getAccessPathEdgeFields

public Set getAccessPathEdgeFields()
Return the set of fields that this node has outside edges with.


getAccessPathEdgeTargets

public Collection getAccessPathEdgeTargets()
Return the collection of target nodes that this node has inside edges with.


setEscapes

public void setEscapes()

getEscapes

public boolean getEscapes()

toString_short

public abstract String toString_short()
Return a string representation of the node in short form.


toString

public String toString()
Overrides:
toString in class Object

toString_long

public String toString_long()
Return a string representation of the node in long form. Includes inside and outside edges and passed parameters.


write

public void write(jwutil.io.Textualizer t)
           throws IOException
Specified by:
write in interface jwutil.io.Textualizable
Throws:
IOException

readEdges

public void readEdges(jwutil.collections.IndexMap map,
                      StringTokenizer st)

addEdge

public void addEdge(String edge,
                    jwutil.io.Textualizable t)
Specified by:
addEdge in interface jwutil.io.Textualizable

writeEdges

public void writeEdges(jwutil.io.Textualizer t)
                throws IOException
Specified by:
writeEdges in interface jwutil.io.Textualizable
Throws:
IOException


Copyright © 2001-2008 John Whaley. All Rights Reserved.