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


Java Classifier类代码示例

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


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

示例1: applyReferencedEvent

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * 
 * applyReferencedEvent
 *  
 * @param copied
 * @param orgEvent
 * @param copiedEvent void
 */
private void applyReferencedEvent(EObject copied, Event orgEvent, Event copiedEvent) {
    if(copied instanceof Interaction || copied instanceof Collaboration) {
        EList<Element> allOwnedElements = ((Classifier) copied).allOwnedElements();
        for (Element element : allOwnedElements) {
            if(element instanceof MessageOccurrenceSpecification) {
                MessageOccurrenceSpecification mos = (MessageOccurrenceSpecification) element;
                Event event = mos.getEvent();
                
                if( orgEvent == event) {
                    mos.setEvent(copiedEvent);
                }
            }
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:24,代码来源:ElementPaster.java

示例2: deactivate

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#deactivate()
 */
@Override
public void deactivate() {
    if (isActive()) {
        super.deactivate();
        AbstractNode model = (AbstractNode) getModel();
        model.eAdapters().remove(this);
        if (model.getUmlModel() instanceof Classifier) {
            ((Classifier) (model.getUmlModel())).eAdapters().remove(this);
        }

        EObject object = (EObject) getParent().getModel();
        object.eAdapters().add(this);
        if (((AbstractView) object).getUmlModel() != null) {
            ((AbstractView) object).getUmlModel().eAdapters().remove(this);
        }

    }

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

示例3: getClassList

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * diagram에 작성된 Classifier의 리스트를 source에 담는다.
 * 
 * @param diagram
 * @param source
 */
public static void getClassList(Diagram diagram, List<Classifier> source) {

    if (null != diagram) {
        EList<AbstractNode> nodeList = diagram.getNodeList();
        for (AbstractNode abstractNode : nodeList) {
            Element element = abstractNode.getUmlModel();
            if (element != null) {
                if (element instanceof Classifier) {
                    if (!source.contains(element)) {
                        source.add((Classifier) element);
                    }
                }
            }
        }
    }

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

示例4: generateEnumClass

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * Generate the Enum from the <<Enumeration>> class.
 * 
 * @param Class
 *            clazz the UML class
 * @return the complete class with its content as a String
 */
public String generateEnumClass(Classifier clazz) {

    StringWriter outString= new StringWriter();
	PrintWriter writer=new PrintWriter(outString);

	javaType = clazz.getAttributes().iterator().next().getType().getName();
	
	generatePackage(clazz, writer);
	generateEnum(clazz, writer);
	
	writer.flush();

	String fileContent = outString.toString();
	logger.log(Level.INFO, "Compilation unit: \n\n" + fileContent);
	return fileContent;
}
 
开发者ID:WalterMourao,项目名称:andromda,代码行数:24,代码来源:EnumClassGenerator.java

示例5: generateConstants

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * Generate Enumeration constants.
 * 
 * @param clazz
 *            the UML class
 * @param ast
 *            the JDT Java AST
 * @param ed
 *            Enumeration declaration for Java JDT
 */
public void generateConstants(Classifier clazz, PrintWriter writer) {
	// Get all properties for this enumeration class
	Class enumerationClass = (Class) clazz;
	EList<Property> attributes = enumerationClass.getAttributes();
	int count=0;
	for (Property enumLiteral : attributes) {
	    count++;
	    String comments=andromdaHelper.concatComments(enumLiteral.getOwnedComments());
	    if(StringUtils.isNotEmpty(comments)){
	        generateSimpleComment(writer, comments.split("\n"));
	    }
           String literalName = nameMasker.mask(enumLiteral.getName(),NameMasker.UPPERUNDERSCORE);
	    writer.format("%s(%s)",literalName,resolveConstantValue(enumLiteral));
	    if(count < attributes.size()){
	        writer.println(",");
	    } else {
               writer.println(";");
	    }
	}
}
 
开发者ID:WalterMourao,项目名称:andromda,代码行数:31,代码来源:EnumClassGenerator.java

示例6: eSet

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case CmpPackage.PROPERTY__NAME:
            setName((String)newValue);
            return;
        case CmpPackage.PROPERTY__VISIBILITY:
            setVisibility((VisibilityKind)newValue);
            return;
        case CmpPackage.PROPERTY__STATIC:
            setStatic((Boolean)newValue);
            return;
        case CmpPackage.PROPERTY__TYPE:
            setType((Classifier)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:PropertyImpl.java

示例7: eSet

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case CmpPackage.PORT__VISIBILITY:
            setVisibility((VisibilityKind)newValue);
            return;
        case CmpPackage.PORT__REFERENCED_ELEMENT:
            setReferencedElement((org.eclipse.uml2.uml.Port)newValue);
            return;
        case CmpPackage.PORT__REALIZED_CLASSIFIER:
            setRealizedClassifier((de.cooperateproject.modeling.textual.component.cmp.Classifier<Classifier>)newValue);
            return;
        case CmpPackage.PORT__CONJUGATED:
            setConjugated((Boolean)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:PortImpl.java

示例8: eUnset

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
    switch (featureID) {
        case CmpPackage.PORT__VISIBILITY:
            unsetVisibility();
            return;
        case CmpPackage.PORT__REFERENCED_ELEMENT:
            setReferencedElement((org.eclipse.uml2.uml.Port)null);
            return;
        case CmpPackage.PORT__REALIZED_CLASSIFIER:
            setRealizedClassifier((de.cooperateproject.modeling.textual.component.cmp.Classifier<Classifier>)null);
            return;
        case CmpPackage.PORT__CONJUGATED:
            unsetConjugated();
            return;
    }
    super.eUnset(featureID);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:PortImpl.java

示例9: eSet

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case ClsPackage.PROPERTY__NAME:
            setName((String)newValue);
            return;
        case ClsPackage.PROPERTY__VISIBILITY:
            setVisibility((VisibilityKind)newValue);
            return;
        case ClsPackage.PROPERTY__TYPE:
            setType((Classifier)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:21,代码来源:PropertyImpl.java

示例10: applyTyped

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
@Override
protected void applyTyped(Generalization object) {
    Optional<Classifier> umlSpecific = Optional.ofNullable(object.getSpecific())
            .map(UMLReferencingElement::getReferencedElement);
    Optional<Classifier> umlGeneral = Optional.ofNullable(object.getGeneral())
            .map(UMLReferencingElement::getReferencedElement);

    if (!umlSpecific.isPresent() || !umlGeneral.isPresent()) {
        return;
    }

    org.eclipse.uml2.uml.Generalization umlGeneralization = umlSpecific.get().getGeneralization(umlGeneral.get());
    if (umlGeneralization != null) {
        object.setReferencedElement(umlGeneralization);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:17,代码来源:GeneralizationCalculator.java

示例11: ClassAttributeLink

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
/**
 * Creates a ClassAttributeLink based on the EMF-UML model-elements and
 * layout information provided
 * 
 * @param layout
 *            the layout informations of this link
 * @param assoc
 *            the EMF-UML model-element which holds informations of this
 *            diagram element
 * @param fromClass
 *            the EMF-UML model Class belonging to the from end of this
 *            association
 * @param toClass
 *            the EMF-UML model Class belonging to the to end of this
 *            association
 * @throws UnexpectedEndException
 *             Exception is thrown if an association's end could not be
 *             linked to the EMF-UML model
 */
public ClassAttributeLink(LineAssociation layout, Association assoc, Classifier fromClass, Classifier toClass)
		throws UnexpectedEndException {
	super(layout);
	name = assoc.getLabel();
	from = null;
	to = null;
	for (Property end : assoc.getMemberEnds()) {
		Class endClass = (Class) end.getType();
		// when handling reflexive links then first add the to end's, then
		// the from end's model information (to match the Papyrus exporter
		// behavior)
		if (endClass == toClass && to == null) {
			to = new AssociationEnd(end);
		} else if (endClass == fromClass && from == null) {
			from = new AssociationEnd(end);
		} else {
			throw new UnexpectedEndException(end.getName());
		}
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:40,代码来源:ClassAttributeLink.java

示例12: addPortToComposite

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

示例13: assignModifiersForElementBasedOnDeclaration

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
public static void assignModifiersForElementBasedOnDeclaration(NamedElement element, BodyDeclaration declaration) {
	int modifiers = declaration.getModifiers();
	VisibilityKind visibility = VisibilityProvider.getVisibilityOfNamedElementFromModifiers(element, modifiers);
	element.setVisibility(visibility);

	boolean isAbstract = Modifier.isAbstract(modifiers);
	boolean isStatic = Modifier.isStatic(modifiers);

	if (element instanceof Classifier) {
		Classifier classifierElem = (Classifier) element;
		classifierElem.setIsAbstract(isAbstract);
	}
	if (element instanceof BehavioralFeature) {
		BehavioralFeature featureElem = (BehavioralFeature) element;
		featureElem.setIsStatic(isStatic);
		featureElem.setIsAbstract(isAbstract);
	}
	if (element instanceof Property) {
		Property propertyElem = (Property) element;
		propertyElem.setIsStatic(isStatic);
	}
}
 
开发者ID:ELTE-Soft,项目名称:txtUML,代码行数:23,代码来源:ElementModifiersAssigner.java

示例14: testStereotypeApplication

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
public void testStereotypeApplication() {
    // builds a package with a class, applying a stereotype
    PackageBuilder packageBuilder = new UML2BuilderFactory().newBuilder(UML2ProductKind.PACKAGE);
    packageBuilder.name("myPackage");
    packageBuilder.applyProfile("myProfile");
    ClassifierBuilder classBuilder = packageBuilder.newClassifier(UML2ProductKind.CLASS);
    classBuilder.name("MyClass").applyStereotype("Stereotype1");

    // builds a profile with a stereotype
    PackageBuilder profileBuilder = new UML2BuilderFactory().newBuilder(UML2ProductKind.PROFILE);
    profileBuilder.name("myProfile");
    ClassifierBuilder stereotypeBuilder = profileBuilder.newClassifier(UML2ProductKind.STEREOTYPE);
    stereotypeBuilder.name("Stereotype1");
    stereotypeBuilder.extend("uml::Class", false);

    // builds the model from the given package builders
    new UML2ModelBuildDriver().build(buildContext, packageBuilder, profileBuilder);

    assertFalse(buildContext.getProblemTracker().hasProblems(Severity.ERROR));

    Classifier targetClass = classBuilder.getProduct();
    Stereotype stereotype = (Stereotype) stereotypeBuilder.getProduct();
    assertTrue(targetClass.isStereotypeApplied(stereotype));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:25,代码来源:StereotypeTests.java

示例15: basicResolveType

import org.eclipse.uml2.uml.Classifier; //导入依赖的package包/类
private Type basicResolveType(final Node node, final String qualifiedIdentifier, Type type) {
    if (type == null) {
        problemBuilder.addProblem(new UnknownType(qualifiedIdentifier), node);
        return null;
    }
    if (type instanceof Classifier) {
        final Classifier asClassifier = ((Classifier) type);
        if (asClassifier.isTemplate()) {
            if (this.parameterIdentifiers == null) {
                problemBuilder.addProblem(new UnboundTemplate(qualifiedIdentifier), node);
                return null;
            }
            type = createBinding(node, asClassifier);
        } else if (this.parameterIdentifiers != null) {
            problemBuilder.addProblem(new NotATemplate(qualifiedIdentifier), node);
            return null;
        }
    }
    return type;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:21,代码来源:AbstractTypeResolver.java


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