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


Java Generalization类代码示例

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


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

示例1: selectionChanged

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
 *      org.eclipse.jface.viewers.ISelection)
 */
public void selectionChanged(IAction action, ISelection selection) {
    objList.clear();
    objList = ProjectUtil.getSelectedEObjects(selection);

    if (objList == null || objList.size() < 1) {
        return;
    }

    for (EObject eobject : objList) {
        if (eobject instanceof Lifeline || eobject instanceof Abstraction || eobject instanceof Association
            || eobject instanceof BehaviorExecutionSpecification || eobject instanceof CombinedFragment
            || eobject instanceof Comment || eobject instanceof Connector || eobject instanceof ControlFlow
            || eobject instanceof Dependency || eobject instanceof ExecutionEvent
            || eobject instanceof ExecutionOccurrenceSpecification || eobject instanceof Extend
            || eobject instanceof Generalization || eobject instanceof Include
            || eobject instanceof InteractionOperand || eobject instanceof InterfaceRealization
            || eobject instanceof Message || eobject instanceof MessageOccurrenceSpecification
            || eobject instanceof ObjectFlow || eobject instanceof Realization
            || eobject instanceof ReceiveOperationEvent || eobject instanceof SendOperationEvent
            || eobject instanceof Usage) {
            objList.clear();
            return;
        }
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:30,代码来源:CopyAction.java

示例2: createClass

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private Class createClass(Package pkg, FHIMInformationModel.Class classModel) {
    Class clazz = modelClassMap.get(classModel);

    LOG.debug("Class: " + clazz.getName());

    // Attributes.
    for (Attribute attributeModel : classModel.getAttributes()) {
        getProperty(clazz, attributeModel);
    }

    // Generalizations.
    for (FHIMInformationModel.Generalization generalizationModel : classModel.getGeneralizations()) {
        createGeneralization(clazz, generalizationModel);
    }

    return clazz;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:18,代码来源:Model2UMLConverter.java

示例3: createGeneralization

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private Generalization createGeneralization(Class clazz,
        FHIMInformationModel.Generalization generalizationModel) {
    FHIMInformationModel.Type typeModel = generalizationModel.getTarget();
    Type type = getTypeForModel(typeModel);

    // Expect type to be an instance of Class.
    if (type instanceof Class) {
        Class general = (Class) type;

        LOG.debug("Generalization: " + general.getName());

        return clazz.createGeneralization(general);
    }

    // Something wrong!
    throw new IllegalArgumentException("Unexpected type: " + type);
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:18,代码来源:Model2UMLConverter.java

示例4: buildClassModel

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private FHIMInformationModel.Class buildClassModel(Class clazz) {
    String name = clazz.getName();
    LOG.debug("Class: " + name);

    FHIMInformationModel.Class classModel = nameClassMap.get(name);

    // Generalizations.
    EList<Generalization> generalizations = clazz.getGeneralizations();
    for (Generalization generalization : generalizations) {
        FHIMInformationModel.Generalization generalizationModel = createGeneralizationModel(generalization);
        classModel.addGeneralization(generalizationModel);
    }

    // Attributes.
    EList<Property> attributes = clazz.getOwnedAttributes();
    for (Property attribute : attributes) {
        FHIMInformationModel.Attribute attributeModel = getAttributeModel(attribute);
        classModel.addAttribute(attributeModel);
    }

    return classModel;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:23,代码来源:UML2ModelConverter.java

示例5: basicRenderObject

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
@Override
protected boolean basicRenderObject(Generalization element, IndentedPrintWriter pw, IRenderingSession context) {
    if (!shouldRender(context, element.getSpecific(), element.getGeneral()))
        return true;
    context.render(element.getGeneral(), element.getGeneral().eResource() != element.eResource());
    pw.print("edge ");
    // if (element.getName() != null)
    // pw.print("\"" + element.getName() + "\" ");
    pw.println("[");
    pw.enterLevel();
    pw.println("arrowtail = \"empty\"");
    pw.println("arrowhead = \"none\"");
    pw.println("taillabel = \"\"");
    pw.println("headlabel = \"\"");
    DOTRenderingUtils.addAttribute(pw, "constraint", "true");
    DOTRenderingUtils.addAttribute(pw, "style", "none");
    pw.exitLevel();
    pw.println("]");
    pw.println("\"" + element.getGeneral().getName() + "\":port" + " -- \"" + element.getSpecific().getName()
            + "\":port");
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:23,代码来源:GeneralizationRenderer.java

示例6: renderObject

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public boolean renderObject(DataType dataType, IndentedPrintWriter writer, IRenderingSession context) {
    RenderingUtils.renderAll(context, ElementUtils.getComments(dataType));
    TextUMLRenderingUtils.renderStereotypeApplications(writer, dataType);
    if (dataType.isAbstract())
        writer.print("abstract ");
    writer.print("datatype " + name(dataType));
    List<Generalization> generalizations = dataType.getGeneralizations();
    StringBuilder specializationList = new StringBuilder();
    for (Generalization generalization : generalizations)
        specializationList.append(TextUMLRenderingUtils.getQualifiedNameIfNeeded(generalization.getGeneral(),
                dataType.getNamespace()) + ", ");
    if (specializationList.length() > 0) {
        specializationList.delete(specializationList.length() - 2, specializationList.length());
        writer.print(" specializes ");
        writer.print(specializationList);
    }
    writer.println();
    writer.enterLevel();
    RenderingUtils.renderAll(context, dataType.getOwnedAttributes());
    RenderingUtils.renderAll(context, dataType.getOwnedOperations());
    writer.exitLevel();
    writer.println("end;");
    writer.println();
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:26,代码来源:DataTypeRenderer.java

示例7: renderObject

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public boolean renderObject(Interface interface_, IndentedPrintWriter writer, IRenderingSession context) {
    RenderingUtils.renderAll(context, ElementUtils.getComments(interface_));
    TextUMLRenderingUtils.renderStereotypeApplications(writer, interface_);
    writer.print("interface " + name(interface_));
    List<Generalization> generalizations = interface_.getGeneralizations();
    StringBuilder specializationList = new StringBuilder();
    for (Generalization generalization : generalizations)
        specializationList.append(TextUMLRenderingUtils.getQualifiedNameIfNeeded(generalization.getGeneral(),
                interface_.getNamespace()) + ", ");
    if (specializationList.length() > 0) {
        specializationList.delete(specializationList.length() - 2, specializationList.length());
        writer.print(" specializes ");
        writer.print(specializationList);
    }
    writer.println();
    writer.enterLevel();
    RenderingUtils.renderAll(context, interface_.getOwnedAttributes());
    RenderingUtils.renderAll(context, interface_.getOwnedOperations());
    RenderingUtils.renderAll(context, interface_.getClientDependencies());
    writer.exitLevel();
    writer.println("end;");
    writer.println();
    return true;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:25,代码来源:InterfaceRenderer.java

示例8: findProperty

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
public static Property findProperty(Classifier classifier, String attributeIdentifier, boolean ignoreCase,
        boolean recurse, EClass propertyClass) {
    Property found = classifier.getAttribute(attributeIdentifier, null, ignoreCase, propertyClass);
    if (found != null || !recurse)
        return found;
    final EList<TemplateBinding> templateBindings = classifier.getTemplateBindings();
    if (!templateBindings.isEmpty()) {
        for (TemplateBinding templateBinding : templateBindings) {
            TemplateSignature signature = templateBinding.getSignature();
            found = findProperty((Classifier) signature.getTemplate(), attributeIdentifier, ignoreCase, true,
                    propertyClass);
            if (found != null)
                return found;
        }
    }
    for (Generalization generalization : classifier.getGeneralizations())
        if ((found = findProperty(generalization.getGeneral(), attributeIdentifier, ignoreCase, true, propertyClass)) != null)
            return found;
    return null;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:21,代码来源:FeatureUtils.java

示例9: createContentsIfNecessary

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
private void createContentsIfNecessary(final View theElementView) {
    final EObject theElement = theElementView.getElement();
    final EList<Property> ownedAttributes = asEList(getOwnedAttributes(theElement));
    if (!ownedAttributes.isEmpty()) {
        final View theOwnedAttributeCompartment = getTheAttributeCompartment(theElementView);
        for (final Property p : ownedAttributes) {
            getOrCreateTheView(p, theOwnedAttributeCompartment);
        }
        @SuppressWarnings("unchecked")
        final EList<View> attributeViews = theOwnedAttributeCompartment.getPersistedChildren();
        ECollections.sort(attributeViews, new Comparator<View>() {
            @Override
            public int compare(final View left, final View right) {
                return Integer.compare(indexOf(ownedAttributes, left.getElement(), 0),
                        indexOf(ownedAttributes, right.getElement(), 0));
            }
        });
    }
    for (final Generalization g : getGeneralizations(theElement)) {
        getOrCreateTheView(g, theElementView.getDiagram());
    }
}
 
开发者ID:GRA-UML,项目名称:tool,代码行数:23,代码来源:DiagramSynchronizer.java

示例10: longTest

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

示例11: checkRelationTarget

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * relation의 source와 target이 같은지 검사
 * 
 * @param relationship
 * @param sourceElement
 * @param targetElement
 * @return boolean
 */
private static boolean checkRelationTarget(Relationship relationship, NamedElement targetElement) {
    if (relationship instanceof Dependency) {
        Dependency dependency = (Dependency) relationship;
        EList<NamedElement> suppliers = dependency.getSuppliers();
        for (NamedElement element : suppliers) {
            if (targetElement.equals(element)) {
                return true;
            }
        }

    } else if (relationship instanceof Generalization) {
        Generalization generalization = (Generalization) relationship;
        if (targetElement.equals(generalization.getGeneral())) {
            return true;
        }

    } else if (relationship instanceof Association) {
        Association association = (Association) relationship;
        EList<Type> endTypes = association.getEndTypes();
        for (Type type : endTypes) {
            if (targetElement.equals(type)) {
                return true;
            }
        }

    }

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

示例12: deleteDirectedAttributes

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.manager.command.DeleteUMLDirectedRelationshipCommand#deleteDirectedAttributes()
 */
@Override
protected void deleteDirectedAttributes() {
    Generalization generalization = (Generalization) this.targetElement;
    this.source = generalization.getSources().get(0);
    ((Classifier) this.source).getGeneralizations().remove(generalization);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:10,代码来源:DeleteUMLGeneralizationCommand.java

示例13: restoreDirectedAttributes

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * @see nexcore.tool.uml.manager.command.DeleteUMLDirectedRelationshipCommand#restoreDirectedAttributes()
 */
@Override
protected void restoreDirectedAttributes() {
    Generalization generalization = (Generalization) this.targetElement;
    this.source = generalization.getSources().get(0);
    ((Classifier) this.source).getGeneralizations().add(generalization);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:10,代码来源:DeleteUMLGeneralizationCommand.java

示例14: getCommand

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * getCommand
 *  
 * @param selectedElement
 * @return Command
 */
public static Command getCommand(Element selectedElement) {

    if (null == selectedElement.eContainer()) {
        return null;
    }
    Command deleteCommand = null;
    if (selectedElement instanceof Diagram) {
        deleteCommand = new DeleteUMLDiagramCommand((Diagram) selectedElement);
    } else if (selectedElement instanceof Association) {
        deleteCommand = new DeleteUMLAssociationCommand((Association) selectedElement);
    } else if (selectedElement instanceof Dependency) {
        deleteCommand = new DeleteUMLDependencyCommand(selectedElement);
    } else if (selectedElement instanceof Include) {
        deleteCommand = new DeleteUMLIncludeCommand(selectedElement);
    } else if (selectedElement instanceof Extend) {
        deleteCommand = new DeleteUMLExtendCommand(selectedElement);
    } else if (selectedElement instanceof Generalization) {
        deleteCommand = new DeleteUMLGeneralizationCommand(selectedElement);
    } else if (selectedElement instanceof InterfaceRealization) {
        deleteCommand = new DeleteUMLInterfaceRealizationCommand(selectedElement);
    } else if (selectedElement instanceof Realization) {
        deleteCommand = new DeleteUMLRealizationCommand(selectedElement);
    } else if (selectedElement instanceof Property) {
        deleteCommand = new DeleteUMLPropertyCommand((Property) selectedElement);
    } else if (selectedElement instanceof ActivityEdge) {
        deleteCommand = new DeleteUMLActivityEdgeCommand((ActivityEdge) selectedElement);
    } else if (selectedElement instanceof ActivityNode) {
        deleteCommand = new DeleteUMLActivityNodeCommand((ActivityNode) selectedElement);
    } else if ((selectedElement instanceof Lifeline) || (selectedElement instanceof Message)) {
        deleteCommand = new DeleteUMLSequenceElementCommand((NamedElement)selectedElement);
    } else if (selectedElement instanceof NamedElement) {
        deleteCommand = new DeleteUMLPackageableElementCommand((NamedElement) selectedElement);
    }//
    return deleteCommand;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:42,代码来源:DeleteUMLElementCommandFactory.java

示例15: getModelChildren

import org.eclipse.uml2.uml.Generalization; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.editparts.AbstractEditPart#getModelChildren()
 */
@Override
public List<EObject> getModelChildren() {
    List<EObject> list = new ArrayList<EObject>();
    list.addAll(((Diagram) getModel()).getNodeList());

    List<AbstractConnection> connectionList = new ArrayList<AbstractConnection>();
    connectionList = ((Diagram) getModel()).getConnectionList();

    if (connectionList.size() != 0) {
        for (AbstractConnection connection : connectionList) {
            if ((connection).getUmlModel() instanceof Association) {
                list.addAll(connection.getLabels());
            }
            // else if( (connection).getUmlModel() instanceof Generalization
            // || (connection).getUmlModel() instanceof Message
            // || (connection).getUmlModel() instanceof ControlFlow ||
            // (connection).getUmlModel() instanceof ObjectFlow ||
            // connection instanceof Attachement){
            // continue;
            // }
            else if ((connection).getUmlModel() instanceof Generalization
                || (connection).getUmlModel() instanceof Message || connection instanceof Attachement) {
                continue;
            } else
                list.addAll(connection.getLabels());
        }
    }

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


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