本文整理汇总了Java中org.eclipse.uml2.uml.Interface类的典型用法代码示例。如果您正苦于以下问题:Java Interface类的具体用法?Java Interface怎么用?Java Interface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Interface类属于org.eclipse.uml2.uml包,在下文中一共展示了Interface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}