Can you make some assumptions about x,y,z,q?
e.G. just one of them can be true. Than you could see it as a State
enum State {
X{
void doSomething(){
doItTheXWay();
}
},
Y{
void doSomething(){
doItTheYWay();
}
},
Z{
void doSomething(){
doItTheZWay();
}
},
Q{
void doSomething(){
doItTheQWay();
}
};
void doSomething(){
}
}
and in your code where you used the if statements
you could assign a state and just do the right thing
State state = getAState();
state.doSomething();
In case you don't like enums State could be an Interface and X to Q could be implementing classes.
The benefits in this case are in multiple usage of the same if else construct. Say some codelines later you would begin with
if(x)
do_the_next_thing_with_X();
...
or you could just extend your enum with another function and make one single call
state.doTheNextThing();