/** * Retrieves all the connectors between subcomponents inside a given component model. (does not * retrieve connectors between component model boundaries and subcomponents inside the model). */ public static List<org.eclipse.uml2.uml.Connector> getInternalConnectors( org.eclipse.uml2.uml.Class c) { LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>(); for (Connector conn : c.getOwnedConnectors()) { if (conn.getEnds().size() >= 2 && (conn.getEnds().get(0).getPartWithPort() != null) && (conn.getEnds().get(1).getPartWithPort() != null)) { connectors.add(conn); } } return connectors; }
/** * Retrieves all the connectors between subcomponents that are inside the component model and the * component model outputs. (does not retrieve connectors between subcomponents inside the * component model, nor connectors from component model inputs to subcomponents). */ public static List<org.eclipse.uml2.uml.Connector> getExternalOutputConnectors( org.eclipse.uml2.uml.Class c) { LinkedList<org.eclipse.uml2.uml.Connector> connectors = new LinkedList<org.eclipse.uml2.uml.Connector>(); for (Connector conn : c.getOwnedConnectors()) { if (conn.getEnds().size() >= 2) { // && (conn.getEnds().get(0).getPartWithPort() != null)) { if (conn.getEnds().get(0).getRole() instanceof Port && conn.getEnds().get(1).getRole() instanceof Port) { Port port_1 = (Port) conn.getEnds().get(0).getRole(); Port port_2 = (Port) conn.getEnds().get(1).getRole(); if ((isAnOutputPort(port_1) && conn.getEnds().get(0).getPartWithPort() == null) || (isAnOutputPort(port_2) && conn.getEnds().get(1).getPartWithPort() == null)) { connectors.add(conn); } } } } return connectors; }
/** @TOOD: author to add some doc. */ public static Boolean definesConnections(org.eclipse.uml2.uml.Class cl) { return cl.getOwnedConnectors().size() > 0; }