public class Block extends java.lang.Object implements java.lang.Iterable<Unit>
Constructor and Description |
---|
Block(Unit aHead,
Unit aTail,
Body aBody,
int aIndexInMethod,
int aBlockLength,
BlockGraph aBlockGraph)
Constructs a Block in the context of a BlockGraph, and enclosing Body instances.
|
Modifier and Type | Method and Description |
---|---|
Body |
getBody()
Returns the Block's enclosing Body instance.
|
Unit |
getHead()
Returns the first unit in this block.
|
int |
getIndexInMethod()
Returns the index of this Block in the list of Blocks that partition it's
enclosing Body instance.
|
Unit |
getPredOf(Unit aItem)
Returns the Unit occurring immediately before some other Unit in the block.
|
java.util.List<Block> |
getPreds()
Returns the List of Block that are predecessors to this block,
|
Unit |
getSuccOf(Unit aItem)
Returns the Unit occurring immediately after some other Unit in the block.
|
java.util.List<Block> |
getSuccs()
Returns the List of Blocks that are successors to this block,
|
Unit |
getTail()
Returns the last unit in this block.
|
void |
insertAfter(Unit toInsert,
Unit point)
Inserts a Unit after some other Unit in the Block.
|
void |
insertBefore(Unit toInsert,
Unit point)
Inserts a Unit before some other Unit in this block.
|
java.util.Iterator<Unit> |
iterator()
Returns an iterator for the linear chain of Units that make up the block.
|
boolean |
remove(Unit item)
Removes a Unit occurring before some other Unit in the Block.
|
void |
setIndexInMethod(int aIndexInMethod)
Set the index of this Block in the list of Blocks that partition
its enclosing Body instance.
|
void |
setPreds(java.util.List<Block> preds)
Sets the list of Blocks that are predecessors of this block in it's enclosing
BlockGraph instance.
|
void |
setSuccs(java.util.List<Block> succs)
Sets the list of Blocks that are successors of this block in it's enclosing
BlockGraph instance.
|
java.lang.String |
toShortString() |
java.lang.String |
toString() |
public Block(Unit aHead, Unit aTail, Body aBody, int aIndexInMethod, int aBlockLength, BlockGraph aBlockGraph)
aHead
- The first unit ir this Block.aTail
- The last unit in this Block.aBody
- The Block's enclosing Body instance.aIndexInMethod
- The index of this Block in the list of
Blocks that partition it's enclosing Body instance.aBlockLength
- The number of units that makeup this block.aBlockGraph
- The Graph of Blocks in which this block lives.Body
,
Chain
,
BlockGraph
,
Unit
,
SootMethod
public Body getBody()
JimpleBody
,
BafBody
,
Body
public java.util.Iterator<Unit> iterator()
public void insertBefore(Unit toInsert, Unit point)
public void insertAfter(Unit toInsert, Unit point)
toInsert
- A Unit to be inserted.point
- A Unit in the Block after which we wish to
insert the Unit.Unit
public boolean remove(Unit item)
item
- A Unit to be remove from the Block's Unit Chain.public Unit getSuccOf(Unit aItem)
aItem
- The Unit from which we wish to get it's successor.aItem
is the tail
for this Block.public Unit getPredOf(Unit aItem)
aItem
- The Unit from which we wish to get it's predecessor.aItem
is the head
for this Block.public void setIndexInMethod(int aIndexInMethod)
aIndexInMethod
- The index of this Block in the list of
Blocks that partition it's enclosing
Body instance.public int getIndexInMethod()
public Unit getHead()
public Unit getTail()
public void setPreds(java.util.List<Block> preds)
preds
- The a List of Blocks that precede this block.BlockGraph
public java.util.List<Block> getPreds()
BlockGraph
public void setSuccs(java.util.List<Block> succs)
succs
- The a List of Blocks that succede this block.BlockGraph
public java.util.List<Block> getSuccs()
BlockGraph
public java.lang.String toShortString()
public java.lang.String toString()
toString
in class java.lang.Object