📄 stereotype.java
字号:
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/**
* Title: XELOPES Data Mining Library
* Description: The XELOPES library is an open platform-independent and data-source-independent library for Embedded Data Mining.
* Copyright: Copyright (c) 2002 Prudential Systems Software GmbH
* Company: ZSoft (www.zsoft.ru), Prudsys (www.prudsys.com)
* @author Valentine Stepanenko (valentine.stepanenko@zsoft.ru)
* @version 1.0
*/
package com.prudsys.pdm.Cwm.Core;
import java.util.Collection;
import java.util.Iterator;
/**
* The stereotype concept provides a way of branding (classifying) model elements
* so that they behave as if they were instances of new virtual metamodel
* constructs. These model elements have the same structure (attributes,
* associations, operations) as similar non-stereotyped model elements of the same
* kind. The stereotype may specify additional constraints and required tagged
* values that apply to model elements. In addition, a stereotype may be used to
* indicate a difference in meaning or usage between two model elements with
* identical structure.
*
*
*
* In the metamodel the Stereotype metaclass is a subclass of ModelElement. Tagged
* Values and Constraints attached to a Stereotype apply to all ModelElements
* branded by that Stereotype.
*
*
*
* A stereotype keeps track of the base class to which it may be applied. The base
* class is a class in the metamodel (not a user-level modeling element) such as
* Class, Association, etc. If a model element is branded by an attached
* stereotype, then the CWM base class of the model element must be the base class
* specified by the stereotype or one of the subclasses of that base class.
*/
public class Stereotype extends ModelElement implements org.omg.cwm.objectmodel.core.Stereotype
{
/**
* Specifies the name of a modeling element to which the stereotype applies, such
* as Class, Association, Constraint, etc. This is the name of a metaclass, that
* is, a class from the metamodel itself rather than a user model class.
*/
public Name baseClass;
public Constraint stereotypeConstraint[];
public ModelElement extendedElement[];
public TaggedValue requiredTag[];
/**
* @roseuid 3C5E96D300B2
*/
public Stereotype()
{
}
public java.lang.String getBaseClass() {
return baseClass.getString();
}
public void setBaseClass(java.lang.String baseClass) {
Name n = new Name();
n.setString(baseClass);
this.baseClass = n;
}
public Collection getExtendedElement() {
return CWMTools.ArrayToList(extendedElement);
}
public void setExtendedElement(Collection extendedElement) {
this.extendedElement = new ModelElement[ extendedElement.size() ];
Iterator it = extendedElement.iterator();
for (int i = 0; i < extendedElement.size(); i++)
this.extendedElement[i] = (ModelElement) it.next();
}
public void addExtendedElement(org.omg.cwm.objectmodel.core.ModelElement input ) {
int size = (extendedElement == null) ? 0 : extendedElement.length;
ModelElement[] oldData = extendedElement;
extendedElement = new ModelElement[size+1];
if (size > 0) System.arraycopy(oldData, 0, extendedElement, 0, size);
extendedElement[size] = (ModelElement) input;
}
public void removeExtendedElement(org.omg.cwm.objectmodel.core.ModelElement input) {
int size = (extendedElement == null) ? 0 : extendedElement.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (extendedElement[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
ModelElement[] oldData = extendedElement;
extendedElement = new ModelElement[size-1];
for (int i = 0; i < ipos; i++)
extendedElement[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
extendedElement[i-1] = oldData[i];
}
public Collection getRequiredTag() {
return CWMTools.ArrayToList(requiredTag);
}
public void setRequiredTag(Collection requiredTag) {
this.requiredTag = new TaggedValue[ requiredTag.size() ];
Iterator it = requiredTag.iterator();
for (int i = 0; i < requiredTag.size(); i++)
this.requiredTag[i] = (TaggedValue) it.next();
}
public void removeRequiredTag(org.omg.cwm.objectmodel.core.TaggedValue input) {
int size = (requiredTag == null) ? 0 : requiredTag.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (requiredTag[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
TaggedValue[] oldData = requiredTag;
requiredTag = new TaggedValue[size-1];
for (int i = 0; i < ipos; i++)
requiredTag[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
requiredTag[i-1] = oldData[i];
}
public Collection getStereotypeConstraint() {
return CWMTools.ArrayToList(stereotypeConstraint);
}
public void setStereotypeConstraint(Collection stereotypeConstraint) {
this.stereotypeConstraint = new Constraint[ stereotypeConstraint.size() ];
Iterator it = stereotypeConstraint.iterator();
for (int i = 0; i < stereotypeConstraint.size(); i++)
this.stereotypeConstraint[i] = (Constraint) it.next();
}
public void removeStereotypeConstraint(org.omg.cwm.objectmodel.core.Constraint input) {
int size = (stereotypeConstraint == null) ? 0 : stereotypeConstraint.length;
if (size == 0)
return;
int ipos = -1;
for (int i = 0; i < size; i++)
if (stereotypeConstraint[i].equals(input)) {
ipos = i;
break;
}
if (ipos == -1)
return;
Constraint[] oldData = stereotypeConstraint;
stereotypeConstraint = new Constraint[size-1];
for (int i = 0; i < ipos; i++)
stereotypeConstraint[i] = oldData[i];
for (int i = ipos+1; i < size; i++)
stereotypeConstraint[i-1] = oldData[i];
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -