Search in sources :

Example 1 with BusAccessImpl

use of org.osate.aadl2.impl.BusAccessImpl in project osate-plugin by sireum.

the class Visitor method buildEndPoint.

private List<org.sireum.hamr.ir.EndPoint> buildEndPoint(ConnectedElement connElem, List<String> path) {
    List<org.sireum.hamr.ir.EndPoint> result = VisitorUtil.iList();
    final List<String> component = (connElem.getContext() != null) && (connElem.getContext() instanceof Subcomponent) ? VisitorUtil.add(path, connElem.getContext().getName()) : path;
    final List<String> feature = (connElem.getContext() instanceof FeatureGroup) ? VisitorUtil.add(component, connElem.getContext().getName() + "_" + connElem.getConnectionEnd().getName()) : VisitorUtil.add(component, connElem.getConnectionEnd().getName());
    AadlASTJavaFactory.Direction dir = null;
    if (connElem.getConnectionEnd() instanceof DirectedFeatureImpl) {
        final DirectedFeatureImpl inFeature = (DirectedFeatureImpl) connElem.getConnectionEnd();
        if (inFeature.isIn() && inFeature.isOut()) {
            dir = AadlASTJavaFactory.Direction.InOut;
        } else if (inFeature.isIn() && !inFeature.isOut()) {
            dir = AadlASTJavaFactory.Direction.In;
        } else {
            dir = AadlASTJavaFactory.Direction.Out;
        }
    }
    final ConnectionEnd ce = connElem.getConnectionEnd();
    // String cname = AadlUtil.getConnectionEndName(connElem);
    if (ce instanceof FeatureGroupImpl) {
        final FeatureGroupImpl fgce = (FeatureGroupImpl) ce;
        result = VisitorUtil.addAll(result, flattenFeatureGroup(component, fgce.getFullName(), fgce, connElem));
    } else if (ce instanceof BusSubcomponentImpl) {
        result = VisitorUtil.add(result, factory.endPoint(factory.name(feature, VisitorUtil.buildPosInfo(connElem.getConnectionEnd())), null, AadlASTJavaFactory.Direction.InOut));
    } else if (ce instanceof BusAccessImpl) {
        result = VisitorUtil.add(result, factory.endPoint(factory.name(component, (connElem.getContext() != null) ? VisitorUtil.buildPosInfo(connElem.getContext()) : null), factory.name(feature, VisitorUtil.buildPosInfo(connElem.getConnectionEnd())), AadlASTJavaFactory.Direction.InOut));
    } else {
        result = VisitorUtil.add(result, factory.endPoint(factory.name(component, (connElem.getContext() != null) ? VisitorUtil.buildPosInfo(connElem.getContext()) : null), factory.name(feature, VisitorUtil.buildPosInfo(connElem.getConnectionEnd())), dir));
    }
    if (result.size() > 1) {
    // System.out.println("");
    }
    return result;
}
Also used : FeatureGroup(org.osate.aadl2.FeatureGroup) DirectedFeatureImpl(org.osate.aadl2.impl.DirectedFeatureImpl) BusAccessImpl(org.osate.aadl2.impl.BusAccessImpl) BusSubcomponentImpl(org.osate.aadl2.impl.BusSubcomponentImpl) FeatureGroupImpl(org.osate.aadl2.impl.FeatureGroupImpl) DataSubcomponent(org.osate.aadl2.DataSubcomponent) Subcomponent(org.osate.aadl2.Subcomponent) AadlASTJavaFactory(org.sireum.hamr.ir.AadlASTJavaFactory) ConnectionEnd(org.osate.aadl2.ConnectionEnd)

Aggregations

ConnectionEnd (org.osate.aadl2.ConnectionEnd)1 DataSubcomponent (org.osate.aadl2.DataSubcomponent)1 FeatureGroup (org.osate.aadl2.FeatureGroup)1 Subcomponent (org.osate.aadl2.Subcomponent)1 BusAccessImpl (org.osate.aadl2.impl.BusAccessImpl)1 BusSubcomponentImpl (org.osate.aadl2.impl.BusSubcomponentImpl)1 DirectedFeatureImpl (org.osate.aadl2.impl.DirectedFeatureImpl)1 FeatureGroupImpl (org.osate.aadl2.impl.FeatureGroupImpl)1 AadlASTJavaFactory (org.sireum.hamr.ir.AadlASTJavaFactory)1