|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.ivmaidns.util.GComparator
net.sf.ivmaidns.util.StrComparator
public class StrComparator
Class for string comparators/metrics.
This comparator class overrides the default semantics of
GComparator class for the case when both of the
objects being compared are instances of String
class. This class also implements Metricable
interface to offer some assessment metrics for string objects.
Here, case-insensitive comparison of strings is implemented
(GComparator class implementation offers
case-sensitive comparison for string objects), and the metrics is
string length plus one. In the subclasses
compare(String, String) method should be overridden
to implement specific comparison and metrics.
CharVector,
Serialized Form| Field Summary | |
|---|---|
static GComparator |
INSTANCE
An instance of this comparator. |
| Constructor Summary | |
|---|---|
StrComparator()
Constructs a new comparator. |
|
| Method Summary | |
|---|---|
int |
compare(java.lang.String strA,
java.lang.String strB)
Compares two given strings. |
int |
evaluate(java.lang.Object obj)
The body of the metrics. |
boolean |
greater(java.lang.Object objA,
java.lang.Object objB)
The body of 'Greater-Than' comparator. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final GComparator INSTANCE
INSTANCE of the
superclass). The implemented comparator orders correctly strings
ignoring letters case, other objects are ordered in the same way
as by GComparator exact instance;
evaluate(Object) method for a string here returns
its length() plus one, for other objects zero is
returned.
greater(java.lang.Object, java.lang.Object),
evaluate(java.lang.Object)| Constructor Detail |
|---|
public StrComparator()
public only to allow custom
dynamic instantiation of this class. In other cases,
INSTANCE should be used.
INSTANCE| Method Detail |
|---|
public final boolean greater(java.lang.Object objA,
java.lang.Object objB)
String
class then (compare(objA, objB) > 0) is returned,
else greater(objA, objB) of the superclass is
returned.
greater in class GComparatorobjA - the first compared argument (may be null).objB - the second compared argument (may be null).
true if and only if objA is greater than
objB.INSTANCE,
compare(java.lang.String, java.lang.String)public final int evaluate(java.lang.Object obj)
String class then compare(null, obj) is
returned, else this method always returns 0.
evaluate in interface Metricableobj - the object (may be null) to evaluate.
INSTANCE,
compare(java.lang.String, java.lang.String)
public int compare(java.lang.String strA,
java.lang.String strB)
strA == null) is length() of
strB plus one). Important notes: zero is returned if
strA == strB; this function is always asymmetrical.
strA - the first compared string (may be null).strB - the second compared string (may be null).
INSTANCE,
greater(java.lang.Object, java.lang.Object),
evaluate(java.lang.Object)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||