use of org.iobserve.analysis.clustering.filter.models.CallInformation in project iobserve-analysis by research-iobserve.
the class TBehaviorModelCreation method createNode.
/**
* Creates an node from a node representing attribute string and value.
*
* @param name
* attribute name
* @param value
* attribute value
*
* @return EntryCallNode
*/
private Optional<EntryCallNode> createNode(final String name, final Double value) {
final String[] signatures = this.splitSignature(AbstractBehaviorModelTable.INFORMATION_INDICATOR_PATTERN, AbstractBehaviorModelTable.INFORMATION_DIVIDER_PATTERN, name);
if (signatures.length == 2) {
final EntryCallNode node = new EntryCallNode(signatures[0]);
final CallInformation callInformation = new CallInformation(signatures[1], value);
node.getEntryCallInformation().add(callInformation);
return Optional.of(node);
} else {
return Optional.empty();
}
}
use of org.iobserve.analysis.clustering.filter.models.CallInformation in project iobserve-analysis by research-iobserve.
the class ComparisonOutputStage method generateAllEntryCallInformationList.
private Set<CallInformation> generateAllEntryCallInformationList(final Set<CallInformation> entryCallInformation, final Set<CallInformation> supplementalCallInfo) {
final Set<CallInformation> allEntryCallInformation = new HashSet<>();
allEntryCallInformation.addAll(entryCallInformation);
for (final CallInformation information : supplementalCallInfo) {
boolean exists = false;
for (final CallInformation referenceInfo : allEntryCallInformation) {
if (referenceInfo.getInformationSignature().equals(information.getInformationSignature()) && referenceInfo.getInformationCode() == information.getInformationCode()) {
exists = true;
}
}
if (!exists) {
allEntryCallInformation.add(information);
}
}
return allEntryCallInformation;
}
use of org.iobserve.analysis.clustering.filter.models.CallInformation in project iobserve-analysis by research-iobserve.
the class ComparisonOutputStage method execute.
@Override
protected void execute(final ComparisonResult result) throws IOException {
final FileWriter fw = new FileWriter(this.outputFile);
final BufferedWriter writer = new BufferedWriter(fw);
final int baselineNodeCount = result.getBaselineNodes().size();
final int testModelNodeCount = result.getTestModelNodes().size();
final int missingNodeCount = result.getMissingNodes().size();
final int additionalNodeCount = result.getAdditionalNodes().size();
final int baselineEdgeCount = result.getBaselineEdges().size();
final int testModelEdgeCount = result.getTestModelEdges().size();
final int missingEdgeCount = result.getMissingEdgeCount();
final int additionalEdgeCount = result.getAdditionalEdgeCount();
writer.write("CP;" + this.outputFile.getName() + ";" + baselineNodeCount + ";" + baselineEdgeCount + ";" + testModelNodeCount + ";" + testModelEdgeCount + ";" + missingNodeCount + ";" + additionalNodeCount + ";" + missingEdgeCount + ";" + additionalEdgeCount + ";" + (double) missingNodeCount / (double) baselineNodeCount + ";" + (double) additionalNodeCount / (double) baselineNodeCount + ";" + (double) missingEdgeCount / (double) baselineEdgeCount + ";" + (double) additionalEdgeCount / (double) baselineEdgeCount + "\n");
final List<EntryCallNode> allNodes = this.createAllNodesList(result.getBaselineNodes(), result.getTestModelNodes());
final List<EntryCallEdge> allEdges = this.createAllEdgesList(result.getBaselineEdges(), result.getTestModelEdges());
this.generateNodeCallInformation(writer, "baseline;" + this.outputFile.getName() + ";", allNodes, result.getBaselineNodes());
this.generateNodeCallInformation(writer, "compared;" + this.outputFile.getName() + ";", allNodes, result.getTestModelNodes());
writer.write("baseline;------------------------------------------ edges\n");
writer.write("compared;------------------------------------------ edges\n");
this.generateEdges(writer, "baseline;" + this.outputFile.getName() + ";", allEdges, result.getBaselineEdges());
this.generateEdges(writer, "compared;" + this.outputFile.getName() + ";", allEdges, result.getTestModelEdges());
writer.write("Nodes:\n\tmissing=" + result.getMissingNodes().size() + "\n\tadditional=" + result.getAdditionalNodes().size() + "\n");
for (final EntryCallNode node : result.getMissingNodes()) {
writer.write("\t - " + node.getSignature() + "\n");
}
for (final EntryCallNode node : result.getAdditionalNodes()) {
writer.write("\t + " + node.getSignature() + "\n");
}
for (final EntryCallNode node : result.getSimilarNodes()) {
writer.write("\t = " + node.getSignature() + "\n");
}
writer.write("Edges:\n\tmissing=" + result.getMissingEdgeCount() + "\n\tadditional=" + result.getAdditionalEdgeCount() + "\n");
writer.write("Node differences:\n");
for (final NodeDifference difference : result.getNodeDifferences()) {
writer.write("\tNode" + difference.getReferenceNode().getSignature() + "\n");
writer.write("\t\tMissing");
String separator = "=";
for (final CallInformation callInformation : difference.getMissingInformation()) {
writer.write(separator + callInformation);
separator = ", ";
}
writer.write("\n");
writer.write("\t\tAdditional");
separator = "=";
for (final CallInformation callInformation : difference.getMissingInformation()) {
writer.write(separator + callInformation);
separator = ", ";
}
writer.write("\n");
}
writer.close();
fw.close();
}
use of org.iobserve.analysis.clustering.filter.models.CallInformation 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.CallInformation 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");
}
}
}
Aggregations