| package org.eclipse.papyrus.ease.test.fmi; |
| |
| import org.eclipse.papyrus.sysml14.portsandflows.FlowDirection; |
| import org.eclipse.uml2.uml.Connector; |
| import org.eclipse.uml2.uml.ConnectorEnd; |
| import org.eclipse.uml2.uml.Port; |
| import org.eclipse.uml2.uml.Property; |
| |
| public class ConnectorHandler { |
| |
| private Connector connector; |
| private FMIPortHandler sourcePort; |
| private FMIPortHandler targetPort; |
| |
| public ConnectorHandler(Connector connector) { |
| this.connector = connector; |
| |
| for (ConnectorEnd end : connector.getEnds()) { |
| Port endPort = (Port) end.getRole(); |
| Property enPart = end.getPartWithPort(); |
| if (endPort != null && enPart != null) { |
| FMIPortHandler portHandler = new FMIPortHandler(enPart, endPort); |
| if (portHandler.getDirection() == FlowDirection.OUT) { |
| sourcePort = portHandler; |
| }else { |
| targetPort = portHandler; |
| } |
| } |
| |
| } |
| } |
| |
| public FMIPortHandler getSourcePort() { |
| return sourcePort; |
| } |
| |
| public FMIPortHandler getTargetPort() { |
| return targetPort; |
| } |
| |
| public Connector getConnector() { |
| return connector; |
| } |
| } |