Agent System POND 1.2 (28.2.2002)

FIM.Util.WWW.Cookies
Class CookiePathComparator

java.lang.Object
  |
  +--FIM.Util.WWW.Cookies.CookiePathComparator
All Implemented Interfaces:
Comparator

public class CookiePathComparator
extends Object
implements Comparator

Compares the paths of two cookies. Returns +1 if the path of the first cookie is less specific than the path of the second cookie (e. g. "/" and "/bar") or -1 if the first path is more specific than the second one (e. g. "/bar" and "/") .
NOTE: 0 is returned if the path is either the same or none of them is the start of the other. It is therefore NOT consistent with equal!

Version:
1.0, 1.7.2000
Author:
Michael Sonntag

Constructor Summary
CookiePathComparator()
          Creates a new comparator for cookie paths.
 
Method Summary
 int compare(Object o1, Object o2)
          Compares its two arguments for order.
 
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

CookiePathComparator

public CookiePathComparator()
Creates a new comparator for cookie paths.
Method Detail

compare

public int compare(Object o1,
                   Object o2)
Compares its two arguments for order. Returns +1 if the path of the first cookie is less specific than the path of the second cookie (e. g. "/" and "/bar") or -1 if the first path is more specific than the second one (e. g. "/bar" and "/").
NOTE: 0 is returned if the path is either the same or none of them is the start of the other. It is therefore NOT consistent with equal!
Specified by:
compare in interface Comparator
Parameters:
o1 - the first object to compare
o2 - the second object to compare
Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second
Throws:
ClassCastException - if the arguments' types are not both of class Cookie

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.