Last change
on this file since 8434 was
8434,
checked in by spimming, 12 years ago
|
#1894
- renamed old Vertex<T> to OsmVertex<T>
- added new Vertex class
|
File size:
1.3 KB
|
Line | |
---|
1 |
|
---|
2 | namespace HeuristicLab.Problems.RoutePlanning.Graph {
|
---|
3 | public class Vertex {
|
---|
4 | private long id;
|
---|
5 | public long Id {
|
---|
6 | get { return id; }
|
---|
7 | set { id = value; }
|
---|
8 | }
|
---|
9 |
|
---|
10 | private double longitude;
|
---|
11 | public double Logitude {
|
---|
12 | get { return longitude; }
|
---|
13 | set { longitude = value; }
|
---|
14 | }
|
---|
15 |
|
---|
16 | private double latitude;
|
---|
17 | public double Latitude {
|
---|
18 | get { return latitude; }
|
---|
19 | set { latitude = value; }
|
---|
20 | }
|
---|
21 |
|
---|
22 | public Vertex(long id) {
|
---|
23 | this.id = id;
|
---|
24 | }
|
---|
25 |
|
---|
26 | public static bool operator ==(Vertex v1, Vertex v2) {
|
---|
27 | if ((object)v1 == null) {
|
---|
28 | if ((object)v2 == null) {
|
---|
29 | return true;
|
---|
30 | }
|
---|
31 | return false;
|
---|
32 | }
|
---|
33 | if ((object)v1 == null && (object)v2 != null) {
|
---|
34 | return false;
|
---|
35 | }
|
---|
36 | return v1.Equals(v2);
|
---|
37 | }
|
---|
38 |
|
---|
39 | public static bool operator !=(Vertex v1, Vertex v2) {
|
---|
40 | return !(v1 == v2);
|
---|
41 | }
|
---|
42 |
|
---|
43 | public override bool Equals(object obj) {
|
---|
44 | if (obj is Vertex) {
|
---|
45 | Vertex v = (obj as Vertex);
|
---|
46 | return this.Equals(v);
|
---|
47 | }
|
---|
48 | return false;
|
---|
49 | }
|
---|
50 |
|
---|
51 | public override int GetHashCode() {
|
---|
52 | return id.GetHashCode() ^ latitude.GetHashCode() ^ longitude.GetHashCode();
|
---|
53 | }
|
---|
54 |
|
---|
55 | public override string ToString() {
|
---|
56 | return string.Format("{0}", id);
|
---|
57 | }
|
---|
58 |
|
---|
59 |
|
---|
60 | }
|
---|
61 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.