Search in sources :

Example 41 with StringLiteral

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

the class ProgrammingProperties method getRecoverEntrypointSourceText.

public static Optional<String> getRecoverEntrypointSourceText(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getRecoverEntrypointSourceText_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 42 with StringLiteral

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

the class ProgrammingProperties method getComputeEntrypointSourceText.

public static Optional<String> getComputeEntrypointSourceText(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getComputeEntrypointSourceText_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 43 with StringLiteral

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

the class ProgrammingProperties method getActivateEntrypointSourceText.

public static Optional<String> getActivateEntrypointSourceText(NamedElement lookupContext, Optional<Mode> mode) {
    Property property = getActivateEntrypointSourceText_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 44 with StringLiteral

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

the class GetProperties method getDataEnumerators.

public static List<String> getDataEnumerators(final NamedElement ne) {
    List<String> res;
    res = new ArrayList<String>();
    try {
        Property st = lookupPropertyDefinition(ne, DataModel._NAME, DataModel.Enumerators);
        List<? extends PropertyExpression> propertyValues = ne.getPropertyValueList(st);
        for (PropertyExpression propertyExpression : propertyValues) {
            // System.out.println("pe=" + propertyExpression);
            StringLiteral sl = (StringLiteral) propertyExpression;
            res.add(sl.getValue());
        }
        return res;
    } catch (PropertyLookupException e) {
        return null;
    }
}
Also used : StringLiteral(org.osate.aadl2.StringLiteral) PropertyExpression(org.osate.aadl2.PropertyExpression) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) PropertyLookupException(org.osate.aadl2.properties.PropertyLookupException)

Example 45 with StringLiteral

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

the class GetProperties method getPlatform.

public static String getPlatform(final NamedElement ne) {
    try {
        Property sn = lookupPropertyDefinition(ne, SEI._NAME, SEI.PLATFORM);
        PropertyAcc pacc = ne.getPropertyValue(sn);
        if (pacc.getAssociations().size() > 0) {
            ModalPropertyValue mdv = pacc.getAssociations().get(0).getOwnedValues().get(0);
            PropertyExpression pe = mdv.getOwnedValue();
            StringLiteral sl = (StringLiteral) pe;
            return sl.getValue();
        }
        return null;
    } catch (PropertyLookupException e) {
        return null;
    }
}
Also used : ModalPropertyValue(org.osate.aadl2.ModalPropertyValue) StringLiteral(org.osate.aadl2.StringLiteral) PropertyAcc(org.osate.aadl2.properties.PropertyAcc) PropertyExpression(org.osate.aadl2.PropertyExpression) BasicProperty(org.osate.aadl2.BasicProperty) Property(org.osate.aadl2.Property) PropertyLookupException(org.osate.aadl2.properties.PropertyLookupException)

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