/**
 * <p>Copyright:Copyright(c) 2017</p>
 * <p>Company:上海中信信息发展股份有限公司</p>
 * <p>包名:com.cesgroup.cesmonitor.service.map</p>
 * <p>文件名:HostGroup.java</p>
 * <p>创建时间:2017年5月23日 上午9:50:46</p>
 * <p>作者:zhang.erwei</p>
 */

package com.cesgroup.cesmonitor.service.map;

import java.util.ArrayList;
import java.util.List;

/**
 * 主机组
 *
 * @author zhang.erwei
 * @version 1.0.0 2017年5月22日
 */
public class HostGroup {

    private String prefixIP;

    private Host gateway = null;

    private String gatewayIP;

    private List<Host> hosts = new ArrayList<Host>();

    public String getPrefixIP() {
        return prefixIP;
    }

    public void setPrefixIP(String prefixIP) {
        this.prefixIP = prefixIP;
    }

    public Host getGateway() {
        return gateway;
    }

    public void setGateway(Host gateway) {
        this.gateway = gateway;
    }

    public List<Host> getHosts() {
        return hosts;
    }

    public void setHosts(List<Host> hosts) {
        this.hosts = hosts;
    }

    public String getGatewayIP() {
        return gatewayIP;
    }

    public void setGatewayIP(String gatewayIP) {
        this.gatewayIP = gatewayIP;
    }

    public void addHost(Host host) {
        boolean contain = false;
        for (Host h : hosts) {
            if (h.getHostObject().getHostid().intValue() == host.getHostObject().getHostid().intValue()) {
                contain = true;
            }
        }
        if (!contain) {
            hosts.add(host);
        }
    }

}
