Skip to content

Method: beginTask()

1: package de.fhdw.wtf.walker.tasks;
2:
3: import de.fhdw.wtf.common.ast.Model;
4: import de.fhdw.wtf.common.ast.Operation;
5: import de.fhdw.wtf.common.ast.type.AtomicType;
6: import de.fhdw.wtf.common.ast.type.BaseType;
7: import de.fhdw.wtf.common.ast.type.ClassType;
8: import de.fhdw.wtf.common.ast.type.CompositeType;
9: import de.fhdw.wtf.common.ast.type.Type;
10: import de.fhdw.wtf.common.ast.type.TypeProxy;
11: import de.fhdw.wtf.common.ast.visitor.AtomicTypeVisitor;
12: import de.fhdw.wtf.common.ast.visitor.TypeVisitor;
13: import de.fhdw.wtf.common.exception.walker.TaskException;
14: import de.fhdw.wtf.common.task.TaskExecutor;
15: import de.fhdw.wtf.walker.walker.SimpleWalkerTaskForTypes;
16:
17: public class FillOverrideOperationWalker extends SimpleWalkerTaskForTypes {
18:         
19:         public FillOverrideOperationWalker(final Model m, final TaskExecutor taskmanager) {
20:                 super(m, taskmanager);
21:                 // TODO Auto-generated constructor stub
22:         }
23:         
24:         @Override
25:         public void handleType(final Type c) throws TaskException {
26:                 final java.util.Iterator<Type> TypeIterator = c.getSuperTypes().iterator();
27:                 while (TypeIterator.hasNext()) {
28:                         final Type currentType = TypeIterator.next();
29:                         currentType.accept(new TypeVisitor() {
30:                                 
31:                                 @Override
32:                                 public void handle(final TypeProxy typeProxy) {
33:                                         // nothing to do here
34:                                         
35:                                 }
36:                                 
37:                                 @Override
38:                                 public void handle(final CompositeType compositeType) {
39:                                         // nothing ToDo here!
40:                                         
41:                                 }
42:                                 
43:                                 @Override
44:                                 public void handle(final AtomicType atomicType) {
45:                                         atomicType.accept(new AtomicTypeVisitor() {
46:                                                 
47:                                                 @Override
48:                                                 public void handle(final ClassType clazz) {
49:                                                         final java.util.Iterator<Operation> operationIterator = clazz.getOperations().iterator();
50:                                                         while (operationIterator.hasNext()) {
51:                                                                 final Operation currentOperation = operationIterator.next();
52:                                                                 final java.util.Iterator<Type> currentOperationSuperClassIterator =
53:                                                                                 currentOperation.getContainingType().getSuperTypes().iterator();
54:                                                                 final Type currentSuperType = currentOperationSuperClassIterator.next();
55:                                                                 
56:                                                                 currentSuperType.accept(new TypeVisitor() {
57:                                                                         
58:                                                                         @Override
59:                                                                         public void handle(final TypeProxy typeProxy) {
60:                                                                                 // nothing to do here!
61:                                                                                 
62:                                                                         }
63:                                                                         
64:                                                                         @Override
65:                                                                         public void handle(final CompositeType compositeType) {
66:                                                                                 // nothing to do here!
67:                                                                                 
68:                                                                         }
69:                                                                         
70:                                                                         @Override
71:                                                                         public void handle(final AtomicType atomicType1) {
72:                                                                                 atomicType1.accept(new AtomicTypeVisitor() {
73:                                                                                         
74:                                                                                         @Override
75:                                                                                         public void handle(final ClassType clazz1) {
76:                                                                                                 final java.util.Iterator<Operation> operationsInSuperTypeIterator =
77:                                                                                                                 clazz1.getOperations().iterator();
78:                                                                                                 
79:                                                                                                 final Operation currentOverrideOperation =
80:                                                                                                                 operationsInSuperTypeIterator.next();
81:                                                                                                 
82:                                                                                                 if (currentOverrideOperation.getSignature().equals(
83:                                                                                                                 currentOperation.getSignature())) {
84:                                                                                                         currentOperation.getOverridingOperations().add(
85:                                                                                                                         currentOverrideOperation);
86:                                                                                                 }
87:                                                                                                 
88:                                                                                         }
89:                                                                                         
90:                                                                                         @Override
91:                                                                                         public void handle(final BaseType baseType) {
92:                                                                                                 // nothing to do here!
93:                                                                                                 
94:                                                                                         }
95:                                                                                 });
96:                                                                                 
97:                                                                         }
98:                                                                 });
99:                                                         }
100:                                                         
101:                                                 }
102:                                                 
103:                                                 @Override
104:                                                 public void handle(final BaseType baseType) {
105:                                                         // nothing to do here!
106:                                                         
107:                                                 }
108:                                         });
109:                                         
110:                                 }
111:                         });
112:                 }
113:         }
114:         
115:         @Override
116:         public void finalizeTask() throws TaskException {
117:                 // TODO Auto-generated method stub
118:                 
119:         }
120:         
121:         @Override
122:         public void beginTask() throws TaskException {
123:                 // TODO Auto-generated method stub
124:                 
125:         }
126:         
127: }