org.mmbase.util
Class MultiColCompare

java.lang.Object
  extended by org.mmbase.util.MultiColCompare
All Implemented Interfaces:
CompareInterface

public class MultiColCompare
extends Object
implements CompareInterface

MultiColCompare compares two Vectors on a given list of column numbers

Version:
$Id: MultiColCompare.java 35335 2009-05-21 08:14:41Z michiel $
Author:
vpro
Application:
SCAN

Field Summary
(package private)  int[] comparePosArray
          Array with column numbers to compare
 
Constructor Summary
MultiColCompare(int[] posArray)
          Creates a MultiColCompare.
MultiColCompare(String posList)
          Constructor for comparing using multiple columns, where column position order is significant.
 
Method Summary
 int compare(Object thisOne, Object other)
          Make the comparison between to Vectors over all colums specified in the postiton array.
 int compareCol(Object thisOne, Object other, int comparePosIndex)
          Make the comparison between to Vectors over all columns specified in the postiton array, starting from a specified index in that array.
(package private)  int internalIntCompare(Object thisOne, Object other)
          Make the comparison between two Integer objects.
(package private)  int internalStringCompare(Object thisOne, Object other)
          Make the comparison between two String objects.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comparePosArray

int[] comparePosArray
Array with column numbers to compare

Constructor Detail

MultiColCompare

public MultiColCompare(int[] posArray)
Creates a MultiColCompare.

Parameters:
posArray - a list of column numbers

MultiColCompare

public MultiColCompare(String posList)
Constructor for comparing using multiple columns, where column position order is significant. First compare is done using first colposnr, if same then 2nd colposnr is compared etc... Column position delimiter character is ':'.

Parameters:
posList - - a String with colpositions syntax "x:y:..." eg. "6:4".
Method Detail

compareCol

public int compareCol(Object thisOne,
                      Object other,
                      int comparePosIndex)
Make the comparison between to Vectors over all columns specified in the postiton array, starting from a specified index in that array. The result is a negative value if the first object is 'smaller' than the second, a positive value if it is 'larger', and 0 if both objects are 'equal'.

Parameters:
thisOne - the first object to compare. should be a Vector.
other - the second object to compare. should be a Vector.
comparePosIndex - the index in the positionarray where to start comparing
Returns:
the result of the comparison

compare

public int compare(Object thisOne,
                   Object other)
Make the comparison between to Vectors over all colums specified in the postiton array. The result is a negative value if the first object is 'smaller' than the second, a positive value if it is 'larger', and 0 if both objects are 'equal'.

Specified by:
compare in interface CompareInterface
Parameters:
thisOne - the first object to compare. should be a Vector.
other - the second object to compare. should be a Vector.
Returns:
the result of the comparison

internalIntCompare

int internalIntCompare(Object thisOne,
                       Object other)
Make the comparison between two Integer objects. The result is a negative value if the first object is 'smaller' than the second, a positive value if it is 'larger', and 0 if both objects are 'equal'.

Parameters:
thisOne - the first object to compare. should be a Integer.
other - the second object to compare. should be a Integer.
Returns:
the result of the comparison

internalStringCompare

int internalStringCompare(Object thisOne,
                          Object other)
Make the comparison between two String objects. The result is a negative value if the first object is 'smaller' than the second, a positive value if it is 'larger', and 0 if both objects are 'equal'.

Parameters:
thisOne - the first object to compare. should be a String.
other - the second object to compare. should be a String.
Returns:
the result of the comparison


MMBase 2.0-SNAPSHOT - null