weka.gui
Class SortedTableModel.SortContainer

java.lang.Object
  extended by weka.gui.SortedTableModel.SortContainer
All Implemented Interfaces:
Comparable<SortedTableModel.SortContainer>
Enclosing class:
SortedTableModel

public static class SortedTableModel.SortContainer
extends Object
implements Comparable<SortedTableModel.SortContainer>

Helper class for sorting the columns.


Constructor Summary
SortedTableModel.SortContainer(Comparable value, int index)
          Initializes the container.
 
Method Summary
 int compareTo(SortedTableModel.SortContainer o)
          Compares this object with the specified object for order.
 boolean equals(Object obj)
          Indicates whether some other object is "equal to" this one.
 int getIndex()
          Returns the original index of the item.
 Comparable getValue()
          Returns the value to sort on.
 String toString()
          Returns a string representation of the sort container.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedTableModel.SortContainer

public SortedTableModel.SortContainer(Comparable value,
                                      int index)
Initializes the container.

Parameters:
value - the value to sort on
index - the original index
Method Detail

getValue

public Comparable getValue()
Returns the value to sort on.

Returns:
the value

getIndex

public int getIndex()
Returns the original index of the item.

Returns:
the index

compareTo

public int compareTo(SortedTableModel.SortContainer o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object. Null is considered smallest. If both values are null, then 0 is returned.

Specified by:
compareTo in interface Comparable<SortedTableModel.SortContainer>
Parameters:
o - the object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this object.

equals

public boolean equals(Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this object.

toString

public String toString()
Returns a string representation of the sort container.

Overrides:
toString in class Object
Returns:
the string representation (value + index)


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.