View Javadoc

1   /***
2    * LocationUtil.java
3    * 
4    * @author Created by Omnicore CodeGuide
5    */
6   package edu.iris.Fissures.model;
7   
8   import edu.iris.Fissures.Location;
9   
10  public class LocationUtil {
11  
12      public static int hash(Location l) {
13          int result = 47;
14          result = 37 * result + l.depth.hashCode();
15          result = 37 * result + l.elevation.hashCode();
16          result = 37 * result + Float.floatToIntBits(l.latitude);
17          result = 37 * result + Float.floatToIntBits(l.longitude);
18          return result;
19      }
20  
21      public static boolean areEqual(Location a, Location b) {
22          if(a == b) { return true; }
23          return a.depth.equals(b.depth) && a.elevation.equals(b.elevation)
24                  && a.latitude == b.latitude && a.longitude == b.longitude;
25      }
26  }