Home | History | Annotate | Download | only in shadows
      1 package com.xtremelabs.robolectric.shadows;
      2 
      3 import com.google.android.maps.GeoPoint;
      4 import com.xtremelabs.robolectric.internal.Implementation;
      5 import com.xtremelabs.robolectric.internal.Implements;
      6 
      7 import static com.xtremelabs.robolectric.Robolectric.shadowOf_;
      8 import static com.xtremelabs.robolectric.shadows.ShadowMapView.fromE6;
      9 
     10 @SuppressWarnings({"UnusedDeclaration"})
     11 @Implements(GeoPoint.class)
     12 public class ShadowGeoPoint {
     13     private int lat;
     14     private int lng;
     15 
     16     public void __constructor__(int lat, int lng) {
     17         this.lat = lat;
     18         this.lng = lng;
     19     }
     20 
     21     @Implementation
     22     public int getLatitudeE6() {
     23         return lat;
     24     }
     25 
     26     @Implementation
     27     public int getLongitudeE6() {
     28         return lng;
     29     }
     30 
     31     @Override @Implementation
     32     public boolean equals(Object o) {
     33         if (o == null) return false;
     34         o = shadowOf_(o);
     35         if (o == null) return false;
     36         if (this == o) return true;
     37         if (getClass() != o.getClass()) return false;
     38 
     39         ShadowGeoPoint that = (ShadowGeoPoint) o;
     40 
     41         if (lat != that.lat) return false;
     42         if (lng != that.lng) return false;
     43 
     44         return true;
     45     }
     46 
     47     @Override @Implementation
     48     public int hashCode() {
     49         int result = lat;
     50         result = 31 * result + lng;
     51         return result;
     52     }
     53 
     54     @Override @Implementation
     55     public String toString() {
     56         return "ShadowGeoPoint{" +
     57                 "lat=" + fromE6(lat) +
     58                 ", lng=" + fromE6(lng) +
     59                 '}';
     60     }
     61 
     62     public int getLat() {
     63         return lat;
     64     }
     65 
     66     public int getLng() {
     67         return lng;
     68     }
     69 }
     70