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


Java UMLFactory类代码示例

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


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

示例1: createCollaboration

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * Collaboration 생성
 * 
 * @param realizePkg
 * @param useCase
 * @return Collaboration
 */
private Collaboration createCollaboration(Package realizePkg, UseCase useCase) {
    Package ucPackage = realizePkg.getNestedPackage(useCase.getName());
    if (ucPackage == null) {
        ucPackage = realizePkg.createNestedPackage(useCase.getName());
    }
    PackageableElement packagedElement = ucPackage.getPackagedElement(useCase.getName());
    Collaboration collabo = null;
    if (packagedElement instanceof Collaboration) {
        collabo = (Collaboration) packagedElement;
    } else {
        EClass eClass = UMLFactory.eINSTANCE.getUMLPackage().getCollaboration();
        collabo = (Collaboration) ucPackage.createPackagedElement(useCase.getName(), eClass);
    }
    ModelUtility.copyDocumentation(collabo, useCase);
    ModelUtility.copyKeywords(useCase, collabo);

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

示例2: createCopyOfOperation

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * Creates new UML operation which is a shallow copy of the specified source
 * operation. It copies the name and the visibility of the source operation
 * as well as the parameters. For the parameters, it copies the name, type
 * and direction of the parameters of the source operation.
 * 
 * @param srcOp
 *            Source operation
 * @return the copy of the operation
 */
public static Operation createCopyOfOperation(Operation srcOp) {
    Operation targetOp = UMLFactory.eINSTANCE.createOperation();
    targetOp.setName(srcOp.getName());
    targetOp.setVisibility(srcOp.getVisibility());

    // EList srcParameters = srcOp.getOwnedParameters();
    EList srcParameters = srcOp.getOwnedMembers();
    for (Iterator piter = srcParameters.iterator(); piter.hasNext();) {
        Object element = piter.next();
        if (element instanceof Parameter) {
            Parameter srcParm = (Parameter) element;
            Parameter targetParm = targetOp.createOwnedParameter(srcParm.getName(), srcParm.getType());
            targetParm.setDirection(srcParm.getDirection());
        }
    }

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

示例3: createUMLModelRoot

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * 최상위 UML 모델 생성
 * 
 * @param uri
 * @return Resource
 */
public Resource createUMLModelRoot(URI uri, final String modelName) {
    final Resource resource = transactionEditingDomain.getResourceSet().createResource(uri);
    DomainUtil.registerDefaultPathmaps();

    transactionEditingDomain.getCommandStack().execute(new RecordingCommand(transactionEditingDomain) {
        /**
         * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
         */
        @Override
        protected void doExecute() {
            Model umlModelRoot = UMLFactory.eINSTANCE.createModel();
            umlModelRoot.setName(modelName);

            Model umlLibrary = (Model) DomainUtil.load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI));
            umlModelRoot.createPackageImport(umlLibrary);

            resource.getContents().add(umlModelRoot);
        }
    });

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

示例4: addComment

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.ui.property.section.DocumentSection#addComment(java.lang.String)
 */
protected void addComment(final String value) {

    MessageOccurrenceSpecification mos = (MessageOccurrenceSpecification) getData().getSendEvent();
    SendOperationEvent soe = (SendOperationEvent) mos.getEvent();

    if (mos != null && soe != null) {
        if (soe.getOperation() == null) {
            MessageDialog.openWarning(UiCorePlugin.getShell(),
                UMLMessage.UML_MODELER,
                UMLMessage.getMessage(UMLMessage.MESSAGE_NO_ASSIGNED_OPERATION));
            return;
        } else {
            comment = UMLFactory.eINSTANCE.createComment();
            comment.setBody(value);

            soe.getOperation().getOwnedComments().clear();
            soe.getOperation().getOwnedComments().add(comment);
        }
    }

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

示例5: setReplyMessage

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * setReplyMessage
 *  
 * @param interaction
 * @param client
 * @param supplier void
 */
protected void setReplyMessage(Interaction interaction, Lifeline client, Lifeline supplier) {
    sendMessageOccurrenceSpecificationForReply = null;
    receiveMessageOccurrenceSpecificationForReply = null;

    sendEventForReply = null;
    receiveEventForReply = null;
    
    replyMessage = UMLFactory.eINSTANCE.createMessage();
    replyMessage.setMessageSort(MessageSort.REPLY_LITERAL);

    sendMessageOccurrenceSpecificationForReply = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
    receiveMessageOccurrenceSpecificationForReply = UMLFactory.eINSTANCE.createMessageOccurrenceSpecification();
    // Reply Block
    if (null != sendMessageOccurrenceSpecificationForReply) {
        setReplyMessageFragment(interaction, client, supplier);
        setReplyViewModel();
    }

    replyMessage = SequenceUtil.setOperationToMessage(operation, replyMessage);

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

示例6: createTestModel

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
private static Container createTestModel() {
	Model umlRoot = UMLFactory.eINSTANCE.createModel();
	Container rootElement = DummyFactory.eINSTANCE.createContainer();

	ReferencingElement refElem11 = rootElement.createReferencingElement();
	setElement(umlRoot, refElem11);
	ReferencingElement refElem12 = rootElement.createReferencingElement();
	setElement(umlRoot, refElem12);
	Container cont11 = rootElement.createContainer();
	Container cont21 = cont11.createContainer();
	ReferencingElement refElem21 = cont11.createReferencingElement();
	setElement(umlRoot, refElem21);
	ReferencingElement2 refElem22 = cont11.createReferencingElement2();
	refElem22.setReferencedElement(refElem21.getReferencedElement());

	return rootElement;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:UMLReferencingElementFinderTest.java

示例7: testSimpleGetInitializer

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
@Test
public void testSimpleGetInitializer() {
    Model model = UMLFactory.eINSTANCE.createModel();

    IAtomicDerivedStateProcessor simpleProcessor = createMock(IAtomicDerivedStateProcessor.class);
    expect(simpleProcessor.getReplacements()).andReturn(Collections.emptyList());
    expect(simpleProcessor.getRequirements()).andReturn(Collections.emptyList());
    simpleProcessor.accept(model);
    replay(simpleProcessor);
    initializerMocks.put(Model.class, simpleProcessor);

    subject.initState(model);
    subject.calculateState(model);
    subject.cleanState(model);

    verify(simpleProcessor);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:DerivedStateProcessorTest.java

示例8: testState

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
@Test
public void testState() {
	// given
	org.eclipse.uml2.uml.State s = UMLFactory.eINSTANCE.createState();
	s.setContainer(region);
	s.setName("S1");

	// when
	State state = new State(s, "package.A.S1");
	state.setLayout(new Rectangle(1, 2, 3, 4));

	// then
	Assert.assertEquals("package.A.S1", state.getId());
	Assert.assertEquals("S1", state.getName());
	Assert.assertEquals(1, state.getPosition().getX());
	Assert.assertEquals(2, state.getPosition().getY());
	Assert.assertEquals(3, state.getWidth().intValue());
	Assert.assertEquals(4, state.getHeight().intValue());
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:20,代码来源:SMDiagramTests.java

示例9: createUMLFile

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
private void createUMLFile(URI uri, String modelname){
	Model model = UMLFactory.eINSTANCE.createModel();
       
	model.setName(modelname);

   	ResourceSet resourceSet = new ResourceSetImpl();
 		resourceSet.getPackageRegistry().put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
       
       resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(
 				UMLResource.FILE_EXTENSION,
 				UMLResource.Factory.INSTANCE
 			);
       
       Resource modelResource = resourceSet.createResource(uri);
       modelResource.getContents().add(model);
       try {
		modelResource.save(null);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:22,代码来源:PapyrusModelCreatorTest.java

示例10: serializeInstance

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void serializeInstance(String fileName, Map<String, Boolean> options) {
	ResourceSet rscSet = new ResourceSetImpl();
	UMLResourcesUtil.init(rscSet);
	fileName+=".uml";
	Resource resource = rscSet.createResource(URI.createURI(fileName).appendFileExtension(UMLResource.FILE_EXTENSION));
	Iterator<EObject> objIt = objList.iterator();
	EObject model = UMLFactory.eINSTANCE.createModel();
	resource.getContents().add(model);
	while (objIt.hasNext()) {
		EObject obj = objIt.next();
		if (isRoot(obj))
		resource.getContents().add(obj);
		((List<EObject>) model.eGet(UMLPackage.eINSTANCE.getPackage_PackagedElement())).add(obj);				
	}
	try{			
		resource.save(options);
	}catch (IOException e) {
		e.printStackTrace();
	}
	
}
 
开发者ID:SOM-Research,项目名称:EMFtoCSP,代码行数:23,代码来源:UmlModelBuilder.java

示例11: mapXSDAnnotation

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
@Operation(contextual = true, kind = Operation.Kind.HELPER)
public static Boolean mapXSDAnnotation(final XSDAnnotation self, final Element owner) {
    final Iterator<org.w3c.dom.Element> elements = self.getUserInformation().iterator();
    if (elements.hasNext()) {
        final Comment theComment = UMLFactory.eINSTANCE.createComment();
        final StringBuilder b = new StringBuilder();
        b.append(elements.next().getTextContent());
        while (elements.hasNext()) {
            b.append('\n');
            b.append(elements.next().getTextContent());
        }
        theComment.setBody(b.toString());
        owner.getOwnedComments().add(theComment);
        return true;
    }
    return false;
}
 
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:18,代码来源:NiemQvtLibrary.java

示例12: longTest

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

示例13: createUmlModelWithProperty

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
private Property createUmlModelWithProperty() {
    Package umlPackage = UMLFactory.eINSTANCE.createPackage();
    Class umlClass = UMLFactory.eINSTANCE.createClass();
    umlPackage.getPackagedElements().add(umlClass);
    Property umlProperty = UMLFactory.eINSTANCE.createProperty();
    umlClass.getOwnedAttributes().add(umlProperty);
    return umlProperty;
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:9,代码来源:DefaultTuidCalculatorTest.java

示例14: createInteraction

import org.eclipse.uml2.uml.UMLFactory; //导入依赖的package包/类
/**
 * Interaction 생성
 * 
 * @param collabo
 * @param name
 * @return Interaction
 */
private Interaction createInteraction(Collaboration collabo, String name) {
    EClass eClass = UMLFactory.eINSTANCE.getUMLPackage().getInteraction();

    Behavior ownedBehavior = collabo.getOwnedBehavior(name);
    if (ownedBehavior != null && ownedBehavior instanceof Interaction) {
        return (Interaction) ownedBehavior;
    } else {
        return (Interaction) collabo.createOwnedBehavior(name, eClass);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:18,代码来源:SemanticModelHandler.java

示例15: createGetter

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

    getter.createReturnResult(srcProperty.getName(), srcProperty.getType());

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


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