I normally adopt the Enum argument suggested in Are booleans as method arguments unacceptable? and implement it using the strategy pattern.
However, I now have a complicated logic that I cannot move into an Enum due to the fact that there's no non-static Enum and a ridiculous amount of variables that needs to be copied into and out of the method in the Enum. If I use a switch in the code instead of the strategy pattern, I seem to lose all the benefits apart from simple clarity.
For this particular method, there can only be two possibilities, so would a boolean argument be more acceptable? (If a enum is used, I am required by our coding standard to handle any unknown enums which seems unnecessary in this case.) Maybe I can put the boolean into constants and call the method using the constants?
Edit:
The complicated logic is proprietary code, but it is something like
public void method(A a, B b, boolean replaceMe) {
// Create and prepare local variables c, d, e, f, g;
if (replaceMe) {
// doSomethingWith a, b, c, d, e and return e, f, g
} else {
// doSomethingElseWith a, b, c, d, e and return e, f, g
}
// Process e, f, g further
}