use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.
the class BehaviorTransitionImpl method basicSetCondition.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetCondition(BehaviorCondition newCondition, NotificationChain msgs) {
BehaviorCondition oldCondition = condition;
condition = newCondition;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AadlBaPackage.BEHAVIOR_TRANSITION__CONDITION, oldCondition, newCondition);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.
the class AadlBaNameResolver method behaviorTransitionResolver.
/**
* Document: AADL Behavior Annex draft
* Version : 0.94
* Type : Naming rule
* Section : D.3 Behavior Specification
* Object : Check naming rule D.3.(N2)
* Keys : empty execution condition
*
* Resolves the names in behavior annex's transitions.
*
* @return {@code true} if all names are resolved. {@code false} otherwise.
*/
private boolean behaviorTransitionResolver() {
boolean result = true;
for (BehaviorTransition tmp : _ba.getTransitions()) {
DeclarativeBehaviorTransition trans = (DeclarativeBehaviorTransition) tmp;
result &= transDestStateResolver(trans);
result &= transSrcStateResolver(trans);
BehaviorCondition cond = trans.getCondition();
// as no condition means always true.
if (cond != null) {
// Case of a dispatch condition
if (cond instanceof DispatchCondition) {
result &= dispatchConditionResolver((DispatchCondition) cond);
} else // Case of mode switch condition
if (cond instanceof ModeSwitchTriggerLogicalExpression) {
result &= modeSwitchTriggerLogicalExpression((ModeSwitchTriggerLogicalExpression) cond);
} else // ModeSwitchTriggerLogicalExpression
// Case of a execute condition
{
if (cond instanceof ValueExpression) {
result &= valueExpressionResolver((ValueExpression) cond);
}
}
}
BehaviorActionBlock block = trans.getActionBlock();
// Behavior actions of an behavior transition may not exist.
if (block != null) {
result &= behaviorActionBlockResolver(block);
}
}
return result;
}
use of org.osate.ba.aadlba.BehaviorCondition in project osate2 by osate.
the class BehaviorTransitionEmbeddedTextUtil method getConditionOffset.
private static int getConditionOffset(final BehaviorTransition behaviorTransition, final String sourceText) {
final BehaviorCondition condition = behaviorTransition.getCondition();
final int conditionOffset;
if (condition == null) {
// Transition offset
final int transitionOffset = behaviorTransition.getAadlBaLocationReference().getOffset();
final Pair<Character, Character> charsToMatch = new Pair<Character, Character>('-', '[');
// Find index for beginning of condition text "-["
conditionOffset = BehaviorAnnexXtextUtil.findUncommentedCharPair(sourceText.substring(transitionOffset), charsToMatch) + transitionOffset;
} else {
// Condition offset
conditionOffset = condition.getAadlBaLocationReference().getOffset();
}
return conditionOffset;
}
Aggregations