use of org.osate.ba.declarative.Reference in project osate2 by osate.
the class AadlBaTypeChecker method unparseNameElement.
private String unparseNameElement(BehaviorElement e) {
if (e instanceof Reference) {
return unparseReference((Reference) e);
} else {
AadlBaUnparser unparser = new AadlBaUnparser();
unparser.process(e);
return unparser.getOutput();
}
}
use of org.osate.ba.declarative.Reference in project osate2 by osate.
the class AadlBaTypeChecker method dispatchConditionCheck.
/**
* Document: AADL Behavior Annex draft
* Version : 0.94
* Type : Naming rule
* Section : D.4 Thread Dispatch Behavior Specification
* Object : Check naming rules D.4.(N1), D.4.(N2)
* Keys : frozen port, subprogram access feature, dispatch trigger condition
*/
private boolean dispatchConditionCheck(DispatchCondition cond) {
boolean result = false;
DispatchTriggerCondition dtc = cond.getDispatchTriggerCondition();
if (dtc != null) {
DispatchTriggerCondition tmp = dispatchTriggerConditionCheck(dtc);
result = tmp != null;
// dispatchTriggerConditionCheck method. So replace if needed.
if (tmp != dtc && result) {
cond.setDispatchTriggerCondition(tmp);
}
} else {
result = true;
}
if (cond.isSetFrozenPorts()) {
PortHolder portHolder = null;
ListIterator<ActualPortHolder> it = cond.getFrozenPorts().listIterator();
while (it.hasNext()) {
Reference ref = (Reference) it.next();
portHolder = frozenPortCheck(ref);
if (portHolder != null) {
it.set((ActualPortHolder) portHolder);
} else {
result = false;
}
}
}
return result;
}
use of org.osate.ba.declarative.Reference in project osate2 by osate.
the class AadlBaNameResolver method dispatchTriggerLogicalExpressionResolver.
private boolean dispatchTriggerLogicalExpressionResolver(DispatchTriggerLogicalExpression dtle) {
boolean result = true;
for (DispatchConjunction dc : dtle.getDispatchConjunctions()) {
for (Element e : dc.getDispatchTriggers()) {
Reference trigg = (Reference) e;
result &= refResolver(trigg);
}
}
return result;
}
use of org.osate.ba.declarative.Reference in project osate2 by osate.
the class AadlBaNameResolver method communicationActionResolver.
private boolean communicationActionResolver(CommAction act) {
boolean result = true;
if (act.getTarget() != null) {
result &= targetResolver(act.getTarget());
}
if (act.getQualifiedName() != null) {
result &= qualifiedNamedElementResolver(act.getQualifiedName(), true);
}
if (act.getReference() != null) {
// Ambiguous cases :
// _ unqualified unique component classifier reference
// without implementation information provided, are parsed as reference
// (single name) without array index.
// _ unqualified unique component classifier reference with
// implementation information provided and a reference (two names)
// without array index.
Reference ref = act.getReference();
EList<ArrayableIdentifier> ids = ref.getIds();
boolean hasArrayIndex = false;
// names.
if (ids.size() > 2) {
result &= refResolver(ref);
} else {
for (ArrayableIdentifier id : ids) {
if (id.isSetArrayIndexes()) {
hasArrayIndex = true;
}
}
// unique component classifier reference can't have array index.
if (hasArrayIndex) {
result &= refResolver(ref);
} else {
// Resolves ambiguous case between unqualified unique component
// classifier reference and a reference with only one name.
ArrayableIdentifier idComponent = ids.get(0);
StringBuilder subprogramName = new StringBuilder();
subprogramName.append(idComponent.getId());
if (ids.size() == 2) {
ArrayableIdentifier idImplementation = ids.get(1);
subprogramName.append('.');
subprogramName.append(idImplementation.getId());
}
QualifiedNamedElement qne = DeclarativeFactory.eINSTANCE.createQualifiedNamedElement();
// Clone the identifier as object reference in the most of the AADLBA
// Front End emf meta model classes are unique (the containment
// attribute set to true).
Identifier idClone = DeclarativeFactory.eINSTANCE.createIdentifier();
idClone.setLocationReference(idComponent.getLocationReference());
idClone.setId(subprogramName.toString());
qne.setBaName(idClone);
qne.setBaNamespace(null);
qne.setLocationReference(idComponent.getLocationReference());
if (qualifiedNamedElementResolver(qne, false)) {
act.setReference(null);
act.setQualifiedName(qne);
act.setLocationReference(qne.getLocationReference());
result &= true;
} else {
result &= refResolver(ref);
}
}
}
}
if (act.isSetParameters()) {
result &= subprogramParameterListResolver(act.getParameters());
}
return result;
}
use of org.osate.ba.declarative.Reference in project osate2 by osate.
the class NamedValueImpl method basicSetReference.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetReference(Reference newReference, NotificationChain msgs) {
Reference oldReference = reference;
reference = newReference;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeclarativePackage.NAMED_VALUE__REFERENCE, oldReference, newReference);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations