Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jboss.deployment.scanner
Class URLDirectoryScanner.FileComparator  view URLDirectoryScanner.FileComparator download URLDirectoryScanner.FileComparator.java

java.lang.Object
  extended byorg.jboss.deployment.scanner.URLDirectoryScanner.FileComparator
All Implemented Interfaces:
java.util.Comparator
Enclosing class:
URLDirectoryScanner

private static class URLDirectoryScanner.FileComparator
extends java.lang.Object
implements java.util.Comparator

This comparator is used by the dirScanner. It compares two url's (or Files) using the specified urlComparator. In the case of a tie, it then uses File's natural ordering. Finally, it normalizes all compare values so that "less-than" is always -1, "greater-than" is always 1, and "equals" is always 0.


Field Summary
private  java.util.Comparator urlComparator
          the delegated URL comparator
 
Constructor Summary
URLDirectoryScanner.FileComparator(java.util.Comparator urlComparator)
          Construct with a (possibly null) URL comparator
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare all non-nulls as less than nulls.
 
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
 

Field Detail

urlComparator

private java.util.Comparator urlComparator
the delegated URL comparator

Constructor Detail

URLDirectoryScanner.FileComparator

public URLDirectoryScanner.FileComparator(java.util.Comparator urlComparator)
Construct with a (possibly null) URL comparator

Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare all non-nulls as less than nulls. Next, compare as URL's using the delegated comparator. And finally, use File's natural ordering.

Specified by:
compare in interface java.util.Comparator