diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-06 13:50:00 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-06 13:50:00 -0400 |
| commit | 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac (patch) | |
| tree | a69e533c558326d583b3aee891fc815208c7b650 /BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java | |
| parent | 4355418164c44170cfb329fcbb7e6f1358c0e314 (diff) | |
Minor bugfixes/changes, as well as beginnings of CLI systems
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java b/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java index e583210..247ee31 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java @@ -50,10 +50,14 @@ public class AdjacencyMap<T> { // First, read in number of vertices numVertices = Integer.parseInt(possibleVertices); } catch (NumberFormatException nfex) { - throw new InputMismatchException( + InputMismatchException imex = new InputMismatchException( "The first line must contain the number of vertices. " + possibleVertices + " is not a valid number"); + + imex.initCause(nfex); + + throw imex; } if (numVertices <= 0) { @@ -87,8 +91,12 @@ public class AdjacencyMap<T> { try { columnWeight = Integer.parseInt(part); } catch (NumberFormatException nfex) { - throw new InputMismatchException( + InputMismatchException imex = new InputMismatchException( "" + part + " is not a valid weight."); + + imex.initCause(nfex); + + throw imex; } adjacencyMap.setWeight(row.unwrap(number -> number), @@ -143,8 +151,8 @@ public class AdjacencyMap<T> { GenHolder<Boolean> result = new GenHolder<>(true); adjacencyMap.entrySet().forEach(mapEntry -> { - Set<Entry<T, Integer>> entryVertices = - mapEntry.getValue().entrySet(); + Set<Entry<T, Integer>> entryVertices = mapEntry.getValue() + .entrySet(); entryVertices.forEach(targetVertex -> { int leftValue = targetVertex.getValue(); |
