parent
d99f534b61
commit
5dc8f476f7
@ -0,0 +1,17 @@
|
||||
package io.nayuki.qrcodegen;
|
||||
|
||||
public class Button {
|
||||
public Command theCommand;
|
||||
|
||||
public Button(Command theCommand) {
|
||||
setCommand(theCommand);
|
||||
}
|
||||
|
||||
public void setCommand(Command newCommand) {
|
||||
this.theCommand = newCommand;
|
||||
}
|
||||
|
||||
public boolean pressed(int y, int x, int msk) {
|
||||
return theCommand.excute(y, x, msk);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package io.nayuki.qrcodegen;
|
||||
|
||||
public interface Command {
|
||||
public abstract boolean excute(int y, int x, int msk);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package io.nayuki.qrcodegen;
|
||||
|
||||
public class Msk0 {
|
||||
public boolean operation(int y, int x, int msk) {
|
||||
return ((x + y) % 2 == 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package io.nayuki.qrcodegen;
|
||||
|
||||
public class msk0Command implements Command{
|
||||
private Msk0 theMsk0;
|
||||
|
||||
public msk0Command(Msk0 theMsk0) {
|
||||
this.theMsk0 = theMsk0;
|
||||
}
|
||||
|
||||
public boolean excute(int y, int x, int msk) {
|
||||
return theMsk0.operation(y, x, msk);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue