Skip to content

Commit f25f4b0

Browse files
committed
whitelist -> allowlist; blacklist -> blocklist
1 parent bccb4ba commit f25f4b0

File tree

4 files changed

+43
-40
lines changed

4 files changed

+43
-40
lines changed

src/main/java/edu/princeton/cs/algs4/WhiteFilter.java renamed to src/main/java/edu/princeton/cs/algs4/AllowFilter.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/******************************************************************************
2-
* Compilation: javac WhiteFilter.java
3-
* Execution: java WhiteFilter whitelist.txt < input.txt
2+
* Compilation: javac AllowFilter.java
3+
* Execution: java AllowFilter allowlist.txt < input.txt
44
* Dependencies: SET In.java StdIn.java StdOut.java
55
* Data files: https://algs4.cs.princeton.edu/35applications/tinyTale.txt
6-
* https://algs4.cs.princeton.edu/35applications/list.txt
6+
* https://algs4.cs.princeton.edu/35applications/allowlist.txt
77
*
8-
* Read in a whitelist of words from a file. Then read in a list of
8+
* Read in a allowlist of words from a file. Then read in a list of
99
* words from standard input and print out all those words that
1010
* are in the first file.
1111
*
@@ -19,7 +19,7 @@
1919
* % more list.txt
2020
* was it the of
2121
*
22-
* % java WhiteFilter list.txt < tinyTale.txt
22+
* % java AllowFilter list.txt < tinyTale.txt
2323
* it was the of it was the of
2424
* it was the of it was the of
2525
* it was the of it was the of
@@ -31,21 +31,22 @@
3131
package edu.princeton.cs.algs4;
3232

3333
/**
34-
* The {@code WhiteFilter} class provides a client for reading in a <em>whitelist</em>
34+
* The {@code AllowFilter} class provides a client for reading in an <em>allowlist</em>
3535
* of words from a file; then, reading in a sequence of words from standard input,
3636
* printing out each word that appears in the file.
3737
* It is useful as a test client for various symbol table implementations.
3838
* <p>
39-
* For additional documentation, see <a href="https://algs4.cs.princeton.edu/35applications">Section 3.5</a> of
39+
* For additional documentation,
40+
* see <a href="https://algs4.cs.princeton.edu/35applications">Section 3.5</a> of
4041
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
4142
*
4243
* @author Robert Sedgewick
4344
* @author Kevin Wayne
4445
*/
45-
public class WhiteFilter {
46+
public class AllowFilter {
4647

4748
// Do not instantiate.
48-
private WhiteFilter() { }
49+
private AllowFilter() { }
4950

5051
public static void main(String[] args) {
5152
SET<String> set = new SET<String>();

src/main/java/edu/princeton/cs/algs4/Whitelist.java renamed to src/main/java/edu/princeton/cs/algs4/Allowlist.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
/******************************************************************************
2-
* Compilation: javac Whitelist.java
3-
* Execution: java Whitelist whitelist.txt < data.txt
2+
* Compilation: javac Allowlist.java
3+
* Execution: java Allowlist allowlist.txt < data.txt
44
* Dependencies: StaticSetOfInts.java In.java StdOut.java
55
*
6-
* Data files: https://algs4.cs.princeton.edu/11model/tinyW.txt
7-
* https://algs4.cs.princeton.edu/11model/tinyT.txt
8-
* https://algs4.cs.princeton.edu/11model/largeW.txt
9-
* https://algs4.cs.princeton.edu/11model/largeT.txt
6+
* Data files: https://algs4.cs.princeton.edu/11model/tinyAllowlist.txt
7+
* https://algs4.cs.princeton.edu/11model/tinyText.txt
8+
* https://algs4.cs.princeton.edu/11model/largeAllowlist.txt
9+
* https://algs4.cs.princeton.edu/11model/largeText.txt
1010
*
11-
* Whitelist filter.
11+
* Allowlist filter.
1212
*
1313
*
14-
* % java Whitelist tinyW.txt < tinyT.txt
14+
* % java Allowlist tinyAllowlist.txt < tinyText.txt
1515
* 50
1616
* 99
1717
* 13
1818
*
19-
* % java Whitelist largeW.txt < largeT.txt | more
19+
* % java Allowlist largeAllowlist.txt < largeText.txt | more
2020
* 499569
2121
* 984875
2222
* 295754
@@ -30,24 +30,25 @@
3030
package edu.princeton.cs.algs4;
3131

3232
/**
33-
* The {@code Whitelist} class provides a client for reading in
33+
* The {@code Allowlist} class provides a client for reading in
3434
* a set of integers from a file; reading in a sequence of integers
3535
* from standard input; and printing to standard output those
36-
* integers not in the whitelist.
36+
* integers not in the allowlist.
3737
* <p>
38-
* For additional documentation, see <a href="https://algs4.cs.princeton.edu/12oop">Section 1.2</a> of
38+
* For additional documentation,
39+
* see <a href="https://algs4.cs.princeton.edu/12oop">Section 1.2</a> of
3940
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
4041
*
4142
* @author Robert Sedgewick
4243
* @author Kevin Wayne
4344
*/
44-
public class Whitelist {
45+
public class Allowlist {
4546

4647
// Do not instantiate.
47-
private Whitelist() { }
48+
private Allowlist() { }
4849

4950
/**
50-
* Reads in a sequence of integers from the whitelist file, specified as
51+
* Reads in a sequence of integers from the allowlist file, specified as
5152
* a command-line argument. Reads in integers from standard input and
5253
* prints to standard output those integers that are not in the file.
5354
*
@@ -58,7 +59,7 @@ public static void main(String[] args) {
5859
int[] white = in.readAllInts();
5960
StaticSETofInts set = new StaticSETofInts(white);
6061

61-
// Read key, print if not in whitelist.
62+
// Read key, print if not in allowlist.
6263
while (!StdIn.isEmpty()) {
6364
int key = StdIn.readInt();
6465
if (!set.contains(key))

src/main/java/edu/princeton/cs/algs4/BinarySearch.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************
22
* Compilation: javac BinarySearch.java
3-
* Execution: java BinarySearch whitelist.txt < input.txt
3+
* Execution: java BinarySearch allowlist.txt < input.txt
44
* Dependencies: In.java StdIn.java StdOut.java
55
* Data files: https://algs4.cs.princeton.edu/11model/tinyW.txt
66
* https://algs4.cs.princeton.edu/11model/tinyT.txt
@@ -82,7 +82,7 @@ public static int rank(int key, int[] a) {
8282
}
8383

8484
/**
85-
* Reads in a sequence of integers from the whitelist file, specified as
85+
* Reads in a sequence of integers from the allowlist file, specified as
8686
* a command-line argument; reads in integers from standard input;
8787
* prints to standard output those integers that do <em>not</em> appear in the file.
8888
*
@@ -92,15 +92,15 @@ public static void main(String[] args) {
9292

9393
// read the integers from a file
9494
In in = new In(args[0]);
95-
int[] whitelist = in.readAllInts();
95+
int[] allowlist = in.readAllInts();
9696

9797
// sort the array
98-
Arrays.sort(whitelist);
98+
Arrays.sort(allowlist);
9999

100-
// read integer key from standard input; print if not in whitelist
100+
// read integer key from standard input; print if not in allowlist
101101
while (!StdIn.isEmpty()) {
102102
int key = StdIn.readInt();
103-
if (BinarySearch.indexOf(whitelist, key) == -1)
103+
if (BinarySearch.indexOf(allowlist, key) == -1)
104104
StdOut.println(key);
105105
}
106106
}

src/main/java/edu/princeton/cs/algs4/BlackFilter.java renamed to src/main/java/edu/princeton/cs/algs4/BlockFilter.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
/******************************************************************************
2-
* Compilation: javac BlackFilter.java
3-
* Execution: java BlackFilter blacklist.txt < input.txt
2+
* Compilation: javac BlockFilter.java
3+
* Execution: java BlockFilter blocklist.txt < input.txt
44
* Dependencies: SET In.java StdIn.java StdOut.java
55
* Data files: https://algs4.cs.princeton.edu/35applications/tinyTale.txt
6-
* https://algs4.cs.princeton.edu/35applications/list.txt
6+
* https://algs4.cs.princeton.edu/35applications/blocklist.txt
77
*
8-
* Read in a blacklist of words from a file. Then read in a list of
8+
* Read in a blocklist of words from a file. Then read in a list of
99
* words from standard input and print out all those words that
1010
* are not in the first file.
1111
*
@@ -19,7 +19,7 @@
1919
* % more list.txt
2020
* was it the of
2121
*
22-
* % java BlackFilter list.txt < tinyTale.txt
22+
* % java BlockFilter list.txt < tinyTale.txt
2323
* best times worst times
2424
* age wisdom age foolishness
2525
* epoch belief epoch incredulity
@@ -31,21 +31,22 @@
3131
package edu.princeton.cs.algs4;
3232

3333
/**
34-
* The {@code BlackFilter} class provides a client for reading in a <em>blacklist</em>
34+
* The {@code BlockFilter} class provides a client for reading in a <em>blocklist</em>
3535
* of words from a file; then, reading in a sequence of words from standard input,
3636
* printing out each word that <em>does not</em> appear in the file.
3737
* It is useful as a test client for various symbol table implementations.
3838
* <p>
39-
* For additional documentation, see <a href="https://algs4.cs.princeton.edu/35applications">Section 3.5</a> of
39+
* For additional documentation,
40+
* see <a href="https://algs4.cs.princeton.edu/35applications">Section 3.5</a> of
4041
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
4142
*
4243
* @author Robert Sedgewick
4344
* @author Kevin Wayne
4445
*/
45-
public class BlackFilter {
46+
public class BlockFilter {
4647

4748
// Do not instantiate.
48-
private BlackFilter() { }
49+
private BlockFilter() { }
4950

5051
public static void main(String[] args) {
5152
SET<String> set = new SET<String>();

0 commit comments

Comments
 (0)