Search in sources :

Example 21 with ComponentClassifier

use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.

the class StakeholderGoalsImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ComponentClassifier newTarget) {
    ComponentClassifier oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.STAKEHOLDER_GOALS__TARGET, oldTarget, target));
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 22 with ComponentClassifier

use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.

the class SystemRequirementSetImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ComponentClassifier newTarget) {
    ComponentClassifier oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ReqSpecPackage.SYSTEM_REQUIREMENT_SET__TARGET, oldTarget, target));
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 23 with ComponentClassifier

use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.

the class VerificationMethodImpl method setTarget.

/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void setTarget(ComponentClassifier newTarget) {
    ComponentClassifier oldTarget = target;
    target = newTarget;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, VerifyPackage.VERIFICATION_METHOD__TARGET, oldTarget, target));
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 24 with ComponentClassifier

use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.

the class Binpack method testClassifier.

/**
 * Test a component against a set of classifiers.
 *
 * @return Whether the component's classifier type is a descendent of any of
 *         the given component classifiers. <em>Returns <code>true</code>
 *         if the given set is empty!</em>
 */
public boolean testClassifier(ComponentInstance ci, final Set<? extends ComponentClassifier> classifiers) {
    if (classifiers.isEmpty()) {
        return true;
    }
    boolean match = false;
    ComponentClassifier cicc = InstanceUtil.getComponentClassifier(ci, 0, null);
    if (cicc == null) {
        return true;
    }
    for (final Iterator<? extends ComponentClassifier> i = classifiers.iterator(); i.hasNext() && !match; ) {
        final ComponentClassifier cc = i.next();
        match = cicc.isDescendentOf(cc);
    }
    return match;
}
Also used : ComponentClassifier(org.osate.aadl2.ComponentClassifier)

Example 25 with ComponentClassifier

use of org.osate.aadl2.ComponentClassifier in project osate2 by osate.

the class ThreadCheck method perform.

@Override
public void perform(SystemInstance si) {
    final List<ComponentInstance> allThreads = si.getAllComponentInstances().stream().filter(comp -> (comp.getCategory() == ComponentCategory.THREAD)).collect(Collectors.toList());
    /**
     * Each thread needs to specify the dispatch protocol "periodic" or
     * "sporadic"
     */
    allThreads.stream().filter(comp -> {
        EnumerationLiteral protocol = GetProperties.getDispatchProtocol(comp);
        return protocol == null || !(protocol.toString().equalsIgnoreCase(AadlProject.PERIODIC_LITERAL) || protocol.toString().equalsIgnoreCase(AadlProject.SPORADIC_LITERAL));
    }).forEach(thr -> addError(new ErrorReport(thr, "Thread needs a Thread_Properties::Dispatch_Protocol property of 'Periodic' or 'Sporadic'")));
    /**
     * Each thread needs to specify period
     */
    final List<ComponentInstance> threadMissingPeriod = allThreads.stream().filter(comp -> (PropertyUtils.getScaled(TimingProperties::getPeriod, comp, TimeUnits.MS).orElse(0.0) == 0.0)).collect(Collectors.toList());
    for (ComponentInstance thr : threadMissingPeriod) {
        addError(new ErrorReport(thr, "Thread must define the property Timing_Properties::Period"));
    }
    final List<ComponentInstance> threadMissingDeadline = allThreads.stream().filter(comp -> (PropertyUtils.getScaled(TimingProperties::getDeadline, comp, TimeUnits.MS).orElse(0.0) == 0.0)).collect(Collectors.toList());
    for (ComponentInstance thr : threadMissingDeadline) {
        addError(new ErrorReport(thr, "Thread must define the property Timing_Properties::Deadline"));
    }
    for (ComponentInstance ci : allThreads) {
        ComponentClassifier cc = ci.getComponentClassifier();
        if (cc instanceof ThreadImplementation) {
            ThreadImplementation ti = (ThreadImplementation) cc;
            for (SubprogramCall sc : ti.getSubprogramCalls()) {
                NamedElement cs = (NamedElement) sc.getCalledSubprogram();
                if (GetProperties.getSourceName(cs) == null) {
                    addError(new ErrorReport(cs, "Subprogram must define the property Programming_Properties::Source_Name"));
                }
                if (GetProperties.getSourceText(cs).size() == 0) {
                    addError(new ErrorReport(cs, "Subprogram must define the property Programming_Properties::Source_Text"));
                }
                if (GetProperties.getSourceLanguage(cs).size() == 0) {
                    addError(new ErrorReport(cs, "Subprogram must define the property Programming_Properties::Source_Language"));
                }
            }
        }
    }
/**
 * FIXME JD Each thread needs to specify execution time
 */
// List<ComponentInstance> threadMissingExecutionTime =
// (List<ComponentInstance>) si.getAllComponentInstances().stream().
// filter( comp -> (comp.getCategory() == ComponentCategory.THREAD) &&
// (GetProperties.get > 0.0));
// for (ComponentInstance thr : threadMissingPeriod)
// {
// addError (new ErrorReport (thr, "Thread needs to define a period"));
// }
}
Also used : ComponentInstance(org.osate.aadl2.instance.ComponentInstance) SystemInstance(org.osate.aadl2.instance.SystemInstance) ThreadImplementation(org.osate.aadl2.ThreadImplementation) PropertyUtils(org.osate.pluginsupport.properties.PropertyUtils) AadlProject(org.osate.xtext.aadl2.properties.util.AadlProject) Collectors(java.util.stream.Collectors) ErrorReport(org.osate.codegen.checker.report.ErrorReport) ComponentClassifier(org.osate.aadl2.ComponentClassifier) List(java.util.List) TimingProperties(org.osate.aadl2.contrib.timing.TimingProperties) ComponentCategory(org.osate.aadl2.ComponentCategory) TimeUnits(org.osate.aadl2.contrib.aadlproject.TimeUnits) GetProperties(org.osate.xtext.aadl2.properties.util.GetProperties) NamedElement(org.osate.aadl2.NamedElement) SubprogramCall(org.osate.aadl2.SubprogramCall) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral) ErrorReport(org.osate.codegen.checker.report.ErrorReport) ComponentClassifier(org.osate.aadl2.ComponentClassifier) ComponentInstance(org.osate.aadl2.instance.ComponentInstance) ThreadImplementation(org.osate.aadl2.ThreadImplementation) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral) SubprogramCall(org.osate.aadl2.SubprogramCall) NamedElement(org.osate.aadl2.NamedElement)

Aggregations

ComponentClassifier (org.osate.aadl2.ComponentClassifier)76 Subcomponent (org.osate.aadl2.Subcomponent)26 Classifier (org.osate.aadl2.Classifier)22 EObject (org.eclipse.emf.ecore.EObject)19 NamedElement (org.osate.aadl2.NamedElement)19 ComponentImplementation (org.osate.aadl2.ComponentImplementation)16 ArrayList (java.util.ArrayList)15 ComponentInstance (org.osate.aadl2.instance.ComponentInstance)14 AadlPackage (org.osate.aadl2.AadlPackage)13 FeatureGroupType (org.osate.aadl2.FeatureGroupType)12 List (java.util.List)11 ComponentPrototype (org.osate.aadl2.ComponentPrototype)11 Element (org.osate.aadl2.Element)11 ComponentType (org.osate.aadl2.ComponentType)10 Feature (org.osate.aadl2.Feature)9 Mode (org.osate.aadl2.Mode)8 BusinessObjectContext (org.osate.ge.BusinessObjectContext)8 Collectors (java.util.stream.Collectors)7 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)7 ComponentCategory (org.osate.aadl2.ComponentCategory)7