|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttip.cfg.CCFG
public class CCFG
CCFG
is the standard implementation of ICFG
. It is used by
CFGBuilder
.
Constructor Summary | |
---|---|
CCFG(String name)
Creates a new empty control flow graph with the name name . |
|
CCFG(String name,
List<IProgramPoint> pointList)
Creates a new linear control flow graph from the list of program points. |
|
CCFG(String name,
Set<ICFG> cfgSet)
Creates a new control flow graph from the set of control flow graphs. |
Method Summary | ||
---|---|---|
void |
add(IProgramPoint point)
Adds the IProgramPoint point to the set
of program points associated with this ICFG . |
|
void |
apply(Analysis analysis)
Applies analysis to all nodes associated with program points
in this control flow graph. |
|
|
apply(Question<Q> caller,
Q question)
Applies the Question caller and question to all nodes
associated with program points in this control flow graph. |
|
void |
clean()
Cleans the control flow graph by removing all predecessors and successors of the program points in the program point set of this control flow graph which are not in the program point set of this control flow graph. |
|
CCFG |
clone()
Returns a deep clone of the ICFG with respect to program points, i.e. program points cloned but the associated AST nodes are not. |
|
boolean |
containsProgramPoint(IProgramPoint point)
Returns true if this ICFG contains the IProgramPoint point . |
|
IProgramPoint |
getEntry()
Returns the entry point of the control flow graph. |
|
IProgramPoint |
getExit()
Returns the exit point of the control flow graph. |
|
String |
getName()
Returns the name of the control flow graph |
|
|
getNodeDescendants(Class<T> classType)
Returns a collection of descendants to the nodes associated to the program points in this control flow graph. |
|
|
getNodeDescendants(Collection<T> collection,
NodeFilter<T> filter)
Adds descendants to the nodes associated to the program points in this control flow graph to collection . |
|
|
getNodeDescendants(NodeFilter<T> filter)
Returns a collection of descendants to the nodes associated to the program points in this control flow graph. |
|
Collection<IProgramPoint> |
getProgramPoints()
Returns the collection of program points in the control flow graph. |
|
void |
insertAfter(IProgramPoint point,
IProgramPoint newPoint)
Inserts newPoint in the control flow graph after point . |
|
void |
insertBefore(IProgramPoint point,
IProgramPoint newPoint)
Inserts newPoint in the control flow graph before point . |
|
void |
prefixCFG(ICFG cfg)
Prefixes cfg in this control flow graph. |
|
void |
remove(IProgramPoint point)
Removes the IProgramPoint point from the set
of program points associated with this ICFG . |
|
void |
removePoint(IProgramPoint point)
Removes point from this control flow graph, updating the
predecessors and successors of point to point to eachother. |
|
void |
replaceByCFG(IProgramPoint point,
ICFG cfg)
Replaces point with cfg in this control flow graph. |
|
void |
replacePoint(IProgramPoint oldPoint,
IProgramPoint newPoint)
Replaces oldPoint with newPoint in this control flow graph. |
|
void |
setEntry(IProgramPoint point)
Sets the entry point of the control flow graph. |
|
void |
setExit(IProgramPoint point)
Sets the exit point of the control flow graph. |
|
void |
suffixCFG(ICFG cfg)
Suffixes cfg in this control flow graph. |
|
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public CCFG(String name)
name
.
name
- the name of the control flow graphpublic CCFG(String name, List<IProgramPoint> pointList)
name
- the name of the control flow graphpointList
- the list of program points from which the control flow graph is constructedpublic CCFG(String name, Set<ICFG> cfgSet)
Node
) are made,
all successors of the entry points are set as successors to this new
entry point and all predecessors of the exit points are set as
predecessors of the new exit point.
name
- the name of the control flow graphcfgSet
- the set of control flow graphs from which the control flow graph is constructedMethod Detail |
---|
public String getName()
getName
in interface ICFG
public void add(IProgramPoint point)
IProgramPoint
point
to the set
of program points associated with this ICFG
.
Predecessors and successors are not updated.
add
in interface ICFG
point
- the IProgramPoint
to be added to this ICFG
public void remove(IProgramPoint point)
IProgramPoint
point
from the set
of program points associated with this ICFG
.
Predecessors and successors are not updated.
remove
in interface ICFG
point
- the IProgramPoint
to be removed from this ICFG
public Collection<IProgramPoint> getProgramPoints()
getProgramPoints
in interface ICFG
public boolean containsProgramPoint(IProgramPoint point)
true
if this ICFG
contains the IProgramPoint
point
.
containsProgramPoint
in interface ICFG
point
- the IProgramPoint
in question
true
if this ICFG
contains the IProgramPoint
point
public void replaceByCFG(IProgramPoint point, ICFG cfg)
point
with cfg
in this control flow graph.
That is, point
is removed from this control flow graph,
all predecessors of point
are set to have all successors
of the entry point in cfg
as their successor instead of
point
and all successors of point
are set to have
all predecessors of the exit point in cfg
as their predecessor
instead of point
. All program point in cfg
, except the
entry and exit points, are added to this control flow graph.
replaceByCFG
in interface ICFG
point
- the replaced pointcfg
- the replacing control flow graphpublic void prefixCFG(ICFG cfg)
cfg
in this control flow graph. That is,
all successors of the entry point in cfg
are set to be
successors of the entry point in this control flow graph, and
all successors of the entry point in this control flow graph
are set as successors of the exit point in cfg
.
All program point in cfg
, except the
entry and exit points, are added to this control flow graph.
prefixCFG
in interface ICFG
cfg
- the prefixed cfgpublic void suffixCFG(ICFG cfg)
cfg
in this control flow graph. That is,
all predecessors of the exit point in cfg
are set to be
predecessors of the exit point in this control flow graph, and
all predecessors of the exit point in this control flow graph
are set as predecessors of the entry point in cfg
.
All program point in cfg
, except the
entry and exit points, are added to this control flow graph.
suffixCFG
in interface ICFG
cfg
- the suffixed cfgpublic void replacePoint(IProgramPoint oldPoint, IProgramPoint newPoint)
oldPoint
with newPoint
in this control flow graph.
Successors and predecessors are transferred from oldPoint
to
newPoint
. oldPoint
is removed from this control flow graph
newPoint
is added to this control flow graph.
replacePoint
in interface ICFG
oldPoint
- the replaced pointnewPoint
- the replacing pointpublic void removePoint(IProgramPoint point)
point
from this control flow graph, updating the
predecessors and successors of point
to point to eachother.
removePoint
in interface ICFG
point
- the removed pointpublic void insertAfter(IProgramPoint point, IProgramPoint newPoint)
newPoint
in the control flow graph after point
.
That is, all successors of point
are set as successors of
newPoint
and newPoint
is set as the sole successor
of point
insertAfter
in interface ICFG
point
- the point in this control flow graph after which newPoint
is insertednewPoint
- the inserted pointpublic void insertBefore(IProgramPoint point, IProgramPoint newPoint)
newPoint
in the control flow graph before point
.
That is, all predecessors of point
are set as predecessors of
newPoint
and newPoint
is set as the sole predecessor
of point
insertBefore
in interface ICFG
point
- the point in this control flow graph before which newPoint
is insertednewPoint
- the inserted pointpublic void clean()
replaceByCFG(IProgramPoint,ICFG)
,
prefixCFG(ICFG)
, suffixCFG(ICFG)
,
replacePoint(IProgramPoint,IProgramPoint)
,
insertAfter(IProgramPoint,IProgramPoint)
, and
insertBefore(IProgramPoint,IProgramPoint)
.
clean
in interface ICFG
public <T extends Node> Collection<T> getNodeDescendants(Class<T> classType)
classType
are returned.
getNodeDescendants
in interface ICFG
classType
- the supertype of returned descendants
public <T extends Node> Collection<T> getNodeDescendants(NodeFilter<T> filter)
NodeFilter
filter
are returned.
getNodeDescendants
in interface ICFG
filter
- the NodeFilter
used for filtering nodes
public <T extends Node> void getNodeDescendants(Collection<T> collection, NodeFilter<T> filter)
collection
.
Only descendants that are accepted by the NodeFilter
filter
are returned.
getNodeDescendants
in interface ICFG
collection
- the collection to which the descendants are addedfilter
- the NodeFilter
used for filtering nodespublic void apply(Analysis analysis)
analysis
to all nodes associated with program points
in this control flow graph.
apply
in interface ICFG
analysis
- the Analysis
applied to the associated nodespublic <Q> void apply(Question<Q> caller, Q question)
Question
caller
and question
to all nodes
associated with program points in this control flow graph.
apply
in interface ICFG
caller
- the Question
applied to the associated nodesquestion
- the provided questionpublic IProgramPoint getEntry()
getEntry
in interface ICFG
public void setEntry(IProgramPoint point)
point
- the entry point of the control flow graph
the graphpublic IProgramPoint getExit()
getExit
in interface ICFG
public void setExit(IProgramPoint point)
point
- the exit point of the control flow graph
the graphpublic CCFG clone()
clone
in interface ICFG
clone
in class Object
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |