package com.cesgroup.cesmonitor.bean;

import java.io.Serializable;

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

    private static final long serialVersionUID = 951647569286590604L;

    private Long hostId;

    private String hostName;

    private Long freeMemory;

    private Long totalMemory;

    private double memoryRate;

    public Memory() {
        super();
    }

    public Long getHostId() {
        return hostId;
    }

    public void setHostId(Long hostId) {
        this.hostId = hostId;
    }

    public String getHostName() {
        return hostName;
    }

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

    public double getMemoryRate() {
        return memoryRate;
    }

    public void setMemoryRate(double memoryRate) {
        this.memoryRate = memoryRate;
    }

    public Long getFreeMemory() {
        return freeMemory;
    }

    public void setFreeMemory(Long freeMemory) {
        this.freeMemory = freeMemory;
    }

    public Long getTotalMemory() {
        return totalMemory;
    }

    public void setTotalMemory(Long totalMemory) {
        this.totalMemory = totalMemory;
    }

    @Override
    public int compareTo(Memory memory) {
        if (this == memory) {
            return 0;
        } else if (memory != null && memory instanceof Memory) {
            Memory m = memory;
            if (this.memoryRate < m.memoryRate) {
                return -1;
            } else if (this.memoryRate > m.memoryRate) {
                return 1;
            } else {
                return 0;
            }
        } else {
            return -1;
        }
    }

}
