|
@@ -1,6 +1,7 @@
|
1
|
1
|
package org.insa.graph;
|
2
|
2
|
|
3
|
3
|
import java.util.ArrayList;
|
|
4
|
+import java.util.Collections;
|
4
|
5
|
import java.util.Iterator;
|
5
|
6
|
import java.util.List;
|
6
|
7
|
|
|
@@ -11,7 +12,7 @@ import java.util.List;
|
11
|
12
|
* holds a list of nodes and each node holds a list of its successors.
|
12
|
13
|
*
|
13
|
14
|
*/
|
14
|
|
-public class Graph implements Iterable<Node> {
|
|
15
|
+public final class Graph implements Iterable<Node> {
|
15
|
16
|
|
16
|
17
|
// Map identifier.
|
17
|
18
|
private final String mapId;
|
|
@@ -36,7 +37,7 @@ public class Graph implements Iterable<Node> {
|
36
|
37
|
public Graph(String mapId, String mapName, List<Node> nodes, GraphStatistics graphStatistics) {
|
37
|
38
|
this.mapId = mapId;
|
38
|
39
|
this.mapName = mapName;
|
39
|
|
- this.nodes = nodes;
|
|
40
|
+ this.nodes = Collections.unmodifiableList(nodes);
|
40
|
41
|
this.graphStatistics = graphStatistics;
|
41
|
42
|
}
|
42
|
43
|
|