SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.netaddr
Class AddressPreference

java.lang.Object
  extended by net.java.sip.communicator.impl.netaddr.AddressPreference
All Implemented Interfaces:
Comparable<AddressPreference>

public class AddressPreference
extends Object
implements Comparable<AddressPreference>

The AddressPreference class is used to assign preference to the various network addresses on a host. Preferencies are in essence integers that may vary between MAX_PREF and MIN_PREF, where MIN_PREF indicates low or inexisting connectivity through the specified address and MAX_PREF - complete, flowless open internet access (the perfect connection ;-) )

Author:
Emil Ivov

Field Summary
static AddressPreference MAX
           
static int MAX_PREF
           
static AddressPreference MIN
           
static int MIN_PREF
           
 
Constructor Summary
AddressPreference()
          Creates an AddressPreference object with a default preference value.
AddressPreference(int preference)
          Creates an AddressPreference instance with the specified preference.
 
Method Summary
 int compareTo(AddressPreference o)
          Compares this address preference with the specified object for order.
 boolean equals(Object obj)
          Returns true if obj is the same object as this AddressPreference or is at least an instance of AddressPreference and has the same numerical value.
 int getPreference()
          Returns the exact preference value of this AddressPreference instance.
(package private)  void setPreference(int preference)
          Sets the preference value of this AddressPreference instance to be
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PREF

public static final int MAX_PREF
See Also:
Constant Field Values

MIN_PREF

public static final int MIN_PREF
See Also:
Constant Field Values

MAX

public static final AddressPreference MAX

MIN

public static final AddressPreference MIN
Constructor Detail

AddressPreference

AddressPreference(int preference)
Creates an AddressPreference instance with the specified preference.

Parameters:
preference - the preference integer corresponding to this AddressPreference

AddressPreference

AddressPreference()
Creates an AddressPreference object with a default preference value.

Method Detail

setPreference

void setPreference(int preference)
Sets the preference value of this AddressPreference instance to be

Parameters:
preference - int

getPreference

public int getPreference()
Returns the exact preference value of this AddressPreference instance.

Returns:
the exact preference value (an ineteger between MAX_PREF and MIN_PREF) representing this AddressPreference instance.

compareTo

public int compareTo(AddressPreference o)
Compares this address preference with the specified object for order. Returns a negative integer, zero, or a positive integer as this AddressPreference is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface Comparable<AddressPreference>
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type is not an instance or a descendant of AddressPreference.

equals

public boolean equals(Object obj)
Returns true if obj is the same object as this AddressPreference or is at least an instance of AddressPreference and has the same numerical value. In all other cases the method returns false.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with
Returns:
true if both objects represent the same preference value and false otherwise.

toString

public String toString()
Overrides:
toString in class Object

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.