com.sun.multicast.allocation
Class ScopeName

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

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

A scope name with an RFC 1766 language tag.

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
ScopeName(java.lang.String name, java.lang.String language)
          Creates a ScopeName with the specified parameters.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this ScopeName with the specified object for order.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.lang.String getLanguage()
          Gets the language tag.
 java.lang.String getName()
          Gets the scope name.
 int hashCode()
          Returns a hash code value for this object.
 java.lang.String toString()
          Returns a string representation of this ScopeName.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScopeName

public ScopeName(java.lang.String name,
                 java.lang.String language)
Creates a ScopeName with the specified parameters.
Parameters:
name - the scope name
language - the language tag that goes along with the name
Method Detail

getName

public java.lang.String getName()
Gets the scope name.
Returns:
the scope name

getLanguage

public java.lang.String getLanguage()
Gets the language tag.
Returns:
the language tag

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this ScopeName 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 ScopeName, a ClassCastException is thrown.

This method imposes a total ordering on ScopeNames. ScopeNames are ordered first by language code and then by 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 ScopeNames are equal if and only if their scope name and language tag strings are 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 ScopeNames are equal if they are equal. However, it may be possible for two unequal ScopeNames to have the same hash code.
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this ScopeName

toString

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


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