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

com.yy.httpdns.bean.DnsKey Maven / Gradle / Ivy

package com.yy.httpdns.bean;

/**
 * Created by huangzhilong on 2016/8/15.
 */

public class DnsKey {
    private int netType = -1;
    private String host = "";
    private int mobileType = -1;
    private String wifiSSID = "";

    // use wifi
    public DnsKey(int netType, String host, String wifiSSID) {
        this.netType = netType;
        this.host = host;
        this.wifiSSID = wifiSSID;
    }

    //use mobile
    public DnsKey(int netType, String host, int mobileType) {
        this.netType = netType;
        this.host = host;
        this.mobileType = mobileType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DnsKey dnsKey = (DnsKey) o;

        if (netType != dnsKey.netType) return false;
        if (mobileType != dnsKey.mobileType) return false;
        if (!host.equals(dnsKey.host)) return false;
        return wifiSSID.equals(dnsKey.wifiSSID);

    }

    @Override
    public int hashCode() {
        int result = netType;
        result = 31 * result + host.hashCode();
        result = 31 * result + mobileType;
        result = 31 * result + wifiSSID.hashCode();
        return result;
    }

    public String getSharePreKey() {
        return netType + host + mobileType + wifiSSID;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy