当前位置: 首页>>代码示例>>Java>>正文


Java Association.getMemberEnd方法代码示例

本文整理汇总了Java中org.eclipse.uml2.uml.Association.getMemberEnd方法的典型用法代码示例。如果您正苦于以下问题:Java Association.getMemberEnd方法的具体用法?Java Association.getMemberEnd怎么用?Java Association.getMemberEnd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.uml2.uml.Association的用法示例。


在下文中一共展示了Association.getMemberEnd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parseSimpleTraversal

import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
private Property parseSimpleTraversal(Classifier sourceType, ASimpleAssociationTraversal node) {
    final String openEndName = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
    Property openEnd = sourceType.getAttribute(openEndName, null);
    Association association;
    if (openEnd == null) {
        EList<Association> associations = sourceType.getAssociations();
        for (Association current : associations)
            if ((openEnd = current.getMemberEnd(openEndName, null)) != null)
                break;
        if (openEnd == null) {
            problemBuilder.addProblem(new UnknownRole(sourceType.getQualifiedName() + NamedElement.SEPARATOR
                    + openEndName), node.getIdentifier());
            throw new AbortedStatementCompilationException();
        }
    }
    association = openEnd.getAssociation();
    if (association == null) {
        problemBuilder.addError(openEndName + " is not an association member end", node.getIdentifier());
        throw new AbortedStatementCompilationException();
    }
    return openEnd;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:23,代码来源:BehaviorGenerator.java

示例2: parseQualifiedTraversal

import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
private Property parseQualifiedTraversal(Classifier sourceType, AQualifiedAssociationTraversal node) {
    String qualifiedIdentifier = TextUMLCore.getSourceMiner().getQualifiedIdentifier(
            node.getMinimalTypeIdentifier());
    final Association association = (Association) getRepository().findNamedElement(qualifiedIdentifier,
            IRepository.PACKAGE.getAssociation(), namespaceTracker.currentPackage());
    if (association == null) {
        problemBuilder.addError("Unknown association '" + qualifiedIdentifier + "'",
                node.getMinimalTypeIdentifier());
        throw new AbortedStatementCompilationException();
    }
    Classifier associated = ClassifierUtils.findUpHierarchy(getRepository(), sourceType, it -> it.getRelationships(IRepository.PACKAGE.getAssociation()).contains(association) ? it : null);
    if (associated == null) {
        problemBuilder.addProblem(
                new NotInAssociation(sourceType.getQualifiedName(), association.getQualifiedName()),
                node.getMinimalTypeIdentifier());
        throw new AbortedStatementCompilationException();
    }
    final String openEndName = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
    // XXX implementation limitation: only binary associations are
    // supported
    Property openEnd = association.getMemberEnd(openEndName, null);
    if (openEnd == null) {
        problemBuilder.addProblem(new UnknownRole(association.getQualifiedName(), openEndName),
                node.getIdentifier());
        throw new AbortedStatementCompilationException();
    }
    return openEnd;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:29,代码来源:BehaviorGenerator.java

示例3: testMemberEnd

import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
private void testMemberEnd(String keyword, AggregationKind expected) throws CoreException {
    String source = "";
    source += "model simple;\n";
    source += "  class ClientWithAccountAttribute\n";
    source += "    attribute account : AccountWithClientAttribute;\n";
    source += "  end;\n";
    source += "  class AccountWithClientAttribute\n";
    source += "    attribute client : ClientWithAccountAttribute;\n";
    source += "  end;\n";
    source += keyword + " AccountClient\n";
    source += "  role ClientWithAccountAttribute.account;\n";
    source += "  role AccountWithClientAttribute.client;\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    Class accountClass = (Class) getRepository().findNamedElement("simple::AccountWithClientAttribute",
            IRepository.PACKAGE.getClass_(), null);
    Class clientClass = (Class) getRepository().findNamedElement("simple::ClientWithAccountAttribute",
            IRepository.PACKAGE.getClass_(), null);
    final Association association = (Association) getRepository().findNamedElement("simple::AccountClient",
            IRepository.PACKAGE.getAssociation(), null);
    assertNotNull(association);
    Property accountEnd = association.getOwnedEnd("account", accountClass);
    assertNull(accountEnd);
    accountEnd = association.getMemberEnd("account", accountClass);
    assertNotNull(accountEnd);
    assertEquals(expected, accountEnd.getAggregation());
    Property clientEnd = association.getOwnedEnd("client", clientClass);
    assertNull(clientEnd);
    clientEnd = association.getMemberEnd("client", clientClass);
    assertNotNull(clientEnd);
    assertEquals(AggregationKind.NONE_LITERAL, clientEnd.getAggregation());
    assertEquals(1, ((LiteralUnlimitedNatural) accountEnd.getLowerValue()).getValue());
    assertEquals(1, ((LiteralUnlimitedNatural) accountEnd.getUpperValue()).getValue());
    assertEquals(1, ((LiteralUnlimitedNatural) clientEnd.getLowerValue()).getValue());
    assertEquals(1, ((LiteralUnlimitedNatural) clientEnd.getUpperValue()).getValue());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:38,代码来源:AssociationTests.java

示例4: testMixedMemberEnd

import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
public void testMixedMemberEnd() throws CoreException {
    String source = "";
    source += "model simple;\n";
    source += "  class Parent\n";
    source += "    attribute children : Child[*];\n";
    source += "  end;\n";
    source += "  class Child\n";
    source += "  end;\n";
    source += "  composition Hierarchy\n";
    source += "    role Parent.children;\n";
    source += "    role parent : Parent;\n";
    source += "  end;\n";
    source += "end.";
    parseAndCheck(source);
    Class parentClass = (Class) getRepository().findNamedElement("simple::Parent", IRepository.PACKAGE.getClass_(),
            null);
    Class childClass = (Class) getRepository().findNamedElement("simple::Child", IRepository.PACKAGE.getClass_(),
            null);
    final Association association = (Association) getRepository().findNamedElement("simple::Hierarchy",
            IRepository.PACKAGE.getAssociation(), null);
    Property parentEnd = association.getOwnedEnd("parent", parentClass);
    assertNotNull(parentEnd);
    assertEquals(AggregationKind.NONE_LITERAL, parentEnd.getAggregation());
    Property childrenEnd = association.getOwnedEnd("children", childClass);
    assertNull(childrenEnd);
    childrenEnd = association.getMemberEnd("children", childClass);
    assertNotNull(childrenEnd);
    assertEquals(AggregationKind.COMPOSITE_LITERAL, childrenEnd.getAggregation());
    assertEquals(0, ((LiteralInteger) childrenEnd.getLowerValue()).getValue());
    assertEquals(LiteralUnlimitedNatural.UNLIMITED,
            ((LiteralUnlimitedNatural) childrenEnd.getUpperValue()).getValue());
    assertEquals(1, ((LiteralUnlimitedNatural) parentEnd.getLowerValue()).getValue());
    assertEquals(1, ((LiteralUnlimitedNatural) parentEnd.getUpperValue()).getValue());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:35,代码来源:AssociationTests.java


注:本文中的org.eclipse.uml2.uml.Association.getMemberEnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。