java.lang.Object
pt.unl.fct.di.novasys.network.data.Host
All Implemented Interfaces:
Comparable<Host>

public class Host extends Object implements Comparable<Host>
Represents a node in the network layer, including its IP Address and listen port
Author:
pfouto
  • Field Details

  • Constructor Details

    • Host

      public Host(InetAddress address, int port)
      Creates a new host with the given address and port
      Parameters:
      address - The address of the host to create
      port - The port of the host to create
  • Method Details

    • getAddress

      public InetAddress getAddress()
      Gets the address of this host
      Returns:
      The INetAddress
    • getPort

      public int getPort()
      Gets the port of this host
      Returns:
      The port
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo

      public int compareTo(Host other)
      Specified by:
      compareTo in interface Comparable<Host>