|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.graphs.Edge sofya.graphs.cfg.CFEdge
public class CFEdge
A control flow edge is an edge in a Sofya control flow graph. It records additional information required for handling exceptional constructs and tracking branch flow in the CFG.
Graph
,
Node
Nested Class Summary | |
---|---|
static class |
CFEdge.BranchID
A branch ID associated with an edge in a CFG. |
Nested classes/interfaces inherited from interface sofya.base.SConstants |
---|
SConstants.BlockLabel, SConstants.BlockObjectType, SConstants.BlockSubType, SConstants.BlockType, SConstants.BranchObjectType, SConstants.BranchType, SConstants.EDObjectType, SConstants.TraceObjectType |
Field Summary | |
---|---|
protected java.lang.String |
auxLabel
Secondary label information (used with JSR and RET edges). |
protected java.util.SortedSet |
branchIDs
Control flow branch IDs assigned to the edge. |
protected org.apache.bcel.generic.Type |
labelType
Type associated with the label, if appropriate. |
protected int |
specialNodeID
ID of a node which has some special relationship to this edge. |
protected java.util.Map |
typeIDMap
Maps edge branch types to their associated branch IDs. |
static CFEdge[] |
ZL_ARRAY
Zero-length control flow edge array useful for specifying array cast types to methods such Graph.getEdges(Node,Node,Edge[]) . |
Fields inherited from class sofya.graphs.Edge |
---|
edgeID, label, predNodeID, succNodeID |
Fields inherited from interface sofya.base.SConstants |
---|
DEFAULT_PORT, INST_COMPATIBLE, INST_OLD_UNSUPPORTED, INST_OPT_NORMAL, INST_OPT_SEQUENCE, SIG_CHKALIVE, SIG_ECHO |
Constructor Summary | |
---|---|
CFEdge()
Creates an edge with ID zero, an empty label, and the successor and predecessor nodes set to zero. |
|
CFEdge(int id,
int s,
int p,
org.apache.bcel.generic.ObjectType type)
Creates an edge with the given label, ID, successor and predecessor nodes, and associated label type. |
|
CFEdge(int id,
int s,
int p,
java.lang.String str)
Creates an edge with the given label, ID, successor, and predecessor nodes. |
|
CFEdge(int id,
int s,
int p,
java.lang.String label,
java.lang.String auxLabel,
int spNode)
Creates an edge with the given label, ID, successor and predecessor nodes, secondary label, and special relationship node. |
Method Summary | |
---|---|
java.lang.String |
getAuxLabel()
Gets the secondary label for this edge. |
CFEdge.BranchID |
getBranchID(int index)
Gets a branch ID from this edge's branch ID set by index. |
CFEdge.BranchID |
getBranchID(SConstants.BranchType type)
Gets the branch ID associated with the given branch type. |
CFEdge.BranchID[] |
getBranchIDArray()
Gets the branch IDs associated with this edge as an array. |
java.util.SortedSet |
getBranchIDSet()
Gets the branch IDs associated with this edge as an unmodifiable sorted set. |
org.apache.bcel.generic.Type |
getLabelType()
Gets the type associated with this edge's label. |
int |
getSpecialNodeID()
Gets the ID of a node which has a special relationship to this edge. |
static void |
main(java.lang.String[] args)
Test driver for the Edge class. |
void |
setAuxLabel(java.lang.String s)
Sets the secondary label for this edge. |
void |
setSpecialNodeID(int n)
Sets the ID of a node which has a special relationship to this edge. |
java.lang.String |
toString()
Returns a string representation of this edge in the form: label: sourceNodeID -> sinkNodeID . |
Methods inherited from class sofya.graphs.Edge |
---|
getID, getLabel, getPredNodeID, getSuccNodeID, setID, setLabel, setPredNodeID, setSuccNodeID |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.SortedSet branchIDs
protected java.util.Map typeIDMap
protected java.lang.String auxLabel
protected int specialNodeID
protected org.apache.bcel.generic.Type labelType
public static final CFEdge[] ZL_ARRAY
Graph.getEdges(Node,Node,Edge[])
.
Constructor Detail |
---|
public CFEdge()
public CFEdge(int id, int s, int p, java.lang.String str)
id
- ID of the new edge.s
- ID of the new edge's successor node.p
- ID of the new edge's predecessor node.str
- Label to be assigned to the new edge.public CFEdge(int id, int s, int p, java.lang.String label, java.lang.String auxLabel, int spNode)
id
- ID of the new edge.s
- ID of the new edge's successor node.p
- ID of the new edge's predecessor node.label
- Label to be assigned to the new edge.auxLabel
- Secondary label to be assigned to the new edge.spNode
- ID of node to be marked as having a special relationship
to this edge.public CFEdge(int id, int s, int p, org.apache.bcel.generic.ObjectType type)
id
- ID of the new edge.s
- ID of the new edge's successor node.p
- ID of the new edge's predecessor node.type
- Type which is associated with this edge.Method Detail |
---|
public CFEdge.BranchID getBranchID(int index)
Branch IDs are stored in numerical order. This method iterates
over the ID set and returns the ID produced by the iterator after
index
iterations.
index
- Index of the branch ID to be retrieved from the ID set.
public CFEdge.BranchID getBranchID(SConstants.BranchType type)
If there is more than one branch ID with the same associated type, only the most specific branch ID is returned. In other words, the branch ID associated with this particular branch decision is returned rather than the ID of any logical branch edge encapsulating the current edge. This allows proper instrumentation and observation of decisions made inside of 'side loops'.
type
- Type of the branch for which the associated branch ID
is to be retrieved.
public CFEdge.BranchID[] getBranchIDArray()
The branch IDs stored in the array will be sorted numerically.
public java.util.SortedSet getBranchIDSet()
public void setAuxLabel(java.lang.String s)
This field is used to record additional unique identifying information related to JSR and RET edges. It may be specific to the particular version of a class from which a CFG is built.
s
- New secondary label to be assigned to this edge.public java.lang.String getAuxLabel()
public void setSpecialNodeID(int n)
This field is used in CFGs to store a reference in JSR edges to the block that contains the matching RET instruction.
n
- ID of the node to be marked as having a special association
with this edge.public int getSpecialNodeID()
For JSR edges, this is expected to be the ID of the node containing the corresponding RET instruction.
public org.apache.bcel.generic.Type getLabelType()
public java.lang.String toString()
label: sourceNodeID -> sinkNodeID
.
If the edge is unlabeled, the special token "(nl)
" is
used for the label.
toString
in class Edge
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |