1 package com.finalist.uml14.simpleuml;
2
3 import org.omg.uml.foundation.core.Operation;
4
5 import java.util.Collection;
6 import java.util.HashMap;
7
8 /***
9 * A Representation of an operation in an UML class. This SimpleOperation contains a
10 * operation from the OMG API containing the actual information.
11 *
12 * @author Kors van Beem
13 * @version $Revision: 1.1 $, $Date: 2004/02/06 22:22:39 $
14 */
15 public class SimpleOperation extends SimpleModelElement {
16
17 private HashMap parameters = new HashMap();
18
19 /***
20 * Constructs a SimpleOperation.
21 */
22 public SimpleOperation() {
23 modelElement = UmlPackageSupplier.getUmlPackage().getCore().getOperation().createOperation();
24 }
25
26 /***
27 * Advanced Constructor.
28 *
29 * @param name The name of this operation.
30 * @param visibility The visibility of this operation.
31 */
32 public SimpleOperation(String name, String visibility) {
33 this();
34 setName(name);
35 setVisibility(visibility);
36 }
37
38 /***
39 * Adds a SimpleParameter to this SimpleOperation.
40 *
41 * @param simpleParameter The SimpleParameter to be added.
42 */
43 public void addSimpleParameter(SimpleParameter simpleParameter) {
44 ((Operation) modelElement).getParameter().add(simpleParameter.getModelElement());
45 parameters.put(simpleParameter.getName(), simpleParameter);
46 }
47
48 /***
49 * Returns a Collection with Parameters.
50 *
51 * @return The Collection containing the parameters.
52 */
53 public Collection getSimpleParameters() {
54 return parameters.values();
55 }
56 }