Advertisement
FALSkills

Untitled

Oct 5th, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. public enum Flags {
  2. OPEN(0), CLOSED(0xFFFFFF), UNINITIALIZED(0x1000000), OCCUPIED(0x100), SOLID(0x20000), BLOCKED(0x200000),
  3.  
  4. NORTH(0x2), EAST(0x8), SOUTH(0x20), WEST(0x80),
  5.  
  6. NORTHEAST(0x4),
  7. SOUTHEAST(0x10),
  8. SOUTHWEST(0x40),
  9. NORTHWEST(0x1),
  10.  
  11. EAST_NORTH(EAST.getValue() | NORTH.getValue()),
  12. EAST_SOUTH(EAST.getValue() | SOUTH.getValue()),
  13. WEST_SOUTH(WEST.getValue() | SOUTH.getValue()),
  14. WEST_NORTH(WEST.getValue() | NORTH.getValue()),
  15.  
  16. BLOCKED_NORTH(0x400),
  17. BLOCKED_EAST(0x1000),
  18. BLOCKED_SOUTH(0x4000),
  19. BLOCKED_WEST(0x10000),
  20.  
  21. BLOCKED_NORTHEAST(0x800),
  22. BLOCKED_SOUTHEAST(0x2000),
  23. BLOCKED_NORTHWEST(0x200),
  24. BLOCKED_SOUTHWEST(0x8000),
  25.  
  26. BLOCKED_EAST_NORTH(BLOCKED_EAST.getValue() | BLOCKED_NORTH.getValue()),
  27. BLOCKED_EAST_SOUTH(BLOCKED_EAST.getValue() | BLOCKED_SOUTH.getValue()),
  28. BLOCKED_WEST_SOUTH(BLOCKED_WEST.getValue() | BLOCKED_SOUTH.getValue()),
  29. BLOCKED_WEST_NORTH(BLOCKED_WEST.getValue() | BLOCKED_NORTH.getValue());
  30.  
  31. private int value;
  32. Flags(int value) {
  33. this.value = value;
  34. }
  35.  
  36. public int getValue() {
  37. return value;
  38. }
  39.  
  40. public boolean has(int flag) {
  41. return (flag & value) != 0;
  42. }
  43.  
  44. public boolean is(int flag) {
  45. return flag == value;
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement