Class MSort

java.lang.Object
org.compiere.util.MSort
All Implemented Interfaces:
Serializable, Comparator<Object>

public final class MSort extends Object implements Comparator<Object>, Serializable
Class to Sort Data

Change log:

  • 2007-01-27 - teo_sarca - [ 1585369 ] CTable sorting is TOO LAZY: Fixed compare(Object, Object) method for Double comparing support, ascending/descending support, comparing strings ignoring case
Version:
$Id: MSort.java,v 1.3 2006/10/06 00:43:09 jjanke Exp $
Author:
Jorg Janke
See Also:
  • Field Details

    • index

      public int index
      Direct access index
    • data

      public Object data
      The data
  • Constructor Details

    • MSort

      public MSort(int new_index, Object new_data)
      Constructor - Sort Entity
      Parameters:
      new_index - index
      new_data - data
  • Method Details

    • setSortAsc

      public void setSortAsc(boolean ascending)
      Sort Ascending
      Parameters:
      ascending - if true sort ascending
    • compare

      public int compare(Object o1, Object o2)
      Compare o1 and o2
      Specified by:
      compare in interface Comparator<Object>
      Parameters:
      o1 - object
      o2 - object
      Returns:
      -1 (less than), 0 (equal) or 1 (greater than). Reverse is return if sort descending.
    • equals

      public boolean equals(Object obj)
      Equal (based on data, ignores index)
      Specified by:
      equals in interface Comparator<Object>
      Overrides:
      equals in class Object
      Parameters:
      obj - object
      Returns:
      true if equal
    • hashCode

      public int hashCode()
      Not implemented, always return 42
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      String Representation
      Overrides:
      toString in class Object
      Returns:
      info