Advertisement
lukejessee

Sync Issue - Tuple3f.java

Jun 13th, 2012
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. public class Tuple3f {
  2.     public float x;
  3.     public float y;
  4.     public float z;
  5.  
  6.     public Tuple3f() {
  7.         this.x = 1;
  8.         this.y = 0;
  9.         this.z = 0;
  10.     }
  11.  
  12.     public boolean equals(Object t1) {
  13.         try {
  14.             Tuple3f t2 = (Tuple3f) t1;
  15.             return (this.x == t2.x && this.y == t2.y && this.z == t2.z);
  16.         } catch (NullPointerException e2) {
  17.             return false;
  18.         } catch (ClassCastException e1) {
  19.             return false;
  20.         }
  21.     }
  22.  
  23.     public int hashCode() {
  24.         long bits = 1L;
  25.         bits = 31L * bits + (long) ((x == 0) ? 0l : Float.floatToIntBits(x));
  26.         bits = 31L * bits + (long) ((y == 0) ? 0l : Float.floatToIntBits(y));
  27.         bits = 31L * bits + (long) ((z == 0) ? 0l : Float.floatToIntBits(z));
  28.         return (int) (bits ^ (bits >> 32));
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement