use of org.iobserve.analysis.clustering.filter.models.EntryCallEdge in project iobserve-analysis by research-iobserve.
the class TUsageModelToBehaviorModel method traverseAction.
private Map<EntryCallNode, Double> traverseAction(final BehaviorModel behaviorModel, final Optional<Map<EntryCallNode, Double>> optPreviousNodes, final AbstractUserAction action) {
if (action instanceof Branch) {
final Branch branch = (Branch) action;
return this.traverseBranch(behaviorModel, optPreviousNodes, branch);
} else if (action instanceof Loop) {
final Loop loop = (Loop) action;
return this.traverseLoop(behaviorModel, optPreviousNodes, loop);
} else if (action instanceof EntryLevelSystemCall) {
final Map<EntryCallNode, Double> endNodes = new HashMap<>();
final EntryLevelSystemCall entryLevelSystemCall = (EntryLevelSystemCall) action;
final EntryCallNode entryCallNode = this.createEntryCallNode(entryLevelSystemCall);
behaviorModel.addNode(entryCallNode);
if (optPreviousNodes.isPresent()) {
optPreviousNodes.get().keySet().stream().map(previousNode -> new EntryCallEdge(previousNode, entryCallNode, optPreviousNodes.get().get(previousNode))).forEach(behaviorModel::addEdge);
}
endNodes.put(entryCallNode, 1.0);
return this.traverseAction(behaviorModel, Optional.of(endNodes), action.getSuccessor());
} else if (action instanceof Stop) {
return optPreviousNodes.isPresent() ? optPreviousNodes.get() : new HashMap<>();
} else {
// skip action
return this.traverseAction(behaviorModel, optPreviousNodes, action.getSuccessor());
}
}
Aggregations