org.n52.security.common.ip
Class InetAddressComparator

java.lang.Object
  extended by org.n52.security.common.ip.InetAddressComparator
All Implemented Interfaces:
Comparator

public class InetAddressComparator
extends Object
implements Comparator

This comparator allows to compare two IP addresses.

Author:
jdr

Constructor Summary
InetAddressComparator()
           
 
Method Summary
 int compare(Object arg0, Object arg1)
          Compares two IP4Addresses.
 
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

InetAddressComparator

public InetAddressComparator()
Method Detail

compare

public int compare(Object arg0,
                   Object arg1)
Compares two IP4Addresses. The addresses are compared by component (each of them seperated by a period), starting with the highest component. An address is greater than another if the first component found that differs is greater.
  • 123.0.0.1 > 122.255.255.255
  • 123.0.1.1 > 123.0.1.0
  • 123.0.0.001 == 123.0.0.1

    Specified by:
    compare in interface Comparator
    Parameters:
    arg0 - the first address.
    arg1 - the second address.


  • Copyright © 2004–2013 52north.org. All rights reserved.