Last change
on this file was
145,
checked in by (none), 14 years ago
|
|
-
Property svn:mime-type set to
text/plain
|
File size:
889 bytes
|
Line | |
---|
1 | /** |
---|
2 | * Vertex Class |
---|
3 | */ |
---|
4 | |
---|
5 | public class Vertex implements Comparable<Vertex> { |
---|
6 | |
---|
7 | private int name; |
---|
8 | |
---|
9 | /** |
---|
10 | * @param name |
---|
11 | */ |
---|
12 | public Vertex(int name) { |
---|
13 | this.name = name; |
---|
14 | } |
---|
15 | |
---|
16 | /** |
---|
17 | * @return the name |
---|
18 | */ |
---|
19 | public int getName() { |
---|
20 | return name; |
---|
21 | } |
---|
22 | |
---|
23 | /** |
---|
24 | * @param name the name to set |
---|
25 | */ |
---|
26 | public void setName(int name) { |
---|
27 | this.name = name; |
---|
28 | } |
---|
29 | |
---|
30 | /** |
---|
31 | * @param v the vertex to compare this vertex to |
---|
32 | * @return 0 if equals, negative is less than, and positive if greater than |
---|
33 | */ |
---|
34 | public int compareTo( Vertex v ) { |
---|
35 | if( name == v.getName() ) |
---|
36 | return 0; |
---|
37 | else if( name < v.getName() ) |
---|
38 | return -1; |
---|
39 | return 1; |
---|
40 | } |
---|
41 | |
---|
42 | /** |
---|
43 | * @param v the vertex to check equivalence |
---|
44 | * @return true if equals and false otherwise |
---|
45 | */ |
---|
46 | public boolean equals( Vertex v ) { |
---|
47 | if( name == v.getName() ) { |
---|
48 | return true; |
---|
49 | } |
---|
50 | return false; |
---|
51 | } |
---|
52 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.