interface Answerer {
public boolean getAnswer();
}
class abstract AbstractAnswerer implements Answerer {
private boolean answer;
private boolean input1;
private boolean input2;
public AbstractAnswerer(boolean input1, boolean input2) {
this.input1 = input1;
this.input2 = input2;
}
@Override public final boolean getAnswer() {
this.answer = computeAnswer(input1, input2);
return this.answer;
}
protected abstract boolean computeAnswer(boolean input1, boolean input2);
}
class ConcreteAnswerer extends AbstractAnswerer {
public ConcreteAnswerer(boolean input1, boolean input2) {
super(input1, input2);
}
@Override protected boolean computeAnswer(boolean input1, boolean input2) {
if(input1 && !input2) return true;
else return false;
}
}
aW50ZXJmYWNlIEFuc3dlcmVyIHsKICAgIHB1YmxpYyBib29sZWFuIGdldEFuc3dlcigpOwp9CmNsYXNzIGFic3RyYWN0IEFic3RyYWN0QW5zd2VyZXIgaW1wbGVtZW50cyBBbnN3ZXJlciB7CiAgICBwcml2YXRlIGJvb2xlYW4gYW5zd2VyOwogICAgcHJpdmF0ZSBib29sZWFuIGlucHV0MTsKICAgIHByaXZhdGUgYm9vbGVhbiBpbnB1dDI7CiAgICBwdWJsaWMgQWJzdHJhY3RBbnN3ZXJlcihib29sZWFuIGlucHV0MSwgYm9vbGVhbiBpbnB1dDIpIHsKICAgICAgICB0aGlzLmlucHV0MSA9IGlucHV0MTsKICAgICAgICB0aGlzLmlucHV0MiA9IGlucHV0MjsKICAgIH0KICAgIEBPdmVycmlkZSBwdWJsaWMgZmluYWwgYm9vbGVhbiBnZXRBbnN3ZXIoKSB7CiAgICAgICAgdGhpcy5hbnN3ZXIgPSBjb21wdXRlQW5zd2VyKGlucHV0MSwgaW5wdXQyKTsKICAgICAgICByZXR1cm4gdGhpcy5hbnN3ZXI7CiAgICB9CiAgICBwcm90ZWN0ZWQgYWJzdHJhY3QgYm9vbGVhbiBjb21wdXRlQW5zd2VyKGJvb2xlYW4gaW5wdXQxLCBib29sZWFuIGlucHV0Mik7CiAgICAKfQpjbGFzcyBDb25jcmV0ZUFuc3dlcmVyIGV4dGVuZHMgQWJzd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