package org.gcube.dataanalysis.dataminer.poolmanager.ansible.model;

import java.util.Collection;
import java.util.Vector;

public class Inventory ***REMOVED***

  private Collection<HostGroup> groups;

  public Inventory() ***REMOVED***
    this.groups = new Vector<>();
  ***REMOVED***

  public void addGroup(HostGroup group) ***REMOVED***
    this.groups.add(group);
  ***REMOVED***

  public void addHost(AnsibleHost h, String groupName) ***REMOVED***
    this.getGroup(groupName).addHost(h);
  ***REMOVED***

  private HostGroup getGroup(String groupName) ***REMOVED***
    for (HostGroup hg : this.groups) ***REMOVED***
      if (groupName.equals(hg.getName())) ***REMOVED***
        return hg;
      ***REMOVED***
    ***REMOVED***
    HostGroup hg = new HostGroup(groupName);
    this.groups.add(hg);
    return hg;
  ***REMOVED***

  public Collection<HostGroup> getHostGroups() ***REMOVED***
    return new Vector<>(this.groups);
  ***REMOVED***

***REMOVED***
