本文整理汇总了Java中org.eclipse.uml2.uml.Association.getMemberEnds方法的典型用法代码示例。如果您正苦于以下问题:Java Association.getMemberEnds方法的具体用法?Java Association.getMemberEnds怎么用?Java Association.getMemberEnds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.uml2.uml.Association
的用法示例。
在下文中一共展示了Association.getMemberEnds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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());
}
}
}
示例3: 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;
}
示例4: basicRenderObject
import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
@Override
public boolean basicRenderObject(Association element, IndentedPrintWriter pw, IRenderingSession<Element> context) {
if (!element.isBinary())
// we humbly admit we can't handle n-ary associations
return false;
if (RendererHelper.shouldSkip(context, element))
return false;
if (element.isDerived() && !context.getSettings().getBoolean(UML2DOTPreferences.SHOW_DERIVED_ELEMENTS, false))
return false;
List<Property> ends = element.getMemberEnds();
// source and target here are about the association direction
// assumes source is the first end
Property source = ends.get(0);
Property target = ends.get(1);
if (source.getType() == null || target.getType() == null)
return false;
// origin and destination here are only w.r.t. where are coming from in
// the rendering session
Type origin = (Type) context.getPrevious(UMLPackage.Literals.TYPE);
Type destination = (ends.get(0).getType() == origin) ? ends.get(1).getType() : ends.get(0)
.getType();
boolean renderedOrigin = context.isRendered(origin);
boolean renderedDestination = context.isRendered(destination);
// if at least one of the members is not going to be rendered, do not render the association
if (!renderedOrigin || !renderedDestination)
return false;
if (!shouldRender(context, origin, destination))
// don't render an association with a class that is not going to be
// shown
return false;
boolean aggregation = source.getAggregation() != AggregationKind.NONE_LITERAL
|| target.getAggregation() != AggregationKind.NONE_LITERAL;
boolean asymmetric = (source.isNavigable() ^ target.isNavigable() || source.getUpper() != target.getUpper())
&& !context.getSettings().getBoolean(OMIT_CONSTRAINTS_FOR_NAVIGABILITY);
if ((aggregation && target.getAggregation() == AggregationKind.NONE_LITERAL)
|| (asymmetric && (!target.isNavigable() || source.getUpper() < target.getUpper()))) {
source = ends.get(1);
target = ends.get(0);
}
Type targetType = target.getType();
Type sourceType = source.getType();
context.render(targetType, targetType.eResource() != element.eResource());
context.render(sourceType, sourceType.eResource() != element.eResource());
pw.print("\"" + sourceType.getName() + "\":port -- " + "\"" + targetType.getName() + "\":port ");
pw.println("[");
Property finalTarget = target;
Property finalSource = source;
pw.runInNewLevel(() -> {
String edgeLabel = context.getSettings().getBoolean(SHOW_ASSOCIATION_NAME) && element.getName() != null ? element
.getName() : "";
DOTRenderingUtils.addAttribute(pw, "label", edgeLabel);
addEndAttributes(pw, "head", finalTarget, context);
addEndAttributes(pw, "tail", finalSource, context);
DOTRenderingUtils.addAttribute(pw, "labeldistance", "1.7");
DOTRenderingUtils.addAttribute(pw, "constraint", Boolean.toString(asymmetric || aggregation));
DOTRenderingUtils.addAttribute(pw, "style", "solid");
});
pw.println("]");
return true;
}
示例5: getMemberEnds
import org.eclipse.uml2.uml.Association; //导入方法依赖的package包/类
/**
* Returns the association member ends that represent the side of the given
* participant (referring to the other participant).
*
* In the case of a reflexive association, returns both ends.
*
* @return a collection of member ends, with 0-2 elements (typically 1)
*/
public static List<Property> getMemberEnds(Association association, Classifier participant) {
List<Property> result = new ArrayList<Property>();
for (Property memberEnd : association.getMemberEnds())
if (memberEnd.getOtherEnd() != null && participant == memberEnd.getOtherEnd().getType())
result.add(memberEnd);
return result;
}