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