spenk

BlockLoc

Mar 4th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.54 KB | None | 0 0
  1. class BlockLoc
  2. {
  3.   int x;
  4.   int y;
  5.   int z;
  6.  
  7.   public BlockLoc(int x, int y, int z)
  8.   {
  9.     this.x = x;
  10.     this.y = y;
  11.     this.z = z;
  12.   }
  13.  
  14.   public boolean equals(Object object)
  15.   {
  16.     if (!(object instanceof BlockLoc)) return false;
  17.  
  18.     BlockLoc block = (BlockLoc)object;
  19.     return (this.x == block.x) && (this.y == block.y) && (this.z == block.z);
  20.   }
  21.  
  22.   public int hashCode()
  23.   {
  24.     return Integer.valueOf(this.x).hashCode() >> 13 ^ Integer.valueOf(this.y).hashCode() >> 7 ^ Integer.valueOf(this.z).hashCode();
  25.   }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment