Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Compil3r.Quad
Class MethodSummary.Node  view MethodSummary.Node download MethodSummary.Node.java

java.lang.Object
  extended byCompil3r.Quad.MethodSummary.Node
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
MethodSummary.ConcreteObjectNode, MethodSummary.ConcreteTypeNode, MethodSummary.OutsideNode, MethodSummary.UnknownTypeNode
Enclosing class:
MethodSummary

public abstract static class MethodSummary.Node
extends java.lang.Object
implements java.lang.Comparable


Field Summary
protected  java.util.Map accessPathEdges
          Map from fields to sets of outside edges from this node on that field.
protected  java.util.Map addedEdges
          Map from fields to sets of inside edges from this node on that field.
private static int current_id
           
(package private)  java.util.HashMap edgesToReasons
          Maps added edges to the quads that they come from.
private  boolean escapes
          Whether or not this node escapes into some unanalyzable code.
protected  int id
          Unique id number.
protected  java.util.Set passedParameters
          Set of passed parameters for this node.
protected  java.util.Map predecessors
          Map from fields to sets of predecessors on that field.
static boolean TRACK_REASONS
           
 
Constructor Summary
protected MethodSummary.Node()
           
protected MethodSummary.Node(MethodSummary.Node that)
           
 
Method Summary
private  boolean _removeAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.FieldNode n)
           
private  boolean _removeEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
           
 boolean addAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.FieldNode n)
          Add the given successor node on the given field to the outside edge set.
 boolean addAccessPathEdges(Clazz.jq_Field m, java.util.Set s)
          Add the given set of successor nodes on the given field to the outside edge set.
 boolean addEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n, java.lang.Object q)
          Add the given successor node on the given field to the inside edge set.
 boolean addEdges(Compil3r.Quad.AndersenInterface.AndersenField m, java.util.Set s, java.lang.Object q)
          Add the given set of successor nodes on the given field to the inside edge set.
static boolean addEdges(java.util.Set s, Compil3r.Quad.AndersenInterface.AndersenField f, MethodSummary.Node n, Quad q)
          Add the given successor node on the given field to the inside edge set of all of the given set of nodes.
