Search in sources :

Example 51 with StringLiteral

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

the class DataModel method getEnumerators.

public static Optional<List<String>> getEnumerators(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getEnumerators_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
            PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
            return ((StringLiteral) resolved1).getValue();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 52 with StringLiteral

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

the class DataModel method getInitialValue.

public static Optional<List<String>> getInitialValue(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getInitialValue_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
            PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
            return ((StringLiteral) resolved1).getValue();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 53 with StringLiteral

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

the class DataModel method getMeasurementUnit.

public static Optional<String> getMeasurementUnit(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getMeasurementUnit_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((StringLiteral) resolved).getValue());
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 54 with StringLiteral

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

the class DataModel method getRepresentation.

public static Optional<List<String>> getRepresentation(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getRepresentation_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((ListValue) resolved).getOwnedListElements().stream().map(element1 -> {
            PropertyExpression resolved1 = CodeGenUtil.resolveNamedValue(element1, lookupContext, mode);
            return ((StringLiteral) resolved1).getValue();
        }).collect(Collectors.toList()));
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) ListValue(org.osate.aadl2.ListValue) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Example 55 with StringLiteral

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

the class Sei method getPlatform.

public static Optional<String> getPlatform(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getPlatform_Property(lookupContext);
    try {
        PropertyExpression value = CodeGenUtil.lookupProperty(property, lookupContext, mode);
        PropertyExpression resolved = CodeGenUtil.resolveNamedValue(value, lookupContext, mode);
        return Optional.of(((StringLiteral) resolved).getValue());
    } catch (PropertyNotPresentException e) {
        return Optional.empty();
    }
}
Also used : PropertyNotPresentException(org.osate.aadl2.properties.PropertyNotPresentException) PropertyExpression(org.osate.aadl2.PropertyExpression) Property(org.osate.aadl2.Property)

Aggregations

StringLiteral (org.osate.aadl2.StringLiteral)42 PropertyExpression (org.osate.aadl2.PropertyExpression)37 Property (org.osate.aadl2.Property)32 ListValue (org.osate.aadl2.ListValue)24 PropertyNotPresentException (org.osate.aadl2.properties.PropertyNotPresentException)19 BooleanLiteral (org.osate.aadl2.BooleanLiteral)18 IntegerLiteral (org.osate.aadl2.IntegerLiteral)17 RealLiteral (org.osate.aadl2.RealLiteral)17 NamedValue (org.osate.aadl2.NamedValue)16 RecordValue (org.osate.aadl2.RecordValue)14 BasicPropertyAssociation (org.osate.aadl2.BasicPropertyAssociation)13 ClassifierValue (org.osate.aadl2.ClassifierValue)13 RangeValue (org.osate.aadl2.RangeValue)12 PropertyAssociation (org.osate.aadl2.PropertyAssociation)11 EPackage (org.eclipse.emf.ecore.EPackage)10 Action (org.eclipse.xtext.Action)10 Parameter (org.eclipse.xtext.Parameter)10 ParserRule (org.eclipse.xtext.ParserRule)10 ContainmentPathElement (org.osate.aadl2.ContainmentPathElement)10 ModalPropertyValue (org.osate.aadl2.ModalPropertyValue)10