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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations