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));
}
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));
}
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));
}
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;
}
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"));
// }
}
Aggregations