Changeset 10906 in josm for trunk/src/org
- Timestamp:
- 2016-08-27T17:23:05+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxData.java
r10680 r10906 482 482 return DataSource.getDataSourceBounds(dataSources); 483 483 } 484 485 @Override 486 public int hashCode() { 487 final int prime = 31; 488 int result = 1; 489 result = prime * result + ((dataSources == null) ? 0 : dataSources.hashCode()); 490 result = prime * result + ((routes == null) ? 0 : routes.hashCode()); 491 result = prime * result + ((tracks == null) ? 0 : tracks.hashCode()); 492 result = prime * result + ((waypoints == null) ? 0 : waypoints.hashCode()); 493 return result; 494 } 495 496 @Override 497 public boolean equals(Object obj) { 498 if (this == obj) 499 return true; 500 if (obj == null) 501 return false; 502 if (getClass() != obj.getClass()) 503 return false; 504 GpxData other = (GpxData) obj; 505 if (dataSources == null) { 506 if (other.dataSources != null) 507 return false; 508 } else if (!dataSources.equals(other.dataSources)) 509 return false; 510 if (routes == null) { 511 if (other.routes != null) 512 return false; 513 } else if (!routes.equals(other.routes)) 514 return false; 515 if (tracks == null) { 516 if (other.tracks != null) 517 return false; 518 } else if (!tracks.equals(other.tracks)) 519 return false; 520 if (waypoints == null) { 521 if (other.waypoints != null) 522 return false; 523 } else if (!waypoints.equals(other.waypoints)) 524 return false; 525 return true; 526 } 484 527 } -
trunk/src/org/openstreetmap/josm/data/gpx/GpxRoute.java
r7005 r10906 7 7 public class GpxRoute extends WithAttributes { 8 8 public Collection<WayPoint> routePoints = new LinkedList<>(); 9 10 @Override 11 public int hashCode() { 12 return 31 * super.hashCode() + ((routePoints == null) ? 0 : routePoints.hashCode()); 13 } 14 15 @Override 16 public boolean equals(Object obj) { 17 if (this == obj) 18 return true; 19 if (!super.equals(obj)) 20 return false; 21 if (getClass() != obj.getClass()) 22 return false; 23 GpxRoute other = (GpxRoute) obj; 24 if (routePoints == null) { 25 if (other.routePoints != null) 26 return false; 27 } else if (!routePoints.equals(other.routePoints)) 28 return false; 29 return true; 30 } 9 31 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrack.java
r9949 r10906 17 17 public class ImmutableGpxTrack extends WithAttributes implements GpxTrack { 18 18 19 private final Collection<GpxTrackSegment> segments;19 private final List<GpxTrackSegment> segments; 20 20 private final double length; 21 21 private final Bounds bounds; … … 34 34 } 35 35 this.attr = Collections.unmodifiableMap(new HashMap<>(attributes)); 36 this.segments = Collections.unmodifiable Collection(newSegments);36 this.segments = Collections.unmodifiableList(newSegments); 37 37 this.length = calculateLength(); 38 38 this.bounds = calculateBounds(); … … 90 90 return 0; 91 91 } 92 93 @Override 94 public int hashCode() { 95 return 31 * super.hashCode() + ((segments == null) ? 0 : segments.hashCode()); 96 } 97 98 @Override 99 public boolean equals(Object obj) { 100 if (this == obj) 101 return true; 102 if (!super.equals(obj)) 103 return false; 104 if (getClass() != obj.getClass()) 105 return false; 106 ImmutableGpxTrack other = (ImmutableGpxTrack) obj; 107 if (segments == null) { 108 if (other.segments != null) 109 return false; 110 } else if (!segments.equals(other.segments)) 111 return false; 112 return true; 113 } 92 114 } -
trunk/src/org/openstreetmap/josm/data/gpx/ImmutableGpxTrackSegment.java
r8510 r10906 5 5 import java.util.Collection; 6 6 import java.util.Collections; 7 import java.util.List; 7 8 8 9 import org.openstreetmap.josm.data.Bounds; … … 10 11 public class ImmutableGpxTrackSegment implements GpxTrackSegment { 11 12 12 private final Collection<WayPoint> wayPoints;13 private final List<WayPoint> wayPoints; 13 14 private final Bounds bounds; 14 15 private final double length; 15 16 17 /** 18 * Constructs a new {@code ImmutableGpxTrackSegment}. 19 * @param wayPoints list of waypoints 20 */ 16 21 public ImmutableGpxTrackSegment(Collection<WayPoint> wayPoints) { 17 this.wayPoints = Collections.unmodifiable Collection(new ArrayList<>(wayPoints));22 this.wayPoints = Collections.unmodifiableList(new ArrayList<>(wayPoints)); 18 23 this.bounds = calculateBounds(); 19 24 this.length = calculateLength(); … … 70 75 } 71 76 77 @Override 78 public int hashCode() { 79 return 31 + ((wayPoints == null) ? 0 : wayPoints.hashCode()); 80 } 81 82 @Override 83 public boolean equals(Object obj) { 84 if (this == obj) 85 return true; 86 if (obj == null) 87 return false; 88 if (getClass() != obj.getClass()) 89 return false; 90 ImmutableGpxTrackSegment other = (ImmutableGpxTrackSegment) obj; 91 if (wayPoints == null) { 92 if (other.wayPoints != null) 93 return false; 94 } else if (!wayPoints.equals(other.wayPoints)) 95 return false; 96 return true; 97 } 72 98 } -
trunk/src/org/openstreetmap/josm/data/gpx/WayPoint.java
r10467 r10906 159 159 return new ArrayList<>(attr.keySet()); 160 160 } 161 162 @Override 163 public int hashCode() { 164 final int prime = 31; 165 int result = super.hashCode(); 166 long temp = Double.doubleToLongBits(lat); 167 result = prime * result + (int) (temp ^ (temp >>> 32)); 168 temp = Double.doubleToLongBits(lon); 169 result = prime * result + (int) (temp ^ (temp >>> 32)); 170 temp = Double.doubleToLongBits(time); 171 result = prime * result + (int) (temp ^ (temp >>> 32)); 172 return result; 173 } 174 175 @Override 176 public boolean equals(Object obj) { 177 if (this == obj) 178 return true; 179 if (!super.equals(obj)) 180 return false; 181 if (getClass() != obj.getClass()) 182 return false; 183 WayPoint other = (WayPoint) obj; 184 if (Double.doubleToLongBits(lat) != Double.doubleToLongBits(other.lat)) 185 return false; 186 if (Double.doubleToLongBits(lon) != Double.doubleToLongBits(other.lon)) 187 return false; 188 if (Double.doubleToLongBits(time) != Double.doubleToLongBits(other.time)) 189 return false; 190 return true; 191 } 161 192 } -
trunk/src/org/openstreetmap/josm/data/gpx/WithAttributes.java
r8510 r10906 90 90 ext.put(key, value); 91 91 } 92 93 @Override 94 public int hashCode() { 95 return 31 + ((attr == null) ? 0 : attr.hashCode()); 96 } 97 98 @Override 99 public boolean equals(Object obj) { 100 if (this == obj) 101 return true; 102 if (obj == null) 103 return false; 104 if (getClass() != obj.getClass()) 105 return false; 106 WithAttributes other = (WithAttributes) obj; 107 if (attr == null) { 108 if (other.attr != null) 109 return false; 110 } else if (!attr.equals(other.attr)) 111 return false; 112 return true; 113 } 92 114 } -
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r10632 r10906 29 29 */ 30 30 public class NmeaReader { 31 32 /** Handler for the different types that NMEA speaks. */33 public enum NMEA_TYPE {34 35 /** RMC = recommended minimum sentence C. */36 GPRMC("$GPRMC"),37 /** GPS positions. */38 GPGGA("$GPGGA"),39 /** SA = satellites active. */40 GPGSA("$GPGSA"),41 /** Course over ground and ground speed */42 GPVTG("$GPVTG");43 44 private final String type;45 46 NMEA_TYPE(String type) {47 this.type = type;48 }49 50 public String getType() {51 return this.type;52 }53 }54 31 55 32 // GPVTG
Note:
See TracChangeset
for help on using the changeset viewer.