-
Notifications
You must be signed in to change notification settings - Fork 0
/
Edge.java
53 lines (43 loc) · 1.06 KB
/
Edge.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
public class Edge {
// Instance variables for class
private Node u,v;
private int type;
private String label;
// Constructor
public Edge(Node u, Node v, int type){
this.u = u;
this.v = v;
this.type = type;
}
// Another constructor
public Edge(Node u, Node v, int type, String label){
this.u = u;
this.v = v;
this.type = type;
this.label = label;
}
// Gets the first Node enpoint in the edge
public Node firstEndpoint() {
return this.u;
}
// Gets the second Node endpoint in the edge
public Node secondEndpoint() {
return this.v;
}
// Gets the type of the edge
public int getType(){
return this.type;
}
// Sets the type of the edge
public void setType(int newType){
this.type = newType;
}
// Gets the label of the edge
public String getLabel(){
return this.label;
}
// Sets the label of the edge
public void setLabel(String newLabel){
this.label = label;
}
}