Search in sources :

Example 16 with BasicPropertyAssociation

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

the class NotCollocated method toPropertyExpression.

@Override
public RecordValue toPropertyExpression(ResourceSet resourceSet) {
    if (!targets.isPresent() && !location.isPresent()) {
        throw new IllegalStateException("Record must have at least one field set.");
    }
    RecordValue recordValue = Aadl2Factory.eINSTANCE.createRecordValue();
    targets.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, TARGETS__URI, TARGETS__NAME));
        fieldAssociation.setOwnedValue(CodeGenUtil.toPropertyExpression(field, element1 -> {
            return CodeGenUtil.toPropertyExpression(element1);
        }));
    });
    location.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, LOCATION__URI, LOCATION__NAME));
        fieldAssociation.setOwnedValue(CodeGenUtil.toPropertyExpression(field));
    });
    return recordValue;
}
Also used : BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ClassifierValue(org.osate.aadl2.ClassifierValue) ListValue(org.osate.aadl2.ListValue) URI(org.eclipse.emf.common.util.URI) InstanceReferenceValue(org.osate.aadl2.instance.InstanceReferenceValue) Collectors(java.util.stream.Collectors) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) Objects(java.util.Objects) Mode(org.osate.aadl2.Mode) PropertyExpression(org.osate.aadl2.PropertyExpression) CodeGenUtil(org.osate.pluginsupport.properties.CodeGenUtil) GeneratedRecord(org.osate.pluginsupport.properties.GeneratedRecord) List(java.util.List) Aadl2Factory(org.osate.aadl2.Aadl2Factory) Classifier(org.osate.aadl2.Classifier) RecordValue(org.osate.aadl2.RecordValue) Optional(java.util.Optional) NamedElement(org.osate.aadl2.NamedElement) InstanceObject(org.osate.aadl2.instance.InstanceObject) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) RecordValue(org.osate.aadl2.RecordValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Example 17 with BasicPropertyAssociation

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

the class ConnectionPair method toPropertyExpression.

@Override
public RecordValue toPropertyExpression(ResourceSet resourceSet) {
    if (!src.isPresent() && !dst.isPresent()) {
        throw new IllegalStateException("Record must have at least one field set.");
    }
    RecordValue recordValue = Aadl2Factory.eINSTANCE.createRecordValue();
    src.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, SRC__URI, SRC__NAME));
        fieldAssociation.setOwnedValue(CodeGenUtil.toPropertyExpression(field, element1 -> {
            return CodeGenUtil.toPropertyExpression(element1);
        }));
    });
    dst.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, DST__URI, DST__NAME));
        fieldAssociation.setOwnedValue(CodeGenUtil.toPropertyExpression(field, element1 -> {
            return CodeGenUtil.toPropertyExpression(element1);
        }));
    });
    return recordValue;
}
Also used : BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation) ListValue(org.osate.aadl2.ListValue) URI(org.eclipse.emf.common.util.URI) IntegerLiteral(org.osate.aadl2.IntegerLiteral) Collectors(java.util.stream.Collectors) ResourceSet(org.eclipse.emf.ecore.resource.ResourceSet) Objects(java.util.Objects) Mode(org.osate.aadl2.Mode) PropertyExpression(org.osate.aadl2.PropertyExpression) CodeGenUtil(org.osate.pluginsupport.properties.CodeGenUtil) GeneratedRecord(org.osate.pluginsupport.properties.GeneratedRecord) List(java.util.List) Aadl2Factory(org.osate.aadl2.Aadl2Factory) RecordValue(org.osate.aadl2.RecordValue) Optional(java.util.Optional) NamedElement(org.osate.aadl2.NamedElement) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) RecordValue(org.osate.aadl2.RecordValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Example 18 with BasicPropertyAssociation

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

the class IoTimeSpec method toPropertyExpression.

@Override
public RecordValue toPropertyExpression(ResourceSet resourceSet) {
    if (!offset.isPresent() && !time.isPresent()) {
        throw new IllegalStateException("Record must have at least one field set.");
    }
    RecordValue recordValue = Aadl2Factory.eINSTANCE.createRecordValue();
    offset.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, OFFSET__URI, OFFSET__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    time.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, TIME__URI, TIME__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    return recordValue;
}
Also used : RecordValue(org.osate.aadl2.RecordValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Example 19 with BasicPropertyAssociation

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

the class RateSpec method toPropertyExpression.

@Override
public RecordValue toPropertyExpression(ResourceSet resourceSet) {
    if (!valueRange.isPresent() && !rateUnit.isPresent() && !rateDistribution.isPresent()) {
        throw new IllegalStateException("Record must have at least one field set.");
    }
    RecordValue recordValue = Aadl2Factory.eINSTANCE.createRecordValue();
    valueRange.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, VALUE_RANGE__URI, VALUE_RANGE__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression());
    });
    rateUnit.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, RATE_UNIT__URI, RATE_UNIT__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    rateDistribution.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, RATE_DISTRIBUTION__URI, RATE_DISTRIBUTION__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    return recordValue;
}
Also used : RecordValue(org.osate.aadl2.RecordValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Example 20 with BasicPropertyAssociation

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

the class TransmissionTime method toPropertyExpression.

@Override
public RecordValue toPropertyExpression(ResourceSet resourceSet) {
    if (!fixed.isPresent() && !perbyte.isPresent()) {
        throw new IllegalStateException("Record must have at least one field set.");
    }
    RecordValue recordValue = Aadl2Factory.eINSTANCE.createRecordValue();
    fixed.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, FIXED__URI, FIXED__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    perbyte.ifPresent(field -> {
        BasicPropertyAssociation fieldAssociation = recordValue.createOwnedFieldValue();
        fieldAssociation.setProperty(loadField(resourceSet, PERBYTE__URI, PERBYTE__NAME));
        fieldAssociation.setOwnedValue(field.toPropertyExpression(resourceSet));
    });
    return recordValue;
}
Also used : RecordValue(org.osate.aadl2.RecordValue) BasicPropertyAssociation(org.osate.aadl2.BasicPropertyAssociation)

Aggregations

BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)42 RecordValue (org.osate.aadl2.RecordValue)30 ListValue (org.osate.aadl2.ListValue)17 PropertyExpression (org.osate.aadl2.PropertyExpression)16 ClassifierValue (org.osate.aadl2.ClassifierValue)11 NamedValue (org.osate.aadl2.NamedValue)11 StringLiteral (org.osate.aadl2.StringLiteral)11 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)10 RangeValue (org.osate.aadl2.RangeValue)10 IntegerLiteral (org.osate.aadl2.IntegerLiteral)9 PropertyAssociation (org.osate.aadl2.PropertyAssociation)9 RealLiteral (org.osate.aadl2.RealLiteral)9 ComputedValue (org.osate.aadl2.ComputedValue)8 ContainedNamedElement (org.osate.aadl2.ContainedNamedElement)8 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)8 ArrayRange (org.osate.aadl2.ArrayRange)7 BasicProperty (org.osate.aadl2.BasicProperty)7 BooleanLiteral (org.osate.aadl2.BooleanLiteral)7 NamedElement (org.osate.aadl2.NamedElement)7 ReferenceValue (org.osate.aadl2.ReferenceValue)7