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


Java PrimitiveType类代码示例

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


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

示例1: generateElementsToBeAdded

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
/**
 * Returns the types of elements that are to be added
 * @return Returns the types of elements that are to be added
 */
private List<java.lang.Class<? extends Element>> generateElementsToBeAdded() {
	List<java.lang.Class<? extends Element>> nodes = new LinkedList<>(Arrays.asList(
			Class.class,
			Component.class,
			DataType.class,
			Enumeration.class,
			InformationItem.class,
			InstanceSpecification.class,
			Interface.class,
			Model.class,
			Package.class,
			PrimitiveType.class
	));
	
	if(PreferencesManager.getBoolean(PreferencesManager.CLASS_DIAGRAM_CONSTRAINT_PREF))
		nodes.add(Constraint.class);
	if(PreferencesManager.getBoolean(PreferencesManager.CLASS_DIAGRAM_COMMENT_PREF))
		nodes.add(Comment.class);
	if(PreferencesManager.getBoolean(PreferencesManager.CLASS_DIAGRAM_SIGNAL_PREF))
		nodes.add(Signal.class);
	
	return nodes;
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:28,代码来源:ClassDiagramElementsManager.java

示例2: getStringRepresentation

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
public static String getStringRepresentation(Object obj) {
	String value = "";
	if(obj instanceof EnumerationLiteral) {
		value = ((EnumerationLiteral) obj).getName();
	} else if(obj instanceof PrimitiveType) {
		// TODO: CHECK!
		value = ((PrimitiveType) obj).toString();
	} else if(obj instanceof LiteralString) {
		value = ((LiteralString) obj).getValue();
	} else {
		value = obj.toString();
	}
	return value;
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:15,代码来源:ToscaUtil.java

示例3: handleNonEObject

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
private static String handleNonEObject(Object object) {
	String ret = "";
	if (object instanceof Integer) {
		if ((Integer) object == -1) {
			ret = "*";
		} else {
			ret = ((Integer) object).toString();
		}

	} else if (object instanceof PrimitiveType) {
		ret = ((PrimitiveType) object).getName();
	}

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

示例4: isAllowedPrimitiveType

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
/**
 * Checks if the given type is an allowed primitive type.
 * 
 * @param type
 *            The type to be checked.
 * @return True, if the type is a allowed primitive type.
 */
private static boolean isAllowedPrimitiveType(Type type) {
    if (!isPrimitiveType(type)) {
        return false;
    }

    if (!Optional.ofNullable(type.eResource()).map(Resource::getURI).map(UML_PRIMITIVE_TYPES_URI::equals)
            .orElse(false)) {
        return false;
    }

    return new DefaultUMLPrimitiveTypeFilter().isAllowed((PrimitiveType) type);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:20,代码来源:PrimitiveTypeCheckingConstraintBase.java

示例5: qualifiedName

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
protected QualifiedName qualifiedName(PrimitiveType element) {
    String primitiveTypeName = element.getName();
    if (primitiveTypeName.startsWith("E")
            && primitiveTypeName.charAt(1) == primitiveTypeName.toUpperCase().charAt(1)) {
        return QualifiedName.create(primitiveTypeName.substring(1).toLowerCase());
    }
    return qualifiedName((NamedElement) element);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:9,代码来源:CooperateQualifiedNameProvider.java

示例6: prepare

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

	List<String> names = Arrays.asList("String", "Boolean", "Integer", "Real", "UnlimitedNatural");
	List<PrimitiveType> types = Arrays.asList(model.createOwnedPrimitiveType("String"),
			model.createOwnedPrimitiveType("Boolean"), model.createOwnedPrimitiveType("Integer"),
			model.createOwnedPrimitiveType("Real"), model.createOwnedPrimitiveType("UnlimitedNatural"));

	primitives = Pair.of(names, types);

	classA = model.createOwnedClass("A", false);
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:14,代码来源:ClassDiagramTests.java

示例7: renderObject

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
public boolean renderObject(PrimitiveType toRender, IndentedPrintWriter writer, IRenderingSession context) {
    RenderingUtils.renderAll(context, ElementUtils.getComments(toRender));
    TextUMLRenderingUtils.renderStereotypeApplications(writer, toRender);
    writer.println("primitive " + name(toRender) + ";");
    writer.println();
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:8,代码来源:PrimitiveTypeRenderer.java

示例8: caseAPrimitiveDef

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
@Override
public void caseAPrimitiveDef(APrimitiveDef node) {
    final String primitiveName = TextUMLCore.getSourceMiner().getIdentifier(node.getIdentifier());
    PrimitiveType newPrimitiveType = (PrimitiveType) namespaceTracker.currentPackage().createPackagedElement(
            primitiveName, IRepository.PACKAGE.getPrimitiveType());
    newPrimitiveType.setName(primitiveName);
	Modifier modifier = Modifier.fromToken(sourceMiner.getText(node.getVisibilityModifier()));
	VisibilityKind toApply = getVisibility(modifier, VisibilityKind.PUBLIC_LITERAL);
	newPrimitiveType.setVisibility(toApply);
    annotationProcessor.process(node.getAnnotations());
    annotationProcessor.applyAnnotations(newPrimitiveType, node);
    applyCurrentComment(newPrimitiveType);
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:14,代码来源:StructureGenerator.java

示例9: findTypes

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
private void findTypes(List<String> proposals, String lastWord) {
    Boolean lastWordEmpty = true;
    if (checkifNotEmpty(lastWord)) {
        lastWord = lastWord.toLowerCase();
        lastWordEmpty = false;
    }
    Package[] packages = getValidPackages();
    for (int i = 0; i < packages.length; i++) {
        for (TreeIterator<EObject> iterator = packages[i].eAllContents(); iterator.hasNext();) {
            EObject object = iterator.next();
            if (object instanceof Class) {
                Class clazz = (Class) object;
                if (lastWordEmpty || clazz.getQualifiedName().toLowerCase().contains(lastWord)) {
                    proposals.add(clazz.getQualifiedName());
                }

            }
            if (object instanceof PrimitiveType) {
                PrimitiveType primo = (PrimitiveType) object;
                if (lastWordEmpty || primo.getQualifiedName().toLowerCase().contains(lastWord)) {
                    proposals.add(primo.getQualifiedName());
                }
            }
            if (object instanceof Enumeration) {
                Enumeration enume = (Enumeration) object;
                if (lastWordEmpty || enume.getQualifiedName().toLowerCase().contains(lastWord)) {
                    proposals.add(enume.getQualifiedName());
                }
            }
        }
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:33,代码来源:TextUMLCompletionProcessor.java

示例10: testPrimitiveType

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
public void testPrimitiveType() throws CoreException {
    String source = "";
    source += "model someModel;\n";
    source += "primitive Primitive1;\n";
    source += "private primitive Primitive2;\n";        
    source += "end.";
    parseAndCheck(source);
    PrimitiveType found1 = get("someModel::Primitive1", IRepository.PACKAGE.getPrimitiveType());
    assertNotNull(found1);
    assertEquals(VisibilityKind.PUBLIC_LITERAL, found1.getVisibility());
    PrimitiveType found2 = get("someModel::Primitive2", IRepository.PACKAGE.getPrimitiveType());
    assertNotNull(found2);
    assertEquals(VisibilityKind.PRIVATE_LITERAL, found2.getVisibility());
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:15,代码来源:ClassifierTests.java

示例11: transformAttributes

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
/**
 * transform attributes for target class or interface
 * 
 * @param sourceType
 * @param targetType
 * @param targetStructureTransformationData
 */
private static void transformAttributes(Type sourceType, Type targetType,
                                        TargetStructureTransformationData targetStructureTransformationData) {
    EList<Property> sourceProperties = null;
    Property sourceProperty = null;
    Property targetProperty = null;
    boolean isNewlyCreated = false;

    // Source(분석 모델)요소가 Class인 경우
    if (sourceType instanceof Class) {
        sourceProperties = ((Class) sourceType).getOwnedAttributes();
        // Source(분석 모델)요소가 Interface인 경우
    } else if (sourceType instanceof Interface) {
        sourceProperties = ((Interface) sourceType).getOwnedAttributes();
    }

    for (Iterator<Property> propertyIterator = sourceProperties.iterator(); propertyIterator.hasNext();) {
        sourceProperty = propertyIterator.next();

        if (targetType instanceof Interface) {
            targetProperty = ((Interface) targetType).getOwnedAttribute(sourceProperty.getName(), null);

            if (targetProperty == null) {
                /**
                 * 2011.03.09 조승현 원래는 모든 property 의 Type을 다 복사해야 맞지만,
                 * Primitive 타입이 아닐 경우에는 아직 만들어 지지 않은 Type(Class) 일 수도 있어서,
                 * 현재는 Primitive 타입일 경우에만 Type을 복사 함. 전개 순서를 패키지 -> Type ->
                 * Attribute -> Operation... 으로 바꾸는 작업이 선행 되어야 함.
                 */
                if (sourceProperty.getType() instanceof PrimitiveType) {
                    targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(),
                        sourceProperty.getType());
                } else {
                    targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(), null);
                }

                isNewlyCreated = true;
            }
        } else if (targetType instanceof Class) {
            targetProperty = ((Class) targetType).getOwnedAttribute(sourceProperty.getName(), null);
            /**
             * 2011.03.09 조승현 원래는 모든 property 의 Type을 다 복사해야 맞지만, Primitive
             * 타입이 아닐 경우에는 아직 만들어 지지 않은 Type(Class) 일 수도 있어서, 현재는 Primitive
             * 타입일 경우에만 Type을 복사 함. 전개 순서를 패키지 -> Type -> Attribute ->
             * Operation... 으로 바꾸는 작업이 선행 되어야 함.
             */
            if (targetProperty == null) {
                if (sourceProperty.getType() instanceof PrimitiveType) {
                    targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(),
                        sourceProperty.getType());
                } else {
                    targetProperty = ((Class) targetType).createOwnedAttribute(sourceProperty.getName(), null);
                }

                isNewlyCreated = true;
            }
        }

        if (targetStructureTransformationData != null
            && targetStructureTransformationData.getPropertyApplicableStereotype() != null
            && targetProperty != null) {
            applyStereotype(sourceProperty, targetProperty, targetStructureTransformationData.getPropertyApplicableStereotype());
        }

        // 신규 생성인 경우
        if (isNewlyCreated) {
            // 코멘트를 복사한다
            copyComment(sourceProperty, targetProperty);
        }

        targetProperty.setVisibility(sourceProperty.getVisibility());
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:80,代码来源:SemanticModelHandlerUtil.java

示例12: createPrimitiveType

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
/**
 * 
 * 
 * @return PrimitiveType
 */
public static PrimitiveType createPrimitiveType() {
    org.eclipse.uml2.uml.PrimitiveType primitiveType = FACTORY.createPrimitiveType();
    primitiveType.setName(UMLMessage.getMessage(UMLMessage.UML_PRIMITIVETYPE));
    return primitiveType;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:11,代码来源:UMLHelper.java

示例13: getPrimitiveTypesIfRequested

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
private Stream<EObject> getPrimitiveTypesIfRequested(Resource umlResource, EClass type) {
    Resource umlPrimitives = umlResource.getResourceSet().getResource(UML_PRIMITIVE_TYPES_URI, true);
    return getScopeElementsFromUMLResource(umlPrimitives, type).filter(PrimitiveType.class::isInstance)
            .map(PrimitiveType.class::cast).filter(umlPrimitiveTypeSelector::isAllowed).map(EObject.class::cast);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:6,代码来源:CooperateGlobalScopeProvider.java

示例14: isAllowed

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
@Override
public boolean isAllowed(PrimitiveType type) {
    return ALLOWED_TYPES.contains(type.getName());
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:5,代码来源:DefaultUMLPrimitiveTypeFilter.java

示例15: setAttribute

import org.eclipse.uml2.uml.PrimitiveType; //导入依赖的package包/类
/**
 * 파라미터로 넘긴 속성을 해당 클래스의 속성으로 설정하는 메소드
 * 
 * @param sourceClass
 * @param attribute
 *            void
 */
public static void setAttribute(org.eclipse.uml2.uml.Package sourcePackage, org.eclipse.uml2.uml.Class sourceClass,
                                String attributeName, String typeName, int lowerBound, int upperBound) {
    Type type = (PrimitiveType) sourcePackage.createOwnedPrimitiveType(typeName);

    sourceClass.createOwnedAttribute(attributeName, type, lowerBound, upperBound);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:14,代码来源:ElementUtil.java


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