| 26 | return True |
| 27 | |
| 28 | def __swap(self, fitID, position1, position2): |
| 29 | fit = Fit.getInstance().getFit(fitID) |
| 30 | mod1 = fit.modules[position1] |
| 31 | mod2 = fit.modules[position2] |
| 32 | fit.modules.free(position1) |
| 33 | fit.modules.free(position2) |
| 34 | fit.modules.replace(position2, mod1) |
| 35 | if len(fit.modules) <= position2 or fit.modules[position2] is not mod1: |
| 36 | fit.modules.replace(position1, mod1) |
| 37 | fit.modules.replace(position2, mod2) |
| 38 | return False |
| 39 | fit.modules.replace(position1, mod2) |
| 40 | if len(fit.modules) <= position1 or fit.modules[position1] is not mod2: |
| 41 | fit.modules.free(position2) |
| 42 | fit.modules.replace(position1, mod1) |
| 43 | fit.modules.replace(position2, mod2) |
| 44 | return False |
| 45 | return True |