From 4d449a9b96570e8c655fc303ca0ca81dab394e3d Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 20 May 2020 19:40:06 -0400 Subject: Update docs --- .../bjc.everge/ControlledString.java.html | 248 +++++++++++---------- 1 file changed, 135 insertions(+), 113 deletions(-) (limited to 'docs/jacoco-ut/bjc.everge/ControlledString.java.html') diff --git a/docs/jacoco-ut/bjc.everge/ControlledString.java.html b/docs/jacoco-ut/bjc.everge/ControlledString.java.html index 9beba2e..43aaf29 100644 --- a/docs/jacoco-ut/bjc.everge/ControlledString.java.html +++ b/docs/jacoco-ut/bjc.everge/ControlledString.java.html @@ -35,7 +35,7 @@ public class ControlledString { * Create a new argless control. * * @param nam - * The name of the control. + * The name of the control. */ public Control(String nam) { name = nam; @@ -45,9 +45,9 @@ public class ControlledString { * Create a new control. * * @param nam - * The name of the control. + * The name of the control. * @param ars - * The arguments of the control. + * The arguments of the control. */ public Control(String nam, String... ars) { name = nam; @@ -60,97 +60,116 @@ public class ControlledString { * @return The number of arguments to this control. */ public int count() { - return args.length; + if (args == null) return 0; + + return args.length; } /** * Get an argument from the control. - * - * @param i The index of the argument to get. + * + * @param i + * The index of the argument to get. * @return The argument at that position. */ public String get(int i) { - if (i < 0) { - String msg = String.format("Control argument index must be greater than 0 (was %d)", i); + if (i < 0) { + String msg = String.format( + "Control argument index must be greater than 0 (was %d)", i); - throw new IllegalArgumentException(msg); + throw new IndexOutOfBoundsException(msg); } - if (i > args.length) { - String msg = String.format("Control argument index must be less than %d (was %d)", - args.length, i); + if (i > args.length) { + String msg = String.format( + "Control argument index must be less than %d (was %d)", + args.length, i); - throw new IllegalArgumentException(msg); + throw new IndexOutOfBoundsException(msg); } - return args[i]; + return args[i]; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(name); + StringBuilder sb = new StringBuilder(); + sb.append(name); - if (args != null && args.length > 0) { - sb.append("/"); + if (args != null && args.length > 0) { + sb.append("/"); - for (String arg : args) { - sb.append(arg); - sb.append(";"); + for (String arg : args) { + sb.append(arg); + sb.append(";"); } } - return sb.toString(); + return sb.toString(); } @Override public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode(args); - result = prime * result + ((name == null) ? 0 : name.hashCode()); - return result; + final int prime = 31; + int result = 1; + result = prime * result + Arrays.hashCode(args); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; } @Override public boolean equals(Object obj) { - if (this == obj) { return true; } - if (obj == null) { return false; } - if (getClass() != obj.getClass()) { return false; } + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } - Control other = (Control) obj; + Control other = (Control) obj; - if (name == null) { - if (other.name != null) { return false; } - } else if (!name.equals(other.name)) { return false; } + if (name == null) { + if (other.name != null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } - boolean isArged = args != null && args.length > 0; - boolean oIsArged = other.args != null && other.args.length > 0; + boolean isArged = args != null && args.length > 0; + boolean oIsArged = other.args != null && other.args.length > 0; - if (isArged && !oIsArged) { return false; } - if (!isArged && oIsArged) { return false; } + if (isArged && !oIsArged) { + return false; + } + if (!isArged && oIsArged) { + return false; + } - if (isArged && oIsArged) { - return Arrays.equals(args, other.args); + if (isArged && oIsArged) { + return Arrays.equals(args, other.args); } - return true; + return true; } /** * Convenient static constructor for static imports. * * @param nam - * The name of the control. + * The name of the control. * @param ars - * The arguments to the control. + * The arguments to the control. * @return A control with the right parameters. */ public static Control C(String nam, String... ars) { - return new Control(nam, ars); + return new Control(nam, ars); } } - + /** * Parameter class for defining how to parse a ControlledString. * @@ -181,39 +200,41 @@ public class ControlledString { * Create a new set of parse strings. * * @param contInd - * The control indicator. + * The control indicator. * @param contSep - * The control separator. + * The control separator. * @param contArg - * The argument separator. + * The argument separator. * @param contEsc - * The control escape. + * The control escape. */ - public ParseStrings(String contInd, String contSep, String contArg, String contEsc) { - this.contInd = contInd; - this.contSep = contSep; - this.contArg = contArg; - this.contEsc = contEsc; - } + public ParseStrings(String contInd, String contSep, String contArg, + String contEsc) { + this.contInd = contInd; + this.contSep = contSep; + this.contArg = contArg; + this.contEsc = contEsc; + } /** * Convenient static constructor. * * @param contInd - * The control indicator. + * The control indicator. * @param contSep - * The control separator. + * The control separator. * @param contArg - * The argument separator. + * The argument separator. * @param contEsc - * The control escape. + * The control escape. * @return A new set of control strings. */ - public static ParseStrings PS(String contInd, String contSep, String contArg, String contEsc) { - return new ParseStrings(contInd, contSep, contArg, contEsc); + public static ParseStrings PS(String contInd, String contSep, String contArg, + String contEsc) { + return new ParseStrings(contInd, contSep, contArg, contEsc); } } - + /** * The string the controls apply to. */ @@ -227,35 +248,35 @@ public class ControlledString { /** * Create a new blank controlled string. */ - public ControlledString() { - controls = new Control[0]; - } + public ControlledString() { + controls = new Control[0]; + } /** * Create a new controlled string without any controls. * * @param strung - * The string to use. + * The string to use. */ - public ControlledString(String strung) { - strang = strung; + public ControlledString(String strung) { + strang = strung; - controls = new Control[0]; - } + controls = new Control[0]; + } /** * Create a new controlled string. * * @param strung - * The string to use. + * The string to use. * @param controls - * The controls that apply to the string. + * The controls that apply to the string. */ - public ControlledString(String strung, Control... controls) { - strang = strung; + public ControlledString(String strung, Control... controls) { + strang = strung; - this.controls = controls; - } + this.controls = controls; + } /** * Check if the string has controls. @@ -263,7 +284,7 @@ public class ControlledString { * @return Whether or not the string has controls. */ public boolean hasControls() { - return controls.length > 0; + return controls.length > 0; } /** @@ -272,7 +293,7 @@ public class ControlledString { * @return The number of controls for this string. */ public int count() { - return controls.length; + return controls.length; } /** @@ -281,71 +302,72 @@ public class ControlledString { * The controls must be parsed from the beginning of the string. * * @param lne - * The string to parse from. + * The string to parse from. * @param strangs - * The object to read the strings from + * The object to read the strings from * @return A parsed control string. */ - public static ControlledString parse(String lne, ParseStrings strangs) - { - if (!lne.startsWith(strangs.contInd)) { - return new ControlledString(lne); + public static ControlledString parse(String lne, ParseStrings strangs) { + if (!lne.startsWith(strangs.contInd)) { + return new ControlledString(lne); } - String[] bits = StringUtils.escapeSplit(strangs.contEsc, strangs.contInd, lne); + String[] bits = StringUtils.escapeSplit(strangs.contEsc, strangs.contInd, lne); - if (bits.length < 2) { - String msg = "Did not find control terminator (%s) where it should be"; - msg = String.format(msg, strangs.contInd); + if (bits.length < 2) { + String msg = "Did not find control terminator (%s) where it should be"; + msg = String.format(msg, strangs.contInd); - throw new IllegalArgumentException(msg); - } + throw new IllegalArgumentException(msg); + } - ControlledString cs = new ControlledString(bits[0]); - if (bits.length > 2) cs.strang = bits[2]; + ControlledString cs = new ControlledString(bits[0]); + if (bits.length > 2) + cs.strang = bits[2]; - bits = StringUtils.escapeSplit(strangs.contEsc, strangs.contSep, bits[1]); + bits = StringUtils.escapeSplit(strangs.contEsc, strangs.contSep, bits[1]); - cs.controls = new Control[bits.length]; + cs.controls = new Control[bits.length]; - for (int i = 0; i < bits.length; i++) { - String bit = bits[i]; + for (int i = 0; i < bits.length; i++) { + String bit = bits[i]; - String[] bots = StringUtils.escapeSplit(strangs.contEsc, strangs.contArg, bit); + String[] bots + = StringUtils.escapeSplit(strangs.contEsc, strangs.contArg, bit); - Control cont = new Control(bots[0]); + Control cont = new Control(bots[0]); - if (cont.name.length() > 1) { - cont.name = cont.name.toUpperCase(); + if (cont.name.length() > 1) { + cont.name = cont.name.toUpperCase(); } - if (bots.length > 1) { - cont.args = new String[bots.length - 1]; - for (int j = 1; j < bots.length; j++) { - cont.args[j - 1] = bots[j]; + if (bots.length > 1) { + cont.args = new String[bots.length - 1]; + for (int j = 1; j < bots.length; j++) { + cont.args[j - 1] = bots[j]; } } - cs.controls[i] = cont; + cs.controls[i] = cont; } - return cs; + return cs; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + StringBuilder sb = new StringBuilder(); - sb.append("//"); + sb.append("//"); - for (Control cont : controls) { - sb.append(cont); + for (Control cont : controls) { + sb.append(cont); } - sb.append("//"); - sb.append(strang); + sb.append("//"); + sb.append(strang); - return sb.toString(); + return sb.toString(); } } \ No newline at end of file -- cgit v1.2.3