public class Branch extends Object implements Serializable, Comparable<Branch>
Branches are created by the CFGMethodAdapter via the BranchPool. Each Branch
holds its corresponding BytecodeInstruction from the RawControlFlowGraph and
is associated with a unique actualBranchId.
A Branch can either come from a jump instruction, as defined in
BytecodeInstruction.isBranch() - which will be called normal branches - or it
can be associated with a case: of a switch statement as defined in
BytecodeInstruction.isSwitch() - which will be called switch case branches.
Only BytecodeInstructions satisfying BytecodeInstruction.isActualbranch() are
expected to be associated with a Branch object.
For SWITCH statements each case Branch that can
be created by constructing a Branch with the SWITCH statement and the targetCaseValue set to null.
| Constructor and Description |
|---|
Branch(BytecodeInstruction branchInstruction,
int actualBranchId)
Constructor for usual jump instruction Branches, that are not SWITCH
instructions.
|
Branch(BytecodeInstruction switchInstruction,
Integer targetCaseValue,
org.objectweb.asm.tree.LabelNode targetLabel,
int actualBranchId)
Constructor for switch case branches
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Branch other) |
boolean |
equals(Object obj) |
int |
getActualBranchId()
Getter for the field
actualBranchId. |
String |
getClassName()
getClassName
|
BytecodeInstruction |
getInstruction()
Getter for the field
instruction. |
String |
getMethodName()
getMethodName
|
Integer |
getTargetCaseValue()
Getter for the field
targetCaseValue. |
int |
hashCode() |
boolean |
isActualCase()
isActualCase
|
boolean |
isDefaultCase()
isDefaultCase
|
boolean |
isInstrumented()
isInstrumented
|
boolean |
isSwitchCaseBranch()
isSwitchCaseBranch
|
void |
setInstrumented(boolean isInstrumented)
setInstrumented
|
String |
toString() |
public Branch(BytecodeInstruction branchInstruction, int actualBranchId)
branchInstruction - a BytecodeInstruction object.actualBranchId - a int.public Branch(BytecodeInstruction switchInstruction, Integer targetCaseValue, org.objectweb.asm.tree.LabelNode targetLabel, int actualBranchId)
switchInstruction - a BytecodeInstruction object.targetCaseValue - a Integer object.targetLabel - a LabelNode object.actualBranchId - a int.public int getActualBranchId()
Getter for the field actualBranchId.
public boolean isDefaultCase()
isDefaultCase
public boolean isActualCase()
isActualCase
public Integer getTargetCaseValue()
Getter for the field targetCaseValue.
Integer object.public BytecodeInstruction getInstruction()
Getter for the field instruction.
BytecodeInstruction object.public boolean isSwitchCaseBranch()
isSwitchCaseBranch
public int compareTo(Branch other)
compareTo in interface Comparable<Branch>public boolean isInstrumented()
isInstrumented
public void setInstrumented(boolean isInstrumented)
setInstrumented
isInstrumented - a boolean.Copyright © 2010–2017 EvoSuite. All rights reserved.