OpenNMS API 1.2.3

org.opennms.netmgt.discovery
Class IPAddressRange.IPAddressRangeGenerator

java.lang.Object
  extended byorg.opennms.netmgt.discovery.IPAddressRange.IPAddressRangeGenerator
All Implemented Interfaces:
java.util.Enumeration, java.util.Iterator
Enclosing class:
IPAddressRange

static class IPAddressRange.IPAddressRangeGenerator
extends java.lang.Object
implements java.util.Enumeration, java.util.Iterator

This class is used to enumerate or iterate through one contiguous set of IP addresses. The class can either be used as an iterator or as an enumeration. In java 1.2 iterators were introduced and are being used in favor of enumerations in new classes.


Field Summary
private  long m_end
          The last address in the range.
private  long m_next
          The next address in the range.
 
Constructor Summary
(package private) IPAddressRange.IPAddressRangeGenerator(long start, long end)
           Creates a generator object that iterates over the range from start to end, inclusive.
 
Method Summary
 boolean hasMoreElements()
           Returns true if the enumeration object has more elements remaining.
 boolean hasNext()
           Returns true if there are more elements in the iteration.
(package private) static java.net.InetAddress make(long addr)
          Converts an integer to an InetAdrress object and discards any exceptions.
 java.lang.Object next()
           Returns the next object in the iteration.
 java.lang.Object nextElement()
           Returns the next element in the enumeration.
 void remove()
           The remove method of the iterator interface is considered optional for the implemetor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_next

private long m_next
The next address in the range.


m_end

private final long m_end
The last address in the range. The remaining address are in the range of [m_next .. m_end].

Constructor Detail

IPAddressRange.IPAddressRangeGenerator

IPAddressRange.IPAddressRangeGenerator(long start,
                                       long end)

Creates a generator object that iterates over the range from start to end, inclusive.

Parameters:
start - The start address.
end - The ending address.
Throws:
java.lang.IllegalArgumentException - Thrown if the start address is greater than the ending address.
Method Detail

make

static java.net.InetAddress make(long addr)
Converts an integer to an InetAdrress object and discards any exceptions. If the address cannot be constructed then a null reference is returned.

Parameters:
addr - The 32-bit IP address value, int network order.
Returns:
An Internet Address Object.

hasMoreElements

public boolean hasMoreElements()

Returns true if the enumeration object has more elements remaining.

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()

Returns the next element in the enumeration. If there is no element left in the enumeration an exception will be thrown.

Specified by:
nextElement in interface java.util.Enumeration
Throws:
java.util.NoSuchElementException - Thrown if the collection is exhausted.

hasNext

public boolean hasNext()

Returns true if there are more elements in the iteration.

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()

Returns the next object in the iteration. If there are no objects left in the iteration an exception will be thrown.

Specified by:
next in interface java.util.Iterator
Throws:
java.util.NoSuchElementException - Thrown if the collection is exhausted.

remove

public void remove()

The remove method of the iterator interface is considered optional for the implemetor. For the purposes of this class it is not implemented and will throw an exception.

Specified by:
remove in interface java.util.Iterator
Throws:
java.lang.UnsupportedOperationException - Always thrown by the remove method.

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.