Skip to content

Commit bf0af4f

Browse files
authored
Version 1.4.0
Merge pull request #9 from Samasaur1/development
2 parents 1cebe7a + 83275a6 commit bf0af4f

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jdk:
1010
- openjdk9
1111

1212

13-
script: "./gradlew clean build --rerun-tasks --scan"
13+
script: "./gradlew clean build --rerun-tasks --scan" # gradle build runs test
1414

1515
before_deploy:
1616
- ./gradlew clean

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'com.gauck.sam'
9-
version '1.3.3'
9+
version '1.4.0'
1010

1111
sourceCompatibility = 1.8
1212

src/main/java/com/gauck/sam/Utilities/Utilities.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
/**
66
* A utility class to help do things.
7+
*
8+
* @author Samasaur
79
*/
810
public final class Utilities {
911
/**
@@ -14,10 +16,11 @@ private Utilities() throws Exception {
1416
}
1517

1618
/**
17-
* A method that takes a string and capitalizes it correctly (e.g. eXamPLe → Example).
19+
* Returns a correctly capitalized string.
20+
* If it is empty or null, it is returned unchanged.
1821
*
1922
* @param original The string to be capitalized.
20-
* @return A capitalized version of the parameter.
23+
* @return A capitalized version of the passed string.
2124
*/
2225
public static String capitalize(String original) {
2326
if (original == null) return null; //Make sure we weren't passed null.
@@ -32,7 +35,7 @@ public static String capitalize(String original) {
3235
}
3336

3437
/**
35-
* A method that takes some number of integers and returns the average of them
38+
* Returns the average of an array of integers.
3639
*
3740
* @param values The ints to take the average of.
3841
* @return The average of the parameters.
@@ -67,10 +70,10 @@ public static <K, V> Map<K, V> generateMap(ArrayList<K> keys, ArrayList<V> value
6770
}
6871

6972
/**
70-
* Removes profanity from a given string.
73+
* Removes profanity from a given string. Strings that are either empty or null will be returned unchanged.
7174
*
72-
* @param original The string to 'clean'.
73-
* @return The cleaned string.
75+
* @param original The string to 'clean'. If this is null, this method returns null. If it is empty, it is returned unchanged.
76+
* @return The cleaned string. This is the original string, with any profane words (separated by nonalphabetic characters) replaced by * characters.
7477
*/
7578
public static String removeProfanity(String original) {
7679
if (original == null) return null;
@@ -81,12 +84,17 @@ public static String removeProfanity(String original) {
8184
}
8285

8386
/**
84-
* Removes profanity from every string in a given ArrayList.
87+
* Removes profanity from every string in a given List.
88+
* Strings that are either empty or null will be returned unchanged. If the List is empty or null, it will be returned unchanged.
89+
* <p>
90+
* For every string in this List, the {@link #removeProfanity(String)} method is called on it.
8591
*
86-
* @param original The ArrayList to 'clean'.
87-
* @return The cleaned ArrayList.
92+
* @param original The List to 'clean'. If this is null, this method returns null. If it is empty, it is returned unchanged.
93+
* @return The cleaned List. Each string in it has been cleansed.
94+
* @see #removeProfanity(String)
95+
* @since 1.4
8896
*/
89-
public static ArrayList<String> removeProfanity(ArrayList<String> original) {
97+
public static List<String> removeProfanity(List<String> original) {
9098
if (original == null) return null;
9199
for (int i = 0; i < original.size(); i++) {
92100
original.set(i, removeProfanity(original.get(i)));

src/test/java/com/gauck/sam/Utilities/RemoveProfanityArrayListTest.java renamed to src/test/java/com/gauck/sam/Utilities/RemoveProfanityListTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
import java.util.*;
77

88
/**
9-
* Unit tests for the {@link Utilities} removeProfanity(ArrayList<String> original) function.
9+
* Unit tests for the {@link Utilities} removeProfanity(List original) function.
1010
*
1111
* @author Samasaur
1212
*/
13-
public class RemoveProfanityArrayListTest {
13+
public class RemoveProfanityListTest {
1414
@Test
15-
public void removeProfanityFromEmptyArrayListTest() {
15+
public void removeProfanityFromEmptyListTest() {
1616
Assert.assertEquals(new ArrayList<String>(), Utilities.removeProfanity(new ArrayList<>()));
1717
}
1818

0 commit comments

Comments
 (0)