All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.jbidibc.netbidib.client.BidibNetAddress Maven / Gradle / Ivy

package org.bidib.jbidibc.netbidib.client;

import java.net.InetAddress;

public class BidibNetAddress {

    private final InetAddress address;

    private final int portNumber;

    public BidibNetAddress(final InetAddress address, final int portNumber) {
        this.address = address;
        this.portNumber = portNumber;
    }

    /**
     * @return the address
     */
    public InetAddress getAddress() {
        return address;
    }

    /**
     * @return the portNumber
     */
    public int getPortNumber() {
        return portNumber;
    }

    @Override
    public boolean equals(Object other) {
        if (other instanceof BidibNetAddress) {
            BidibNetAddress bidibHost = (BidibNetAddress) other;
            if (bidibHost.getAddress().equals(address) && bidibHost.getPortNumber() == portNumber) {
                return true;
            }
        }
        return false;
    }

    @Override
    public String toString() {
        return new StringBuilder("BidibNetAddress[address=")
            .append(address).append(",portNumber=").append(portNumber).append("]").toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy