use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.
the class TypeTransformationImpl method basicSetSource.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(TypeSet newSource, NotificationChain msgs) {
TypeSet oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.TYPE_TRANSFORMATION__SOURCE, oldSource, newSource);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.
the class OutgoingPropagationConditionImpl method basicSetTypeToken.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTypeToken(TypeSet newTypeToken, NotificationChain msgs) {
TypeSet oldTypeToken = typeToken;
typeToken = newTypeToken;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.OUTGOING_PROPAGATION_CONDITION__TYPE_TOKEN, oldTypeToken, newTypeToken);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.
the class OutgoingPropagationConditionImpl method basicSetTypeTokenConstraint.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetTypeTokenConstraint(TypeSet newTypeTokenConstraint, NotificationChain msgs) {
TypeSet oldTypeTokenConstraint = typeTokenConstraint;
typeTokenConstraint = newTypeTokenConstraint;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ErrorModelPackage.OUTGOING_PROPAGATION_CONDITION__TYPE_TOKEN_CONSTRAINT, oldTypeTokenConstraint, newTypeTokenConstraint);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.
the class EMV2Properties method getFailure.
/**
* @param element - the EMV2 element that referes to the artifact
* @param relatedComponent - the component the component (instance, subcomponent or classifier) that have the property association
* @return - the text related to the failure part of the hazards property. Null if not defined
*/
public static String getFailure(NamedElement element, NamedElement relatedComponent) {
TypeSet ts = null;
if (element instanceof ErrorBehaviorState) {
ts = ((ErrorBehaviorState) element).getTypeSet();
}
if (element instanceof ErrorPropagation) {
ts = ((ErrorPropagation) element).getTypeSet();
}
if (element instanceof ErrorEvent) {
ts = ((ErrorEvent) element).getTypeSet();
}
List<EMV2PropertyAssociation> PA = EMV2Properties.getHazardsProperty(relatedComponent, element, ts);
if (PA.isEmpty()) {
return null;
}
// XXX TODO we may get more than one back, one each for different types
PropertyExpression val = getPropertyValue(PA.get(0));
if (val instanceof RecordValue) {
RecordValue rv = (RecordValue) val;
EList<BasicPropertyAssociation> fields = rv.getOwnedFieldValues();
BasicPropertyAssociation xref = GetProperties.getRecordField(fields, "failure");
if (xref != null) {
PropertyExpression peVal = getPropertyValue(xref);
if (peVal instanceof StringLiteral) {
return ((StringLiteral) peVal).getValue();
}
}
}
if (val instanceof ListValue) {
ListValue lv = (ListValue) val;
for (PropertyExpression pe : lv.getOwnedListElements()) {
if (pe instanceof RecordValue) {
RecordValue rv = (RecordValue) pe;
EList<BasicPropertyAssociation> fields = rv.getOwnedFieldValues();
BasicPropertyAssociation xref = GetProperties.getRecordField(fields, "failure");
if (xref != null) {
PropertyExpression peVal = getPropertyValue(xref);
if (peVal instanceof StringLiteral) {
return ((StringLiteral) peVal).getValue();
}
}
}
}
}
return null;
}
use of org.osate.xtext.aadl2.errormodel.errorModel.TypeSet in project osate2 by osate.
the class EMV2TypeSetUtil method reverseMapTypeToken.
/**
* map a TypeToken from the target type token to the first type token in the source type set according to the TypeMappingSet.
* The original token is not modified.
* The result token is currently that from the mapping rule and is not expected to be modified
* @param token TypeToken
* @param tms TypeMappingSet
* @return result TypeToken or null if no mapping found
*/
public static TypeToken reverseMapTypeToken(TypeToken token, TypeMappingSet tms) {
EList<TypeMapping> tmlist = tms.getMapping();
for (TypeMapping typeMapping : tmlist) {
TypeSet src = typeMapping.getSource();
TypeSet trg = typeMapping.getTarget();
if (contains(trg, token)) {
return src.getTypeTokens().get(0);
}
}
return null;
}
Aggregations