• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Interface类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getContainedValidElementCount

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 입력된 패키지의 하위패키지 중 의미있는 엘리먼트를 가지고 있는지 카운트를 반환한다. 몇개가 있는지가 중요한것이 아니라, 있는지
 * 없는지만 알면 되므로 cnt 가 0을 넘으면 더 이상 수행하지 않고 그냥 cnt 를 반환한다. 이 메소드는 전개 후 불필요하게
 * 생성된 빈 패키지를 없애기 위해 수행된다. 재귀 메소드 임. 의미있는 엘리먼트 : 더 필요하면 추가 할 것 - 클래스, 인터페이스,
 * Collaboration, Actor, Component, Interaction
 * 
 * @param targetPackage
 * @param cnt
 * @return int
 */
public static int getContainedValidElementCount(Package targetPackage, int cnt) {
    if (cnt > 0)
        return cnt;

    for (Package p : targetPackage.getNestedPackages()) {
        for (Element element : p.getOwnedElements()) {
            if (element instanceof Class || element instanceof Interface || element instanceof Collaboration
                || element instanceof Actor || element instanceof Component || element instanceof Interaction) {
                cnt++;
            }
        }

        cnt = getContainedValidElementCount(p, cnt);
    }

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


示例2: getSameNameOperation

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * Checks if a class contains the same name operation
 * 
 * @param obj
 *            class or interface
 * @param op
 *            The operation
 * @return True if the class contains the operation.
 */
public static Operation getSameNameOperation(Object obj, String opName) {
    Operation foundOperation = null;
    if (opName == null || obj == null)
        return null;

    Iterator iter = null;
    if (obj instanceof Class) {
        Class cls = (Class) obj;
        iter = cls.getOperations().iterator();
    } else if (obj instanceof Interface) {
        Interface inter = (Interface) obj;
        iter = inter.getOperations().iterator();
    }

    while (foundOperation == null && iter.hasNext()) {
        Operation ownedOp = (Operation) iter.next();
        if (opName.equals(ownedOp.getName()))
            foundOperation = ownedOp;
    }
    return foundOperation;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:ModelUtility.java


示例3: createInterfaceList

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 컴포넌트의 Provided Interface 리스트.
 * 
 * @param component
 * @return List<DataModel>
 */
protected List<DataModel> createInterfaceList(Component component) {
    List<DataModel> interfaceDataModelList = new ArrayList<DataModel>();
    DataModel dataModel;
    EList<Interface> interfaces = component.getProvideds();
    for (Interface interfaze : interfaces) {
        dataModel = new DataModel();
        setDataModel(dataModel, UICoreConstant.REPORT__INTERFACE_NAME, interfaze.getName());

        // 설명
        setDataModel(dataModel,
            UICoreConstant.REPORT__INTERFACE_DOCUMENTATION,
            applyPreference(getCommentToString(interfaze.getOwnedComments())));

        setDataModel(dataModel, UICoreConstant.REPORT__OPERATION_LIST, createOperationList(interfaze));
        if (null != dataModel) {
            interfaceDataModelList.add(dataModel);
        }

    }
    return interfaceDataModelList;

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


示例4: removeOperation

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 테이블 뷰어에서 선택된 하나 이상의 오퍼레이션을 삭제.
 */
@SuppressWarnings("unchecked")
private void removeOperation() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Operation> operationList = null;
    if (getData() instanceof org.eclipse.uml2.uml.Class) {
        operationList = ((org.eclipse.uml2.uml.Class) getData()).getOwnedOperations();
    } else if (getData() instanceof Interface) {
        operationList = ((Interface) getData()).getOwnedOperations();
    } else if (getData() instanceof DataType) {
        operationList = ((DataType) getData()).getOwnedOperations();
    }
    for (Iterator<Operation> iterator = selection.iterator(); iterator.hasNext();) {
        operationList.remove(iterator.next());
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:OperationSection.java


示例5: upperOperation

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 테이블 뷰어에서 선택된 하나 이상의 오퍼레이션을 위로 이동.
 */
@SuppressWarnings("unchecked")
private void upperOperation() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Operation> operationList = null;
    if (getData() instanceof org.eclipse.uml2.uml.Class) {
        operationList = ((org.eclipse.uml2.uml.Class) getData()).getOwnedOperations();
    } else if (getData() instanceof Interface) {
        operationList = ((Interface) getData()).getOwnedOperations();
    } else if (getData() instanceof DataType) {
        operationList = ((DataType) getData()).getOwnedOperations();
    }
    int index = 0;
    for (Iterator<Operation> iterator = selection.iterator(); iterator.hasNext();) {
        Operation next = iterator.next();
        index = operationList.indexOf(next);
        if (index > 0)
            operationList.move(index - 1, next);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:OperationSection.java


示例6: downOperation

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 테이블 뷰어에서 선택된 하나 이상의 오퍼레이션을 아래로 이동.
 */
@SuppressWarnings("unchecked")
private void downOperation() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Operation> operationList = null;
    if (getData() instanceof org.eclipse.uml2.uml.Class) {
        operationList = ((org.eclipse.uml2.uml.Class) getData()).getOwnedOperations();
    } else if (getData() instanceof Interface) {
        operationList = ((Interface) getData()).getOwnedOperations();
    } else if (getData() instanceof DataType) {
        operationList = ((DataType) getData()).getOwnedOperations();
    }
    int index = 0;
    for (Iterator<Operation> iterator = selection.iterator(); iterator.hasNext();) {
        Operation next = iterator.next();
        index = operationList.indexOf(next);
        if (index < operationList.size() - 1)
            operationList.move(index + 1, next);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:OperationSection.java


示例7: removeAttribute

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 테이블 뷰어에서 선택된 하나 이상의 속성을 삭제.
 */
@SuppressWarnings("unchecked")
private void removeAttribute() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Property> attributeList = null;
    if (getData() instanceof StructuredClassifier) {
        attributeList = ((StructuredClassifier) getData()).getOwnedAttributes();
    } else if (getData() instanceof Interface) {
        attributeList = ((Interface) getData()).getOwnedAttributes();
    } else if (getData() instanceof DataType) {
        attributeList = ((DataType) getData()).getOwnedAttributes();
    } else if (getData() instanceof Signal) {
        attributeList = ((Signal) getData()).getOwnedAttributes();
    }
    for (Iterator<Property> iterator = selection.iterator(); iterator.hasNext();) {
        attributeList.remove(iterator.next());
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:AttributeSection.java


示例8: upperAttribute

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 선택된 Attribute를 위로 이동
 */
@SuppressWarnings("unchecked")
private void upperAttribute() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Property> attributeList = null;
    if (getData() instanceof StructuredClassifier) {
        attributeList = ((StructuredClassifier) getData()).getOwnedAttributes();
    } else if (getData() instanceof Interface) {
        attributeList = ((Interface) getData()).getOwnedAttributes();
    } else if (getData() instanceof DataType) {
        attributeList = ((DataType) getData()).getOwnedAttributes();
    } else if (getData() instanceof Signal) {
        attributeList = ((Signal) getData()).getOwnedAttributes();
    }
    int index = 0;
    for (Iterator<Property> iterator = selection.iterator(); iterator.hasNext();) {
        Property next = iterator.next();
        index = attributeList.indexOf(next);
        if (index > 0)
            attributeList.move(index - 1, next);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:AttributeSection.java


示例9: downAttribute

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 선택된 Attribute를 아래로 이동
 */
@SuppressWarnings("unchecked")
private void downAttribute() {
    IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection();
    EList<Property> attributeList = null;
    if (getData() instanceof StructuredClassifier) {
        attributeList = ((StructuredClassifier) getData()).getOwnedAttributes();
    } else if (getData() instanceof Interface) {
        attributeList = ((Interface) getData()).getOwnedAttributes();
    } else if (getData() instanceof DataType) {
        attributeList = ((DataType) getData()).getOwnedAttributes();
    } else if (getData() instanceof Signal) {
        attributeList = ((Signal) getData()).getOwnedAttributes();
    }
    int index = 0;
    for (Iterator<Property> iterator = selection.iterator(); iterator.hasNext();) {
        Property next = iterator.next();
        index = attributeList.indexOf(next);
        if (index < attributeList.size() - 1)
            attributeList.move(index + 1, next);
    }
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:25,代码来源:AttributeSection.java


示例10: getTypeList

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * 
 * void
 */
private void getTypeList() {

    typeList.clear();
    typeList.add(pType);

    if (pType instanceof Class) {
        Class clazz = (Class) pType;
        List<Interface> interfaces = clazz.getAllImplementedInterfaces();
        typeList.addAll(interfaces);
    }

    typeCombo.removeAll();
    for (Type t : typeList) {
        typeCombo.add(t.getName());
    }
    typeCombo.select(0);
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:22,代码来源:CreateOperationDialog.java


示例11: validateCooperateModel

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
@Override
public boolean validateCooperateModel(IValidationContext ctx, Association target) {
    Collection<java.lang.Class<?>> relevantEndTypes = Arrays.asList(Class.class, Interface.class);
    if (!target.getEndTypes().stream().allMatch(
            testType -> relevantEndTypes.stream().anyMatch(relevantType -> relevantType.isInstance(testType)))) {
        // The association is not in a class diagram and therefore not relevant for this constraint
        return true;
    }

    if (!StringUtils.isBlank(target.getName())) {
        return true;
    }

    Collection<Type> wantedTypes = getTypes(target);
    return target.getNearestPackage().getMembers().stream().filter(Association.class::isInstance)
            .map(Association.class::cast).filter(a -> a != target).allMatch(a -> !getTypes(a).equals(wantedTypes));
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:ClassDiagramAssociationConstraint.java


示例12: eSet

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
    switch (featureID) {
        case CmpPackage.GENERALIZATION__NAME:
            setName((String)newValue);
            return;
        case CmpPackage.GENERALIZATION__ALIAS:
            setAlias((String)newValue);
            return;
        case CmpPackage.GENERALIZATION__LEFT_CLASSIFIER:
            setLeftClassifier((Classifier<Interface>)newValue);
            return;
        case CmpPackage.GENERALIZATION__RIGHT_CLASSIFIER:
            setRightClassifier((Classifier<Interface>)newValue);
            return;
    }
    super.eSet(featureID, newValue);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:GeneralizationImpl.java


示例13: eUnset

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public void eUnset(int featureID) {
    switch (featureID) {
        case CmpPackage.GENERALIZATION__NAME:
            unsetName();
            return;
        case CmpPackage.GENERALIZATION__ALIAS:
            unsetAlias();
            return;
        case CmpPackage.GENERALIZATION__LEFT_CLASSIFIER:
            setLeftClassifier((Classifier<Interface>)null);
            return;
        case CmpPackage.GENERALIZATION__RIGHT_CLASSIFIER:
            setRightClassifier((Classifier<Interface>)null);
            return;
    }
    super.eUnset(featureID);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:24,代码来源:GeneralizationImpl.java


示例14: generateElementsToBeAdded

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


示例15: basicRenderObject

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


示例16: renderObject

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


示例17: findProvidingPart

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
private static Property findProvidingPart(Set<ConnectorEnd> visited, List<Interface> required,
        ConnectorEnd connectorEnd) {
    if (!visited.add(connectorEnd))
        // already visited
        return null;
    if (connectorEnd.getRole() instanceof Port) {
        Port asPort = (Port) connectorEnd.getRole();
        if (!asPort.getProvideds().containsAll(required) && !asPort.getRequireds().containsAll(required))
            // wrong path
            return null;
        Property found = findProvidingPart(visited, required, asPort);
        if (found != null)
            return found;
        return findProvidingPart(visited, required, getAllEnds(connectorEnd));
    } else {
        Property asProperty = (Property) connectorEnd.getRole();
        return asProperty;
    }
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:20,代码来源:ConnectorUtils.java


示例18: findAllSpecifics

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
public static List<Classifier> findAllSpecifics(IRepository repository, final Classifier general) {
	boolean isInterface = general instanceof Interface;
    List<Classifier> specifics = repository.findInAnyPackage(new EObjectCondition() {
        @Override
        public boolean isSatisfied(EObject object) {
            if (object instanceof Classifier) {
            	if (object == general) 
            		return false;
                Classifier classifier = (Classifier) object;
                if (classifier.conformsTo(general))
                	return true;
                if (isInterface && object instanceof BehavioredClassifier)
                	return doesImplement((BehavioredClassifier) object, (Interface) general);
            }
            return false;
        }
    });
    return specifics;
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:20,代码来源:ClassifierUtils.java


示例19: testClassImplements

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
public void testClassImplements() throws CoreException {
    String source = "";
    source += "model someModel;\n";
    source += "interface SomeInterface\n";
    source += "end;\n";
    source += "class SomeClass implements SomeInterface\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    final Class someClass = (Class) getRepository().findNamedElement("someModel::SomeClass",
            IRepository.PACKAGE.getClass_(), null);
    final Interface someInterface = (Interface) getRepository().findNamedElement("someModel::SomeInterface",
            IRepository.PACKAGE.getInterface(), null);
    assertNotNull(someClass);
    assertNotNull(someInterface);
    assertTrue(someClass.getImplementedInterfaces().contains(someInterface));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:18,代码来源:ClassifierTests.java


示例20: testInterfaceSpecializes

import org.eclipse.uml2.uml.Interface; //导入依赖的package包/类
public void testInterfaceSpecializes() throws CoreException {
    String source = "";
    source += "model someModel;\n";
    source += "interface SuperInterface\n";
    source += "end;\n";
    source += "interface SubInterface specializes SuperInterface\n";
    source += "end;\n";
    source += "end.";
    parseAndCheck(source);
    final Interface superInterface = (Interface) getRepository().findNamedElement("someModel::SuperInterface",
            IRepository.PACKAGE.getInterface(), null);
    final Interface subInterface = (Interface) getRepository().findNamedElement("someModel::SubInterface",
            IRepository.PACKAGE.getInterface(), null);
    assertNotNull(superInterface);
    assertNotNull(subInterface);
    assertNotNull(subInterface.getGeneralization(superInterface));
}
 
开发者ID:abstratt,项目名称:textuml,代码行数:18,代码来源:ClassifierTests.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EagerNClass类代码示例发布时间:2022-05-23
下一篇:
Java MenuModel类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap