Last change
on this file since 170 was
145,
checked in by (none), 14 years ago
|
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * Edge Class |
---|
3 | */ |
---|
4 | |
---|
5 | public class Edge { |
---|
6 | |
---|
7 | private Vertex start; |
---|
8 | private Vertex end; |
---|
9 | private int distance; |
---|
10 | |
---|
11 | /** |
---|
12 | * @param name |
---|
13 | * @param start |
---|
14 | * @param end |
---|
15 | * @param distance |
---|
16 | */ |
---|
17 | public Edge(Vertex start, Vertex end, int distance) { |
---|
18 | this.start = start; |
---|
19 | this.end = end; |
---|
20 | this.distance = distance; |
---|
21 | } |
---|
22 | |
---|
23 | /** |
---|
24 | * @return the start |
---|
25 | */ |
---|
26 | public Vertex getStart() { |
---|
27 | return start; |
---|
28 | } |
---|
29 | |
---|
30 | /** |
---|
31 | * @param start the start to set |
---|
32 | */ |
---|
33 | public void setStart(Vertex start) { |
---|
34 | this.start = start; |
---|
35 | } |
---|
36 | |
---|
37 | /** |
---|
38 | * @return the end |
---|
39 | */ |
---|
40 | public Vertex getEnd() { |
---|
41 | return end; |
---|
42 | } |
---|
43 | |
---|
44 | /** |
---|
45 | * @param end the end to set |
---|
46 | */ |
---|
47 | public void setEnd(Vertex end) { |
---|
48 | this.end = end; |
---|
49 | } |
---|
50 | |
---|
51 | /** |
---|
52 | * @return the distance |
---|
53 | */ |
---|
54 | public int getDistance() { |
---|
55 | return distance; |
---|
56 | } |
---|
57 | |
---|
58 | /** |
---|
59 | * @param distance the distance to set |
---|
60 | */ |
---|
61 | public void setDistance(int distance) { |
---|
62 | this.distance = distance; |
---|
63 | } |
---|
64 | |
---|
65 | /** |
---|
66 | * @param v the vertex not to return |
---|
67 | * @return the other vertex |
---|
68 | */ |
---|
69 | public Vertex getOtherVertex( Vertex v ) { |
---|
70 | if( v.equals( start ) ) return end; |
---|
71 | return start; |
---|
72 | } |
---|
73 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.