本文整理汇总了Java中org.eclipse.uml2.uml.Association.getEndTypes方法的典型用法代码示例。如果您正苦于以下问题:Java Association.getEndTypes方法的具体用法?Java Association.getEndTypes怎么用?Java Association.getEndTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Association
的用法示例。
在下文中一共展示了Association.getEndTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkRelationTarget
import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
/**
* relation의 source와 target이 같은지 검사
*
* @param relationship
* @param sourceElement
* @param targetElement
* @return boolean
*/
private static boolean checkRelationTarget(Relationship relationship, NamedElement targetElement) {
if (relationship instanceof Dependency) {
Dependency dependency = (Dependency) relationship;
EList<NamedElement> suppliers = dependency.getSuppliers();
for (NamedElement element : suppliers) {
if (targetElement.equals(element)) {
return true;
}
}
} else if (relationship instanceof Generalization) {
Generalization generalization = (Generalization) relationship;
if (targetElement.equals(generalization.getGeneral())) {
return true;
}
} else if (relationship instanceof Association) {
Association association = (Association) relationship;
EList<Type> endTypes = association.getEndTypes();
for (Type type : endTypes) {
if (targetElement.equals(type)) {
return true;
}
}
}
return false;
}
示例2: isInAssoc
import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
boolean isInAssoc(Class cls1, Class cls2) {
for (Association assoc : cls1.getAssociations()) {
for (Type endType : assoc.getEndTypes()) {
if (endType.getName().equals(cls2.getName())) {
return true;
}
}
}
return false;
}