01: package org.andromda.cartridges.meta.metafacades;
02:
03: import java.util.Iterator;
04:
05: import org.andromda.metafacades.uml.OperationFacade;
06:
07: /**
08: * MetafacadeLogic implementation for
09: * org.andromda.cartridges.meta.metafacades.PSMmetaclass.
10: *
11: * @see org.andromda.cartridges.meta.metafacades.PSMmetaclass
12: */
13: public class PSMmetaclassLogicImpl extends PSMmetaclassLogic {
14:
15: public PSMmetaclassLogicImpl(Object metaObject, String context) {
16: super (metaObject, context);
17: }
18:
19: /**
20: * @see org.andromda.cartridges.meta.metafacades.PSMmetaclass#isOperationsPresent()
21: */
22: protected boolean handleIsOperationsPresent() {
23: return this .getOperations().size() > 0;
24: }
25:
26: /*
27: * (non-Javadoc)
28: *
29: * @see org.andromda.cartridges.meta.metafacades.PSMmetaclassLogic#handleIsImplMustBeAbstract()
30: */
31: protected boolean handleIsImplMustBeAbstract() {
32: boolean result = false;
33:
34: // if the class itself is abstract, make the impl abstract, too.
35: if (this .isAbstract()) {
36: result = true;
37: } else {
38: // if the class contains abstract operations, the impl must be
39: // abstract, too, because the abstract operations will not be
40: // generated as methods.
41: for (Iterator iter = this .getOperations().iterator(); iter
42: .hasNext();) {
43: OperationFacade operation = (OperationFacade) iter
44: .next();
45: if (operation.isAbstract()) {
46: result = true;
47: break;
48: }
49: }
50: }
51: return result;
52: }
53:
54: }
|