@Override public String toString() { final StringBuilder strBuild = new StringBuilder(128); strBuild.append(this.traceId) .append('[').append(this.eoi).append(',').append(this.ess).append("] ") .append(this.tin).append('-').append(this.tout).append(' ') .append(this.allocationComponent.toString()).append('.') .append(this.operation.getSignature().getName()).append(' ') .append((this.sessionId != null) ? this.sessionId : NO_SESSION_ID); // NOCS if (this.assumed) { strBuild.append(" (assumed)"); } return strBuild.toString(); } }
public final Operation createAndRegisterOperation(final String namedIdentifier, final ComponentType componentType, final Signature signature) { if (this.operationsByName.containsKey(namedIdentifier)) { throw new IllegalArgumentException("Element with name " + namedIdentifier + "exists already"); } final int id = this.getAndIncrementNextId(); final Operation newInst = new Operation(id, componentType, signature); this.operationsById.put(id, newInst); this.operationsByName.put(namedIdentifier, newInst); return newInst; }
/** * Compares this {@link Execution} with the given object with respect to type and fields. All * fields but the {@link #isAssumed()} are considered for comparison. * * @param obj * The object to be compared with this instance. * * @return true if and only if the current object and the given object have equal values. */ @Override public boolean equals(final Object obj) { if (!(obj instanceof Execution)) { return false; } if (this == obj) { return true; } final Execution other = (Execution) obj; return this.allocationComponent.equals(other.allocationComponent) && this.operation.equals(other.operation) && this.sessionId.equals(other.sessionId) && (this.traceId == other.traceId) && (this.eoi == other.eoi) && (this.ess == other.ess) && (this.tin == other.tin) && (this.tout == other.tout) && (this.assumed == other.assumed); }
for (final Operation op : type.getOperations()) { opListBuilder.append("<li>") .append(this.htmlEntityRef(op.getId(), SystemModelRepository.simpleHTMLEscape(op.getSignature().toString()), EntityType.OPERATION)) .append("</li>"); for (final Operation op : operations) { final StringBuilder paramListStrBuild = new StringBuilder(); for (final String paramType : op.getSignature().getParamTypeList()) { paramListStrBuild.append("<li>").append(SystemModelRepository.simpleHTMLEscape(paramType)).append("</li>"); this.htmlEntityLabel(op.getId(), Integer.toString(op.getId()), EntityType.OPERATION), this.htmlEntityRef(op.getComponentType().getId(), SystemModelRepository.simpleHTMLEscape(op.getComponentType().getFullQualifiedName()), EntityType.COMPONENT_TYPE), SystemModelRepository.simpleHTMLEscape(op.getSignature().getName()), paramListStrBuild.toString(), SystemModelRepository.simpleHTMLEscape(op.getSignature().getReturnType()), }; this.printHtmlTableRow(ps, cells);
@Override public String toString() { return +this.allocationComponent.getId() + ":" + this.operation.getId() + "@" + this.id; }
@Override public int hashCode() { int hash = 3; hash = (43 * hash) + (this.operation != null ? this.operation.hashCode() : 0); // NOCS (inline ?) hash = (43 * hash) + (this.allocationComponent != null ? this.allocationComponent.hashCode() : 0); // NOCS (inline ?) hash = (43 * hash) + (int) (this.traceId ^ (this.traceId >>> 32)); hash = (43 * hash) + (this.sessionId != null ? this.sessionId.hashCode() : 0); // NOCS (inline ?) hash = (43 * hash) + this.eoi; hash = (43 * hash) + this.ess; hash = (43 * hash) + (int) (this.tin ^ (this.tin >>> 32)); hash = (43 * hash) + (int) (this.tout ^ (this.tout >>> 32)); hash = (43 * hash) + (this.assumed ? 5643 : 5648); // NOCS (inline ?) return hash; }
/** * Utility function to create a textual node ID for an operation. * * @param operation * The operation to create the ID for * @return The created ID */ protected static String createOperationNodeId(final Operation operation) { return AbstractDependencyGraphFormatter.createNodeId(operation.getId()); }
private String createOperationSignature(final Operation operation) { final StringBuilder builder = new StringBuilder(); final Signature signature = operation.getSignature(); builder.append(signature.getName()).append('('); final String[] parameterTypes = signature.getParamTypeList(); if (parameterTypes.length > 0) { // // parameterTypes cannot be null (getParamTypeList never returns null) builder.append(".."); } builder.append(')'); return builder.toString(); }
@Override public String toString() { return +this.assemblyComponent.getId() + ":" + this.operation.getId() + "@" + this.id; }
private static final String assemblyComponentOperationPairNodeLabel( final AbstractCallTreeNode<AssemblyComponentOperationPair> node, final boolean shortLabels) { final AssemblyComponentOperationPair p = node.getEntity(); final AssemblyComponent component = p.getAssemblyComponent(); final Operation operation = p.getOperation(); final String assemblyComponentName = component.getName(); final String componentTypePackagePrefx = component.getType().getPackageName(); final String componentTypeIdentifier = component.getType().getTypeName(); final StringBuilder strBuild = new StringBuilder(assemblyComponentName).append(":"); if (!shortLabels) { strBuild.append(componentTypePackagePrefx).append('.'); } else { strBuild.append(".."); } strBuild.append(componentTypeIdentifier).append("\\n."); final Signature sig = operation.getSignature(); final StringBuilder opLabel = new StringBuilder(sig.getName()); opLabel.append('('); final String[] paramList = sig.getParamTypeList(); if (paramList.length > 0) { opLabel.append(".."); } opLabel.append(')'); strBuild.append(opLabel.toString()); return strBuild.toString(); }
@Override public String toString() { final StringBuilder strBuild = new StringBuilder(); strBuild.append(this.timestamp) .append(' '); if (this.getSendingExecution().getOperation().getId() == Operation.ROOT_OPERATION_ID) { strBuild.append(SystemModelRepository.ROOT_NODE_LABEL); } else { strBuild.append(this.getSendingExecution()); } strBuild.append(" --> "); if (this.getReceivingExecution().getOperation().getId() == Operation.ROOT_OPERATION_ID) { strBuild.append(SystemModelRepository.ROOT_NODE_LABEL); } else { strBuild.append(this.getReceivingExecution()); } return strBuild.toString(); }
private static final String allocationComponentOperationPairNodeLabel( final AbstractCallTreeNode<AllocationComponentOperationPair> node, final boolean shortLabels) { final AllocationComponentOperationPair p = node.getEntity(); final AllocationComponent component = p.getAllocationComponent(); final Operation operation = p.getOperation(); final String resourceContainerName = component.getExecutionContainer().getName(); final String assemblyComponentName = component.getAssemblyComponent().getName(); final String componentTypePackagePrefx = component.getAssemblyComponent().getType().getPackageName(); final String componentTypeIdentifier = component.getAssemblyComponent().getType().getTypeName(); final StringBuilder strBuild = new StringBuilder(resourceContainerName).append("::\\n") .append(assemblyComponentName).append(":"); if (!shortLabels) { strBuild.append(componentTypePackagePrefx).append('.'); } else { strBuild.append(".."); } strBuild.append(componentTypeIdentifier).append("\\n."); final Signature sig = operation.getSignature(); final StringBuilder opLabel = new StringBuilder(sig.getName()); opLabel.append('('); final String[] paramList = sig.getParamTypeList(); if (paramList.length > 0) { opLabel.append(".."); } opLabel.append(')'); strBuild.append(opLabel.toString()); return strBuild.toString(); }
/** * Creates a new pair using both elements and registers it was well. * * @param operation * The second element of the pair (the operation). * @param allocationComponent * The first element of the pair (the allocation component). * * @return The newly created pair. */ private final AllocationComponentOperationPair createAndRegisterPair(final Operation operation, final AllocationComponent allocationComponent) { return this.createAndRegisterPair(allocationComponent.getId() + "-" + operation.getId(), operation, allocationComponent); }
final Signature sig = me.getReceivingExecution().getOperation().getSignature(); final StringBuilder msgLabel = new StringBuilder(sig.getName()); msgLabel.append('(');
/** * Returns a corresponding pair instance (existing or newly created). * * @param allocationComponent * The first element of the pair (the allocation component). * @param operation * The second element of the pair (the operation). * * @return A (possible new) pair containing both elements. */ public final AllocationComponentOperationPair getPairInstanceByPair(final AllocationComponent allocationComponent, final Operation operation) { final AllocationComponentOperationPair inst = this.getPairByNamedIdentifier(allocationComponent.getId() + "-" + operation.getId()); if (inst == null) { return this.createAndRegisterPair(operation, allocationComponent); } return inst; }
Assert.assertEquals("Class/Component type names differ", opExecClassOperationSignature.getFqClassname(), exec.getAllocationComponent().getAssemblyComponent().getType().getFullQualifiedName()); Assert.assertEquals("Signatures differ", opExecClassOperationSignature.getSignature(), exec.getOperation().getSignature());
/** * Returns a corresponding pair instance (existing or newly created). * * @param assemblyComponent * The assemble component for the pair. * @param operation * The operation for the pair. * * @return The corresponding pair instance if it exists, otherwise a new one. */ public final AssemblyComponentOperationPair getPairInstanceByPair(final AssemblyComponent assemblyComponent, final Operation operation) { final String namedIdentifier = assemblyComponent.getId() + "-" + operation.getId(); final AssemblyComponentOperationPair inst = this.getPairByNamedIdentifier(namedIdentifier); if (inst == null) { return this.createAndRegisterPair(namedIdentifier, operation, assemblyComponent); } return inst; }
/** * Checks whether the given executions are equal or not. * * @param r1 * The first execution object. * @param r2 * The second execution object. * * @return true if and only if the executions have the same values. */ private boolean executionsEqual(final Execution r1, final Execution r2) { if (r1 == r2) { // NOPMD (no equals) return true; } if ((r1 == null) || (r2 == null)) { return false; } return (r1.getAllocationComponent().getId() == r2.getAllocationComponent().getId()) && (r1.getOperation().getId() == r2.getOperation().getId()) && (r1.getEoi() == r2.getEoi()) && (r1.getEss() == r2.getEss()); }
/** * Creates a new instance of this class using the given parameters. * * @param t * The execution trace to be stored in this container. */ public ExecutionTraceHashContainerAllocationEquivalence(final ExecutionTrace t) { super(t); final int prime = 31; int result = 1; for (final Execution r : t.getTraceAsSortedExecutionSet()) { result = (prime * result) + r.getOperation().getId(); result = (prime * result) + r.getAllocationComponent().getId(); result = (prime * result) + r.getEoi(); result = (prime * result) + r.getEss(); } // this.hashcodeBuffer = result; }
/** * Checks whether the given executions are equal or not. * * @param r1 * The first execution object. * @param r2 * The second execution object. * * @return true if and only if the executions have the same values. */ private boolean executionsEqual(final Execution r1, final Execution r2) { if (r1 == r2) { // NOPMD (no equals) return true; } if ((r1 == null) || (r2 == null)) { return false; } return (r1.getAllocationComponent().getAssemblyComponent().getId() == r2.getAllocationComponent().getAssemblyComponent().getId()) && (r1.getOperation().getId() == r2.getOperation().getId()) && (r1.getEoi() == r2.getEoi()) && (r1.getEss() == r2.getEss()); }