source: josm/trunk/src/org/openstreetmap/josm/data/osm/SimplePrimitiveId.java@ 2448

Last change on this file since 2448 was 2448, checked in by Gubaer, 14 years ago

fixed #3352: History doesn't get invalidated on upload?
fixed #3912: Extend history dialog to contain the currently modified version
new: zoom to node in list of nodes in history dialog (popup menu)
new: load history of node from node list in history dialog (popup menu or double click)
fixed: close all history dialogs when the number of layers drop to 0
fixed: implemented equals() and hashCode() on SimplePrimitiveId
fixed: history features now usePrimitiveId instead of long.

  • Property svn:mime-type set to text/plain
File size: 1.2 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4public class SimplePrimitiveId implements PrimitiveId {
5
6 private final long id;
7 private final OsmPrimitiveType type;
8
9 public SimplePrimitiveId(long id, OsmPrimitiveType type) {
10 this.id = id;
11 this.type = type;
12 }
13
14 public OsmPrimitiveType getType() {
15 return type;
16 }
17
18 public long getUniqueId() {
19 return id;
20 }
21
22 @Override
23 public int hashCode() {
24 final int prime = 31;
25 int result = 1;
26 result = prime * result + (int) (id ^ (id >>> 32));
27 result = prime * result + ((type == null) ? 0 : type.hashCode());
28 return result;
29 }
30
31 @Override
32 public boolean equals(Object obj) {
33 if (this == obj)
34 return true;
35 if (obj == null)
36 return false;
37 if (getClass() != obj.getClass())
38 return false;
39 SimplePrimitiveId other = (SimplePrimitiveId) obj;
40 if (id != other.id)
41 return false;
42 if (type == null) {
43 if (other.type != null)
44 return false;
45 } else if (!type.equals(other.type))
46 return false;
47 return true;
48 }
49}
Note: See TracBrowser for help on using the repository browser.