public static class Sorter.SortRule
extends java.lang.Object
implements java.util.Comparator<weka.knowledgeflow.steps.Sorter.InstanceHolder>
Constructor and Description |
---|
SortRule()
Constructor
|
SortRule(java.lang.String setup)
Constructor
|
SortRule(java.lang.String att,
boolean descending)
Constructor
|
Modifier and Type | Method and Description |
---|---|
int |
compare(weka.knowledgeflow.steps.Sorter.InstanceHolder o1,
weka.knowledgeflow.steps.Sorter.InstanceHolder o2)
Compare two instances according to the rule
|
java.lang.String |
getAttribute()
Get the name or index of the attribute to sort on
|
boolean |
getDescending()
Return true if the sort is descending
|
void |
init(Environment env,
Instances structure)
Initialize the rule
|
void |
setAttribute(java.lang.String att)
Set the name or index of the attribute to sort on
|
void |
setDescending(boolean d)
Set whether the sort should be descending rather than ascending
|
java.lang.String |
toString()
Prints the rule in human readable format
|
java.lang.String |
toStringInternal()
Gets the rule in internal format
|
public SortRule(java.lang.String att, boolean descending)
att
- the name or index of the attribute to compare ondescending
- true if order should be descendingpublic SortRule()
public SortRule(java.lang.String setup)
setup
- the definition of a sort rulepublic java.lang.String toStringInternal()
public java.lang.String toString()
toString
in class java.lang.Object
public void setAttribute(java.lang.String att)
att
- the name or index of tha attribute to sort onpublic java.lang.String getAttribute()
public void setDescending(boolean d)
d
- true for a descending sortpublic boolean getDescending()
public void init(Environment env, Instances structure)
env
- the environment variables to usestructure
- the structure of the instances that the rule will
opperate onpublic int compare(weka.knowledgeflow.steps.Sorter.InstanceHolder o1, weka.knowledgeflow.steps.Sorter.InstanceHolder o2)
compare
in interface java.util.Comparator<weka.knowledgeflow.steps.Sorter.InstanceHolder>
o1
- the first instanceo2
- the second instance