Last change
on this file since 16310 was
8516,
checked in by spimming, 12 years ago
|
#1894:
- solution restructured
- removed obsolete and outdated parts
|
File size:
1.5 KB
|
Line | |
---|
1 |
|
---|
2 | namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph {
|
---|
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 Vertex(long id, double longitude, double latitude) {
|
---|
27 | this.id = id;
|
---|
28 | this.longitude = longitude;
|
---|
29 | this.latitude = latitude;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public static bool operator ==(Vertex v1, Vertex v2) {
|
---|
33 | if ((object)v1 == null) {
|
---|
34 | if ((object)v2 == null) {
|
---|
35 | return true;
|
---|
36 | }
|
---|
37 | return false;
|
---|
38 | }
|
---|
39 | if ((object)v1 == null && (object)v2 != null) {
|
---|
40 | return false;
|
---|
41 | }
|
---|
42 | return v1.Equals(v2);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public static bool operator !=(Vertex v1, Vertex v2) {
|
---|
46 | return !(v1 == v2);
|
---|
47 | }
|
---|
48 |
|
---|
49 | public override bool Equals(object obj) {
|
---|
50 | if (obj is Vertex) {
|
---|
51 | Vertex v = (obj as Vertex);
|
---|
52 | return (this.id == v.id); //TODO:
|
---|
53 | }
|
---|
54 | return false;
|
---|
55 | }
|
---|
56 |
|
---|
57 | public override int GetHashCode() {
|
---|
58 | return id.GetHashCode() ^ latitude.GetHashCode() ^ longitude.GetHashCode();
|
---|
59 | }
|
---|
60 |
|
---|
61 | public override string ToString() {
|
---|
62 | return string.Format("{0}", id);
|
---|
63 | }
|
---|
64 |
|
---|
65 |
|
---|
66 | }
|
---|
67 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.