1 package com.finalist.uml14.simpleuml;
2
3 import org.omg.uml.foundation.core.ModelElement;
4 import org.omg.uml.foundation.datatypes.VisibilityKindEnum;
5
6 /***
7 * The SimpleModelElement implements some functions that are used by all the
8 * SimpleModelElements in this package.
9 *
10 * @author kors
11 * @version $Revision: 1.1 $, $Date: 2004/02/06 22:22:39 $
12 */
13 public abstract class SimpleModelElement {
14
15 /*** The OMG ModelElement that contains the actual information. */
16 protected ModelElement modelElement;
17
18 /*** Defines the public visibility of a SimpleElement */
19 public static final String PUBLIC = "public";
20 /*** Defines the protected visibility of a SimpleElement */
21 public static final String PROTECTED = "protected";
22 /*** Defines the private visibility of a SimpleElement */
23 public static final String PRIVATE = "private";
24
25 /***
26 * Returns the name of the SimpleModelElement.
27 *
28 * @return A string containing the name of the ModelElement.
29 */
30 public String getName() {
31
32 return modelElement.getName();
33 }
34
35 /***
36 * Sets the name of the SimpleModelElement.
37 *
38 * @param name The name of the SimpleModelElement.
39 */
40 public void setName(String name) {
41
42 modelElement.setName(name);
43 }
44
45 /***
46 * Returns the OMG object of the SimpleElement.
47 *
48 * @return A ModelElement.
49 */
50 public ModelElement getModelElement() {
51 return modelElement;
52 }
53
54 /***
55 * Returns the visibility of this SimpleModelElement.
56 *
57 * @return The visibility of this SimpleModelElement.
58 */
59 public String getVisibility() {
60 String returnValue = SimpleModelElement.PUBLIC;
61 if (modelElement.getVisibility().equals(VisibilityKindEnum.VK_PROTECTED)) {
62 returnValue = SimpleModelElement.PROTECTED;
63 }
64 else if (modelElement.getVisibility().equals(VisibilityKindEnum.VK_PRIVATE)) {
65 returnValue = SimpleModelElement.PRIVATE;
66 }
67 return returnValue;
68 }
69
70 /***
71 * Sets the visibility of a ModelElement.
72 *
73 * @param visibility A string representing the visibility.
74 */
75 public void setVisibility(String visibility) {
76 if (visibility.equalsIgnoreCase(SimpleModelElement.PUBLIC)) {
77 modelElement.setVisibility(VisibilityKindEnum.VK_PUBLIC);
78 }
79 else if (visibility.equalsIgnoreCase(SimpleModelElement.PROTECTED)) {
80 modelElement.setVisibility(VisibilityKindEnum.VK_PROTECTED);
81 }
82 else if (visibility.equalsIgnoreCase(SimpleModelElement.PRIVATE)) {
83 modelElement.setVisibility(VisibilityKindEnum.VK_PRIVATE);
84 }
85 }
86 }
87 /***
88 * $Log: SimpleModelElement.java,v $
89 * Revision 1.1 2004/02/06 22:22:39 ekkelenkamp
90 * initial import on sourceforge
91 *
92 * Revision 1.2 2003/11/20 15:32:58 kors
93 * Added the getVisibility function.
94 *
95 * Revision 1.1 2003/10/29 10:43:52 kors
96 * no message
97 *
98 *
99 */
100
101
102
103