|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.multicast.allocation.AddressRange
A range of network addresses.
Objects of this class and all values returned by their methods are immutable. That is, their values cannot change after they are constructed.
Constructor Summary | |
AddressRange(Address firstAddress,
Address lastAddress)
Creates an AddressRange with the specified addresses. |
Method Summary | |
int |
compareTo(java.lang.Object o)
Compares this AddressRange with the specified
object for order. |
boolean |
contains(Address address)
Checks whether this AddressRange contains a given
Address . |
boolean |
equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. |
long |
getAddressCount()
Gets the number of addresses in this AddressRange . |
AddressType |
getAddressType()
Gets the type of addresses in this AddressRange . |
Address |
getFirstAddress()
Gets the first address in this AddressRange . |
Address |
getLastAddress()
Gets the last address in this AddressRange . |
int |
hashCode()
Returns a hash code value for the AddressRange . |
AddressRange |
merge(AddressRange otherRange)
Returns an AddressRange represents the merger of this
AddressRange with otherRange . |
boolean |
overlaps(AddressRange otherRange)
Checks whether this AddressRange overlaps with another. |
java.lang.String |
toString()
Returns a string representation of this AddressRange . |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AddressRange(Address firstAddress, Address lastAddress)
AddressRange
with the specified addresses.startAddress
- the first address in the rangeendAddress
- the last address in the rangeMethod Detail |
public Address getFirstAddress()
AddressRange
.AddressRange
public Address getLastAddress()
AddressRange
.AddressRange
public long getAddressCount()
AddressRange
.AddressRange
public AddressType getAddressType()
AddressRange
.AddressRange
public int compareTo(java.lang.Object o) throws java.lang.ClassCastException
AddressRange
with the specified
object for order. Returns a negative integer, zero, or
a positive integer as this object is less than, equal
to, or greater than the specified object.
AddressRanges
are ordered first on the basis
of first address and then on the basis of last address.
That is, the first addresses in the ranges are compared. If they
are not equal, this is the result of the range comparison. If
they are equal, the last address ranges are compared and this
is the result of the comparison. If the two AddressRanges
cannot be compared (usually because they are of different
AddressTypes
), a ClassCastException
is thrown.
This method imposes a total ordering on addresses of the same
AddressRange
.
o
- the Object
to compare againstjava.lang.ClassCastException
- if the objects cannot be comparedpublic boolean overlaps(AddressRange otherRange) throws java.lang.ClassCastException
AddressRange
overlaps with another.
If the two AddressRanges
are of different
AddressTypes
, a ClassCastException
is thrown.
otherRange
- the AddressRange
to check for overlap withtrue
if this AddressRange
overlaps with otherRange
,
false
otherwise.public boolean contains(Address address) throws java.lang.ClassCastException
AddressRange
contains a given
Address
.
If the Address
is not of the same
AddressType
as this AddressRange
,
a ClassCastException
is thrown.
address
- the Address
to check fortrue
if this AddressRange
contains the Address
,
false
otherwise.public AddressRange merge(AddressRange otherRange) throws java.lang.ClassCastException
AddressRange
represents the merger of this
AddressRange
with otherRange
. If the two ranges
do not overlap, the result will also include addresses that were not in
either of the ranges. This method does not affect the values of either
this AddressRange
or otherRange
.
If the two AddressRanges
are of different
AddressTypes
, a ClassCastException
is thrown.
otherRange
- the AddressRange
to merge withAddressRange
that represents the merger of this
AddressRange
with otherRange
public boolean equals(java.lang.Object obj)
AddressRanges
are equal if and only if they have the same
first and last addresses.equals
in class java.lang.Object
obj
- the object with which to comparetrue
if this object is the same as the
reference object, false
otherwise.public int hashCode()
AddressRange
.
The hash code values for two AddressRanges
are equal
if they are equal. However, it may be possible for two unequal
AddressRanges
to have the same hash code.hashCode
in class java.lang.Object
AddressRange
public java.lang.String toString()
AddressRange
.toString
in class java.lang.Object
AddressRange
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.