Search in sources :

Example 1 with DeclarativeReferenceValue

use of org.osate.ba.declarative.DeclarativeReferenceValue in project osate2 by osate.

the class AadlBaParserVisitor method clonePropertyExpression.

private PropertyExpression clonePropertyExpression(PropertyExpression sourcePropertyExpression) {
    PropertyExpression targetPropertyExpression = null;
    if (sourcePropertyExpression instanceof ListValue) {
        ListValue sourceLV = (ListValue) sourcePropertyExpression;
        ListValue targetLV = _coreFact.createListValue();
        for (PropertyExpression propInList : sourceLV.getOwnedListElements()) {
            targetLV.getOwnedListElements().add(clonePropertyExpression(propInList));
        }
        targetPropertyExpression = targetLV;
    } else if (sourcePropertyExpression instanceof StringLiteral) {
        StringLiteral sourceSL = (StringLiteral) sourcePropertyExpression;
        StringLiteral targetSL = _coreFact.createStringLiteral();
        targetSL.setValue(sourceSL.getValue());
        targetPropertyExpression = targetSL;
    } else if (sourcePropertyExpression instanceof IntegerLiteral) {
        IntegerLiteral sourceIL = (IntegerLiteral) sourcePropertyExpression;
        IntegerLiteral targetIL = _coreFact.createIntegerLiteral();
        targetIL.setValue(sourceIL.getValue());
        targetIL.setUnit(sourceIL.getUnit());
        targetPropertyExpression = targetIL;
    } else if (sourcePropertyExpression instanceof RealLiteral) {
        RealLiteral sourceRL = (RealLiteral) sourcePropertyExpression;
        RealLiteral targetRL = _coreFact.createRealLiteral();
        targetRL.setValue(sourceRL.getValue());
        targetRL.setUnit(sourceRL.getUnit());
        targetPropertyExpression = targetRL;
    } else if (sourcePropertyExpression instanceof RecordValue) {
        RecordValue sourceRV = (RecordValue) sourcePropertyExpression;
        RecordValue targetRV = _coreFact.createRecordValue();
        targetRV.getOwnedFieldValues().addAll(sourceRV.getOwnedFieldValues());
        targetPropertyExpression = targetRV;
    } else if (sourcePropertyExpression instanceof BooleanLiteral) {
        BooleanLiteral sourceBL = (BooleanLiteral) sourcePropertyExpression;
        BooleanLiteral targetBL = _coreFact.createBooleanLiteral();
        targetBL.setValue(sourceBL.getValue());
        targetPropertyExpression = targetBL;
    } else if (sourcePropertyExpression instanceof RangeValue) {
        RangeValue sourceRV = (RangeValue) sourcePropertyExpression;
        RangeValue targetRV = _coreFact.createRangeValue();
        targetRV.setMinimum(clonePropertyExpression(sourceRV.getMinimum()));
        targetRV.setMaximum(clonePropertyExpression(sourceRV.getMaximum()));
        targetPropertyExpression = targetRV;
    } else if (sourcePropertyExpression instanceof DeclarativeReferenceValue) {
        DeclarativeReferenceValue sourceDRV = (DeclarativeReferenceValue) sourcePropertyExpression;
        ReferenceValue targetRV = _coreFact.createReferenceValue();
        targetRV.setPath(sourceDRV.getRef());
        targetPropertyExpression = targetRV;
    } else if (sourcePropertyExpression instanceof DeclarativeClassifierValue) {
        DeclarativeClassifierValue sourceDCV = (DeclarativeClassifierValue) sourcePropertyExpression;
        ClassifierValue targetCV = _coreFact.createClassifierValue();
        targetCV.setClassifier(sourceDCV.getClassifier());
        targetPropertyExpression = targetCV;
    }
    return targetPropertyExpression;
}
Also used : RealLiteral(org.osate.aadl2.RealLiteral) BehaviorRealLiteral(org.osate.ba.aadlba.BehaviorRealLiteral) ClassifierValue(org.osate.aadl2.ClassifierValue) DeclarativeClassifierValue(org.osate.ba.declarative.DeclarativeClassifierValue) BehaviorStringLiteral(org.osate.ba.aadlba.BehaviorStringLiteral) StringLiteral(org.osate.aadl2.StringLiteral) DeclarativeReferenceValue(org.osate.ba.declarative.DeclarativeReferenceValue) BehaviorBooleanLiteral(org.osate.ba.aadlba.BehaviorBooleanLiteral) BooleanLiteral(org.osate.aadl2.BooleanLiteral) DeclarativeReferenceValue(org.osate.ba.declarative.DeclarativeReferenceValue) ReferenceValue(org.osate.aadl2.ReferenceValue) DeclarativeClassifierValue(org.osate.ba.declarative.DeclarativeClassifierValue) ListValue(org.osate.aadl2.ListValue) RecordValue(org.osate.aadl2.RecordValue) PropertyExpression(org.osate.aadl2.PropertyExpression) DeclarativePropertyExpression(org.osate.ba.declarative.DeclarativePropertyExpression) IntegerLiteral(org.osate.aadl2.IntegerLiteral) BehaviorIntegerLiteral(org.osate.ba.aadlba.BehaviorIntegerLiteral) RangeValue(org.osate.aadl2.RangeValue)

Aggregations

BooleanLiteral (org.osate.aadl2.BooleanLiteral)1 ClassifierValue (org.osate.aadl2.ClassifierValue)1 IntegerLiteral (org.osate.aadl2.IntegerLiteral)1 ListValue (org.osate.aadl2.ListValue)1 PropertyExpression (org.osate.aadl2.PropertyExpression)1 RangeValue (org.osate.aadl2.RangeValue)1 RealLiteral (org.osate.aadl2.RealLiteral)1 RecordValue (org.osate.aadl2.RecordValue)1 ReferenceValue (org.osate.aadl2.ReferenceValue)1 StringLiteral (org.osate.aadl2.StringLiteral)1 BehaviorBooleanLiteral (org.osate.ba.aadlba.BehaviorBooleanLiteral)1 BehaviorIntegerLiteral (org.osate.ba.aadlba.BehaviorIntegerLiteral)1 BehaviorRealLiteral (org.osate.ba.aadlba.BehaviorRealLiteral)1 BehaviorStringLiteral (org.osate.ba.aadlba.BehaviorStringLiteral)1 DeclarativeClassifierValue (org.osate.ba.declarative.DeclarativeClassifierValue)1 DeclarativePropertyExpression (org.osate.ba.declarative.DeclarativePropertyExpression)1 DeclarativeReferenceValue (org.osate.ba.declarative.DeclarativeReferenceValue)1