Package minpq.moderator
Class Moderator
- java.lang.Object
 - 
- minpq.moderator.Moderator
 
 
- 
class Moderator extends Object
Simulate a content moderation priority queue with "streaming" data. 
- 
- 
Field Summary
Fields Modifier and Type Field Description private static StringPATHPath to the toxic content.private static booleanSAFE_FOR_WORKHide the content if true. 
- 
Constructor Summary
Constructors Constructor Description Moderator() 
- 
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidaddComments(ExtrinsicMinPQ<String> pq, Scanner scanner, int n)Adds up to N comments from the scanner to the priority queue with negated weights.static voidmain(String[] args) 
 - 
 
- 
- 
Field Detail
- 
SAFE_FOR_WORK
private static final boolean SAFE_FOR_WORK
Hide the content if true.- See Also:
 - Constant Field Values
 
 
- 
PATH
private static final String PATH
Path to the toxic content.- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
main
public static void main(String[] args) throws IOException, InterruptedException
- Throws:
 IOExceptionInterruptedException
 
- 
addComments
private static void addComments(ExtrinsicMinPQ<String> pq, Scanner scanner, int n)
Adds up to N comments from the scanner to the priority queue with negated weights.- Parameters:
 pq- the destination priority queue.scanner- the input scanner.n- the number of comments to read from the scanner.
 
 - 
 
 -