Search in sources :

Example 11 with RecordValue

use of org.osate.aadl2.RecordValue in project osate2 by osate.

the class AbstractPropertiesSemanticSequencer 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;
        }
    if (errorAcceptor != null)
        errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
}
Also used : ParserRule(org.eclipse.xtext.ParserRule) ComputedValue(org.osate.aadl2.ComputedValue) Action(org.eclipse.xtext.Action) ClassifierValue(org.osate.aadl2.ClassifierValue) ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) BooleanLiteral(org.osate.aadl2.BooleanLiteral) PropertyAssociation(org.osate.aadl2.PropertyAssociation) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ReferenceValue(org.osate.aadl2.ReferenceValue) ListValue(org.osate.aadl2.ListValue) ContainmentPathElement(org.osate.aadl2.ContainmentPathElement) RecordValue(org.osate.aadl2.RecordValue) ArrayRange(org.osate.aadl2.ArrayRange) NamedValue(org.osate.aadl2.NamedValue) Operation(org.osate.aadl2.Operation) RangeValue(org.osate.aadl2.RangeValue) EPackage(org.eclipse.emf.ecore.EPackage) RealLiteral(org.osate.aadl2.RealLiteral) StringLiteral(org.osate.aadl2.StringLiteral) Parameter(org.eclipse.xtext.Parameter) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ContainedNamedElement(org.osate.aadl2.ContainedNamedElement) IntegerLiteral(org.osate.aadl2.IntegerLiteral)

Example 12 with RecordValue

use of org.osate.aadl2.RecordValue in project osate2 by osate.

the class GetProperties method getMaximumTransmissionTimeFixed.

public static double getMaximumTransmissionTimeFixed(final NamedElement bus) {
    RecordValue rv;
    RangeValue bpa;
    NumberValue nv;
    rv = GetProperties.getTransmissionTime(bus);
    if (rv == null) {
        return 0;
    }
    bpa = (RangeValue) PropertyUtils.getRecordFieldValue(rv, "Fixed");
    if (bpa != null) {
        nv = bpa.getMaximumValue();
        return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
    }
    return 0;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Example 13 with RecordValue

use of org.osate.aadl2.RecordValue in project osate2 by osate.

the class GetProperties method getRateUnit.

public static EnumerationLiteral getRateUnit(final RecordValue ne) {
    EList<BasicPropertyAssociation> fields = ne.getOwnedFieldValues();
    BasicPropertyAssociation rateUnit = getRecordField(fields, "Rate_Unit");
    PropertyExpression res = rateUnit.getValue();
    if (res instanceof NamedValue) {
        return (EnumerationLiteral) ((NamedValue) res).getNamedValue();
    }
    return null;
}
Also used : PropertyExpression(org.osate.aadl2.PropertyExpression) NamedValue(org.osate.aadl2.NamedValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Example 14 with RecordValue

use of org.osate.aadl2.RecordValue in project osate2 by osate.

the class GetProperties method getMaximumTransmissionTimePerByte.

public static double getMaximumTransmissionTimePerByte(final NamedElement bus) {
    RecordValue rv;
    RangeValue bpa;
    NumberValue nv;
    rv = GetProperties.getTransmissionTime(bus);
    if (rv == null) {
        return 0;
    }
    bpa = (RangeValue) PropertyUtils.getRecordFieldValue(rv, "PerByte");
    if (bpa != null) {
        nv = bpa.getMaximumValue();
        return nv.getScaledValue(GetProperties.getMSUnitLiteral(bus));
    }
    return 0;
}
Also used : NumberValue(org.osate.aadl2.NumberValue) RecordValue(org.osate.aadl2.RecordValue) RangeValue(org.osate.aadl2.RangeValue)

Example 15 with RecordValue

use of org.osate.aadl2.RecordValue in project osate2 by osate.

the class GetProperties method getOutgoingMessageRatePerSecond.

/*
	 * Look for Message_Rate or SEI::Data_Rate first. Then pick up Output_Rate,
	 * whose default value is 1 per dispatch That rate is converted to persecond
	 * using Period. If Period is zero then the resulting data rate is zero as
	 * well.
	 */
public static double getOutgoingMessageRatePerSecond(final NamedElement ne) {
    double res = GetProperties.getMessageRatePerSecond(ne);
    if (res > 0) {
        return res;
    }
    Property outputRate = lookupPropertyDefinition(ne, CommunicationProperties._NAME, CommunicationProperties.OUTPUT_RATE);
    RecordValue rec = GetProperties.getOutPutRate(ne);
    if (rec != null) {
        res = GetProperties.getMaxDataRate(rec);
        EnumerationLiteral unit = GetProperties.getRateUnit(rec);
        double period = 0;
        if (unit == null || unit.getName().equalsIgnoreCase("PerDispatch")) {
            if (ne instanceof InstanceObject) {
                period = GetProperties.getPeriodInSeconds(((InstanceObject) ne).getContainingComponentInstance(), 0);
            } else {
                period = GetProperties.getPeriodInSeconds(ne.getContainingClassifier(), 0);
            }
            if (period == 0) {
                return 0;
            }
            res = res / period;
        }
        if (res > 0) {
            return res;
        }
    }
    double period = GetProperties.getPeriodInSeconds(ne.getContainingClassifier(), 0);
    if (period == 0) {
        return 0;
    }
    res = 1 / period;
    return res;
}
Also used : InstanceObject(org.osate.aadl2.instance.InstanceObject) RecordValue(org.osate.aadl2.RecordValue) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) EnumerationLiteral(org.osate.aadl2.EnumerationLiteral)

Aggregations

RecordValue (org.osate.aadl2.RecordValue)46 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)37 ListValue (org.osate.aadl2.ListValue)22 PropertyExpression (org.osate.aadl2.PropertyExpression)20 RangeValue (org.osate.aadl2.RangeValue)19 ClassifierValue (org.osate.aadl2.ClassifierValue)13 IntegerLiteral (org.osate.aadl2.IntegerLiteral)13 StringLiteral (org.osate.aadl2.StringLiteral)13 RealLiteral (org.osate.aadl2.RealLiteral)12 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)11 NamedValue (org.osate.aadl2.NamedValue)11 BooleanLiteral (org.osate.aadl2.BooleanLiteral)10 ReferenceValue (org.osate.aadl2.ReferenceValue)10 ComputedValue (org.osate.aadl2.ComputedValue)8 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)8 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)8 NamedElement (org.osate.aadl2.NamedElement)8 PropertyAssociation (org.osate.aadl2.PropertyAssociation)8 ArrayRange (org.osate.aadl2.ArrayRange)7 Operation (org.osate.aadl2.Operation)7