org.n52.security.common.ip
Class IPIntervalRange

java.lang.Object
  extended by org.n52.security.common.ip.IPIntervalRange
All Implemented Interfaces:
IPRange

public class IPIntervalRange
extends Object
implements IPRange

Represents a contiguous range of IP addresses defined by a lower and an upper boundary.

Author:
jdr

Constructor Summary
IPIntervalRange(InetAddress singleAddress)
          Creates an IP range based on a single IP address.
IPIntervalRange(InetAddress lowerBoundary, InetAddress upperBoundary)
          Creates an IP range based on two IP addresses defining an interval, which contains the lower and upper boundaries.
 
Method Summary
 boolean contains(InetAddress address)
          Checks whether a given IP address is part of this IP address range.
 boolean equals(Object obj)
           
 InetAddress first()
           
 int hashCode()
           
 InetAddress last()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IPIntervalRange

public IPIntervalRange(InetAddress lowerBoundary,
                       InetAddress upperBoundary)
Creates an IP range based on two IP addresses defining an interval, which contains the lower and upper boundaries.

Parameters:
lowerBoundary - IP address defining the lower boundary.
upperBoundary - IP address defining the upper boundary.

IPIntervalRange

public IPIntervalRange(InetAddress singleAddress)
Creates an IP range based on a single IP address. The interval thus only contains a single IP address.

Parameters:
singleAddress - the single IP address that is contained in this range.
Method Detail

contains

public boolean contains(InetAddress address)
Description copied from interface: IPRange
Checks whether a given IP address is part of this IP address range.

Specified by:
contains in interface IPRange
Parameters:
address - the address to test.
Returns:
true if the specified address is in the range, false otherwise.

first

public InetAddress first()
Specified by:
first in interface IPRange
Returns:
IP address that is the upper border of the range.

last

public InetAddress last()
Specified by:
last in interface IPRange
Returns:
IP address that is the lower border of the range.

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2004–2014 52north.org. All rights reserved.