1 | /** | | 1 | /** |
2 | * To simplify implementation, we list all associations | | 2 | * Return all edges going to given port.<p> |
3 | * found with any of the Classifiers | | 3 | * |
4 | * represented by the linked Instances. <p> | | 4 | * The only objects with ports on the use case diagram are actors |
5 | * | | 5 | * and use cases. In each case we find the attached association |
6 | * TODO: Make a foolproof algorithm that only allows selecting associations | | 6 | * ends, and build a list of them as the incoming ports.<p> |
7 | * that create a correct model. Also take into account n-ary associations | | 7 | * |
8 | * and associationclasses. This algo best goes in the model subsystem, e.g. | | 8 | * @param port The port for which we want to know the incoming edges. |
9 | * in a method getAllPossibleAssociationsForALink(). | | 9 | * |
10 | * | | 10 | * @return A list of objects which are the incoming edges. |
11 | * @see org.argouml.uml.ui.UMLComboBoxModel#buildModelList() | | 11 | */ |
12 | */ | | 12 | public List getInEdges(Object port) { |
13 | protected void buildModelList() { | | 13 | if (Model.getFacade().isAActor(port) |
14 | Collection linkEnds; | | 14 | || Model.getFacade().isAUseCase(port)) { |
15 | Collection associations = new HashSet(); | | 15 | List result = new ArrayList(); |
16 | Object t = getTarget(); | | 16 | Collection ends = Model.getFacade().getAssociationEnds(port); |
17 | if (Model.getFacade().isALink(t)) { | | 17 | if (ends == null) { |
18 | linkEnds = Model.getFacade().getConnections(t); | | 18 | return Collections.EMPTY_LIST; |
19 | Iterator ile = linkEnds.iterator(); | | 19 | } |
20 | while (ile.hasNext()) { | | 20 | for (Object ae : ends) { |
21 | Object instance = Model.getFacade().getInstance(ile.next()); | | 21 | result.add(Model.getFacade().getAssociation(ae)); |
22 | Collection c = Model.getFacade().getClassifiers(instance); | | 22 | } |
23 | Iterator ic = c.iterator(); | | 23 | return result; |
24 | while (ic.hasNext()) { | | 24 | } |
25 | Object classifier = ic.next(); | | 25 | return Collections.EMPTY_LIST; |
26 | Collection ae = | | 26 | } |
27 | Model.getFacade().getAssociationEnds(classifier); | | | |
28 | Iterator iae = ae.iterator(); | | | |
29 | while (iae.hasNext()) { | | | |
30 | Object associationEnd = iae.next(); | | | |
31 | Object association = | | | |
32 | Model.getFacade().getAssociation(associationEnd); | | | |
33 | associations.add(association); | | | |
34 | } | | | |
35 | } | | | |
36 | } | | | |
37 | } | | | |
38 | setElements(associations); | | | |
39 | } | | | |