com.sun.multicast.allocation
Class Scope

java.lang.Object
  |
  +--com.sun.multicast.allocation.Scope
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class Scope
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

A multicast scope.

Objects of this class and all values returned by their methods are immutable. That is, their values cannot change after they are constructed.

See Also:
Serialized Form

Constructor Summary
Scope(AddressRange addresses, int ttl, java.util.Enumeration names, ScopeName defaultName)
          Creates a Scope with the specified parameters.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this Scope with the specified object for order.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 AddressRange getAddresses()
          Gets the addresses included in the scope.
 ScopeName getDefaultName()
          Gets a default ScopeName for the scope.
 java.util.Enumeration getNames()
          Gets an Enumeration of the names for the scope.
 int getTTL()
          Gets the ttl value to be used when transmitting on addresses in the scope.
 int hashCode()
          Returns a hash code value for this object.
 java.lang.String toString()
          Returns a string representation of this Scope.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Scope

public Scope(AddressRange addresses,
             int ttl,
             java.util.Enumeration names,
             ScopeName defaultName)
Creates a Scope with the specified parameters.
Parameters:
addresses - the addresses included in the scope
ttl - the ttl value to be used when transmitting on addresses in the scope
names - an Enumeration of ScopeNames
defaultName - the ScopeName to be used if no name is available in the desired language (null if none). This name (if not null) must be in the ScopeName Enumeration.
Method Detail

getAddresses

public AddressRange getAddresses()
Gets the addresses included in the scope.
Returns:
an AddressRange representing the addresses included in the scope

getTTL

public int getTTL()
Gets the ttl value to be used when transmitting on addresses in the scope.
Returns:
the ttl value to be used when transmitting on addresses in the scope

getNames

public java.util.Enumeration getNames()
Gets an Enumeration of the names for the scope.
Returns:
an Enumeration of ScopeNames representing the names associated with the scope

getDefaultName

public ScopeName getDefaultName()
Gets a default ScopeName for the scope.
Returns:
a default ScopeName for the scope

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this Scope 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.

If the other object is not a Scope, a ClassCastException is thrown.

This method imposes a total ordering on Scopes. Scopes are ordered first by address range, ttl, scope name, and then default name.

Parameters:
o - the Object to compare against
Returns:
an integer reflecting the outcome of the comparison
Throws:
java.lang.ClassCastException - if the objects cannot be compared

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one. Two Scopes are equal if and only if their address ranges, ttls, scope names, and default names are all equal.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object with which to compare
Returns:
true if this object is the same as the reference object, false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this object. The hash code values for two Scopes are equal if they are equal. However, it may be possible for two unequal Scopes to have the same hash code.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this Scope

toString

public java.lang.String toString()
Returns a string representation of this Scope.
Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Scope


JavaTM Reliable MulticastTM Service version 1.1
Copyright (c) 2001, Sun Microsystems Laboratories, All rights reserved.