summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/everge/ReplError.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-10-31 12:45:15 -0400
committerBen Culkin <scorpress@gmail.com>2020-10-31 12:45:15 -0400
commitd5eaaa14adc980e9b0588a3caf7ee7d81df1183e (patch)
tree866603edc90f0e1538e869db8a7732ce8c4bf03c /src/main/java/bjc/everge/ReplError.java
parente8b01037e47884c10d9f910192ac59cef14d28bf (diff)
General cleanup
This does a bunch of structural cleanups to make the code better
Diffstat (limited to 'src/main/java/bjc/everge/ReplError.java')
-rw-r--r--src/main/java/bjc/everge/ReplError.java107
1 files changed, 0 insertions, 107 deletions
diff --git a/src/main/java/bjc/everge/ReplError.java b/src/main/java/bjc/everge/ReplError.java
deleted file mode 100644
index f9a30a9..0000000
--- a/src/main/java/bjc/everge/ReplError.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package bjc.everge;
-
-import bjc.data.IntHolder;
-
-/**
- * Represents an error encountered parsing ReplPairs
- *
- * @author Ben Culkin
- */
-public class ReplError {
- /**
- * The line the error occurred 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(IntHolder lne, IntHolder nPairs, String msg, String txt) {
- this(lne.get(), nPairs.get(), msg, txt);
- }
-
- /**
- * 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);
- }
-
- /**
- * Convert the error to a printable string.
- *
- * @return The error as a printable string.
- */
- public String toPrintString() {
- return toPrintString("");
- }
-
- /**
- * Convert the error to a printable string, with a custom header.
- *
- * @param hdr
- * The text to include in the header.
- *
- * @return The error as a printable string.
- */
- public String toPrintString(String hdr) {
- 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("[ERROR] line %d, pair %d: %s\n%s\tContext: %s", line,
- numPairs, msg, hdr, errString);
- }
-}