PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/projects/argouml-0.34/argouml/src/argouml-core-model/src/org/argouml/model/ExtensionMechanismsHelper.java

https://gitlab.com/essere.lab.public/qualitas.class-corpus
Java | 338 lines | 34 code | 34 blank | 270 comment | 0 complexity | 7ff5684b6cdce70ee40c716bb183ed65 MD5 | raw file
  1. /* $Id: ExtensionMechanismsHelper.java 19046 2011-02-21 22:36:40Z thn $
  2. *******************************************************************************
  3. * Copyright (c) 2009 Contributors - see below
  4. * All rights reserved. This program and the accompanying materials
  5. * are made available under the terms of the Eclipse Public License v1.0
  6. * which accompanies this distribution, and is available at
  7. * http://www.eclipse.org/legal/epl-v10.html
  8. *
  9. * Contributors:
  10. * Thomas Neustupny
  11. *******************************************************************************
  12. *
  13. * Some portions of this file was previously release using the BSD License:
  14. */
  15. // Copyright (c) 2005-2008 The Regents of the University of California. All
  16. // Rights Reserved. Permission to use, copy, modify, and distribute this
  17. // software and its documentation without fee, and without a written
  18. // agreement is hereby granted, provided that the above copyright notice
  19. // and this paragraph appear in all copies. This software program and
  20. // documentation are copyrighted by The Regents of the University of
  21. // California. The software program and documentation are supplied "AS
  22. // IS", without any accompanying services from The Regents. The Regents
  23. // does not warrant that the operation of the program will be
  24. // uninterrupted or error-free. The end-user understands that the program
  25. // was developed for research purposes and is advised not to rely
  26. // exclusively on the program for any reason. IN NO EVENT SHALL THE
  27. // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
  28. // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
  29. // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
  30. // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
  31. // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
  32. // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  33. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
  34. // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
  35. // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
  36. // UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  37. package org.argouml.model;
  38. import java.util.Collection;
  39. /**
  40. * The interface for the helper of the ExtensionMechanisms.
  41. */
  42. public interface ExtensionMechanismsHelper {
  43. /**
  44. * Returns all stereotypes in a given namespace,
  45. * and all those in any sub-namespace of the given namespace.
  46. *
  47. * @param ns is the namespace.
  48. * @return a Collection with the stereotypes.
  49. */
  50. Collection getStereotypes(Object ns);
  51. /**
  52. * Finds a stereotype in a given namespace,
  53. * and all those in any sub-namespace of the given namespace.
  54. * Returns null if no such stereotype is found.
  55. * <p>
  56. * TODO: What if stereo.getName() or stereo.getBaseClass() is null?
  57. * Then you know immediately that none will be found, but is that the
  58. * correct answer?
  59. * Currently, null is returned in these cases. <p>
  60. *
  61. * TODO: This function should not take a stereotype object as parameter,
  62. * but a name and a baseclass. <p>
  63. * TODO: Currently only works for stereotypes with only one baseclass. <p>
  64. * TODO: Currently only works for stereotypes where the baseclass is
  65. * equal to the given one - inheritance does not work.
  66. *
  67. * @return the stereotype found or null.
  68. * @param ns is the namespace.
  69. * @param stereo is the stereotype.
  70. */
  71. Object getStereotype(Object ns, Object stereo);
  72. /**
  73. * Searches for a stereotype just like the given stereotype in all
  74. * given models (and their sub-namespaces).
  75. * The given stereotype can not have its namespace set yet;
  76. * otherwise it will be returned itself!
  77. *
  78. * TODO: This function should not take a stereotype object as parameter,
  79. * but a name and a baseclass. <p>
  80. * TODO: Currently only works for stereotypes with only one baseclass. <p>
  81. * TODO: Should it only search for stereotypes owned by the Model object?
  82. *
  83. * @param models a collection of models
  84. * @param stereo is the given stereotype
  85. * @return Stereotype
  86. */
  87. Object getStereotype(Collection models, Object stereo);
  88. /**
  89. * @param m the ModelElement
  90. * @return the name of the metatype (i.e UML type) of this Element
  91. * @deprecated for 0.27.3 by tfmorris. Use {@link MetaTypes#getName(Object)}
  92. */
  93. @Deprecated
  94. String getMetaModelName(Object m);
  95. /**
  96. * Returns all possible stereotypes for some
  97. * modelelement. Possible stereotypes are those stereotypes that
  98. * are owned by the same namespace the modelelement is owned by
  99. * and that have a baseclass that is the same as the
  100. * metamodelelement name of the modelelement.
  101. *
  102. * @param modelElement is the model element
  103. * @param models the models to search in
  104. * @return Collection
  105. */
  106. Collection getAllPossibleStereotypes(Collection models,
  107. Object modelElement);
  108. /**
  109. * Returns <code>true</code> if the given stereotype has a baseclass that
  110. * equals the baseclass of the given ModelElement or one of the superclasses
  111. * of the given ModelElement.
  112. *
  113. * @param theModelElement
  114. * is the model element
  115. * @param theStereotype
  116. * is the stereotype
  117. * @return boolean
  118. */
  119. boolean isValidStereotype(Object theModelElement, Object theStereotype);
  120. /**
  121. * Get all stereotypes from all Models in the list. <p>
  122. *
  123. * Finds also all stereotypes owned by any sub-namespaces of the Model.
  124. *
  125. * @return the collection of stereotypes in all models
  126. * in the current project
  127. * @param models the models to search
  128. */
  129. Collection getStereotypes(Collection models);
  130. /**
  131. * Get commonly used tagged value types. <p>
  132. * While in early UML 1.x versions only String was provided, in UML 2.x
  133. * tagged values are stereotype properties with any possible type. However
  134. * even in UML 2.x only primitive types are used in most cases. The client
  135. * of the model subsystem should be able to handle at least the returned
  136. * types, but is still free to provide support for any type.
  137. *
  138. * @return a collection of types
  139. */
  140. Collection getCommonTaggedValueTypes();
  141. /**
  142. * Sets the stereotype of some modelelement. The method also
  143. * copies a stereotype that is not a part of the current model to
  144. * the current model.<p>
  145. *
  146. * @param modelElement is the model element
  147. * @param stereotype is the stereotype
  148. */
  149. void addCopyStereotype(Object modelElement, Object stereotype);
  150. /**
  151. * Tests if a stereotype has a given name and given base class.
  152. * While comparing the baseclass, inheritance is not considered.
  153. *
  154. * @param object is the stereotype.
  155. * @param name is the name of the stereotype.
  156. * @param base is a string representing the base class of the stereotype.
  157. * @return true if object is a stereotype with the desired characteristics.
  158. */
  159. boolean isStereotype(Object object, String name, String base);
  160. /**
  161. * Tests if a stereotype is or inherits from a stereotype with some
  162. * name and base class.
  163. *
  164. * @param object is the stereotype.
  165. * @param name is the name of the stereotype.
  166. * @param base is the base class of the stereotype.
  167. * @return true if object is a (descendant of a) stereotype with the
  168. * desired characteristics.
  169. */
  170. boolean isStereotypeInh(Object object, String name, String base);
  171. /**
  172. * Add an extended element to a stereotype.
  173. *
  174. * @param handle Stereotype
  175. * @param extendedElement ExtensionPoint
  176. */
  177. void addExtendedElement(Object handle, Object extendedElement);
  178. /**
  179. * Add a baseclass to some stereotype.
  180. *
  181. * @param handle the stereotype
  182. * @param baseClass the baseclass to add
  183. */
  184. void addBaseClass(Object handle, Object baseClass);
  185. /**
  186. * Remove baseclass from some stereotype.
  187. *
  188. * @param handle the stereotype
  189. * @param baseClass the baseclass to remove
  190. */
  191. void removeBaseClass(Object handle, Object baseClass);
  192. /**
  193. * Set the icon for a stereotype.
  194. *
  195. * @param handle Stereotype
  196. * @param icon String
  197. */
  198. void setIcon(Object handle, Object icon);
  199. /**
  200. * Set the tagType of a TaggedDefinition. This controls the range of legal
  201. * values for the associated TaggedValues.
  202. *
  203. * @param handle the taggedValue
  204. * @param tagType A string containing the name of the type for values that
  205. * may be assigned to this tag. This can either be the name
  206. * of a datatype (e.g. "String", "Integer" or "Boolean") or
  207. * the name of a metaclass for more complex types of tagged
  208. * values.
  209. */
  210. void setTagType(Object handle, String tagType);
  211. /**
  212. * Set the type of a taggedvalue.
  213. *
  214. * @param handle the taggedValue
  215. * @param type the tagDefinition
  216. */
  217. void setType(Object handle, Object type);
  218. /**
  219. * Sets the dataValues of the given TaggedValue to a single String value.
  220. * Provided for backward compatibility with UML 1.3. new uses should use
  221. * setDataValues.
  222. *
  223. * @param handle
  224. * is the tagged value
  225. * @param value
  226. * is the value
  227. * @deprecated for 0.25.5 by tfmorris. Use
  228. * {@link #setDataValues(Object, String[])}.
  229. */
  230. @Deprecated
  231. void setValueOfTag(Object handle, String value);
  232. /**
  233. * Sets the dataValues of the given TaggedValue. UML1 only.
  234. *
  235. * @param handle is the tagged value
  236. * @param values an array of String values
  237. */
  238. void setDataValues(Object handle, String[] values);
  239. //additional support for tagged values
  240. /**
  241. * Add a tagged value.
  242. *
  243. * @param handle The model element to add to.
  244. * @param taggedValue The tagged value to add.
  245. */
  246. void addTaggedValue(Object handle, Object taggedValue);
  247. /**
  248. * Apply a profile to a model or another profile.
  249. *
  250. * @param handle The model or profile.
  251. * @param profile The to be applied profile.
  252. */
  253. public void applyProfile(Object handle, Object profile);
  254. /**
  255. * Remove a tagged value.
  256. *
  257. * @param handle The model element to remove from.
  258. * @param taggedValue The tagged value to remove.
  259. */
  260. void removeTaggedValue(Object handle, Object taggedValue);
  261. /**
  262. * Set the list of tagged values for a model element. UML1 only.
  263. *
  264. * @param handle The model element to set for.
  265. * @param taggedValues A Collection of tagged values.
  266. */
  267. void setTaggedValue(Object handle, Collection taggedValues);
  268. /**
  269. * Set tagged value (bound to a stereotype) for a model element.
  270. * The value might be an List, depending on the multiplicity of the
  271. * property.
  272. *
  273. * @param handle The model element to set for.
  274. * @param property The property of the applied stereotype.
  275. * @param value Single value or a List value to set to.
  276. */
  277. void setTaggedValue(Object handle, Object property, Object value);
  278. /**
  279. * Unapply a profile to a model or another profile.
  280. *
  281. * @param handle The model or profile.
  282. * @param profile The to be unapplied profile.
  283. */
  284. public void unapplyProfile(Object handle, Object profile);
  285. /**
  286. * Returns <code>true</code> if the given ModelElement has a Stereotype
  287. * with the given name.
  288. *
  289. * @param element the given ModelElement
  290. * @param name the given name
  291. * @return true if there is such a stereotype
  292. */
  293. boolean hasStereotype(Object element, String name);
  294. /**
  295. * Make a profile applicable. Usually a profile edited in a UML design
  296. * environment like ArgoUML is not directly applicable, but needs to be
  297. * shifted to the metamodel level, so that it can serve as an extension
  298. * to the UML metamodel.
  299. *
  300. * @param handle the profile before made applicable to a model
  301. * @return the profile made applicable to a model
  302. */
  303. Object makeProfileApplicable(Object handle);
  304. }