public class Cfg extends CfgModelNode implements UseDef
Constructor and Description |
---|
Cfg()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAsSink(CfgNode node)
Substitutes internal default
Sink node by other node. |
void |
addAsSource(CfgNode node)
Substitutes internal default
Source node by other node. |
void |
addChild(CfgModelNode node)
Throws an exception.
|
void |
addNode(CfgModelNode node)
Adds control flow graph node.
|
void |
addNodes(java.util.Collection<CfgNode> nodes)
Adds control flow graph nodes collection.
|
void |
addParent(CfgModelNode node)
Adds parent node.
|
void |
append(Cfg cfg)
Appends another control flow graph.
|
void |
applyToCfg(java.util.Map<java.lang.String,ru.ispras.fortress.expression.Node> bindings)
Applies bindings to control flow graph internals.
|
CfgModelNode |
deepcopy()
Returns a copy of this node.
|
java.util.Collection<CfgModelNode> |
getChildren()
Return child nodes.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getDefines()
Returns a set of defined variables.
|
java.lang.String |
getDescription(ru.ispras.fortress.expression.printer.ExprTreePrinter printer)
Returns node string description in the format of the specified printer.
|
CfgNode |
getLastNode(CfgNodeType type)
Returns last internal node with the specified type.
|
CfgNode |
getNode(java.lang.String id)
Returns first internal node with the specified identifier.
|
java.util.Collection<CfgNode> |
getNodes()
Returns all internal control flow graph nodes.
|
CfgModelNode |
getOnlyChild()
Returns the only child node.
|
CfgModelNode |
getOnlyParent()
Returns the only parent node.
|
java.util.Collection<CfgModelNode> |
getParents()
Returns parent nodes.
|
Sink |
getSink()
Returns
Sink node of this graph. |
Source |
getSource()
Returns
Source node of this graph. |
CfgNodeType |
getType()
Returns node type.
|
java.util.Set<ru.ispras.fortress.expression.NodeVariable> |
getUses()
Returns a set of used variables.
|
boolean |
hasChildren()
Checks rather node has child nodes.
|
boolean |
hasParents()
Checks rather node has parent nodes.
|
void |
removeChild(CfgModelNode node)
Throws an exception.
|
void |
removeNode(CfgNode node)
Removes internal node from control flow graph.
|
void |
removeParent(CfgModelNode node)
Removes parent node.
|
getId
addMetaInfo, addMetaInfo, addMetaInfo, addMetaInfo, getMetaInfo, getMetaInfo, getMetaInfo, hasMetaInfo, hasMetaInfo, removeMetaInfo, removeMetaInfo
public Cfg()
public void addNode(CfgModelNode node)
public void addNodes(java.util.Collection<CfgNode> nodes)
nodes
- nodes to be addedjava.lang.NullPointerException
- when argument is null
.public void append(Cfg cfg)
cfg
- control flow graph to be appendedjava.lang.NullPointerException
- when argument is null
.public void addAsSource(CfgNode node)
Source
node by other node.
Previous SOURCE node will be removed from control flow graph.node
- node to be added as the new "source"java.lang.NullPointerException
- when argument is null
.public void addAsSink(CfgNode node)
Sink
node by other node.
Previous SINK node will be removed from control flow graph.node
- node to be added as the new "sink"java.lang.NullPointerException
- when argument is null
.public void removeNode(CfgNode node)
node
- node to be removedjava.lang.NullPointerException
- when argument is null
.public java.util.Collection<CfgNode> getNodes()
public CfgNode getNode(java.lang.String id)
Cfg
control flow graph type nodes.id
- target node identifierjava.util.NoSuchElementException
- if there is no such nodepublic CfgNode getLastNode(CfgNodeType type)
type
- type of target nodenull
if there is no such nodepublic void applyToCfg(java.util.Map<java.lang.String,ru.ispras.fortress.expression.Node> bindings)
bindings
- "variable name - expression" bindingjava.lang.NullPointerException
- when argument is null
.java.lang.IllegalArgumentException
- when some argument element
has a key that is not of NodeVariable
type.public CfgModelNode deepcopy()
CfgModelNode
deepcopy
in class CfgModelNode
public void addChild(CfgModelNode node)
addChild
in class CfgModelNode
node
- child nodejava.lang.UnsupportedOperationException
- every time it is calledpublic void addParent(CfgModelNode node)
addParent
in class CfgModelNode
node
- parent nodejava.lang.NullPointerException
- when argument is null
.java.lang.IllegalStateException
- when this object
does not have such parent node.java.lang.IllegalArgumentException
- when the specified node
is not of Process
type.public void removeChild(CfgModelNode node)
removeChild
in class CfgModelNode
node
- child nodejava.lang.UnsupportedOperationException
- every time it is called.public void removeParent(CfgModelNode node)
removeParent
in class CfgModelNode
node
- parent nodejava.lang.NullPointerException
- when argument is null
.java.lang.IllegalArgumentException
- when the specified node
is not of Process
typejava.lang.IllegalStateException
- when this object
does not contain the specified node as parent.public java.util.Collection<CfgModelNode> getParents()
CfgModelNode
getParents
in class CfgModelNode
public CfgModelNode getOnlyChild()
CfgModelNode
getOnlyChild
in class CfgModelNode
public java.util.Collection<CfgModelNode> getChildren()
CfgModelNode
getChildren
in class CfgModelNode
public java.lang.String getDescription(ru.ispras.fortress.expression.printer.ExprTreePrinter printer)
CfgModelNode
getDescription
in class CfgModelNode
printer
- printerpublic CfgNodeType getType()
CfgModelNode
CfgNodeType.NODE
type.getType
in class CfgModelNode
public boolean hasParents()
CfgModelNode
hasParents
in class CfgModelNode
true
if node has at least one parent, false
otherwise.public boolean hasChildren()
CfgModelNode
hasChildren
in class CfgModelNode
true
if node has at least one child,
false
otherwise.public CfgModelNode getOnlyParent()
CfgModelNode
getOnlyParent
in class CfgModelNode
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getUses()
UseDef
public java.util.Set<ru.ispras.fortress.expression.NodeVariable> getDefines()
UseDef
getDefines
in interface UseDef