summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/everge/ReplError.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2019-06-13 19:07:28 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2019-06-13 19:07:28 -0400
commit7ece1ed3e64770561a1e50085969dcfa6bda20a9 (patch)
tree4653612556ad33ec02a205945c6c2b89dd18f6de /src/main/java/bjc/everge/ReplError.java
parentf46810bf4277d2b2ef78819af3c1f8bf69494f2d (diff)
Rename package
Things are now in package bjc.everge, not bjc.replpair
Diffstat (limited to 'src/main/java/bjc/everge/ReplError.java')
-rw-r--r--src/main/java/bjc/everge/ReplError.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/main/java/bjc/everge/ReplError.java b/src/main/java/bjc/everge/ReplError.java
new file mode 100644
index 0000000..e5a4dd0
--- /dev/null
+++ b/src/main/java/bjc/everge/ReplError.java
@@ -0,0 +1,56 @@
+package bjc.everge;
+
+/**
+ * Represents an error encountered parsing ReplPairs
+ *
+ * @author Ben Culkin
+ */
+public class ReplError {
+ /**
+ * The line the error occured on.
+ */
+ public int line;
+ /**
+ * The number of pairs we have processed so far.
+ */
+ public int numPairs;
+
+ /**
+ * The text of the line we errored on.
+ */
+ public String txt;
+ /**
+ * The message of the error.
+ */
+ public String msg;
+
+ /**
+ * Create a new ReplPair parse error.
+ *
+ * @param lne
+ * The line the error occured on.
+ * @param nPairs
+ * The number of pairs processed up to this point.
+ * @param msg
+ * The message detailing the error.
+ * @param txt
+ * The text that caused the error.
+ */
+ public ReplError(int lne, int nPairs, String msg, String txt) {
+ line = lne;
+ numPairs = nPairs;
+
+ this.txt = txt;
+ this.msg = msg;
+ }
+
+ @Override
+ public String toString() {
+ String errString;
+ if (txt == null) errString = "No associated line";
+ else if (txt.equals("")) errString = "Text of line was empty";
+ else errString = "Text of line was: " + txt;
+
+ return String.format("line %d, pair %d:%s\n\t%s", line, numPairs, msg, errString);
+ }
+}