From 79d3a4a47cbc1fcf17c77c6fc12ff826a3077bac Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 6 Apr 2016 13:50:00 -0400 Subject: Minor bugfixes/changes, as well as beginnings of CLI systems --- .../src/main/java/bjc/utils/graph/AdjacencyMap.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/graph/AdjacencyMap.java') 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 { // 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 { 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 { GenHolder result = new GenHolder<>(true); adjacencyMap.entrySet().forEach(mapEntry -> { - Set> entryVertices = - mapEntry.getValue().entrySet(); + Set> entryVertices = mapEntry.getValue() + .entrySet(); entryVertices.forEach(targetVertex -> { int leftValue = targetVertex.getValue(); -- cgit v1.2.3