summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/funcutils
diff options
context:
space:
mode:
authorstudent <student@192.168.1.186>2017-04-07 11:34:00 -0400
committerstudent <student@192.168.1.186>2017-04-07 11:34:00 -0400
commit7692fa077a84972231948354d3f0de99f27a9ad7 (patch)
treea7539aff7732339f7655c35f2c2c07723618127b /BJC-Utils2/src/main/java/bjc/utils/funcutils
parent63d88eb8db1f7a6d5924ec2a8b7f462373d5ac9a (diff)
Fix property bugs
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcutils')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java72
1 files changed, 35 insertions, 37 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java b/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
index 540fb39..d5eaadf 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/funcutils/StringUtils.java
@@ -16,53 +16,51 @@ public class StringUtils {
* expression
*
* @param input
- * The string to check
- * @param regex
- * The regex to see if the string only contains matches
- * of
- * @return Whether or not the string consists only of multiple matches
- * of the provided regex
+ * The string to check
+ * @param rRegex
+ * The regex to see if the string only contains matches of
+ * @return Whether or not the string consists only of multiple matches of
+ * the provided regex
*/
- public static boolean containsOnly(String input, String regex) {
- if(input == null)
+ public static boolean containsOnly(String input, String rRegex) {
+ if (input == null)
throw new NullPointerException("Input must not be null");
- else if(regex == null) throw new NullPointerException("Regex must not be null");
+ else if (rRegex == null)
+ throw new NullPointerException("Regex must not be null");
/*
* This regular expression is fairly simple.
*
* First, we match the beginning of the string. Then, we start a
- * non-capturing group whose contents are the passed in regex.
- * That group is then matched one or more times and the pattern
- * matches to the end of the string
+ * non-capturing group whose contents are the passed in regex. That
+ * group is then matched one or more times and the pattern matches to
+ * the end of the string
*/
- return input.matches("\\A(?:" + regex + ")+\\Z");
+ return input.matches("\\A(?:" + rRegex + ")+\\Z");
}
/**
* Indent the string being built in a StringBuilder n levels
*
* @param builder
- * The builder to indent in
+ * The builder to indent in
* @param levels
- * The number of levels to indent
+ * The number of levels to indent
*/
public static void indentNLevels(StringBuilder builder, int levels) {
- for(int i = 0; i < levels; i++) {
+ for (int i = 0; i < levels; i++) {
builder.append("\t");
}
}
/**
- * Print out a deque with a special case for easily showing a deque is
- * empty
+ * Print out a deque with a special case for easily showing a deque is empty
*
* @param <ContainedType>
- * The type in the deque
+ * The type in the deque
* @param queue
- * The deque to print
- * @return A string version of the deque, with allowance for an empty
- * deque
+ * The deque to print
+ * @return A string version of the deque, with allowance for an empty deque
*/
public static <ContainedType> String printDeque(Deque<ContainedType> queue) {
return queue.isEmpty() ? "(none)" : queue.toString();
@@ -72,17 +70,17 @@ public class StringUtils {
* Converts a sequence to an English list.
*
* @param objects
- * The sequence to convert to an English list.
+ * The sequence to convert to an English list.
* @param join
- * The string to use for separating the last element from
- * the rest.
+ * The string to use for separating the last element from the
+ * rest.
* @param comma
- * The string to use as a comma
+ * The string to use as a comma
*
* @return The sequence as an English list.
*/
public static String toEnglishList(Object[] objects, String join, String comma) {
- if(objects == null) {
+ if (objects == null) {
throw new NullPointerException("Sequence must not be null");
}
@@ -91,7 +89,7 @@ public class StringUtils {
String joiner = join;
String coma = comma;
- switch(objects.length) {
+ switch (objects.length) {
case 0:
/*
* Empty list.
@@ -115,7 +113,7 @@ public class StringUtils {
/*
* Three or more items.
*/
- for(int i = 0; i < objects.length - 1; i++) {
+ for (int i = 0; i < objects.length - 1; i++) {
sb.append(objects[i].toString());
sb.append(coma + " ");
}
@@ -137,10 +135,10 @@ public class StringUtils {
* Converts a sequence to an English list.
*
* @param objects
- * The sequence to convert to an English list.
+ * The sequence to convert to an English list.
* @param join
- * The string to use for separating the last element from
- * the rest.
+ * The string to use for separating the last element from the
+ * rest.
*
* @return The sequence as an English list.
*/
@@ -152,14 +150,14 @@ public class StringUtils {
* Converts a sequence to an English list.
*
* @param objects
- * The sequence to convert to an English list.
+ * The sequence to convert to an English list.
* @param and
- * Whether to use 'and' or 'or'.
+ * Whether to use 'and' or 'or'.
*
* @return The sequence as an English list.
*/
public static String toEnglishList(Object[] objects, boolean and) {
- if(and) {
+ if (and) {
return toEnglishList(objects, "and");
} else {
return toEnglishList(objects, "or");
@@ -170,7 +168,7 @@ public class StringUtils {
* Count the number of graphemes in a string.
*
* @param value
- * The string to check.
+ * The string to check.
*
* @return The number of graphemes in the string.
*/
@@ -179,7 +177,7 @@ public class StringUtils {
it.setText(value);
int count = 0;
- while(it.next() != BreakIterator.DONE) {
+ while (it.next() != BreakIterator.DONE) {
count++;
}