/** * Creates a new assembly component instance and registers it as well. * * @param namedIdentifier * The identifier of the new component. * @param componentType * The new component type. * * @return The newly created assembly component. */ public final AssemblyComponent createAndRegisterAssemblyComponentInstance(final String namedIdentifier, final ComponentType componentType) { if (this.assemblyComponentInstancesByName.containsKey(namedIdentifier)) { throw new IllegalArgumentException("Element with name " + namedIdentifier + "exists already"); } final int id = this.getAndIncrementNextId(); final AssemblyComponent newInst = new AssemblyComponent(id, "@" + id, componentType); this.assemblyComponentInstancesById.put(id, newInst); this.assemblyComponentInstancesByName.put(namedIdentifier, newInst); return newInst; }
/** * Utility function to create a textual container ID for an assembly component. * * @param component * The assembly component to create the ID for * @return The created ID */ protected static String createAssemblyComponentId(final AssemblyComponent component) { return COMPONENT_NODE_ID_PREFIX + component.getId(); }
for (final AssemblyComponent ac : assemblyComponents) { final String[] cells = new String[] { this.htmlEntityLabel(ac.getId(), Integer.toString(ac.getId()), EntityType.ASSEMBLY_COMPONENT), ac.getName(), this.htmlEntityRef(ac.getType().getId(), SystemModelRepository.simpleHTMLEscape(ac.getType().getFullQualifiedName()), EntityType.COMPONENT_TYPE), }; this.printHtmlTableRow(ps, cells); this.htmlEntityLabel(allocationComponent.getId(), Integer.toString(allocationComponent.getId()), EntityType.ALLOCATION_COMPONENT), this.htmlEntityRef(allocationComponent.getAssemblyComponent().getId(), SystemModelRepository.simpleHTMLEscape(allocationComponent.getAssemblyComponent().toString()), EntityType.ALLOCATION_COMPONENT), this.htmlEntityRef(allocationComponent.getExecutionContainer().getId(),
final AssemblyComponent assemblyComponent = entry.getKey(); if (assemblyComponent.isRootComponent()) { builder.append(DotFactory.createNode("", AbstractDependencyGraphFormatter.createNodeId(assemblyComponent.getId()), assemblyComponent.getName(), DotFactory.DOT_SHAPE_NONE,
final AssemblyComponent component = vertex.getEntity(); if (component.isRootComponent()) { this.builder.append(DotFactory.createNode("", AbstractDependencyGraphFormatter.createNodeId(vertex), component.getName(),
@Override public final String toString() { final StringBuilder strBuild = new StringBuilder(); strBuild.append(this.executionContainer.getName()).append("::").append(this.assemblyComponent.toString()); return strBuild.toString(); }
@Override public String getIdentifier() { return this.getAssemblyComponent().getIdentifier(); } }
@Override public String getIdentifier() { return this.getAssemblyComponent().getName(); } }
private String createNodeLabel(final DependencyGraphNode<AssemblyComponent> vertex, final AssemblyComponent component) { final StringBuilder builder = new StringBuilder(); builder.append(AbstractDependencyGraphFormatter.STEREOTYPE_ASSEMBLY_COMPONENT).append("\\n") .append(component.getName()).append(':'); if (this.useShortLabels) { builder.append("..").append(component.getType().getTypeName()); } else { builder.append(component.getType().getFullQualifiedName()); } AbstractGraphFormatter.formatDecorations(builder, vertex); return builder.toString(); }
ClassOperationSignaturePair.splitOperationSignatureStr(opExec.getOperationSignature()); Assert.assertEquals("Class/Component type names differ", opExecClassOperationSignature.getFqClassname(), exec.getAllocationComponent().getAssemblyComponent().getType().getFullQualifiedName()); Assert.assertEquals("Signatures differ", opExecClassOperationSignature.getSignature(), exec.getOperation().getSignature());
@Override public String toString() { return +this.assemblyComponent.getId() + ":" + this.operation.getId() + "@" + this.id; }
private static String assemblyComponentLabel(final AssemblyComponent component, final boolean shortLabels) { 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); return strBuild.toString(); }
/** * 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; }
private static String createComponentNodeLabel(final AssemblyComponent component, final boolean useShortLabels) { final StringBuilder builder = new StringBuilder(); builder.append(AbstractDependencyGraphFormatter.STEREOTYPE_ASSEMBLY_COMPONENT).append("\\n") .append(component.getName()).append(':'); if (useShortLabels) { builder.append(".."); } else { builder.append(component.getType().getPackageName()).append('.'); } builder.append(component.getType().getTypeName()); return builder.toString(); }
final AssemblyComponent senderComponent = me.getSendingExecution().getAllocationComponent().getAssemblyComponent(); final AssemblyComponent receiverComponent = me.getReceivingExecution().getAllocationComponent().getAssemblyComponent(); if (!plottedComponentIds.contains(senderComponent.getId())) { ps.print("object(O" + senderComponent.getId() + ",\"\",\"" + SequenceDiagramFilter.assemblyComponentLabel(senderComponent, shortLabels) + "\");" + "\n"); plottedComponentIds.add(senderComponent.getId()); if (!plottedComponentIds.contains(receiverComponent.getId())) { ps.print("object(O" + receiverComponent.getId() + ",\"\",\"" + SequenceDiagramFilter.assemblyComponentLabel(receiverComponent, shortLabels) + "\");" + "\n"); plottedComponentIds.add(receiverComponent.getId()); final AssemblyComponent senderComponent = me.getSendingExecution().getAllocationComponent().getAssemblyComponent(); final AssemblyComponent receiverComponent = me.getReceivingExecution().getAllocationComponent().getAssemblyComponent(); senderDotId = "O" + senderComponent.getId(); receiverDotId = "O" + receiverComponent.getId(); } else { // needs to be adjusted if a new mode is introduced AbstractAnalysisComponent.LOGGER.error("Invalid mode: {}", sdMode);
private static String createAllocationComponentNodeLabel(final AllocationComponent component, final boolean useShortLabels) { final StringBuilder builder = new StringBuilder(); builder.append(AbstractDependencyGraphFormatter.STEREOTYPE_ALLOCATION_COMPONENT).append("\\n") .append(component.getAssemblyComponent().getName()).append(':'); if (useShortLabels) { builder.append(".."); } else { builder.append(component.getAssemblyComponent().getType().getPackageName()).append('.'); } builder.append(component.getAssemblyComponent().getType().getTypeName()); return builder.toString(); }
/** * 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()); }