for(TestGoalBase oTestGoal : io_colGoals) {
Double nBranchingFactor = 1.0;
if(oTestGoal instanceof TestGoalGuardConditions) {
TestGoalGuardConditions oGoalGuard = (TestGoalGuardConditions)oTestGoal;
nBranchingFactor = 0.0;
TCGNode oBranchingNode = (TCGNode)oGoalGuard.getElement();
// collect branching factor of transition's target node
if(oGoalGuard.getDNFToBeSatisfied().getConjunctions().isEmpty()) {
List<TCGTransition> colTransitions = TCGTransitionHelperClass.findResultingTransitions(
oBranchingNode, oGoalGuard.getEventToBeCalled(), null);
if(!colTransitions.isEmpty()) {
oBranchingNode = colTransitions.get(0).getTargetNode();
}
nBranchingFactor = getBranchingFactor(oBranchingNode);
}
else {
for(TCGConjunction oConjunction : oGoalGuard.getDNFToBeSatisfied().getConjunctions()) {
oBranchingNode = (TCGNode)oGoalGuard.getElement();
List<TCGTransition> colTransitions = TCGTransitionHelperClass.findResultingTransitions(
oBranchingNode, oGoalGuard.getEventToBeCalled(), oConjunction);
if(!colTransitions.isEmpty()) {
oBranchingNode = colTransitions.get(0).getTargetNode();
}
Double nBranching = getBranchingFactor(oBranchingNode);
nBranchingFactor += nBranching;
}
nBranchingFactor /= Double.valueOf(
(double)oGoalGuard.getDNFToBeSatisfied().getConjunctions().size());
}
}
else {
TCGNode oBranchingNode = (TCGNode)oTestGoal.getElement();
nBranchingFactor = getBranchingFactor(oBranchingNode);
}
oTestGoal.setPriority(nBranchingFactor);
colGoalsBranchingFactor.put(oTestGoal, nBranchingFactor);
}