public class CommentComparator extends Object implements Comparator<String>, ICommentDetector
Default comment detector that is designed for comments found at the head of Wordnet dictionary files. It assumes that each comment line starts with two spaces, followed by a number that indicates the position of the comment line relative to the rest of the comment lines in the file.
This class follows a singleton design pattern, and is not intended to be
instantiated directly; rather, call the getInstance() method to get
the singleton instance.
| Modifier | Constructor and Description |
|---|---|
protected |
CommentComparator()
This constructor is marked protected so that the class may be
sub-classed, but not directly instantiated.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compare(String s1,
String s2) |
static CommentComparator |
getInstance()
Returns the singleton instance of this class, instantiating it if
necessary.
|
boolean |
isCommentLine(String line)
Returns
true if the specified string is a comment line,
false otherwise. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongprotected CommentComparator()
getInstance() method.public static CommentComparator getInstance()
null.null singleton instance of this class,
instantiating it if necessary.public int compare(String s1, String s2)
compare in interface Comparator<String>public boolean isCommentLine(String line)
ICommentDetectortrue if the specified string is a comment line,
false otherwise.isCommentLine in interface ICommentDetectorline - the line to be analyzedtrue if the specified string is a comment line,
false otherwise.Copyright © 2018. All rights reserved.