ca.sqlpower.architect.diff
Class SQLIndexComparator

java.lang.Object
  extended by ca.sqlpower.architect.diff.SQLIndexComparator
All Implemented Interfaces:
java.util.Comparator<SQLIndex>

public class SQLIndexComparator
extends java.lang.Object
implements java.util.Comparator<SQLIndex>

A comparator class used for SQLIndex comparisons. It will not distinguish between a rename or drop/add of an index's column. Also, a null value for SQLIndex.Column#getAscendingOrDescending in a column will be treated to be the same as SQLIndex.AscendDescend.UNSPECIFIED.


Constructor Summary
SQLIndexComparator()
           
 
Method Summary
 int compare(SQLIndex source, SQLIndex target)
           
 int compareColumns(java.util.Set<SQLIndex.Column> source, java.util.Set<SQLIndex.Column> target)
          Compares the given sets of Columns on name and ascending/descending.
 int compareString(java.lang.String source, java.lang.String target)
          Performs the String.compareTo() but with null checks as well.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

SQLIndexComparator

public SQLIndexComparator()
Method Detail

compare

public int compare(SQLIndex source,
                   SQLIndex target)
Specified by:
compare in interface java.util.Comparator<SQLIndex>

compareColumns

public int compareColumns(java.util.Set<SQLIndex.Column> source,
                          java.util.Set<SQLIndex.Column> target)
Compares the given sets of Columns on name and ascending/descending. A null ascending/descending value is taken as UNSPECIFIED.

Parameters:
source - The "left side" for the comparison.
target - The "right side" for the comparison.

compareString

public int compareString(java.lang.String source,
                         java.lang.String target)
Performs the String.compareTo() but with null checks as well.

Parameters:
source - The "left side" for the comparison.
target - The "right side" for the comparison.


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca