-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmst.java
58 lines (47 loc) · 1.06 KB
/
mst.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//purpose
//store mst data
public class mst implements Comparable <mst>
{
private int start, end;
private int parent;
private double edge;
private int children; //todo ??? need???
public mst(int start, double edge, int end)
{
this.parent = -1; //set as -1 is no parent atm
this.start = start;
this.edge = edge;
this.end = end;
}
public int getStart()
{
return start;
}
public double getEdge()
{
return edge;
}
public int getEnd()
{
return end;
}
public int getParent() { return parent; }
public void setEnd(int end)
{
this.end = end;
}
public void setParent(int parent) { this.parent= parent; }
@Override
public int compareTo(mst compareMST)
{
if(this.getEnd() > compareMST.getEnd())
{
return 1;
}
else if(this.getEnd() < compareMST.getEnd())
{
return -1;
}
return 0;
}
}