Skip to content
Snippets Groups Projects
Commit 452c94c9 authored by Sören Henning's avatar Sören Henning
Browse files

refactoring

parent 0fad3438
No related branches found
No related tags found
1 merge request!17Get impletemented stages and Java 8
......@@ -23,10 +23,7 @@ public class OperationsDependency {
public void addCall(final AggregatedOperationCall call) {
// Add call (node)
addOperation(call);
// Add relation (edge)
addRelation(call);
}
......@@ -40,22 +37,21 @@ public class OperationsDependency {
}
private void addRelation(final AggregatedOperationCall call) {
// TODO Rename
String key2 = call.getIdentifier() + ',' + call.getIdentifier();
if (!relations.containsKey(key2)) {
String key = call.getIdentifier() + ',' + call.getIdentifier();
if (!relations.containsKey(key)) {
// Todo rename
AggregatedOperationCall thiz = operations.get(call.getIdentifier());
AggregatedOperationCall parent = operations.get(call.getParent().getIdentifier());
AggregatedOperationCall callee = operations.get(call.getIdentifier());
AggregatedOperationCall caller = operations.get(call.getParent().getIdentifier());
OperationsDependencyRelation relation = new OperationsDependencyRelation(thiz, parent);
relations.put(key2, relation);
OperationsDependencyRelation relation = new OperationsDependencyRelation(callee, caller);
relations.put(key, relation);
}
if (call.isFailed()) {
relations.get(key2).addCall();
relations.get(key).addCall();
} else {
relations.get(key2).addFailuredCall();
relations.get(key).addFailuredCall();
}
}
......@@ -101,39 +97,6 @@ public class OperationsDependency {
* }
*/
/**
* Wrapper class for {@link AggregatedOperationCall} for calculating the hash code and check equality of two {@link AggregatedOperationCall}.
*
* @author Sören Henning
*
*/
private static class OperationCallWrapper {
private final AggregatedOperationCall operationCall;
public OperationCallWrapper(final AggregatedOperationCall operationCall) {
this.operationCall = operationCall;
}
public AggregatedOperationCall getOperationCall() {
return operationCall;
}
@Override
public int hashCode() {
return this.operationCall.calculateHashCode();
}
@Override
public boolean equals(final Object obj) {
if (!(obj instanceof OperationCallWrapper)) {
return false;
}
return this.operationCall.isEqualTo(((OperationCallWrapper) obj).operationCall);
}
}
/**
* Relation between two {@link AggregatedOperationCall}. If this class will be
* extended by more attributes, new hashCode() and equals() methods are required.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment