@Override public boolean equals(Object other) { if (other == null) { return false; } //TODO: getOwner.equals may be troublesome, because they are not directly the owners, but Optionals of owners if (other instanceof RequiredExecutionPlatformInstance) { RequiredExecutionPlatformInstance otherNode = (RequiredExecutionPlatformInstance) other; return getName().equals(otherNode.getName()) && this.getOwner().equals(otherNode.getOwner()); } else { return false; } } }
public InternalComponentInstance getSubject() { return (InternalComponentInstance) getRequiredEnd().getOwner().get(); }
public boolean hasSubject(InternalComponentInstance component) { return getRequiredEnd().getOwner().get().getName().equals(component.getName()); }
public InternalComponentInstance(String name, InternalComponent type) { super(name, type); requiredPortInstances = instantiateAllRequiredPorts(type); requiredExecutionPlatformInstance = type.getRequiredExecutionPlatform().instantiate(); requiredExecutionPlatformInstance.getOwner().set(this); this.status = State.UNINSTALLED; }
private void addExecutes(){ addedExecutes = new ArrayList<ExecuteInstance>(targetDM.getExecuteInstances()); addedExecutes.removeAll(matchingExecutes.values()); for (ExecuteInstance ei : addedExecutes) { int i = currentDM.getComponentInstances().toList().indexOf(ei.getRequiredEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); ei.setRequiredEnd(((InternalComponentInstance) a).getRequiredExecutionPlatform()); } i = currentDM.getComponentInstances().toList().indexOf(ei.getProvidedEnd().getOwner().get()); if (i >= 0) { ComponentInstance a = currentDM.getComponentInstances().toList().get(i); int j = a.getProvidedExecutionPlatforms().toList().indexOf(ei.getProvidedEnd()); List<ProvidedExecutionPlatformInstance> l = a.getProvidedExecutionPlatforms().toList(); ei.setProvidedEnd(l.get(j)); } } }
private void initRequiredExecutionPlatformInstance(net.cloudml.core.InternalComponentInstance kInternalComponentInstance, InternalComponentInstance ai) { if (kInternalComponentInstance.getRequiredExecutionPlatformInstance() != null) { //assert !vmInstances.isEmpty(); RequiredExecutionPlatformInstance repi = new RequiredExecutionPlatformInstance(kInternalComponentInstance.getRequiredExecutionPlatformInstance().getName(), ai.getType().getRequiredExecutionPlatform()); repi.getOwner().set(ai); convertProperties(kInternalComponentInstance.getRequiredExecutionPlatformInstance(), repi); convertResources(kInternalComponentInstance.getRequiredExecutionPlatformInstance(), repi); requiredExecutionPlatformInstances.put(repi.getName(), repi); ai.setRequiredExecutionPlatform(repi); } }
public boolean isBetween(String demanderName, String demandName, String providerName, String providedName) { return this.getRequiredEnd().getOwner().get().isNamed(demanderName) && this.getRequiredEnd().isNamed(demandName) && this.getProvidedEnd().getOwner().get().isNamed(providerName) && this.getProvidedEnd().isNamed(providedName); }