package com.cesgroup.cesmonitor.bean;

import java.io.Serializable;

/**
 * 内存使用率报表
 *
 * @author user
 * @version 1.0.0 2017年5月11日
 */
public class MemoryUsageRateReport implements Serializable, Comparable<MemoryUsageRateReport> {

    private static final long serialVersionUID = -4762500324500734962L;

    private String name;

    private String host;

    private String hname;

    private double valueMin;

    private double valueAvg;

    private double valueMax;

    public MemoryUsageRateReport() {
    }

    /**
     * @param name
     *            主机组
     * @param host
     *            主机
     * @param hname
     *            主机可见名
     * @param valueMin
     *            最小值
     * @param valueAvg
     *            平均值
     * @param valueMax
     *            最大值
     */
    public MemoryUsageRateReport(final String name, final String host, final String hname, final double valueMin,
        final double valueAvg,
        final double valueMax) {
        super();
        this.name = name;
        this.host = host;
        this.hname = hname;
        this.valueMin = valueMin;
        this.valueAvg = valueAvg;
        this.valueMax = valueMax;
    }

    public String getName() {
        return name;
    }

    public void setName(final String name) {
        this.name = name;
    }

    public String getHost() {
        return host;
    }

    public void setHost(final String host) {
        this.host = host;
    }

    public String getHname() {
        return hname;
    }

    public void setHname(final String hname) {
        this.hname = hname;
    }

    public double getValueMin() {
        return valueMin;
    }

    public void setValueMin(final double valueMin) {
        this.valueMin = valueMin;
    }

    public double getValueAvg() {
        return valueAvg;
    }

    public void setValueAvg(final double valueAvg) {
        this.valueAvg = valueAvg;
    }

    public double getValueMax() {
        return valueMax;
    }

    public void setValueMax(final double valueMax) {
        this.valueMax = valueMax;
    }

    @Override
    public int compareTo(final MemoryUsageRateReport memory) {
        if (this.valueAvg < memory.getValueAvg()) {
            return 1;
        }
        if (this.valueAvg > memory.getValueAvg()) {
            return -1;
        }
        return 0;
    }

    @Override
    public String toString() {
        return "MemoryUsageRateReport [name=" + name + ", host=" + host + ", hname=" + hname + ", valueMin=" + valueMin
            + ", valueAvg=" + valueAvg + ", valueMax=" + valueMax + "]";
    }
}