use of org.osate.ba.aadlba.BehaviorTransition 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.BehaviorTransition in project osate2 by osate.
the class BehaviorTransitionPropertySection method refresh.
@Override
public void refresh() {
final Optional<BusinessObjectContext> optSelectedBoc = selectedBos.bocStream().filter(boc -> isBehaviorTransition(boc) && ProjectUtil.getProjectForBo(boc.getBusinessObject()).isPresent()).findAny();
if (optSelectedBoc.isPresent()) {
final BusinessObjectContext selectedBoc = optSelectedBoc.orElseThrow();
final boolean isSingleSelection = selectedBos.bocStream().limit(2).count() == 1;
if (!isSingleSelection) {
setControlsToMultipleSelected();
} else {
final BehaviorTransition behaviorTransition = (BehaviorTransition) selectedBoc.getBusinessObject();
conditionTextEditor.setEditorTextValue(BehaviorTransitionEmbeddedTextUtil.createConditionTextValue(behaviorTransition));
actionBlockTextEditor.setEditorTextValue(BehaviorActionBlockEmbeddedTextValue.create(behaviorTransition));
}
}
}
use of org.osate.ba.aadlba.BehaviorTransition in project osate2 by osate.
the class BehaviorTransitionHandler method rename.
@Override
public void rename(final RenameContext ctx) {
final BehaviorTransition behaviorTransition = ctx.getBusinessObject(BehaviorTransition.class).orElseThrow();
final String newName = ctx.getNewName();
// An unnamed transition's name must be set to null
behaviorTransition.setName(newName.isEmpty() ? null : newName);
}
Aggregations