jgroup.relacs.types
Class EndPointImpl

java.lang.Object
  extended by jgroup.relacs.types.EndPointImpl
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Comparable, EndPoint
Direct Known Subclasses:
Domain, Host

public class EndPointImpl
extends java.lang.Object
implements EndPoint

Since:
Jgroup 1.2
Author:
Alberto Montresor, Hein Meling
See Also:
Serialized Form

Field Summary
protected  java.net.InetAddress address
          Internet address
protected  boolean local
          True if this endpoint is the local endpoint; false otherwise
protected  int port
          Port number
static int SIZE
          Size of this object (in bytes) when marshalled.
 
Constructor Summary
EndPointImpl()
          Default constructor for externalization
EndPointImpl(java.net.InetAddress address, int port)
          Constructs a new endpoint for the specified internet address and port number.
EndPointImpl(int packedAddress, int port)
          Constructs a new endpoint for the internet address specified as integer, and the specified port number.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object obj)
          Compares two EndPointImpl objects for content equality.
 java.net.InetAddress getAddress()
          Returns the InetAddress associated to this endpoint.
 int getIntAddress()
          Returns the IP address contained in this endpoint, enclosed in an integer value.
 int getPort()
          Return the port number associated to this end point
 int hashCode()
           
 boolean isLocal()
          Returns true if this endpoint is the local endpoint.
 boolean isMulticastEndPoint()
          Return true if this endpoint is a multicast endpoint.
 void readExternal(java.io.ObjectInput in)
          Restores the content of this object from the marshalled data contained in the specified input stream.
 java.lang.String toString()
          Returns a string representation of this object
 void writeExternal(java.io.ObjectOutput out)
          Marshals the content of this object to the specified output stream.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
Size of this object (in bytes) when marshalled.

See Also:
Constant Field Values

address

protected java.net.InetAddress address
Internet address


port

protected int port
Port number


local

protected boolean local
True if this endpoint is the local endpoint; false otherwise

Constructor Detail

EndPointImpl

public EndPointImpl()
Default constructor for externalization


EndPointImpl

public EndPointImpl(java.net.InetAddress address,
                    int port)
Constructs a new endpoint for the specified internet address and port number. Computes the packed address and checks if the endpoint is local.


EndPointImpl

public EndPointImpl(int packedAddress,
                    int port)
Constructs a new endpoint for the internet address specified as integer, and the specified port number. The InetAddress version of the address is computed only when needed, to avoid useless DNS lookups.

Method Detail

getAddress

public java.net.InetAddress getAddress()
Returns the InetAddress associated to this endpoint. If needed, performs the translation between the integer version of the address and the InetAddress version.

Specified by:
getAddress in interface EndPoint

getPort

public int getPort()
Return the port number associated to this end point

Specified by:
getPort in interface EndPoint

getIntAddress

public int getIntAddress()
Description copied from interface: EndPoint
Returns the IP address contained in this endpoint, enclosed in an integer value.

Specified by:
getIntAddress in interface EndPoint

isMulticastEndPoint

public boolean isMulticastEndPoint()
Description copied from interface: EndPoint
Return true if this endpoint is a multicast endpoint.

Specified by:
isMulticastEndPoint in interface EndPoint

isLocal

public boolean isLocal()
Description copied from interface: EndPoint
Returns true if this endpoint is the local endpoint.

Specified by:
isLocal in interface EndPoint

compareTo

public int compareTo(java.lang.Object obj)
Compares this object with the specified object for order.

Specified by:
compareTo in interface java.lang.Comparable

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Compares two EndPointImpl objects for content equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to compare this object with.
Returns:
True if the objects are equal; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this object

Overrides:
toString in class java.lang.Object

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Restores the content of this object from the marshalled data contained in the specified input stream.

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
in - the stream to be read
Throws:
java.lang.ClassNotFoundException
java.io.IOException

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Marshals the content of this object to the specified output stream.

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
out - the stream to be written
Throws:
java.io.IOException


Copyright © 1998-2006 The Jgroup/ARM development team. All Rights Reserved.