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


Java ObjectNode类代码示例

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


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

示例1: caseALinkIdentifierExpression

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的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

示例2: checkCompatibility

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
/**
 * Checks the compatibility of the input pins in the given action with their
 * corresponding incoming output pins. If a mismatch is found, the
 * corresponding flow is returned.
 * 
 * @param repository
 * @param action
 *            the action to check
 * @param substitutions
 *            a list of template parameter substitutions, or
 *            <code>null</code>
 * @return the offending flow, or <code>null</code>
 */
public static ObjectFlow checkCompatibility(IBasicRepository repository, Action action, TemplateableElement bound) {
    for (InputPin current : ActivityUtils.getActionInputs(action)) {
        List<ActivityEdge> incomings = current.getIncomings();
        if (incomings.isEmpty())
            continue;
        flowLoop: for (ActivityEdge edge : incomings) {
            ObjectFlow flow = (ObjectFlow) edge;
            // we cannot assume source is a pin (it can be another type of
            // object node)
            final ObjectNode source = (ObjectNode) flow.getSource();
            final ObjectNode target = (ObjectNode) flow.getTarget();
            if (!isCompatible(repository, source, target, null)) {
                if (bound != null)
                    for (TemplateBinding binding : bound.getTemplateBindings())
                        if (isCompatible(repository, source, target, new ParameterSubstitutionMap(binding)))
                            // found one substitution that works
                            continue flowLoop;
                return flow;
            }
        }
    }
    // no problems found
    return null;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:38,代码来源:TypeUtils.java

示例3: connectTo

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
/**
 * Connects the output pins of the action represented by this action info to
 * the input pins of the action represented by destination action info.
 * 
 * @param destination
 */
private void connectTo(ActionInfo destination) {
    List<ObjectNode> allInputs = destination.inputs;
    List<ObjectNode> allOutputs = this.outputs;
    int currentOutputIndex = 0;
    for (Iterator<ObjectNode> i = allInputs.iterator(); i.hasNext() && currentOutputIndex < allOutputs.size();) {
        ObjectNode currentInput = i.next();
        if (currentInput instanceof ValuePin || !currentInput.getIncomings().isEmpty())
            // input not available, cannot connect to this one
            continue;
        final ObjectNode currentOutput = allOutputs.get(currentOutputIndex++);
        ActivityUtils.connect(((StructuredActivityNode) action.getOwner()), currentOutput, currentInput);
    }
    boolean allPinsMatched = currentOutputIndex == allOutputs.size();
    Assert.isTrue(allPinsMatched, "Not enough inputs in " + destination.action.eClass().getInstanceClassName()
            + " for " + this.action.eClass().getInstanceClassName() + ": inputs = " + currentOutputIndex
            + ", outputs = " + allOutputs.size());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:24,代码来源:ActionInfo.java

示例4: caseAAttributeIdentifierExpression

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
@Override
public void caseAAttributeIdentifierExpression(AAttributeIdentifierExpression node) {
    ReadStructuralFeatureAction action = (ReadStructuralFeatureAction) builder.createAction(IRepository.PACKAGE
            .getReadStructuralFeatureAction());
    final String attributeIdentifier = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
    try {
        builder.registerInput(action.createObject(null, null));
        super.caseAAttributeIdentifierExpression(node);
        builder.registerOutput(action.createResult(null, null));
        final ObjectNode source = ActivityUtils.getSource(action.getObject());
        Classifier targetClassifier = (Classifier) TypeUtils.getTargetType(getRepository(), source, true);
        if (targetClassifier == null) {
            problemBuilder.addError("Object type not determined for '"
                    + ((ATarget) node.getTarget()).getOperand().toString().trim() + "'", node.getIdentifier());
            throw new AbortedStatementCompilationException();
        }
        Property attribute = FeatureUtils.findAttribute(targetClassifier, attributeIdentifier, false, true);
        if (attribute == null) {
            problemBuilder.addProblem(new UnknownAttribute(targetClassifier.getName(), attributeIdentifier, false),
                    node.getIdentifier());
            throw new AbortedStatementCompilationException();
        }
        if (attribute.isStatic()) {
            problemBuilder.addError("Non-static attribute expected: '" + attributeIdentifier + "' in '"
                    + targetClassifier.getName() + "'", node.getIdentifier());
            throw new AbortedStatementCompilationException();
        }
        action.setStructuralFeature(attribute);
        action.getObject().setType(source.getType());
        TypeUtils.copyType(attribute, action.getResult(), targetClassifier);
        fillDebugInfo(action, node);
    } finally {
        builder.closeAction();
    }
    checkIncomings(action, node.getIdentifier(), getBoundElement());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:37,代码来源:BehaviorGenerator.java

示例5: checkIncomings

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
private void checkIncomings(final Action action, final Node node, TemplateableElement bound) {
    ObjectFlow incompatible = TypeUtils.checkCompatibility(getRepository(), action, bound);
    if (incompatible == null)
        return;
    final ObjectNode target = ((ObjectNode) incompatible.getTarget());
    final ObjectNode source = ((ObjectNode) incompatible.getSource());
    final Type anyType = findBuiltInType(TypeUtils.ANY_TYPE, node);
    if (target.getType() != null && target.getType() != anyType
            && (source.getType() == null || source.getType() == anyType))
        source.setType(target.getType());
    else
        problemBuilder.addProblem(new TypeMismatch(MDDUtil.getDisplayName(target), MDDUtil.getDisplayName(source)),
                node);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:15,代码来源:BehaviorGenerator.java

示例6: connect

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static ObjectFlow connect(StructuredActivityNode parent, ObjectNode source, ObjectNode target) {
    ObjectFlow flow = (ObjectFlow) parent.createEdge(null, UMLPackage.eINSTANCE.getObjectFlow());
    // this is valid in UML but not in TextUML (text format doesn't allow
    // that)
    Assert.isLegal(source.getOutgoings().isEmpty());
    // this is invalid according to UML
    Assert.isLegal(target.getIncomings().isEmpty());
    flow.setSource(source);
    flow.setTarget(target);
    if (target.getType() == null && source.getType() != null)
        TypeUtils.copyType(source, target);
    return flow;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:14,代码来源:ActivityUtils.java

示例7: getSourceAction

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static Action getSourceAction(ObjectNode target) {
    if (target == null)
        return null;
    ObjectNode sourcePin = getSource(target);
    if (sourcePin == null)
        return null;
    Action sourceAction = (Action) sourcePin.getOwner();
    return sourceAction;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:10,代码来源:ActivityUtils.java

示例8: getTargetAction

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static Action getTargetAction(ObjectNode target) {
    ObjectNode targetPin = getTarget(target);
    if (targetPin == null)
        return null;
    Action targetAction = (Action) targetPin.getOwner();
    return targetAction;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:ActivityUtils.java

示例9: getTarget

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static ObjectNode getTarget(ObjectNode source) {
    final List<ActivityEdge> outgoings = source.getOutgoings();
    if (outgoings.isEmpty())
        return null;
    Assert.isLegal(outgoings.size() == 1);
    return (ObjectNode) outgoings.get(0).getTarget();
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:ActivityUtils.java

示例10: checkIncomings

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
private void checkIncomings(TemplateableElement bound) {
    ObjectFlow incompatible = TypeUtils.checkCompatibility(getContext().getRepository(), getProduct(), bound);
    if (incompatible == null)
        return;
    final ObjectNode target = ((ObjectNode) incompatible.getTarget());
    final ObjectNode source = ((ObjectNode) incompatible.getSource());
    getContext().getProblemTracker().add(
            new TypeMismatch(MDDUtil.getDisplayName(target), MDDUtil.getDisplayName(source)));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:10,代码来源:ActionBuilder.java

示例11: getSource

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static ObjectNode getSource(ObjectNode target) {
    final List<ActivityEdge> incomings = target.getIncomings();
    Assert.isLegal(incomings.size() == 1, "Object node has no incoming flows");
    return (ObjectNode) ((ObjectFlow) incomings.get(0)).getSource();
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:6,代码来源:ActivityUtils.java

示例12: getTargetInput

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public static InputPin getTargetInput(ObjectNode source) {
	return (InputPin) getTarget(source);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:4,代码来源:ActivityUtils.java

示例13: registerInput

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public <T extends ObjectNode> T registerInput(T input) {
    currentAction.registerInput(input);
    return input;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:5,代码来源:ActivityBuilder.java

示例14: registerOutput

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public <T extends ObjectNode> T registerOutput(T output) {
    Assert.isLegal(output != null);
    currentAction.registerOutput(output);
    return output;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:6,代码来源:ActivityBuilder.java

示例15: registerInput

import org.eclipse.uml2.uml.ObjectNode; //导入依赖的package包/类
public void registerInput(ObjectNode input) {
    this.inputs.add(input);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:4,代码来源:ActionInfo.java


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