Class BranchTrace
- java.lang.Object
-
- ru.ispras.microtesk.test.engine.branch.BranchTrace
-
public final class BranchTrace extends java.lang.Object
BranchTrace
represents an execution trace of a branch instruction.
-
-
Constructor Summary
Constructors Constructor Description BranchTrace()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add()
Adds an execution to the trace.void
addExecution(boolean conditionalBranch)
Adds an execution to the trace.void
clear()
Removes all executions from the trace.BranchTrace
clone()
BranchExecution
get(int i)
int
getChangeNumber()
Returns the number of condition changes in the trace.int
getChangePosition()
Returns the first position of condition change for simple branching.boolean
getCondition(int i)
Returns the condition value of the given execution.int
getFalseNumber()
Returns the number of false conditions in the trace.BranchExecution
getLastExecution()
Returns the last execution of the trace.int
getTrueNumber()
Returns the number of true conditions in the trace.boolean
isEmpty()
boolean
isFictitious()
Checks whether the branch is fictitious (condition does not change) or not.boolean
isPointed()
Checks whether the branch is pointed (there is only one branch execution which condition equals to the negation of the first one.boolean
isSimple()
Checks whether the branch is simple (condition does not change more than one time) or not.void
removeLastExecution()
Removes the last execution from the trace.int
size()
java.lang.String
toString()
-
-
-
Method Detail
-
size
public int size()
-
isEmpty
public boolean isEmpty()
-
get
public BranchExecution get(int i)
-
getLastExecution
public BranchExecution getLastExecution()
Returns the last execution of the trace.- Returns:
- the last execution.
-
clear
public void clear()
Removes all executions from the trace.
-
add
public void add()
Adds an execution to the trace.
-
addExecution
public void addExecution(boolean conditionalBranch)
Adds an execution to the trace.- Parameters:
conditionalBranch
- the type of the branch instruction.
-
removeLastExecution
public void removeLastExecution()
Removes the last execution from the trace.
-
getTrueNumber
public int getTrueNumber()
Returns the number of true conditions in the trace.- Returns:
- the number of true conditions.
-
getFalseNumber
public int getFalseNumber()
Returns the number of false conditions in the trace.- Returns:
- the number of false conditions.
-
getChangeNumber
public int getChangeNumber()
Returns the number of condition changes in the trace.- Returns:
- the number of condition changes.
-
getChangePosition
public int getChangePosition()
Returns the first position of condition change for simple branching.- Returns:
- the first position of condition change or 0.
-
isFictitious
public boolean isFictitious()
Checks whether the branch is fictitious (condition does not change) or not.- Returns:
true
if the branch is fictitious;false
otherwise.
-
isSimple
public boolean isSimple()
Checks whether the branch is simple (condition does not change more than one time) or not.- Returns:
true
if the branch is simple;false
otherwise.
-
isPointed
public boolean isPointed()
Checks whether the branch is pointed (there is only one branch execution which condition equals to the negation of the first one.- Returns:
true
if the branch is pointed;false
otherwise.
-
getCondition
public boolean getCondition(int i)
Returns the condition value of the given execution.- Parameters:
i
- the execution index.- Returns:
- the condition value.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
clone
public BranchTrace clone()
- Overrides:
clone
in classjava.lang.Object
-
-