Class DBRowComparator

java.lang.Object
overit.geocall.sql.DBRowComparator
All Implemented Interfaces:
Serializable, Comparator

public class DBRowComparator extends Object implements Comparator, Serializable
The class implements the object used to compare and sort the DBRow of a DBView
See Also:
  • Field Details

    • _ordermode

      protected String _ordermode
    • _positions

      protected int[] _positions
    • _inverses

      protected int[] _inverses
    • _sv

      protected StaticView[] _sv
    • _dbvSv

      protected DBView[] _dbvSv
    • _svColumnPos

      protected int[] _svColumnPos
    • _inverse

      protected int _inverse
    • _fieldmap

      protected Map _fieldmap
    • _allDifferents

      protected boolean _allDifferents
  • Constructor Details

    • DBRowComparator

      public DBRowComparator(String ordermode)
      Creates a new DBRowComparator
      Parameters:
      ordermode - A string that defines the name of a single field of the row to create a row comparator based on that field; it can be the name of a single field preceded by the exclamation mark, to obtain a row comparator that can order the values in descending order. It can also be a comma separated list of field names (with or without exclamation marks) to obtain a comparator based on multiple fields. The null value is allowed.
    • DBRowComparator

      @Deprecated public DBRowComparator(String ordermode, Identified caller)
      Deprecated.
      Parameters:
      ordermode - A string that defines the name of a single field of the row to create a row comparator based on that field; it can be the name of a single field preceded by the exclamation mark, to obtain a row comparator that can order the values in descending order. It can also be a comma separated list of field names (with or without exclamation marks) to obtain a comparator based on multiple fields. The null value is allowed.
      caller - The Identified
  • Method Details

    • setAllDifferents

      public void setAllDifferents(boolean b)
      Defines whether the comparator considers also different rows that have the same values on the fields of interest
      Parameters:
      b - true to consider the rows different, false otherwise
    • setupMetaData

      public void setupMetaData(Map m)
      Setup of the map of the fields that compose the rows
      Parameters:
      m - The map of the fields of the rows to compare
    • compare

      public final int compare(Object o1, Object o2)
      Specified by:
      compare in interface Comparator
    • calcPositions

      protected void calcPositions()
    • compare

      protected int compare(DBRow row1, DBRow row2)
    • getInverse

      public boolean getInverse()
      Returns true if the DBRowComparator is working in inverse mode
      Returns:
      true if the comparator is working in inverse mode, false otherwise
    • setInverse

      public void setInverse(boolean inverse)
      Sets the working mode of the DBRowComparator
      Parameters:
      inverse - true to make it working in inverse mode, false otherwise
    • reverseMode

      public static String reverseMode(String order)
      Returns the reverse order from the one passed as a parameter
      Parameters:
      order - The string that defines an order for the comparator. It can be the name of a single field, the name of a single field preceded by the exclamation mark or a comma separated list of field names (with or without exclamation marks)
      Returns:
      The string that defines the reverse order