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

Java ParameterDirectionKind类代码示例

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

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



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


示例16: createParameterVariables

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public static void createParameterVariables(Activity activity) {
    StructuredActivityNode bodyNode = getBodyNode(activity);
    for (Parameter parameter : activity.getOwnedParameters()) {
        // variables represent the value for each input/output parameter -
        // their values will be transferred to the output pins of the
        // activity at the end
        // convention: the unnamed variable corresponds to the result value
        String varName = parameter.getDirection() == ParameterDirectionKind.RETURN_LITERAL ? "" : parameter
                .getName();
        Variable newVariable = bodyNode.createVariable(varName, null);
        TypeUtils.copyType(parameter, newVariable);
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:14,代码来源:ActivityUtils.java


示例17: computeSignatureName

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public static String computeSignatureName(List<Parameter> signature) {
    StringBuffer name = new StringBuffer("{(");
    final List<Parameter> inputParameters = FeatureUtils.getInputParameters(signature);
    for (Parameter parameter : inputParameters) {
        if (parameter.getName() != null) {
            name.append(parameter.getName());
            name.append(" ");
        }
        name.append(": ");
        final Type parameterType = parameter.getType();
        final String parameterTypeName = parameterType == null ? "any" : parameterType.getQualifiedName();
        name.append(parameterTypeName);
        addMultiplicity(name, parameter);
        name.append(", ");
    }
    if (!inputParameters.isEmpty())
        name.delete(name.length() - ", ".length(), name.length());
    name.append(")");
    List<Parameter> returnParameter = FeatureUtils.filterParameters(signature,
            ParameterDirectionKind.RETURN_LITERAL);
    if (!returnParameter.isEmpty()) {
        name.append(" : ");
        final Type returnType = returnParameter.get(0).getType();
        final String returnTypeName = returnType == null ? "any" : returnType.getQualifiedName();
        name.append(returnTypeName);
    }
    name.append('}');
    return name.toString();
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:30,代码来源:MDDUtil.java


示例18: filterParameters

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public static List<Parameter> filterParameters(List<Parameter> original, ParameterDirectionKind... direction) {
    List<ParameterDirectionKind> directionList = Arrays.asList(direction);
    List<Parameter> filtered = new ArrayList<Parameter>(original.size());
    for (Parameter parameter : original)
        if (directionList.contains(parameter.getDirection()))
            filtered.add(parameter);
    return filtered;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:9,代码来源:FeatureUtils.java


示例19: enhanceAction

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

    Operation operation = findNamedElement(operationName, Literals.OPERATION);
    getProduct().setOperation(operation);

    List<Parameter> signatureParameters = StructuralFeatureUtils.filterParameters(operation.getOwnedParameters(),
            ParameterDirectionKind.IN_LITERAL, ParameterDirectionKind.INOUT_LITERAL,
            ParameterDirectionKind.OUT_LITERAL);
    int parameterCount = signatureParameters.size();
    int argumentCount = argumentBuilders.size();
    if (parameterCount != argumentCount)
        abortStatement(new WrongNumberOfArguments(parameterCount, argumentCount));
    // TODO only if not static
    getProduct().createTarget(null, null);
    buildSource(getProduct().getTarget(), targetBuilder);
    Classifier targetClassifier = (Classifier) ActivityUtils.getSource(getProduct().getTarget()).getType();
    getProduct().getTarget().setType(targetClassifier);
    // matches parameters and arguments
    for (int i = 0; i < parameterCount; i++) {
        Parameter current = signatureParameters.get(i);
        InputPin argument = getProduct().createArgument(null, null);
        argument.setName(current.getName());
        TypeUtils.copyType(current, argument, targetClassifier);
        buildSource(argument, argumentBuilders.get(i));
    }
    // optional result
    if (operation.getReturnResult() != null) {
        final OutputPin result = getProduct().createResult(null, null);
        TypeUtils.copyType(operation.getReturnResult(), result, getBoundElement());
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:33,代码来源:CallOperationActionBuilder.java


示例20: testFunctionAsParameter

import org.eclipse.uml2.uml.ParameterDirectionKind; //导入依赖的package包/类
public void testFunctionAsParameter() throws CoreException {
    String model = "model tests;\n";
    model += "import base;\n";
    model += "class Test\n";
    model += "operation op1(filter: {(: Integer) : Boolean});\n";
    model += "begin\n";
    model += "end;\n";
    model += "end;\n";
    model += "end.\n";
    parseAndCheck(model);
    Type integerType = (Type) getRepository()
            .findNamedElement("base::Integer", IRepository.PACKAGE.getType(), null);
    assertNotNull(integerType);
    Type booleanType = (Type) getRepository()
            .findNamedElement("base::Boolean", IRepository.PACKAGE.getType(), null);
    assertNotNull(booleanType);
    Operation op = (Operation) getRepository().findNamedElement("tests::Test::op1",
            IRepository.PACKAGE.getOperation(), null);
    assertNotNull(op);
    assertEquals(1, op.getOwnedParameters().size());
    Parameter opParam = op.getOwnedParameters().get(0);
    Type paramType = opParam.getType();
    assertTrue("found: " + paramType, MDDExtensionUtils.isSignature(paramType));
    assertEquals(2, MDDExtensionUtils.getSignatureParameters(paramType).size());
    Parameter signatureParam = MDDExtensionUtils.getSignatureParameters(paramType).get(0);
    assertNull(signatureParam.getName());
    assertEquals(ParameterDirectionKind.IN_LITERAL, signatureParam.getDirection());
    assertSame(integerType, signatureParam.getType());
    Parameter signatureReturn = MDDExtensionUtils.getSignatureParameters(paramType).get(1);
    assertNull(signatureReturn.getName());
    assertEquals(ParameterDirectionKind.RETURN_LITERAL, signatureReturn.getDirection());
    assertSame(booleanType, signatureReturn.getType());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:34,代码来源:SignatureTests.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RewriteRegexRule类代码示例发布时间:2022-05-22
下一篇:
Java MemoryLayoutSpecification类代码示例发布时间: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