package com.cesgroup.cesmonitor.bean;

import java.io.Serializable;

/**
 * @author user
 * @version 1.0.0 2017年5月10日
 */
public class ResponseTime implements Serializable, Comparable<ResponseTime> {

    private static final long serialVersionUID = -3313791603181822462L;

    /**
     * 主机名称
     */
    private String hostName;

    /**
     * 主机的hostId
     */
    private String hostId;

    /**
     * 响应时间
     */
    private double responseTime;

    /**
     * 构造函数
     */
    public ResponseTime(String hostName, double responseTime) {
        super();
        this.hostName = hostName;
        this.responseTime = responseTime;
    }

    public ResponseTime() {
        super();
    }

    public String getHostName() {
        return hostName;
    }

    public void setHostName(String hostName) {
        this.hostName = hostName;
    }

    public double getResponseTime() {
        return responseTime;
    }

    public void setResponseTime(double responseTime) {
        this.responseTime = responseTime;
    }

    /**
     * @return the hostId
     */
    public String getHostId() {
        return hostId;
    }

    /**
     * @param hostId
     *            the hostId to set
     */
    public void setHostId(String hostId) {
        this.hostId = hostId;
    }

    @Override
    public int compareTo(ResponseTime responseTime) {
        if (this == responseTime) {
            return 0;
        } else if (responseTime != null && responseTime instanceof ResponseTime) {
            ResponseTime rt = responseTime;
            if (this.responseTime < rt.responseTime) {
                return -1;
            } else if (this.responseTime > rt.responseTime) {
                return 1;
            } else {
                return 0;
            }
        } else {
            return -1;
        }
    }

}
