* @return the value 0 if the argument is equal.
*/
public int compareToWebdavResource(WebdavResource another) {
try {
HttpURL anotherUrl = another.getHttpURL();
String thisHost = httpURL.getHost();
String anotherHost= anotherUrl.getHost();
if (!thisHost.equalsIgnoreCase(anotherHost))
return thisHost.compareTo(anotherHost);
int thisPort = httpURL.getPort();
int anotherPort= anotherUrl.getPort();
if (thisPort != anotherPort)
return (thisPort < anotherPort) ? -1 : 1;
boolean thisCollection = isCollection();
boolean anotherCollection = another.isCollection();
if (thisCollection && !anotherCollection)
return -1;
if (anotherCollection && !thisCollection)
return 1;
String thisPath = httpURL.getPathQuery();
String anotherPath= anotherUrl.getPathQuery();
return thisPath.compareTo(anotherPath);
} catch (Exception e) {
// FIXME: not to return 0.
}