games.strategy.net
Class Node
java.lang.Object
games.strategy.net.Node
- All Implemented Interfaces:
- INode, java.io.Externalizable, java.io.Serializable, java.lang.Comparable<INode>
public class Node
- extends java.lang.Object
- implements INode, java.io.Externalizable
- Author:
- Sean Bridges
- See Also:
- Serialized Form
|
Constructor Summary |
Node()
|
Node(java.lang.String name,
java.net.InetAddress address,
int port)
Creates new Node |
Node(java.lang.String name,
java.net.InetSocketAddress address)
Creates new Node |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
NULL_NODE
public static final INode NULL_NODE
Node
public Node()
Node
public Node(java.lang.String name,
java.net.InetSocketAddress address)
- Creates new Node
Node
public Node(java.lang.String name,
java.net.InetAddress address,
int port)
- Creates new Node
getName
public java.lang.String getName()
- Specified by:
getName in interface INode
- Returns:
- the display/user name for the node
equals
public boolean equals(java.lang.Object obj)
- Node equality is done based on network adress/port.
The name is not part of the node identity.
- Overrides:
equals in class java.lang.Object
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
getPort
public int getPort()
- Specified by:
getPort in interface INode
- Returns:
- the port for the node as seen by the server
getAddress
public java.net.InetAddress getAddress()
- Specified by:
getAddress in interface INode
- Returns:
- the adress for the node as seen by the server
readExternal
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
- Specified by:
readExternal in interface java.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
writeExternal
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
- Specified by:
writeExternal in interface java.io.Externalizable
- Throws:
java.io.IOException
compareTo
public int compareTo(INode o)
- Specified by:
compareTo in interface java.lang.Comparable<INode>
main
public static void main(java.lang.String[] args)
throws java.io.IOException
- Throws:
java.io.IOException
getSocketAddress
public java.net.InetSocketAddress getSocketAddress()
- Specified by:
getSocketAddress in interface INode
- Returns:
- the adress for the node as seen by the server