Yes, you should probably use some other mechanism to prevent code duplication, for instance write a function which computes everything relevant and invoke it twice, in `isApplicable` and `apply`