use of org.osate.aadl2.ContainedNamedElement in project osate2 by osate.
the class AbstractInstanceSemanticSequencer method sequence.
@Override
public void sequence(ISerializationContext context, EObject semanticObject) {
EPackage epackage = semanticObject.eClass().getEPackage();
ParserRule rule = context.getParserRule();
Action action = context.getAssignedAction();
Set<Parameter> parameters = context.getEnabledBooleanParameters();
if (epackage == Aadl2Package.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case Aadl2Package.ARRAY_RANGE:
sequence_ArrayRange(context, (ArrayRange) semanticObject);
return;
case Aadl2Package.BASIC_PROPERTY_ASSOCIATION:
sequence_FieldPropertyAssociation(context, (BasicPropertyAssociation) semanticObject);
return;
case Aadl2Package.BOOLEAN_LITERAL:
sequence_BooleanLiteral(context, (BooleanLiteral) semanticObject);
return;
case Aadl2Package.CLASSIFIER_VALUE:
sequence_ComponentClassifierTerm(context, (ClassifierValue) semanticObject);
return;
case Aadl2Package.COMPUTED_VALUE:
sequence_ComputedTerm(context, (ComputedValue) semanticObject);
return;
case Aadl2Package.CONTAINED_NAMED_ELEMENT:
sequence_ContainmentPath(context, (ContainedNamedElement) semanticObject);
return;
case Aadl2Package.CONTAINMENT_PATH_ELEMENT:
sequence_ContainmentPathElement(context, (ContainmentPathElement) semanticObject);
return;
case Aadl2Package.INTEGER_LITERAL:
sequence_IntegerTerm(context, (IntegerLiteral) semanticObject);
return;
case Aadl2Package.LIST_VALUE:
sequence_ListTerm(context, (ListValue) semanticObject);
return;
case Aadl2Package.MODAL_PROPERTY_VALUE:
if (rule == grammarAccess.getModalPropertyValueRule()) {
sequence_ModalPropertyValue(context, (ModalPropertyValue) semanticObject);
return;
} else if (rule == grammarAccess.getOptionalModalPropertyValueRule()) {
sequence_OptionalModalPropertyValue(context, (ModalPropertyValue) semanticObject);
return;
} else if (rule == grammarAccess.getPropertyValueRule()) {
sequence_PropertyValue(context, (ModalPropertyValue) semanticObject);
return;
} else
break;
case Aadl2Package.NAMED_VALUE:
if (rule == grammarAccess.getConstantValueRule() || rule == grammarAccess.getNumAltRule()) {
sequence_ConstantValue(context, (NamedValue) semanticObject);
return;
} else if (rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getLiteralorReferenceTermRule()) {
sequence_LiteralorReferenceTerm(context, (NamedValue) semanticObject);
return;
} else
break;
case Aadl2Package.OPERATION:
sequence_SignedConstant(context, (Operation) semanticObject);
return;
case Aadl2Package.PROPERTY_ASSOCIATION:
if (rule == grammarAccess.getBasicPropertyAssociationRule()) {
sequence_BasicPropertyAssociation(context, (PropertyAssociation) semanticObject);
return;
} else if (rule == grammarAccess.getPModelRule() || rule == grammarAccess.getContainedPropertyAssociationRule()) {
sequence_ContainedPropertyAssociation(context, (PropertyAssociation) semanticObject);
return;
} else if (rule == grammarAccess.getPropertyAssociationRule()) {
sequence_PropertyAssociation(context, (PropertyAssociation) semanticObject);
return;
} else
break;
case Aadl2Package.RANGE_VALUE:
sequence_NumericRangeTerm(context, (RangeValue) semanticObject);
return;
case Aadl2Package.REAL_LITERAL:
sequence_RealTerm(context, (RealLiteral) semanticObject);
return;
case Aadl2Package.RECORD_VALUE:
if (rule == grammarAccess.getOldRecordTermRule()) {
sequence_OldRecordTerm(context, (RecordValue) semanticObject);
return;
} else if (rule == grammarAccess.getPropertyExpressionRule() || rule == grammarAccess.getRecordTermRule()) {
sequence_RecordTerm(context, (RecordValue) semanticObject);
return;
} else
break;
case Aadl2Package.REFERENCE_VALUE:
sequence_ReferenceTerm(context, (ReferenceValue) semanticObject);
return;
case Aadl2Package.STRING_LITERAL:
sequence_StringTerm(context, (StringLiteral) semanticObject);
return;
}
else if (epackage == InstancePackage.eINSTANCE)
switch(semanticObject.eClass().getClassifierID()) {
case InstancePackage.COMPONENT_INSTANCE:
sequence_ComponentInstance(context, (ComponentInstance) semanticObject);
return;
case InstancePackage.CONNECTION_INSTANCE:
sequence_ConnectionInstance(context, (ConnectionInstance) semanticObject);
return;
case InstancePackage.CONNECTION_REFERENCE:
sequence_ConnectionReference(context, (ConnectionReference) semanticObject);
return;
case InstancePackage.END_TO_END_FLOW_INSTANCE:
sequence_EndToEndFlowInstance(context, (EndToEndFlowInstance) semanticObject);
return;
case InstancePackage.FEATURE_INSTANCE:
sequence_FeatureInstance(context, (FeatureInstance) semanticObject);
return;
case InstancePackage.FLOW_SPECIFICATION_INSTANCE:
sequence_FlowSpecificationInstance(context, (FlowSpecificationInstance) semanticObject);
return;
case InstancePackage.INSTANCE_REFERENCE_VALUE:
sequence_InstanceReferenceValue(context, (InstanceReferenceValue) semanticObject);
return;
case InstancePackage.MODE_INSTANCE:
sequence_ModeInstance(context, (ModeInstance) semanticObject);
return;
case InstancePackage.MODE_TRANSITION_INSTANCE:
sequence_ModeTransitionInstance(context, (ModeTransitionInstance) semanticObject);
return;
case InstancePackage.PROPERTY_ASSOCIATION_INSTANCE:
sequence_PropertyAssociationInstance(context, (PropertyAssociationInstance) semanticObject);
return;
case InstancePackage.SYSTEM_INSTANCE:
sequence_SystemInstance(context, (SystemInstance) semanticObject);
return;
case InstancePackage.SYSTEM_OPERATION_MODE:
sequence_SystemOperationMode(context, (SystemOperationMode) semanticObject);
return;
}
if (errorAcceptor != null)
errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
use of org.osate.aadl2.ContainedNamedElement in project osate2 by osate.
the class PropertyAssociationImpl method createAppliesTo.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ContainedNamedElement createAppliesTo(EClass eClass) {
ContainedNamedElement newAppliesTo = (ContainedNamedElement) create(eClass);
getAppliesTos().add(newAppliesTo);
return newAppliesTo;
}
use of org.osate.aadl2.ContainedNamedElement in project osate2 by osate.
the class PropertiesValidator method checkPropertyReferenceAppliesTo.
@Check
public void checkPropertyReferenceAppliesTo(NamedValue namedValue) {
AbstractNamedValue anv = namedValue.getNamedValue();
PropertyAssociation association = EcoreUtil2.getContainerOfType(namedValue, PropertyAssociation.class);
if (!anv.eIsProxy() && anv instanceof Property && association != null) {
Property referencedProperty = (Property) anv;
List<ContainedNamedElement> appliesTo = association.getAppliesTos();
if (appliesTo.isEmpty()) {
NamedElement holder = EcoreUtil2.getContainerOfType(association, NamedElement.class);
if (holder != null && !holder.acceptsProperty(referencedProperty)) {
error("Property " + referencedProperty.getQualifiedName() + " does not apply to " + holder.getName());
}
} else {
for (ContainedNamedElement cna : appliesTo) {
List<ContainmentPathElement> path = cna.getContainmentPathElements();
if (!path.isEmpty()) {
NamedElement holder = path.get(path.size() - 1).getNamedElement();
if (!holder.eIsProxy() && !holder.acceptsProperty(referencedProperty)) {
error("Property " + referencedProperty.getQualifiedName() + " does not apply to " + unparseAppliesTo(cna));
}
}
}
}
}
}
use of org.osate.aadl2.ContainedNamedElement in project osate2 by osate.
the class PropertiesValidator method checkContainedProperties.
public void checkContainedProperties(PropertyAssociation pa) {
List<ModalPropertyValue> mpvs = pa.getOwnedValues();
if (null == mpvs || mpvs.isEmpty()) {
return;
}
List<ContainedNamedElement> appliesTo = pa.getAppliesTos();
if (null == appliesTo || appliesTo.size() != 1) {
return;
}
List<Mode> masterModes = getMasterModes(appliesTo.get(0));
if (null == masterModes || masterModes.isEmpty()) {
return;
}
List<Mode> modesWithProperty = new ArrayList<Mode>();
ModalPropertyValue lastModalPropertyValue = mpvs.get(mpvs.size() - 1);
List<Mode> lastInModes = lastModalPropertyValue.getInModes();
if (null == lastInModes || lastInModes.isEmpty()) {
modesWithProperty.addAll(masterModes);
} else {
for (ModalPropertyValue mpv : mpvs) {
List<Mode> inModes = mpv.getInModes();
if (null != inModes && !inModes.isEmpty()) {
modesWithProperty.removeAll(inModes);
modesWithProperty.addAll(inModes);
}
}
}
for (Mode masterMode : masterModes) {
if (!modesWithProperty.contains(masterMode)) {
warning(pa, "Value not set for mode " + masterMode.getName() + " for property " + pa.getProperty().getQualifiedName());
}
}
}
use of org.osate.aadl2.ContainedNamedElement in project osate2 by osate.
the class PropertiesValidator method checkAssociationAppliesTo.
/**
* Check constraints that property applies to the element it is associated
* with per Section 10.3:
*
* <blockquote>The property named by a property association must list the
* category of the component type, component implementation, subcomponent,
* feature, connection, flow, or mode the property association is declared
* for in its Property_Owner_Category list. </blockquote>
*/
private void checkAssociationAppliesTo(final PropertyAssociation pa) {
final Property pn = pa.getProperty();
final EList<ContainedNamedElement> appliesTo = pa.getAppliesTos();
if (appliesTo == null || appliesTo.size() == 0) {
Element element = pa.getOwner();
if (element instanceof NamedElement) {
final boolean applies = ((NamedElement) element).acceptsProperty(pn);
if (!applies) {
error(pa, "Property " + pa.getProperty().getQualifiedName() + " does not apply to " + ((NamedElement) element).getName());
// error(pa,
// "Property " + pa.getQualifiedName() +
// " does not apply to " + element.eClass().getName());
}
}
} else {
for (ContainedNamedElement cna : appliesTo) {
EList<ContainmentPathElement> path = cna.getContainmentPathElements();
if (!path.isEmpty()) {
// only the last value is interesting to us
final ContainmentPathElement ph = path.get(path.size() - 1);
if (!Aadl2Util.isNull(ph.getNamedElement())) {
final boolean applies = ph.getNamedElement().acceptsProperty(pn);
if (!applies) {
error(pa, "Property " + pa.getProperty().getQualifiedName() + " does not apply to " + unparseAppliesTo(cna));
}
}
}
}
}
}
Aggregations