• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Association类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: unsetAssociation

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * association설정지움
 * 
 * @param umlModel
 *            void
 */
public static void unsetAssociation(Association umlModel) {
    umlModel.getNearestPackage().getPackagedElements().remove(umlModel);
    EList<Property> propertyList = umlModel.getMemberEnds();
    Property property;
    Element element;
    for (Iterator<Property> iter = propertyList.iterator(); iter.hasNext();) {
        property = iter.next();
        element = property.getOwner();
        if (!umlModel.equals(element)) {
            ((StructuredClassifier) element).getOwnedAttributes().remove(property);
            deleteElement(property);
        }
    }
    umlModel.getMemberEnds().clear();
    deleteElement(umlModel);

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:UMLManager.java


示例2: createAssociation

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * 클래스간 관계 생성
 * 
 * @param type1
 * @param end1IsNavigable
 * @param end1Aggregation
 * @param end1Name
 * @param end1LowerBound
 * @param end1UpperBound
 * @param type2
 * @param end2IsNavigable
 * @param end2Aggregation
 * @param end2Name
 * @param end2LowerBound
 * @param end2UpperBound
 * @return Association
 */
public static Association createAssociation(Type type1, boolean end1IsNavigable, AggregationKind end1Aggregation,
                                            String end1Name, int end1LowerBound, int end1UpperBound, Type type2,
                                            boolean end2IsNavigable, AggregationKind end2Aggregation,
                                            String end2Name, int end2LowerBound, int end2UpperBound) {

    Association association = type1.createAssociation(end1IsNavigable,
        end1Aggregation,
        end1Name,
        end1LowerBound,
        end1UpperBound,
        type2,
        end2IsNavigable,
        end2Aggregation,
        end2Name,
        end2LowerBound,
        end2UpperBound);
    return association;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:36,代码来源:ClassDiagramUtil.java


示例3: createConnectionNameLabel

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * 
 * 
 * @param association
 * @param relation
 * @param sourceAnchorLocation
 * @param targetAnchorLocation
 * @param hasNameLabel
 *            void
 */
private void createConnectionNameLabel(Association association, AbstractConnection relation,
                                       Point sourceAnchorLocation, Point targetAnchorLocation, boolean hasNameLabel) {
    LabelNode associationLabel = UMLDiagramFactory.eINSTANCE.createLabelNode();
    associationLabel.setType(LabelType.COMPARTMENT);
    associationLabel.setName(association.getName());
    associationLabel.setUmlModel(association);
    associationLabel.setX(0);
    associationLabel.setY(0);
    associationLabel.setParent(relation);
    int associationWidth = DiagramUtil.getWidthSize(association.getName(), UiCorePlugin.getDefault()
        .getFont("default"));
    associationLabel.setWidth(associationWidth);
    associationLabel.setHeight(40);
    if (!hasNameLabel) {
        relation.getLabels().add(associationLabel);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:28,代码来源:CreateConnectionCommand.java


示例4: selectionChanged

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
 *      org.eclipse.jface.viewers.ISelection)
 */
public void selectionChanged(IAction action, ISelection selection) {
    objList.clear();
    objList = ProjectUtil.getSelectedEObjects(selection);

    if (objList == null || objList.size() < 1) {
        return;
    }

    for (EObject eobject : objList) {
        if (eobject instanceof Lifeline || eobject instanceof Abstraction || eobject instanceof Association
            || eobject instanceof BehaviorExecutionSpecification || eobject instanceof CombinedFragment
            || eobject instanceof Comment || eobject instanceof Connector || eobject instanceof ControlFlow
            || eobject instanceof Dependency || eobject instanceof ExecutionEvent
            || eobject instanceof ExecutionOccurrenceSpecification || eobject instanceof Extend
            || eobject instanceof Generalization || eobject instanceof Include
            || eobject instanceof InteractionOperand || eobject instanceof InterfaceRealization
            || eobject instanceof Message || eobject instanceof MessageOccurrenceSpecification
            || eobject instanceof ObjectFlow || eobject instanceof Realization
            || eobject instanceof ReceiveOperationEvent || eobject instanceof SendOperationEvent
            || eobject instanceof Usage) {
            objList.clear();
            return;
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:CopyAction.java


示例5: checkAssociationsUnambigous

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
@Check
private void checkAssociationsUnambigous(XtextAssociation association) {
    if (StringUtils.isNotEmpty(association.getName())) {
        return;
    }

    List<Classifier<? extends org.eclipse.uml2.uml.Classifier>> chosenTypes = getTypes(association);
    if (association.getOwningPackage().getConnectors().stream().filter(XtextAssociation.class::isInstance)
            .map(XtextAssociation.class::cast).filter(a -> a != association).map(ClsValidator::getTypes)
            .anyMatch(chosenTypes::equals)) {
        error("The association is not clearly distinguishable from other associations in this diagram.",
                ClsPackage.Literals.XTEXT_ASSOCIATION__MEMBER_END_TYPES, ASSOCIATION_AMBIGUOUS);
        return;
    }

    Collection<Association> candidates = Optional.ofNullable(association.getOwningPackage().getReferencedElement())
            .map(umlPackage -> AssociationMatcher.findUMLElements(association, umlPackage))
            .orElse(Collections.emptySet());
    candidates.remove(association.getReferencedElement());
    if (!candidates.isEmpty()) {
        error("The association is not clearly distinguishable from other associations in the UML model.",
                ClsPackage.Literals.XTEXT_ASSOCIATION__MEMBER_END_TYPES, ASSOCIATION_AMBIGUOUS);
    }

}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:26,代码来源:ClsValidator.java


示例6: match

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * Matches the given textual with the given UML association based on the involved member end types.
 * 
 * @param txtAssociation
 *            The textual association.
 * @param umlAssociation
 *            The UML association.
 * @return True if all types match. False otherwise.
 */
public static boolean match(XtextAssociation txtAssociation, Association umlAssociation) {
    Optional<List<org.eclipse.uml2.uml.Classifier>> txtUMLTypes = findUMLTypes(txtAssociation);
    if (!txtUMLTypes.isPresent()) {
        return false;
    }
    List<Type> umlUMLTypes = umlAssociation.getMemberEnds().stream().map(Property::getType)
            .collect(Collectors.toList());
    if (txtUMLTypes.get().size() != umlUMLTypes.size() || txtUMLTypes.get().stream().anyMatch(Objects::isNull)) {
        return false;
    }

    for (int i = 0; i < txtUMLTypes.get().size(); ++i) {
        if (txtUMLTypes.get().get(i) != umlUMLTypes.get(mapIndexTxt2Uml(i, txtUMLTypes.get().size()))) {
            return false;
        }
    }
    return true;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:28,代码来源:AssociationMatcher.java


示例7: validateCooperateModel

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
@Override
public boolean validateCooperateModel(IValidationContext ctx, Association target) {
    Collection<java.lang.Class<?>> relevantEndTypes = Arrays.asList(Class.class, Interface.class);
    if (!target.getEndTypes().stream().allMatch(
            testType -> relevantEndTypes.stream().anyMatch(relevantType -> relevantType.isInstance(testType)))) {
        // The association is not in a class diagram and therefore not relevant for this constraint
        return true;
    }

    if (!StringUtils.isBlank(target.getName())) {
        return true;
    }

    Collection<Type> wantedTypes = getTypes(target);
    return target.getNearestPackage().getMembers().stream().filter(Association.class::isInstance)
            .map(Association.class::cast).filter(a -> a != target).allMatch(a -> !getTypes(a).equals(wantedTypes));
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:ClassDiagramAssociationConstraint.java


示例8: ClassAttributeLink

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * Creates a ClassAttributeLink based on the EMF-UML model-elements and
 * layout information provided
 * 
 * @param layout
 *            the layout informations of this link
 * @param assoc
 *            the EMF-UML model-element which holds informations of this
 *            diagram element
 * @param fromClass
 *            the EMF-UML model Class belonging to the from end of this
 *            association
 * @param toClass
 *            the EMF-UML model Class belonging to the to end of this
 *            association
 * @throws UnexpectedEndException
 *             Exception is thrown if an association's end could not be
 *             linked to the EMF-UML model
 */
public ClassAttributeLink(LineAssociation layout, Association assoc, Classifier fromClass, Classifier toClass)
		throws UnexpectedEndException {
	super(layout);
	name = assoc.getLabel();
	from = null;
	to = null;
	for (Property end : assoc.getMemberEnds()) {
		Class endClass = (Class) end.getType();
		// when handling reflexive links then first add the to end's, then
		// the from end's model information (to match the Papyrus exporter
		// behavior)
		if (endClass == toClass && to == null) {
			to = new AssociationEnd(end);
		} else if (endClass == fromClass && from == null) {
			from = new AssociationEnd(end);
		} else {
			throw new UnexpectedEndException(end.getName());
		}
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:40,代码来源:ClassAttributeLink.java


示例9: buildAssociationModel

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
private FHIMInformationModel.Association buildAssociationModel(Association association) {
    String name = association.getName();
    FHIMInformationModel.Association associationModel = new FHIMInformationModel.Association(name);
    LOG.debug("Association: " + name);

    // Expect binary associations.
    Preconditions.checkArgument(association.isBinary());

    // "Owned" ends.
    EList<Property> ownedEnds = association.getOwnedEnds();

    // Member ends.
    EList<Property> memberEnds = association.getMemberEnds();
    for (Property memberEnd : memberEnds) {
        LOG.debug("    memberEnd: " + memberEnd.getName());
        FHIMInformationModel.Attribute memberEndModel = getAttributeModel(memberEnd);
        associationModel.addMemberEnd(memberEndModel);

        boolean owned = ownedEnds.contains(memberEnd);
        LOG.debug("    owned: " + owned);
        associationModel.setOwned(memberEndModel, owned);
    }

    return associationModel;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:26,代码来源:UML2ModelConverter.java


示例10: caseALinkIdentifierExpression

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
@Override
public void caseALinkIdentifierExpression(ALinkIdentifierExpression node) {
    ReadLinkAction action = (ReadLinkAction) builder.createAction(IRepository.PACKAGE.getReadLinkAction());
    try {
        InputPin linkEndValue = builder.registerInput(action.createInputValue(null, null));
        node.getIdentifierExpression().apply(this);
        ObjectNode source = ActivityUtils.getSource(linkEndValue);
        Classifier targetClassifier = (Classifier) TypeUtils.getTargetType(getRepository(), source, true);
        Property openEnd = parseRole(targetClassifier, node.getAssociationTraversal());
        Association association = openEnd.getAssociation();
        linkEndValue.setType(targetClassifier);
        int openEndIndex = association.getMemberEnds().indexOf(openEnd);
        Property fedEnd = association.getMemberEnds().get(1 - openEndIndex);
        LinkEndData endData = action.createEndData();
        endData.setEnd(fedEnd);
        endData.setValue(linkEndValue);
        builder.registerOutput(action.createResult(null, openEnd.getType()));
        TypeUtils.copyType(openEnd, action.getResult());
        fillDebugInfo(action, node);
    } finally {
        builder.closeAction();
    }
    checkIncomings(action, node.getAssociationTraversal(), getBoundElement());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:25,代码来源:BehaviorGenerator.java


示例11: 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


示例12: testSimpleAggregation

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
public void testSimpleAggregation() throws CoreException {
    String source = "";
    source += "model simple;\n";
    source += "aggregation AccountClient\n";
    source += "  navigable role account : Account[*];\n";
    source += "  navigable role client : Client[1];\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(getSimpleModelSource(), source);
    final Association association = (Association) getRepository().findNamedElement("simple::AccountClient",
            IRepository.PACKAGE.getAssociation(), null);
    assertNotNull(association);
    Property accountEnd = association.getOwnedEnd("account", null);
    assertNotNull(accountEnd);
    assertEquals(AggregationKind.SHARED_LITERAL, accountEnd.getAggregation());
    Property clientEnd = association.getOwnedEnd("client", null);
    assertNotNull(clientEnd);
    assertEquals(AggregationKind.NONE_LITERAL, clientEnd.getAggregation());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:20,代码来源:AssociationTests.java


示例13: testSimpleComposition

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
public void testSimpleComposition() throws CoreException {
    String source = "";
    source += "model simple;\n";
    source += "composition AccountClient\n";
    source += "  navigable role account : Account[*];\n";
    source += "  navigable role client : Client[1];\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(getSimpleModelSource(), source);
    final Association association = getRepository().findNamedElement("simple::AccountClient",
            IRepository.PACKAGE.getAssociation(), null);
    assertNotNull(association);
    Property accountEnd = association.getOwnedEnd("account", null);
    assertNotNull(accountEnd);
    assertEquals(AggregationKind.COMPOSITE_LITERAL, accountEnd.getAggregation());
    Property clientEnd = association.getOwnedEnd("client", null);
    assertNotNull(clientEnd);
    assertEquals(AggregationKind.NONE_LITERAL, clientEnd.getAggregation());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:20,代码来源:AssociationTests.java


示例14: 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;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:38,代码来源:UMLModelerNotationModelHandler.java


示例15: setAssociationForStructuredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * Association설정
 * 
 * @param relationType
 * @param umlModel
 * @param supplier
 * @param isNevigableSupplier
 * @param client
 * @param isNevigableClient
 *            void
 */
public static void setAssociationForStructuredClassifier(Association umlModel, NamedElement supplier,
                                                         boolean isNevigableSupplier,
                                                         AggregationKind aggregationKindSupplier,
                                                         NamedElement client, boolean isNevigableClient,
                                                         AggregationKind aggregationKindClient) {
    Property supplierProperty = UMLHelper.createProperty();
    Property clientProperty = UMLHelper.createProperty();
    supplierProperty.setType((Type) client);
    clientProperty.setType((Type) supplier);

    clientProperty.setName(supplier.getName().toLowerCase());
    supplierProperty.setName(client.getName().toLowerCase());

    supplierProperty.setAggregation(aggregationKindSupplier);
    clientProperty.setAggregation(aggregationKindClient);

    supplierProperty.setAssociation(umlModel);
    clientProperty.setAssociation(umlModel);

    if (isNevigableSupplier) {
        setProperty(supplier, supplierProperty);
    } else {
        umlModel.getOwnedEnds().add(supplierProperty);
    }
    if (isNevigableClient) {
        setProperty(client, clientProperty);
    } else {
        umlModel.getOwnedEnds().add(clientProperty);
    }

    org.eclipse.uml2.uml.Package packageElement = client.getNearestPackage();
    if (client instanceof Component) {
        ((Component) client).getPackagedElements().add(umlModel);
    } else {
        packageElement.getPackagedElements().add(umlModel);
    }

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:50,代码来源:UMLManager.java


示例16: setAggregationForStructuredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * Aggregation설정
 * 
 * @param relationType
 * @param umlModel
 * @param supplier
 * @param isNevigableSupplier
 * @param client
 * @param isNevigableClient
 *            void
 */
public static void setAggregationForStructuredClassifier(Association umlModel, NamedElement supplier,
                                                         NamedElement client) {
    setAssociationForStructuredClassifier(umlModel,
        supplier,
        true,
        AggregationKind.NONE_LITERAL,
        client,
        true,
        AggregationKind.SHARED_LITERAL);

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:UMLManager.java


示例17: setDirectedAggregationForStructuredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * Aggregation설정
 * 
 * @param relationType
 * @param umlModel
 * @param supplier
 * @param isNevigableSupplier
 * @param client
 * @param isNevigableClient
 *            void
 */
public static void setDirectedAggregationForStructuredClassifier(Association umlModel, NamedElement supplier,
                                                                 NamedElement client) {
    setAssociationForStructuredClassifier(umlModel,
        supplier,
        false,
        AggregationKind.NONE_LITERAL,
        client,
        true,
        AggregationKind.SHARED_LITERAL);

}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:UMLManager.java


示例18: setAggregationForBehavioredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * setAggregationForBehavioredClassifier
 *  
 * @param umlModel
 * @param supplier
 * @param client void
 */
public static void setAggregationForBehavioredClassifier(Association umlModel, NamedElement supplier,
                                                         NamedElement client) {
    setAssociationForBehavioredClassifier(umlModel,
        supplier,
        true,
        AggregationKind.SHARED_LITERAL,
        client,
        true,
        AggregationKind.NONE_LITERAL);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:18,代码来源:UMLManager.java


示例19: setCompositionForBehavioredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * setCompositionForBehavioredClassifier
 *  
 * @param umlModel
 * @param supplier
 * @param client void
 */
public static void setCompositionForBehavioredClassifier(Association umlModel, NamedElement supplier,
                                                         NamedElement client) {
    setAssociationForBehavioredClassifier(umlModel,
        supplier,
        true,
        AggregationKind.COMPOSITE_LITERAL,
        client,
        true,
        AggregationKind.NONE_LITERAL);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:18,代码来源:UMLManager.java


示例20: setDirectedAssociationForBehavioredClassifier

import org.eclipse.uml2.uml.Association; //导入依赖的package包/类
/**
 * setDirectedAssociationForBehavioredClassifier
 *  
 * @param umlModel
 * @param supplier
 * @param client void
 */
public static void setDirectedAssociationForBehavioredClassifier(Association umlModel, NamedElement supplier,
                                                                 NamedElement client) {
    setAssociationForBehavioredClassifier(umlModel,
        supplier,
        true,
        AggregationKind.NONE_LITERAL,
        client,
        false,
        AggregationKind.NONE_LITERAL);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:18,代码来源:UMLManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultCookieSpec类代码示例发布时间:2022-05-22
下一篇:
Java NativeAudioSendFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap