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


Java Property类代码示例

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


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

示例1: addPortToComposite

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private void addPortToComposite(RoundedCompartmentEditPart compartment) {
	Element elem = (Element) ((View)compartment.getModel()).getElement();
	List<Port> ports = Collections.emptyList();
	if(elem instanceof Property){
		Property prop = (Property) elem;
		Object clazz =  prop.getType();
		if(clazz instanceof Classifier){
			ports = (List<Port>) (Object) ((Classifier)clazz).getAttributes().stream().filter(p-> p instanceof Port).collect(Collectors.toList());
		}
	}else if(elem instanceof org.eclipse.uml2.uml.Class){
		ports = (List<Port>) (Object) ((org.eclipse.uml2.uml.Class) elem).getAttributes().stream().filter(p-> p instanceof Port).collect(Collectors.toList());
	}
	
	for(Port p : ports){
		CompositeDiagramElementsController.addPortToCompartmentEditPart(compartment, p);
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:19,代码来源:CompositeDiagramElementsManager.java

示例2: createContainmentFeatureMapEntry

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
public static FeatureMap.Entry createContainmentFeatureMapEntry(String nsPrefix, String nsURI, String name, Element base, Stereotype refinement) {
	AnyType anyType = XMLTypeFactory.eINSTANCE.createAnyType();
	
	// create for each property of the refinement an EReference and the SimpleFeatureMapEntry
	for(Property property : refinement.getAllAttributes()) {
		if(!property.getName().startsWith("base_")) {
			AnyType anyTypeForProperty = XMLTypeFactory.eINSTANCE.createAnyType();
			SimpleFeatureMapEntry simpleFeatureMapEntry = new SimpleFeatureMapEntry((EStructuralFeature.Internal) Text_Attribute, getStringRepresentation(base.getValue(refinement, property.getName())));
			anyTypeForProperty.getMixed().add(simpleFeatureMapEntry);
			
			EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry containmentFeatureMapEntry = 
					new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, property.getName()), (InternalEObject) anyTypeForProperty);
		
			anyType.getMixed().add(containmentFeatureMapEntry);
		}
	}
	
	return new EStructuralFeatureImpl.ContainmentUpdatingFeatureMapEntry((EStructuralFeature.Internal) createTEReference(nsPrefix, nsURI, name), 
			(InternalEObject) anyType); 		
}
 
开发者ID:alexander-bergmayr,项目名称:caml2tosca,代码行数:21,代码来源:ToscaUtil.java

示例3: getApplicableElementName

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 스테레오타입이 적용될 수 있는 엘리먼트들의 이름을 나열해 반환한다. Class, Operation, Property 만 적용될 수
 * 있다고 간주한다. 각각 base_Class, base_Operation, base_Property 임. 이 로직은 프로퍼티 파일
 * 구조를 분석해 나온 로직으로서 정확한지 확인필요(알맞은 메소드가 존재하는지 여부) 명쾌한 해답이 없어요..
 * 
 * @param stereotype
 * @return String
 */
public static String getApplicableElementName(Stereotype stereotype) {
    if( null == stereotype) {
        return MDDCoreConstant.EMPTY_STRING;
    }
    StringBuffer name = new StringBuffer();

    for (Property property : stereotype.getOwnedAttributes()) {
        for (String typeName : MDDCoreConstant.APPLICABLE_TYPE_NAMES) {
            if (typeName.equals(property.getName())) {
                name.append(MDDCoreConstant.COMMA);
                name.append(property.getName().substring(5)); // "base_" 를.
                // 빼면 엘리먼트 명이
                // 된다.
                break;
            }
        }
    }

    if (name.length() > 0) {
        return name.substring(1); // 맨앞에 "," 제거
    } else {
        return MDDCoreConstant.EMPTY_STRING;
    }

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

示例4: AssociationEnd

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * Creates an AssociationEnd based on the EMF-UML model-element provided
 * 
 * @param end
 *            the EMF-UML model-element which holds informations of this
 *            diagram element
 */
public AssociationEnd(Property end) {
	name = end.getLabel();
	int low = end.lowerBound();
	int high = end.upperBound();

	// Create an UML-style multiplicity string
	if (low == 0 && high == -1) {
		multiplicity = "*";
	} else if (low == high) {
		multiplicity = Integer.toString(low);
	} else {
		multiplicity = low + ".." + (high == -1 ? "*" : high);
	}
	visibility = end.getVisibility();
	navigable = end.isNavigable();
	composition = end.isComposite();
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:25,代码来源:AssociationEnd.java

示例5: unsetAssociation

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * association설정지움
 * 
 * @param umlModel
 *            void
 */
public static void unsetAssociation(Association umlModel) {
    umlModel.getNearestPackage().getPackagedElements().remove(umlModel);
    EList<Property> propertyList = umlModel.getMemberEnds();
    Property property;
    Element element;
    for (Iterator<Property> iter = propertyList.iterator(); iter.hasNext();) {
        property = iter.next();
        element = property.getOwner();
        if (!umlModel.equals(element)) {
            ((StructuredClassifier) element).getOwnedAttributes().remove(property);
            deleteElement(property);
        }
    }
    umlModel.getMemberEnds().clear();
    deleteElement(umlModel);

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

示例6: testLink

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
@Test
public void testLink() throws Exception {
	Model model = model("hu.elte.txtuml.export.uml2.tests.models.link_and_unlink");
	Class clsA = cls(model, "A");
	Property otherEnd = property(clsA, "OtherEnd", "B");
	Class clsB = cls(model, "B");
	Property thisEnd = property(clsB, "ThisEnd", "A");

	SequenceNode body = loadActionCode(model, "A", "testLink");
	SequenceNode linkStmt = node(body, 0, "link inst1 to inst2;", SequenceNode.class);
	node(linkStmt, 0, "inst1", ReadVariableAction.class);
	node(linkStmt, 1, "inst2", ReadVariableAction.class);
	CreateLinkAction linkNode = node(linkStmt, 2, "link inst1 to inst2", CreateLinkAction.class);
	assertEquals(thisEnd, linkNode.getEndData().get(0).getEnd());
	assertNotNull(linkNode.getEndData().get(0).getValue());
	assertEquals(otherEnd, linkNode.getEndData().get(1).getEnd());
	assertNotNull(linkNode.getEndData().get(1).getValue());
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:19,代码来源:TestActionCode.java

示例7: parentIsEnumerationAndDo

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 상위 부모가 Enumeration 요소이고 자식 요소가 해당 Enumeration에
 * 속한다면 붙이기를 수행한다.
 * @param parent UML 요소를 붙여 넣을 부모
 * @param copied 복사된 UML 요소
 * @param original 원본 UML 요소
 * @param something 복사할 것인지 복사 가능여부만 체크할 것인지 결정하는 플래그
 * @return boolean 부모로 복사 성공 여부
 */
private static boolean parentIsEnumerationAndDo(EObject parent, EObject copied, EObject original, int something) {
    boolean result = false;
    
    Enumeration enumeration = (Enumeration) parent;
    if (copied instanceof EnumerationLiteral) {
        if (something == COPY) enumeration.getOwnedLiterals().add((EnumerationLiteral) copied);
        result = true;
        
    } else if (copied instanceof Property) {
        if (something == COPY) enumeration.getOwnedAttributes().add((Property) copied);
        result = true;
        
    } else if (copied instanceof Operation) {
        if (something == COPY) enumeration.getOwnedOperations().add((Operation) copied);
        result = true;
    }
    
    if (result && something == COPY) applyStereotypes(parent, copied, original); 
    
    return result;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ElementCopier.java

示例8: parentIsArtifactAndDo

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 상위 부모가 Artifact 요소이고 자식 요소가 해당 Artifact에
 * 속한다면 붙이기를 수행한다.
 * @param parent UML 요소를 붙여 넣을 부모
 * @param copied 복사된 UML 요소
 * @param original 원본 UML 요소
 * @param something 복사할 것인지 복사 가능여부만 체크할 것인지 결정하는 플래그
 * @return boolean 부모로 복사 성공 여부
 */
private static boolean parentIsArtifactAndDo(EObject parent, EObject copied, EObject original, int something) {
    boolean result = false;
    
    Artifact artifact = (Artifact) parent;
    if (copied instanceof Property) {
        if (something == COPY) artifact.getOwnedAttributes().add((Property) copied);
        result = true;
        
    } else if (copied instanceof Operation) {
        if (something == COPY) artifact.getOwnedOperations().add((Operation) copied);
        result = true;
        
    } else if (copied instanceof Artifact) {
        if (something == COPY) artifact.getNestedArtifacts().add((Artifact) copied);
        result = true;
    }
    
    if (result && something == COPY) applyStereotypes(parent, copied, original); 
    
    return result;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ElementCopier.java

示例9: applyTyped

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
@Override
protected void applyTyped(ConnectorEnd object) {
	if (object.getReferencedElement() != null) {
		org.eclipse.uml2.uml.ConnectorEnd umlEnd = object.getReferencedElement();
		Property umlPart = umlEnd.getPartWithPort();
		ConnectableElement umlRole = umlEnd.getRole();

		UMLReferencingElementFinder finder = UMLReferencingElementFinder.create(EcoreUtil.getRootContainer(object));

		if (umlPart != null) {
			Optional<Attribute> attribute = finder.findElement(umlPart, Attribute.class);
			if (attribute.isPresent())
				object.setPart(attribute.get());
		}

		if (umlRole != null) {
			Optional<Port> port = finder.findElement(umlRole, Port.class);
			if (port.isPresent())
				object.setRole(port.get());
		}

	}

}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:ConnectorEndInitializer.java

示例10: collectExtraElement

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 해당 UML 요소와 관련되어 있는 추가적인 요소들을 더 수집한다.
 * @param element 찾으려는 UML 요소
 * @return Set<EObject> 수집된 UML 요소
 */
private Set<EObject> collectExtraElement(Element element) {
    Set<EObject> set = new HashSet<EObject>();
    
    if (!(element instanceof Property)) set.add(element);
    if (element instanceof Lifeline) {
        Lifeline lifeline = (Lifeline)element;
        if (lifeline.getRepresents() != null) {
            set.add(lifeline.getRepresents());
            if (lifeline.getRepresents().getType() != null)
                set.add(lifeline.getRepresents().getType());
        }
    }
    
    return set;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:ElementCollector.java

示例11: getObjectValueOfProperty

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 해당 프로퍼티의 값을 Object 로 반환하는 메소드 - 넘겨진 boolean 값에 따라 프로퍼티의 값이 없을 경우 default
 * value 가져오도록 구현
 * 
 * @param parentElement
 * @param property
 * @param wantDefaultValue
 * @return Object
 */
public static Object getObjectValueOfProperty(NamedElement parentElement, Object property, boolean wantDefaultValue) {
    Object propertyValue = null;

    try {
        propertyValue = parentElement.getValue((Stereotype) ((Property) property).eContainer(),
            ((Property) property).getName());
    } catch (NullPointerException npe) {
        if (wantDefaultValue) {
            propertyValue = ((Property) property).isSetDefault() ? ((Property) property).getDefault() : ""; //$NON-NLS-1$
        } else {
            propertyValue = ""; //$NON-NLS-1$
        }
    }

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

示例12: createReadLinkActionCode

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
public String createReadLinkActionCode(ReadLinkAction readLinkNode) {

		Property otherMember = null;
		for (LinkEndData end : readLinkNode.getEndData()) {
			if (end.getValue() == null) {
				otherMember = end.getEnd();
			}
		}
		tempVariableExporter.exportOutputPinToMap(readLinkNode.getResult());

		String target = readLinkNode.getInputValues().size() > 0
				? activityExportResolver.getTargetFromInputPin(readLinkNode.getInputValues().get(0))
				: ActivityTemplates.SelfLiteral;

		return ActivityTemplates.defineAndAddToCollection(otherMember.getType().getName(),
				tempVariableExporter.getRealVariableName(readLinkNode.getResult()), ActivityTemplates
						.selectAllTemplate(target, otherMember.getAssociation().getName(), otherMember.getName()));
	}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:19,代码来源:LinkActionExporter.java

示例13: testUnlink

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
@Test
public void testUnlink() throws Exception {
	Model model = model("hu.elte.txtuml.export.uml2.tests.models.link_and_unlink");
	Class clsA = cls(model, "A");
	Property otherEnd = property(clsA, "OtherEnd", "B");
	Class clsB = cls(model, "B");
	Property thisEnd = property(clsB, "ThisEnd", "A");

	SequenceNode body = loadActionCode(model, "A", "testUnlink");
	SequenceNode linkStmt = node(body, 0, "unlink inst1 from inst2;", SequenceNode.class);
	node(linkStmt, 0, "inst1", ReadVariableAction.class);
	node(linkStmt, 1, "inst2", ReadVariableAction.class);
	DestroyLinkAction linkNode = node(linkStmt, 2, "unlink inst1 from inst2", DestroyLinkAction.class);
	assertEquals(thisEnd, linkNode.getEndData().get(0).getEnd());
	assertNotNull(linkNode.getEndData().get(0).getValue());
	assertEquals(otherEnd, linkNode.getEndData().get(1).getEnd());
	assertNotNull(linkNode.getEndData().get(1).getValue());
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:19,代码来源:TestActionCode.java

示例14: setLabelVisibility

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
/**
 * 
 * 
 * @param labelNode
 *            void
 */
private void setLabelVisibility(LabelNode labelNode) {
    if (labelNode.getUmlModel() instanceof Property) {
        if (((Property) labelNode.getUmlModel()).isNavigable()) {
            labelVisibility = true;
        } else {
            labelVisibility = false;
        }
    } else if (labelNode.getUmlModel() instanceof ControlFlow) {
        labelVisibility = true;
    } else if (labelNode.getUmlModel() instanceof ObjectFlow) {
        labelVisibility = true;
    } else {
        labelVisibility = false;
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:22,代码来源:LabelNodeEditPart.java

示例15: createAttributes

import org.eclipse.uml2.uml.Property; //导入依赖的package包/类
private String createAttributes(VisibilityKind modifyer) {
	StringBuilder source = new StringBuilder("");
	for (Property attribute : structuredElement.getOwnedAttributes()) {
		if (attribute.getVisibility().equals(modifyer)) {
			String type = UKNOWN_TYPE;
			if (attribute.getType() != null) {
				type = attribute.getType().getName();
			}

			if (isSimpleAttribute(attribute)) {

				source.append(VariableTemplates.propertyDecl(type, attribute.getName(), attribute.getDefault()));
			} else {
				dependencyExporter.addDependency(type);
			}
		}
	}
	return source.toString();
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:20,代码来源:StructuredElementExporter.java


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