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


Java ParameterDirectionKind类代码示例

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


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

示例1: MemberOperation

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * Creates a MemberOperation based on the EMF-UML model-element provided
 * 
 * @param op
 *            the EMF-UML model-element which holds informations of this
 *            diagram element
 */
public MemberOperation(Operation op) {
	super(op.getName(), op.getVisibility());
	isAbstract = op.isAbstract();
	isStatic = op.isStatic();

	returnType = null;
	args = new ArrayList<Argument>();
	for (Parameter arg : op.getOwnedParameters()) {
		// return type is a parameter in the EMF-UML model
		if (arg.getDirection() == ParameterDirectionKind.RETURN_LITERAL) {
			returnType = arg.getType().getName();
		} else {
			args.add(new Argument(arg));
		}
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:24,代码来源:MemberOperation.java

示例2: searchReturnNode

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public void searchReturnNode(List<ActivityEdge> edges) {
	if (!containsReturnNode) {

		for (ActivityEdge aEdge : edges) {
			if (aEdge.eClass().equals(UMLPackage.Literals.OBJECT_FLOW)) {
				ObjectFlow objectFlow = (ObjectFlow) aEdge;
				if (objectFlow.getTarget().eClass().equals(UMLPackage.Literals.ACTIVITY_PARAMETER_NODE)) {
					ActivityParameterNode parameterNode = (ActivityParameterNode) objectFlow.getTarget();
					if (parameterNode.getParameter().getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
						returnNode = objectFlow.getSource();
						containsReturnNode = true;
					}
				}
			}
		}
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:18,代码来源:ReturnNodeExporter.java

示例3: testParameterModifiers

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * In the presence of multiple conflicting modifiers, the last one wins.
 */
public void testParameterModifiers() throws CoreException {
    String source = "";
    source += "model someModel;\n";
    source += "import base;\n";
    source += "class SomeClass\n";
    source += "operation op1(create read in out param1 : Integer);\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    Operation op1 = (Operation) getRepository().findNamedElement("someModel::SomeClass::op1",
            UMLPackage.Literals.OPERATION, null);
    Parameter param1 = op1.getOwnedParameter("param1", null);
    assertNotNull(param1);
    assertEquals(ParameterDirectionKind.OUT_LITERAL, param1.getDirection());
    assertEquals(ParameterEffectKind.READ_LITERAL, param1.getEffect());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:20,代码来源:ClassifierTests.java

示例4: longTest

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
@Test
public void longTest() {

	Model model = UMLFactory.eINSTANCE.createModel();
	model.setName("myUmlModel");

	Interface it1 = UMLFactory.eINSTANCE.createInterface();
	it1.setName("it1");
	model.getPackagedElements().add(it1);

	Interface it2 = UMLFactory.eINSTANCE.createInterface();
	it2.setName("it2");
	model.getPackagedElements().add(it2);

	Generalization gen = UMLFactory.eINSTANCE.createGeneralization();
	gen.setGeneral(it2);
	it2.getGeneralizations().add(gen);

	Interface it3 = UMLFactory.eINSTANCE.createInterface();
	it3.setName("it3");
	model.getPackagedElements().add(it3);
	gen.setGeneral(it3);

	Operation op = UMLFactory.eINSTANCE.createOperation();
	op.setName("op1");
	it3.getOwnedOperations().add(op);

	Parameter parameter = UMLFactory.eINSTANCE.createParameter();
	parameter.setName("par1");
	parameter.setDirection(ParameterDirectionKind.RETURN_LITERAL);
	parameter.setType(it1);
	op.getOwnedParameters().add(parameter);

	assertEquals(1, it2.getAllOperations().size());
}
 
开发者ID:i-BP,项目名称:boem,代码行数:36,代码来源:UMLJavaTest.java

示例5: getNonReturnParameters

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * Creates a list of non-return (in, out, and in-out) parameters of an
 * operation.
 * 
 * @param op
 *            The specified operation
 * @return List of non-return parameters.
 */
private static List getNonReturnParameters(Operation op) {
    ArrayList plist = new ArrayList();
    Iterator iter = op.getOwnedParameters().iterator();
    while (iter.hasNext()) {
        Parameter p = (Parameter) iter.next();
        if (p.getDirection() != ParameterDirectionKind.RETURN_LITERAL) {
            plist.add(p);
        }
    }
    return plist;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:20,代码来源:ModelUtility.java

示例6: createSetter

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * Creates a "setter" UML operation for a UML property.
 * 
 * @param srcProperty
 *            The UML property
 * @return The "setter" operation
 */
public static Operation createSetter(Property srcProperty) {
    Operation setter = UMLFactory.eINSTANCE.createOperation();
    setter.setName("set_" + srcProperty.getName()); //$NON-NLS-1$

    Parameter setParm = setter.createOwnedParameter(srcProperty.getName(), srcProperty.getType());
    setParm.setDirection(ParameterDirectionKind.IN_LITERAL);

    return setter;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:17,代码来源:ModelUtility.java

示例7: getParameterName

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * 
 * 
 * @param direction
 * @return String
 */
private String getParameterName(ParameterDirectionKind direction) {
    if (ParameterDirectionKind.IN_LITERAL.equals(direction)) {
        return UMLMessage.LABEL_IN;
    } else if (ParameterDirectionKind.INOUT_LITERAL.equals(direction)) {
        return UMLMessage.LABEL_IN_OUT;
    } else if (ParameterDirectionKind.OUT_LITERAL.equals(direction)) {
        return UMLMessage.LABEL_OUT;
    } else if (ParameterDirectionKind.RETURN_LITERAL.equals(direction)) {
        return UMLMessage.LABEL_RETURN;
    }
    return null;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:CreateClassDefinitionToXMLFileJob.java

示例8: getTextOfDirection

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
/**
 * 
 * 
 * @param element
 * @return Object
 */
private String getTextOfDirection(Parameter element) {
    if (element.getDirection().equals(ParameterDirectionKind.IN_LITERAL)) {
        return ParameterDirectionType.IN.toString();
    } else if (element.getDirection().equals(ParameterDirectionKind.INOUT_LITERAL)) {
        return ParameterDirectionType.INOUT.toString();
    } else if (element.getDirection().equals(ParameterDirectionKind.OUT_LITERAL)) {
        return ParameterDirectionType.OUT.toString();
    } else if (element.getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
        return ParameterDirectionType.RETURN.toString();
    }
    return null;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:ParameterSectionLabelProvider.java

示例9: testOperation

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
@Test
public void testOperation() throws Exception {
	Model model = model("hu.elte.txtuml.export.uml2.tests.models.operation");
	Class cls = cls(model, "TestClass");
	Operation op1 = operation(cls, "op1");

	Parameter returnParam = op1.getOwnedParameters().get(0);
	assertEquals("return", returnParam.getName());
	assertEquals("Integer", returnParam.getType().getName());
	assertEquals(ParameterDirectionKind.RETURN_LITERAL, returnParam.getDirection());

	Parameter param1 = op1.getOwnedParameters().get(1);
	assertEquals("b", param1.getName());
	assertEquals("Boolean", param1.getType().getName());
	assertEquals(ParameterDirectionKind.IN_LITERAL, param1.getDirection());

	Parameter param2 = op1.getOwnedParameters().get(2);
	assertEquals("c", param2.getName());
	assertEquals("String", param2.getType().getName());
	assertEquals(ParameterDirectionKind.IN_LITERAL, param2.getDirection());

	Operation op2 = operation(cls, "op2");
	assertTrue(op2.getOwnedParameters().isEmpty());
	assertEquals(VisibilityKind.PUBLIC_LITERAL, op2.getVisibility());

	Operation op3 = operation(cls, "op3");
	assertEquals(VisibilityKind.PRIVATE_LITERAL, op3.getVisibility());
	Operation op4 = operation(cls, "op4");
	assertEquals(VisibilityKind.PROTECTED_LITERAL, op4.getVisibility());

	assertNull(cls.getOperation("external_op", null, null));
	Operation externalBodyOp = operation(cls, "external_body_op");
	assertTrue(externalBodyOp.isAbstract());
	Operation staticOp = operation(cls, "static_op");
	assertTrue(staticOp.isStatic());
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:37,代码来源:TestStructure.java

示例10: searchReturnPin

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
private OutputPin searchReturnPin(EList<OutputPin> results, EList<Parameter> outputParameters) {
	for (int i = 0; i < Math.min(results.size(), outputParameters.size()); i++) {

		if (outputParameters.get(i).getDirection().equals(ParameterDirectionKind.RETURN_LITERAL)) {
			return results.get(i);
		}
	}
	return null;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:10,代码来源:CallOperationExporter.java

示例11: getEParameters

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
@Override
public EList<EParameter> getEParameters() {
	List<Parameter> paramList = origOperation.getOwnedParameters();
	EList<EParameter> result = new BasicEList<EParameter>();
    if (! paramList.isEmpty()){
    	for (Parameter param : paramList)
    		 if (param.getDirection() != ParameterDirectionKind.RETURN_LITERAL)
    		result.add(((EResourceUMLAdapter)owningResource).getParamIfNotExists(new EParameterUMLAdapter(param,owningResource)));
    }
return result;
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:12,代码来源:EOperationUMLAdapter.java

示例12: renderObject

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public boolean renderObject(Parameter parameter, IndentedPrintWriter w, IRenderingSession context) {
    TextUMLRenderingUtils.renderStereotypeApplications(w, parameter, false);
    ParameterDirectionKind direction = parameter.getDirection();
    if (direction != null)
        w.print(direction.getLiteral() + " ");
    w.print(name(parameter));
    w.print(" : ");
    w.print(TextUMLRenderingUtils.getQualifiedNameIfNeeded(parameter));
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:11,代码来源:ParameterRenderer.java

示例13: applyModifiers

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
private void applyModifiers(Set<Modifier> modifiers, Parameter parameter) {
    ParameterDirectionKind directionKind = ParameterDirectionKind.IN_LITERAL;
    ParameterEffectKind effectKind = null;
    for (Modifier modifier : modifiers) {
        switch (modifier) {
        case IN:
            directionKind = ParameterDirectionKind.IN_LITERAL;
            break;
        case OUT:
            directionKind = ParameterDirectionKind.OUT_LITERAL;
            break;
        case INOUT:
            directionKind = ParameterDirectionKind.INOUT_LITERAL;
            break;
        case CREATE:
            effectKind = ParameterEffectKind.CREATE_LITERAL;
            break;
        case UPDATE:
            effectKind = ParameterEffectKind.UPDATE_LITERAL;
            break;
        case DELETE:
            effectKind = ParameterEffectKind.DELETE_LITERAL;
            break;
        case READ:
            effectKind = ParameterEffectKind.READ_LITERAL;
            break;
        }
    }
    parameter.setDirection(directionKind);
    if (effectKind != null)
        // workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=522336
        parameter.setEffect(effectKind);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:34,代码来源:SignatureProcessor.java

示例14: createParameter

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
protected Parameter createParameter(String name, PTypeIdentifier typeNode, ParameterDirectionKind direction) {
    if (name == null && direction != ParameterDirectionKind.RETURN_LITERAL && !unnamedParameters) {
        problemBuilder.addError("Parameter names are required in this context", typeNode.parent());
        return null;
    }
    Parameter parameter = createParameter(name);
    parameter.setDirection(direction);
    createParameterTypeSetter(parameter).process(typeNode);
    // a default value was provided, consider this not required
    if (parameter.getDefault() != null || parameter.getDefaultValue() != null)
    	parameter.setLowerValue(MDDUtil.createLiteralUnlimitedNatural(parent.getNearestPackage(), 0));
    return parameter;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:14,代码来源:AbstractSignatureProcessor.java

示例15: process

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public void process(final TypedElement initializableElement,
        final AComplexInitializationExpression initializationExpression) {
    sourceContext.getNamespaceTracker().enterNamespace(currentClass);
    try {
        Activity activity = (Activity) currentClass.createOwnedBehavior(null, IRepository.PACKAGE.getActivity());
        activity.setIsReadOnly(true);
        activity.setName("defaultValue_" + initializableElement.getName());
        Parameter activityReturn = activity.createOwnedParameter(null, null);
        activityReturn.setDirection(ParameterDirectionKind.RETURN_LITERAL);
        TypeUtils.copyType(initializableElement, activityReturn);
        BehaviorGenerator behaviorGenerator = new BehaviorGenerator(sourceContext);
        behaviorGenerator.createBody(initializationExpression.getExpressionBlock(), activity);
        ValueSpecification reference = ActivityUtils.buildBehaviorReference(currentClass.getNearestPackage(),
                activity, null);

        MDDExtensionUtils.makeDerivation(initializableElement, activity);
        if (initializableElement instanceof Property)
            ((Property) initializableElement).setDefaultValue(reference);
        else if (initializableElement instanceof Parameter)
            ((Parameter) initializableElement).setDefaultValue(reference);
        else
            problemBuilder.addError("Element is not initializable: " + initializableElement.getName() + " : "
                    + initializableElement.eClass().getName(), initializationExpression);
    } finally {
        sourceContext.getNamespaceTracker().leaveNamespace();
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:28,代码来源:ComplexInitializationExpressionProcessor.java


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