本文整理汇总了Java中org.eclipse.uml2.uml.Package.getOwnedMember方法的典型用法代码示例。如果您正苦于以下问题:Java Package.getOwnedMember方法的具体用法?Java Package.getOwnedMember怎么用?Java Package.getOwnedMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Package
的用法示例。
在下文中一共展示了Package.getOwnedMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createPackage
import org.eclipse.uml2.uml.Package; //导入方法依赖的package包/类
/**
* parent 패키지에 특정 name의 패키지 생성
*
* @param parent
* @param name
* @return
*/
public static Package createPackage(Package parent, String name) {
// null 확인
if (parent == null || name == null) {
return null;
}
NamedElement namedElement = parent.getOwnedMember(name);
if (namedElement != null && namedElement instanceof Package) {
return (Package) namedElement;
} else {
Package createdPackage = parent.createNestedPackage(name);
return createdPackage;
}
}
示例2: copy
import org.eclipse.uml2.uml.Package; //导入方法依赖的package包/类
/**
* Source(분석 모델)요소를 Target(설계모델) 패키지 이하로 복사하는 메소드
*
* @param sourceElement
* @param targetPackage
* @param transformationData
*/
private static void copy(NamedElement sourceElement, Package targetPackage,
MDADesignerTransformationData transformationData) {
// null 확인
if (sourceElement == null || targetPackage == null) {
return;
}
if (sourceElement instanceof Activity) {
return;
}
if (sourceElement instanceof Collaboration || sourceElement instanceof Class
|| sourceElement instanceof Interface || sourceElement instanceof Component
|| sourceElement instanceof Actor) {
NamedElement namedElement = targetPackage.getOwnedMember(sourceElement.getName());
if (namedElement != null) {
if (namedElement instanceof Collaboration && sourceElement instanceof Collaboration)
return;
else if (namedElement instanceof Class && sourceElement instanceof Class)
return;
else if (namedElement instanceof Interface && sourceElement instanceof Interface)
return;
else if (namedElement instanceof Component && sourceElement instanceof Component)
return;
else if (namedElement instanceof Actor && sourceElement instanceof Actor)
return;
}
copyElement(targetPackage, sourceElement, transformationData);
}
}
示例3: copyType
import org.eclipse.uml2.uml.Package; //导入方法依赖的package包/类
/**
* copy a source type to target package
*
* @param sourceType
* @param targetPackage
* @return
*/
private static Type copyType(Type sourceType, Package targetPackage) {
// null 확인
if (sourceType == null || targetPackage == null) {
return null;
}
EObject targetEobject = null;
NamedElement targetNamedElement = targetPackage.getOwnedMember(sourceType.getName());
if (targetNamedElement != null) {
if (targetNamedElement instanceof Class && sourceType instanceof Class) {
return (Type) targetNamedElement;
} else if (targetNamedElement instanceof Interface && sourceType instanceof Interface) {
return (Type) targetNamedElement;
}
}
targetEobject = EcoreUtil.copy((EObject) sourceType);
if (targetEobject instanceof Type) {
targetPackage.getPackagedElements().add((Type) targetEobject);
return (Type) targetEobject;
}
return null;
}