-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEdge.java
More file actions
37 lines (24 loc) · 817 Bytes
/
Edge.java
File metadata and controls
37 lines (24 loc) · 817 Bytes
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
// Implementation of Edge objects for Graph class
// package GraphGame;
public class Edge<V> {
// Instance variables
private Vertex<V> first;
private Vertex<V> second;
private boolean marker;
/* CONSTRUCTOR */
// Sets end points of edge, which is unfrozen by default
public Edge(Vertex<V> u, Vertex<V> v) {
first = u;
second = v;
marker = false;
}
/* METHODS */
// Returns first endpoint
public Vertex<V> getEndPoint1() { return first; }
// Returns second endpoint
public Vertex<V> getEndPoint2() { return second; }
// Sets the marker for this edge to either true or false
public void setMarker(boolean mark) { marker = mark; }
// Returns marker of edge (ie. true = frozen or false = unfrozen)
public boolean getMarker() { return marker; }
} // End of class