diff options
author | Jonas Smedegaard <dr@jones.dk> | 2025-04-29 06:03:56 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2025-04-29 06:11:41 +0200 |
commit | a5c3599d7bc7a9ef5583ad2d50a55975f030fbea (patch) | |
tree | db4ed74e48997d4b4450148116a9c990978a1641 /src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java | |
parent | 03d2d06e8f5bfadd79912efb94e8931e54296735 (diff) |
declare variables final when possible
Diffstat (limited to 'src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java')
-rw-r--r-- | src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java index ed38f1d..1382a4a 100644 --- a/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java +++ b/src/dk.biks.bachelorizer/dk/biks/bachelorizer/Graph.java @@ -120,7 +120,7 @@ public final class Graph { /// @param g Graph to inspect /// @throws IllegalArgumentException /// https://docs.oracle.com/javase/tutorial/essential/exceptions/runtime.html - public static void assertConnected(AbstractGraph g) { + public static void assertConnected(final AbstractGraph g) { // collect all vertices in the graph Collection<Vertex> c = g.vertices(); @@ -143,7 +143,7 @@ public final class Graph { /// /// @param g Graph to inspect /// @return list of disjoint sets - public static ArrayList<Set<Vertex>> disjoint(AbstractGraph g) { + public static ArrayList<Set<Vertex>> disjoint(final AbstractGraph g) { // get all subject modules // @@ -159,7 +159,7 @@ public final class Graph { /// @param g Graph to inspect /// @param vip Ordered list of subject modules to prioritize /// @return List of sets of disjoint choices - public static ArrayList<Set<Vertex>> disjoint(AbstractGraph g, List<Vertex> vip) { + public static ArrayList<Set<Vertex>> disjoint(final AbstractGraph g, final List<Vertex> vip) { ArrayList<Set<Vertex>> sets = new ArrayList<>(); // track done subject modules as extendable set @@ -205,7 +205,7 @@ public final class Graph { /// @param sets list of disjoint choices /// @param g choices as weights in graph /// @return groups of disjoint choices as a graph - public static AbstractGraph moduleGroups(ArrayList<Set<Vertex>> sets, AbstractGraph g) { + public static AbstractGraph moduleGroups(final ArrayList<Set<Vertex>> sets, final AbstractGraph g) { AbstractGraph h = new AdjListGraph(); for (Set<Vertex> s: sets) { for (Set<Vertex> t: sets) { @@ -230,7 +230,7 @@ public final class Graph { /// /// @param g sets of disjoint choices as a graph /// @return amount of students in consecutive slots - public static int solution(AbstractGraph g) { + public static int solution(final AbstractGraph g) { // pick a random vertice in the graph Vertex v = g.vertices().iterator().next(); @@ -243,7 +243,7 @@ public final class Graph { /// @param g groups of disjoint choices as a graph /// @param v seed vertex within graph /// @return amount of students in consecutive slots - public static int solution(AbstractGraph g, Vertex v) { + public static int solution(final AbstractGraph g, final Vertex v) { return GraphAlgorithms.pathLength( GraphAlgorithms.dijkstra(g, v)); } |