(package private) static void addGlobalEdges(MethodSummary.Node n)
           
 boolean addPredecessor(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
          Add the given predecessor node on the given field to the predecessor set.
 int compareTo(MethodSummary.Node that)
           
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
abstract  MethodSummary.Node copy()
          Return a shallow copy of this node.
 java.util.Set getAccessPathEdgeFields()
          Return the set of fields that this node has outside edges with.
 java.util.Set getAccessPathEdges()
          Return a set of Map.Entry objects corresponding to the outside edges of this node.
 void getAccessPathEdges(Clazz.jq_Field m, java.util.Set result)
          Add the nodes that are targets of outside edges on the given field to the given result set.
abstract  Compil3r.Quad.AndersenInterface.AndersenReference getDeclaredType()
          Return the declared type of this node.
 java.util.Set getEdgeFields()
          Return the set of fields that this node has inside edges with.
 void getEdges_escaped(Compil3r.Quad.AndersenInterface.AndersenField m, java.util.Set result)
          Add the nodes that are targets of inside edges on the given field to the given result set.
 java.util.Set getEdges()
          Return a set of Map.Entry objects corresponding to the inside edges of this node.
 java.util.Set getEdges(Compil3r.Quad.AndersenInterface.AndersenField m)
           
 void getEdges(Compil3r.Quad.AndersenInterface.AndersenField m, java.util.Set result)
          Add the nodes that are targets of inside edges on the given field to the given result set.
 boolean getEscapes()
           
 java.util.Set getNonEscapingEdges(Compil3r.Quad.AndersenInterface.AndersenField m)
           
 java.util.Set getPassedParameters()
           
 java.util.Set getPredecessors()
          Return a set of Map.Entry objects corresponding to the incoming inside edges of this node.
 Quad getSourceQuad(Compil3r.Quad.AndersenInterface.AndersenField f, MethodSummary.Node n)
           
 boolean hasAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
           
 boolean hasAccessPathEdges()
          Returns true if this node has any added outside edges.
 boolean hasEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
           
 boolean hasEdges()
          Returns true if this node has any added inside edges.
 int hashCode()
          Get a value that represents this Object, as uniquely as possible within the confines of an int.
 boolean hasPredecessor(Compil3r.Quad.AndersenInterface.AndersenField f, MethodSummary.Node n)
           
 boolean recordPassedParameter(MethodSummary.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(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.FieldNode n)
          Remove the given successor node on the given field from the outside edge set.
 boolean removeEdge(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
          Remove the given successor node on the given field from the inside edge set.
 boolean removePredecessor(Compil3r.Quad.AndersenInterface.AndersenField m, MethodSummary.Node n)
          Remove the given predecessor node on the given field from the predecessor set.
 void replaceBy(java.util.Set set, boolean removeSelf)
          Replace this node by the given set of nodes.
 void setEscapes()
           
 java.lang.String toString_long()
          Return a string representation of the node in long form.
abstract  java.lang.String toString_short()
          Return a string representation of the node in short form.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 void update(java.util.HashMap um)
          Update all predecessor and successor nodes with the given update map.
(package private) static void updateMap_unknown(java.util.Map um, java.util.Iterator i, java.util.Map m)
           
(package private) static void updateMap(java.util.Map um, java.util.Iterator i, java.util.Map m)
          Helper function to update map m given an update map um.
abstract  void write(MethodSummary ms, java.io.DataOutput out)
          Prints an identifier of this node to the given output writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

predecessors

protected java.util.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 java.util.Set passedParameters
Set of passed parameters for this node.


addedEdges

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


accessPathEdges

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


id

protected final int id
Unique id number.


escapes

private boolean escapes
Whether or not this node escapes into some unanalyzable code.


TRACK_REASONS

public static boolean TRACK_REASONS

edgesToReasons

java.util.HashMap edgesToReasons
Maps added edges to the quads that they come from. Only used if TRACK_REASONS is true.


current_id

private static int current_id
Constructor Detail

MethodSummary.Node

protected MethodSummary.Node()

MethodSummary.Node

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

hashCode

public int hashCode()
Description copied from class: java.lang.Object
Get a value that represents this Object, as uniquely as possible within the confines of an int.

There are some requirements on this method which subclasses must follow:

  • Semantic equality implies identical hashcodes. In other words, if a.equals(b) is true, then a.hashCode() == b.hashCode() must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal.
  • It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.

Notice that since hashCode is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.

The default implementation returns System.identityHashCode(this)


compareTo

public final int compareTo(MethodSummary.Node that)

compareTo

public final int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable

getPassedParameters

public java.util.Set getPassedParameters()

replaceBy

public void replaceBy(java.util.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.


updateMap

static void updateMap(java.util.Map um,
                      java.util.Iterator i,
                      java.util.Map m)
Helper function to update map m given an update map um.


addGlobalEdges

static void addGlobalEdges(MethodSummary.Node n)

updateMap_unknown

static void updateMap_unknown(java.util.Map um,
                              java.util.Iterator i,
                              java.util.Map m)

update

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


getDeclaredType

public abstract Compil3r.Quad.AndersenInterface.AndersenReference getDeclaredType()
Return the declared type of this node.


copy

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


hasPredecessor

public boolean hasPredecessor(Compil3r.Quad.AndersenInterface.AndersenField f,
                              MethodSummary.Node n)

removePredecessor

public boolean removePredecessor(Compil3r.Quad.AndersenInterface.AndersenField m,
                                 MethodSummary.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(Compil3r.Quad.AndersenInterface.AndersenField m,
                              MethodSummary.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 java.util.Set getPredecessors()
Return a set of Map.Entry objects corresponding to the incoming inside edges of this node.


recordPassedParameter

public boolean recordPassedParameter(MethodSummary.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

private boolean _removeEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                            MethodSummary.Node n)

removeEdge

public boolean removeEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                          MethodSummary.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.


hasEdge

public boolean hasEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                       MethodSummary.Node n)

addEdge

public boolean addEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                       MethodSummary.Node n,
                       java.lang.Object q)
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(Compil3r.Quad.AndersenInterface.AndersenField m,
                        java.util.Set s,
                        java.lang.Object q)
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(java.util.Set s,
                               Compil3r.Quad.AndersenInterface.AndersenField f,
                               MethodSummary.Node n,
                               Quad q)
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

private boolean _removeAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                                      MethodSummary.FieldNode n)

removeAccessPathEdge

public boolean removeAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                                    MethodSummary.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(Compil3r.Quad.AndersenInterface.AndersenField m,
                                 MethodSummary.Node n)

addAccessPathEdge

public boolean addAccessPathEdge(Compil3r.Quad.AndersenInterface.AndersenField m,
                                 MethodSummary.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(Clazz.jq_Field m,
                                  java.util.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.


getEdges

public final void getEdges(Compil3r.Quad.AndersenInterface.AndersenField m,
                           java.util.Set result)
Add the nodes that are targets of inside edges on the given field to the given result set.


getEdges

public final java.util.Set getEdges(Compil3r.Quad.AndersenInterface.AndersenField m)

getNonEscapingEdges

public final java.util.Set getNonEscapingEdges(Compil3r.Quad.AndersenInterface.AndersenField m)

getEdges_escaped

public void getEdges_escaped(Compil3r.Quad.AndersenInterface.AndersenField m,
                             java.util.Set result)
Add the nodes that are targets of inside edges on the given field to the given result set.


getEdges

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


getEdgeFields

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


hasEdges

public boolean hasEdges()
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 void getAccessPathEdges(Clazz.jq_Field m,
                               java.util.Set result)
Add the nodes that are targets of outside edges on the given field to the given result set.


getAccessPathEdges

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


getAccessPathEdgeFields

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


getSourceQuad

public Quad getSourceQuad(Compil3r.Quad.AndersenInterface.AndersenField f,
                          MethodSummary.Node n)

setEscapes

public void setEscapes()

getEscapes

public boolean getEscapes()

toString_short

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


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).


toString_long

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


write

public abstract void write(MethodSummary ms,
                           java.io.DataOutput out)
                    throws java.io.IOException
Prints an identifier of this node to the given output writer.