/** * Collects all operations the classifier and their interfaces have. * * @param classifier * The classifier the operations should be collected * @return An <code>EList</code> with all collected operations */ public EList<Operation> getAllOperations(Classifier classifier) { EList<Operation> operations = new UniqueEList<Operation>(); operations.addAll(classifier.getOperations()); if (classifier instanceof org.eclipse.uml2.uml.Class) { Class clazz = (Class) classifier; for (int i = 0; i < clazz.getImplementedInterfaces().size(); i++) { operations.addAll(getAllInterfaceOperations(clazz .getImplementedInterfaces().get(i))); } } return operations; }
/** * Collects all operation of the given interface needed to implement by a * implementing class. * * @param iFace * The interface to collect the operations from * @return An <code>EList</code> with all collected operations */ private EList<Operation> getAllInterfaceOperations(Interface iFace) { EList<Operation> operations = new UniqueEList<Operation>(); operations.addAll(iFace.getAllOperations()); if (iFace.getGeneralizations().size() > 0) { for (int i = 0; i < iFace.getGeneralizations().size(); i++) { operations.addAll(getAllInterfaceOperations((Interface) iFace .getGeneralizations().get(i).getGeneral())); } } return operations; }