hp.opencall.media.common
Class Address

java.lang.Object
  extended byhp.opencall.media.common.Address
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
hp.opencall.media.common.AddressWString, E164Address

public abstract class Address
extends Object
implements Cloneable

Defines a generic way to name & manipulate:
1- Externally visible objects implemented by the system like Managed Objects, etc..
2- External Addresses involved in the call control e.g., E.164, IP etc...

The advantage of using this class is the number of built-in hashing and comparaison functions that makes it easy to use these objects as indexes.

Provides a way to wildcard a part of an address, e.g. for IP 125.12.*.*.
Wildcarding is limited to preserve the ordering i.e., 124.12.*.2 is illegal.

Provides support to manipulate set of addresses.

Immutable Objects & serializables

WARNING: The E164Address class extends Address, but there is no point trying to pass a E164Address referenced as an Address as an argument to one of the methods defined here. It won't make sense as the E164Address class needed to be more complete and so broke the logic of the abstract class. This is not a problem for another class extending Address except for the greater method. In the class E164Address, this method has been overriden and says that a E164Address is greater than any type of address. So you should be aware of this, the proper way to do it would be to keep the beginning of the comparaison in the greater method here and to specialize it in the subclasses.

Since:
OCMP 2.0

Method Summary
 boolean equals(Object anAddr)
          Indicates whether the two addresses are equal.
 boolean greater(Address anAddress)
          Indicates whether this address is strictly greater than the passed address.
 int hashCode()
           
 boolean overlap(Address anAddress)
          Compares addresses containing wildcards.
 String toString()
          Returns the address as a printable string.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

hashCode

public int hashCode()

equals

public boolean equals(Object anAddr)
Indicates whether the two addresses are equal.

Can compare two (non wildcard) addresses or an address and a wildcard.

Returns:
true if the addresses are equal (non wildcard addresses) or if the address is within the range defined by the wildcard.

greater

public boolean greater(Address anAddress)
Indicates whether this address is strictly greater than the passed address.

Assumes that hashCode always returns different values for different Class objects.


overlap

public boolean overlap(Address anAddress)
Compares addresses containing wildcards.

Returns:
true if the two addresses are wildcards and if their ranges overlap.

toString

public String toString()
Returns the address as a printable string.

Recommended to use for debugging purposes only since this is not optimized.