use of org.osate.xtext.aadl2.properties.util.GetProperties in project osate2 by osate.
the class CheckBindingConstraints method runAnalysis.
public static List<Issue> runAnalysis(IProgressMonitor monitor, SystemInstance si) {
List<Issue> issuesList = new ArrayList<>();
SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
System.out.println(si.getSystemOperationModes().size());
SubMonitor loopMonitor = subMonitor.split(100).setWorkRemaining(si.getSystemOperationModes().size());
for (SOMIterator somIter = new SOMIterator(si); somIter.hasNext(); ) {
SystemOperationMode som = somIter.next();
SubMonitor iterationMonitor = loopMonitor.split(1);
iterationMonitor.setWorkRemaining(8);
// Processor binding
SubMonitor processorChild = iterationMonitor.split(2);
subMonitor.setTaskName("Getting Processor Binding Components");
processorChild.split(1);
List<ComponentInstance> processorBindingComponents = getComponents(monitor, si, ComponentCategory.THREAD, ComponentCategory.VIRTUAL_PROCESSOR, ComponentCategory.DEVICE).collect(Collectors.toList());
processorChild.setTaskName("Checking Processor Bindings");
processorChild.split(1);
issuesList.addAll(checkBindingConstraints(processorBindingComponents.stream(), "processor", GetProperties::getActualProcessorBinding, GetProperties::getAllowedProcessorBinding, GetProperties::getAllowedProcessorBindingClass, som));
// Dispatch Protocol
subMonitor.setTaskName("Checking Dispacth Protocols");
SubMonitor dispatchChild = iterationMonitor.split(1);
issuesList.addAll(checkDispatchProtocol(processorBindingComponents.stream(), som));
// Memory binding
subMonitor.setTaskName("Getting Memory Components");
SubMonitor memrChild = iterationMonitor.split(2);
memrChild.split(1);
Stream<ComponentInstance> memoryBindingComponents = getComponents(monitor, si, ComponentCategory.THREAD, ComponentCategory.DEVICE, ComponentCategory.DATA, ComponentCategory.SUBPROGRAM, ComponentCategory.PROCESSOR, ComponentCategory.VIRTUAL_PROCESSOR);
subMonitor.setTaskName("Checking Memory Bindings");
memrChild.split(1);
Stream<FeatureInstance> memoryBindingFeatures = getFeatures(monitor, si, FeatureCategory.DATA_PORT, FeatureCategory.EVENT_DATA_PORT);
Stream<InstanceObject> memoryBindingElements = Stream.concat(memoryBindingComponents, memoryBindingFeatures);
issuesList.addAll(checkBindingConstraints(memoryBindingElements, "memory", GetProperties::getActualMemoryBinding, GetProperties::getAllowedMemoryBinding, GetProperties::getAllowedMemoryBindingClass, som));
// Connection binding (only handles connection and virtual bus)
subMonitor.setTaskName("Checking Connection Bindings");
SubMonitor conenctionChild = iterationMonitor.split(1);
Stream<ComponentInstance> connectionBindingComponents = getComponents(monitor, si, ComponentCategory.VIRTUAL_BUS);
Stream<ConnectionInstance> connectionBindingConnections = getConnections(monitor, si);
List<InstanceObject> connectionBindingElements = Stream.concat(connectionBindingComponents, connectionBindingConnections).collect(Collectors.toList());
issuesList.addAll(checkBindingConstraints(connectionBindingElements.stream(), "connection", GetProperties::getActualConnectionBinding, GetProperties::getAllowedConnectionBinding, GetProperties::getAllowedConnectionBindingClass, som));
// Connection Quality of Service
subMonitor.setTaskName("Checking Connection Quality of Services");
SubMonitor qualityChild = iterationMonitor.split(1);
issuesList.addAll(checkRequiredAndProvided(connectionBindingElements.stream(), GetProperties::getRequiredConnectionQualityOfService, "Required_Connection_Quality_Of_Service", GetProperties::getProvidedConnectionQualityOfService, qos -> qos.getName(), som));
// Virtual Bus Class
subMonitor.setTaskName("Checking Virtual Bus Bindings");
SubMonitor busChild = iterationMonitor.split(1);
Function<ComponentInstance, Collection<ComponentClassifier>> getProvidedVBClass = boundElement -> {
Stream<ComponentClassifier> providedProperty = GetProperties.getProvidedVirtualBusClass(boundElement).stream();
Stream<ComponentClassifier> providedBySubcomponent = boundElement.getComponentInstances().stream().map(subcomponent -> subcomponent.getClassifier());
return Stream.concat(providedProperty, providedBySubcomponent).collect(Collectors.toSet());
};
issuesList.addAll(checkRequiredAndProvided(connectionBindingElements.stream(), GetProperties::getRequiredVirtualBusClass, "Required_Virtual_Bus_Class", getProvidedVBClass, vbClass -> vbClass.getName(), som));
busChild.setWorkRemaining(0);
}
subMonitor.setWorkRemaining(0);
return issuesList;
}
Aggregations