|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.core.InstanceComparator
public class InstanceComparator
A comparator for the Instance class. it can be used with or without the
class label. Missing values are sorted at the beginning.
Can be used as comparator in the sorting and binary search algorithms of
Arrays
and Collections
.
Relational values are compared instance by instance with a nested
InstanceComparator.
Instance
,
Arrays
,
Collections
,
Serialized FormConstructor Summary | |
---|---|
InstanceComparator()
initializes the comparator and includes the class in the comparison |
|
InstanceComparator(boolean includeClass)
initializes the comparator |
Method Summary | |
---|---|
int |
compare(java.lang.Object o1,
java.lang.Object o2)
compares the two instances, returns -1 if o1 is smaller than o2, 0 if equal and +1 if greater. |
boolean |
getIncludeClass()
returns TRUE if the class is included in the comparison |
java.lang.String |
getRevision()
Returns the revision string. |
static void |
main(java.lang.String[] args)
for testing only. |
void |
setIncludeClass(boolean includeClass)
sets whether the class should be included (= TRUE) in the comparison |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
---|
equals |
Constructor Detail |
---|
public InstanceComparator()
public InstanceComparator(boolean includeClass)
Method Detail |
---|
public void setIncludeClass(boolean includeClass)
includeClass
- whether to include the class in the comparisonpublic boolean getIncludeClass()
public int compare(java.lang.Object o1, java.lang.Object o2)
compare
in interface java.util.Comparator
o1
- the first instance to compareo2
- the second instance to compare
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |