use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.
the class TBehaviorModelVisualization method createNodes.
/**
* Create new nodes at visualisation backend.
*
* @param entryCallNodes
* entryCallNodes
*/
private void createNodes(final Set<EntryCallNode> entryCallNodes, final long modelId) {
final ArrayNode nodes = this.objectMapper.createArrayNode();
for (final EntryCallNode entryCallNode : entryCallNodes) {
final ObjectNode json = this.objectMapper.createObjectNode();
json.put("id", 0);
json.put("name", this.signatureStrategy.getSignature(entryCallNode));
final ObjectNode extras = this.objectMapper.createObjectNode();
for (final CallInformation callInformation : entryCallNode.getEntryCallInformation()) {
extras.put(callInformation.getInformationSignature(), callInformation.getInformationCode());
}
json.put("extra", extras);
// TODO visualizations doesn't accept lists.
// TODO is this a requirement request?
nodes.add(json);
final JsonNode node = this.postElement(json, this.getNodeUrl(modelId));
this.nodeMap.put(entryCallNode.getSignature(), node);
}
}
use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.
the class TUsageModelToBehaviorModel method createEntryCallNode.
/**
* creates an {@link EntryCallNode} from an {@link EntryLevelSystemCall}.
*
* @param entryLevelSystemCall
* {@link EntryLevelSystemCall}
* @return entryCallNode
*/
private EntryCallNode createEntryCallNode(final EntryLevelSystemCall entryLevelSystemCall) {
final String signature = entryLevelSystemCall.getOperationSignature__EntryLevelSystemCall().getEntityName();
final EntryCallNode entryCallNode = new EntryCallNode(signature);
return entryCallNode;
}
use of org.iobserve.analysis.clustering.filter.models.EntryCallNode 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());
}
}
use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.
the class ComparisonOutputStage method generateNodeCallInformation.
private void generateNodeCallInformation(final BufferedWriter writer, final String prefix, final List<EntryCallNode> allNodes, final List<EntryCallNode> selectedNodes) throws IOException {
for (final EntryCallNode referenceNode : allNodes) {
final EntryCallNode printNode = this.findNode(selectedNodes, referenceNode);
if (printNode != null) {
final Set<CallInformation> allEntryCallInformation = this.generateAllEntryCallInformationList(referenceNode.getEntryCallInformation(), printNode.getEntryCallInformation());
writer.write(prefix + printNode.getSignature().substring(18) + "\n");
this.generateCallInformation(writer, prefix + "\t", allEntryCallInformation, printNode.getEntryCallInformation());
} else {
writer.write(prefix + " -- \n");
}
}
}
use of org.iobserve.analysis.clustering.filter.models.EntryCallNode in project iobserve-analysis by research-iobserve.
the class ComparisonOutputStage method createAllNodesList.
/**
* Get all nodes used in this comparison.
*
* @param baselineNodes
* @param testModelNodes
* @return
*/
private List<EntryCallNode> createAllNodesList(final List<EntryCallNode> baselineNodes, final List<EntryCallNode> testModelNodes) {
final List<EntryCallNode> result = new ArrayList<>();
result.addAll(baselineNodes);
for (final EntryCallNode node : testModelNodes) {
if (!this.nodeExists(baselineNodes, node)) {
result.add(node);
}
}
return result;
}
Aggregations