Advertisement
CaptainSpaceCat

ElectricRunner - Tile

Apr 14th, 2017
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.68 KB | None | 0 0
  1. public class Tile {
  2.   private boolean present;
  3.   private int tiletype; //0-4
  4.   private int orientation; //0-3
  5.   private boolean bolted;
  6.   private boolean star;
  7.  
  8.   private boolean flag;
  9.  
  10.   //-------initializers-------/
  11.   public Tile() {
  12.     present = true;
  13.     tiletype = 0;
  14.     orientation = 0;
  15.     bolted = false;
  16.     star = false;
  17.    
  18.     flag = false;
  19.   }
  20.  
  21.   //-------accessors-------//
  22.   public boolean isPresent() {
  23.     return present;
  24.   }
  25.  
  26.   public boolean isBolted() {
  27.     return bolted;
  28.   }
  29.  
  30.   public boolean containsStar() {
  31.     return star;
  32.   }
  33.  
  34.   public int getType() {
  35.     return tiletype;
  36.   }
  37.  
  38.   public int getOrientation() {
  39.     return orientation;
  40.   }
  41.  
  42.   public boolean isFlagged() {
  43.     return flag;
  44.   }
  45.  
  46.   //-------mutators-------//
  47.   public void copyProperties(Tile t) {
  48.     present = t.isPresent();
  49.     tiletype = t.getType();
  50.     orientation = t.getOrientation();
  51.     bolted = t.isBolted();
  52.     star = t.containsStar();
  53.   }
  54.  
  55.   public void setProperties(int t, int o) {
  56.     present = true;
  57.     tiletype = t;
  58.     orientation = o;
  59.   }
  60.  
  61.   public void setProperties(int[] data) {
  62.     present = true;
  63.     tiletype = data[0];
  64.     orientation = data[1];
  65.   }
  66.  
  67.   public void setPresent(boolean p) {
  68.     present = p;
  69.   }
  70.  
  71.   public void setBolted(boolean b) {
  72.     bolted = b;
  73.   }
  74.  
  75.   public void containsStar(boolean s) {
  76.     star = s;
  77.   }
  78.  
  79.   public void setType(int t) {
  80.     tiletype = t;
  81.   }
  82.  
  83.   public void setOrientation(int o) {
  84.     orientation = o;
  85.   }
  86.  
  87.   public void setFlagged(boolean f) {
  88.     flag = f;
  89.   }
  90.  
  91.   public void rotate() {
  92.     orientation = (orientation+1) % 4;
  93.   }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement