From 8c699d68d65f8af77790d305a4f8b29ceaa733d8 Mon Sep 17 00:00:00 2001 From: Alexander Diewald <diewald@fortiss.org> Date: Fri, 3 Mar 2017 14:12:53 +0000 Subject: [PATCH] - Cleanup ExplorationAlgUtils. --- .../alg/util/ExplorationAlgUtils.java | 118 ------------------ 1 file changed, 118 deletions(-) diff --git a/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/util/ExplorationAlgUtils.java b/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/util/ExplorationAlgUtils.java index 7f8cbd47..9ed66db6 100644 --- a/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/util/ExplorationAlgUtils.java +++ b/org.fortiss.af3.exploration.alg/trunk/src/org/fortiss/af3/exploration/alg/util/ExplorationAlgUtils.java @@ -37,12 +37,8 @@ import java.util.Queue; import java.util.Set; import java.util.Stack; import java.util.function.Predicate; -import java.util.stream.Stream; import org.conqat.lib.commons.reflect.ReflectionUtils; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Status; import org.eclipse.emf.common.util.BasicEList; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.common.util.TreeIterator; @@ -58,7 +54,6 @@ import org.fortiss.af3.exploration.alg.dse.backend.opt4j.solution.TimeSlot; import org.fortiss.af3.exploration.alg.exception.InvalidTimingModelException; import org.fortiss.af3.exploration.model.ExplorationTarget; import org.fortiss.af3.exploration.model.IProblemDimension; -import org.fortiss.af3.exploration.util.ExplorationUtils; import org.fortiss.af3.platform.model.IPlatformResource; import org.fortiss.af3.platform.model.IVirtualizationPlatformArchitectureElement; import org.fortiss.af3.platform.model.annotation.ResourceLink; @@ -140,16 +135,6 @@ public class ExplorationAlgUtils { return classes.stream().anyMatch(cls -> cls.isAssignableFrom(obj.getClass())); } - // // TODO: move to dedicated AF3 adapter class, or get the set dynamically from the adapters - // /** Contains a collection of platform elements which are connected via directed connections. - // */ - // public static Collection<Class<?>> directedConnectionElements = Collections - // .unmodifiableSet(new HashSet<Class<?>>() { - // { - // add(NocRouter.class); - // } - // }); - /** * Finds the (target) {@link InputPort}s to which the given {@link OutputPort} is connected. * 'Target Ports' are connected {@link InputPort}s of {@link Component}s from the set of @@ -182,40 +167,6 @@ public class ExplorationAlgUtils { return targets; } - /** - * Finds the (source) {@link OutputPort}s to which the given {@link InputPort} is connected. The - * search follows all channels to input ports of deployable/atomic {@link Component}s. The - * source port must be attached to an deployable/atomic {@link Component}, otherwise this method - * returns an empty list. - * - * @param sourcePort - * The port to start the search from. - * @return The list of target ports of atomic {@link Component}s. - * @throws Exception - * if the timing specification of any traversed element is inconsistent. - */ - // FIXME: HERE - // public static List<OutputPort> findSourcePorts(InputPort sourcePort) throws Exception { - // if(getEventAnnotationOf(sourcePort) == null && - // !isDefinedAsDeployableElement(sourcePort.getComponent())) { - // return Collections.emptyList(); - // } - // List<OutputPort> sources = new ArrayList<OutputPort>(); - // LinkedList<Channel> exploreChannels = new LinkedList<Channel>(); - // exploreChannels.addAll(sourcePort.getIncomingChannels()); - // while(!exploreChannels.isEmpty()) { - // Channel currentExploreChannel = exploreChannels.removeFirst(); - // Component currentSourceComponent = currentExploreChannel.getSource().getComponent(); - // if(/* getEventAnnotationOf(currentExploreChannel.getTarget()) != null || */ - // isDefinedAsDeployableElement(currentSourceComponent)) { - // sources.add((OutputPort)currentExploreChannel.getSource()); - // } else { - // exploreChannels.addAll(currentExploreChannel.getSource().getIncomingChannels()); - // } - // } - // return sources; - // } - /** * Returns a list of source ports within the given {@link ComponentArchitecture}. Source ports * are defined as ports that do not have direct inputs. @@ -410,62 +361,6 @@ public class ExplorationAlgUtils { return false; } - // /** - // * Determines whether the given element is relevant for a deployment. It examines whether the - // * given element is a sub-element of a deployment target or a sub-element of a virtualized - // * hardware element. If neither applies, the element is not part of a 'black box' and, hence, - // it - // * is 'relevant'. - // * - // * @param element - // * The platform element to be examined. - // * @param virtualizationProviders - // * The list of all present virtualization providers (hypervisors). - // * @return Boolean indicating the relevance for of the element for a deployment. - // */ - // public static boolean isPlatformTargetResource(IPlatformResource element, - // Collection<IPlatformResource> deploymentTargets, - // Collection<IVirtualizationPlatformArchitectureElement> virtualizationProviders) { - // if(isPlatformTargetResource(element, deploymentTargets) && - // (!hasVirtualizationLayer(element, virtualizationProviders)) || - // isReferencedByNetworkDriver(element, virtualizationProviders)) { - // return true; - // } - // return false; - // } - // - // /** - // * Determines whether the given element is referenced by network driver. Useful to determine - // * {@link GatewayUnit}s that would not be considered in the communication structure, if it - // were - // * "hidden" by a parent element. - // * - // * @param element - // * The {@link IHierarchicElement} to be examined. - // * @param virtualizationProviders - // * List of {@link IVirtualizationPlatformArchitectureElement}s that contain the - // * network drivers. - // * @return Predicate if the given element is referenced by a network driver located contained - // in - // * the given virtualization providers. - // */ - // private static boolean isReferencedByNetworkDriver(IPlatformResource element, - // Collection<IVirtualizationPlatformArchitectureElement> virtualizationProviders) { - // EList<GatewayUnit> allPresentNetworkDrivers = - // getAllChildrenWithType(virtualizationProviders, OnChipNetworkDriver.class); - // for(GatewayUnit currentNetworkDriver : allPresentNetworkDrivers) { - // EList<IHierarchicElement> referencedGateway = - // getReferencedElementsWithType(currentNetworkDriver, IHierarchicElement.class); - // assert (referencedGateway.size() == 1) : "The OnChipNetworkDriver " + - // currentNetworkDriver.getName() + - // " references none or more than one network interface. This is not supported."; - // if(referencedGateway.get(0) == element) { - // return true; - // } - // } - // return false; - // } - /** * Returns a list of child elements of the given type for each parent in the given collection. * NOTE: This operation can be very costly, if elements are contained in the list which are far @@ -486,19 +381,6 @@ public class ExplorationAlgUtils { return childrenWithType; } - // /** - // * Predicate, if the given {@link IHierarchicElement} has direct child elements are connected - // * via directed connections. - // */ - // public static boolean hasCildrenWithDirectedConnections(IHierarchicElement element) { - // for(IHierarchicElement currentElement : element.getContainedElements()) { - // if(directedConnectionElements.contains(currentElement.getClass())) { - // return true; - // } - // } - // return false; - // } - /** * Determines whether the given hardware element is virtualized by a * {@link IVirtualizationPlatformArchitectureElement}. -- GitLab