Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Downloader implements Runnable {
- volatile Status status;
- public void run() {
- // ...
- while (status.isInProgress()) { ... }
- }
- }
- public enum Status {
- PAUSED {
- public int someData() { return 0; }
- },
- INPROGRESS {
- public int someData() { return 1; }
- }
- public abstract int someData();
- private String msg;
- public String getSomeMsg() {
- return msg;
- }
- public void setSomeMsg(String s) {
- msg=s;
- }
- public boolean isInProgress() {
- return this == INPROGRESS;
- }
- }
Add Comment
Please, Sign In to add comment