use of org.osate.ba.declarative.Identifier in project osate2 by osate.
the class AadlBaNameResolver method behaviorTimeResolver.
private boolean behaviorTimeResolver(DeclarativeTime bt) {
Identifier timeUnit = bt.getUnitId();
boolean result = integerValueResolver(bt.getIntegerValue());
result &= timeUnitResolver(timeUnit);
if (result && bt.getIntegerValue() instanceof BehaviorIntegerLiteral) {
BehaviorIntegerLiteral bil = (BehaviorIntegerLiteral) bt.getIntegerValue();
bil.setUnit((UnitLiteral) timeUnit.getOsateRef());
}
return result;
}
use of org.osate.ba.declarative.Identifier in project osate2 by osate.
the class AadlBaNameResolver method transDestStateResolver.
private boolean transDestStateResolver(DeclarativeBehaviorTransition trans) {
BehaviorState state = null;
Identifier id = trans.getDestState();
state = AadlBaVisitors.findBehaviorState(_ba, id.getId());
if (state != null) {
id.setBaRef(state);
return true;
} else {
reportNameError(id, id.getId());
return false;
}
}
use of org.osate.ba.declarative.Identifier in project osate2 by osate.
the class AadlBaNameResolver method transSrcStateResolver.
private boolean transSrcStateResolver(DeclarativeBehaviorTransition trans) {
boolean result = true;
BehaviorState state = null;
for (Identifier id : trans.getSrcStates()) {
state = AadlBaVisitors.findBehaviorState(_ba, id.getId());
if (state != null) {
id.setBaRef(state);
} else {
reportNameError(id, id.getId());
result = false;
}
}
return result;
}
use of org.osate.ba.declarative.Identifier in project osate2 by osate.
the class AadlBaNameResolver method classifierFeaturePropertyReferenceResolver.
private boolean classifierFeaturePropertyReferenceResolver(DeclarativePropertyReference ref) {
Reference component = ref.getReference();
if (refResolver(component)) {
PropertyAssociation pa = null;
Classifier type = null;
Identifier propertyNameId = ref.getPropertyNames().get(0).getPropertyName();
Element el = (component.getOsateRef() != null) ? component.getOsateRef() : component.getBaRef();
if (el instanceof PrototypeBinding) {
PrototypeBinding pb = (PrototypeBinding) el;
type = AadlBaUtils.getClassifier(pb, pb.getContainingClassifier());
} else if (el instanceof ClassifierFeature) {
ClassifierFeature cf = (ClassifierFeature) el;
// Fetch the own property association of the classifier feature.
pa = PropertyUtils.findPropertyAssociation(propertyNameId.getId(), cf);
if (pa == null) {
type = AadlBaUtils.getClassifier(cf, cf.getContainingClassifier());
}
} else if (el instanceof BehaviorVariable) {
BehaviorVariable bv = (BehaviorVariable) el;
DeclarativeBehaviorElement de = (DeclarativeBehaviorElement) bv.getDataClassifier();
if (de.getOsateRef() instanceof Classifier) {
type = (Classifier) de.getOsateRef();
}
} else // Cannot resolve or unimplemented cases.
{
String msg = "the type of \'" + ((NamedElement) el).getName() + "\' cannot be resolved";
_errManager.error(el, msg);
}
// search within its type.
if (pa == null && type != null) {
pa = PropertyUtils.findPropertyAssociation(propertyNameId.getId(), type);
}
if (pa != null) {
ref.getPropertyNames().get(0).setOsateRef(pa);
propertyNameId.setOsateRef(pa);
return propertyNameResolver(ref.getPropertyNames());
} else {
reportNameError(propertyNameId, propertyNameId.getId());
return false;
}
} else {
// refResolver has already reported the error.
return false;
}
}
use of org.osate.ba.declarative.Identifier in project osate2 by osate.
the class QualifiedNamedElementImpl method basicSetBaNamespace.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetBaNamespace(Identifier newBaNamespace, NotificationChain msgs) {
Identifier oldBaNamespace = baNamespace;
baNamespace = newBaNamespace;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DeclarativePackage.QUALIFIED_NAMED_ELEMENT__BA_NAMESPACE, oldBaNamespace, newBaNamespace);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
Aggregations