Commit 191d6409 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Slight refactoring of the HostBuilder, removed unused interface method

parent c0e2cc2b
......@@ -65,15 +65,4 @@ public interface HostBuilder extends Builder, GlobalComponent {
* de.tud.kom.p2psim.api.scenario.Configurator)
*/
public void parse(Element elem, Configurator config);
/**
* Return the group of hosts with the given ID. This must be the same id as
* specified in the configuration file. Single hosts with an own id will be
* returned by this method too (as a list with only one entry).
*
* @param groupId
* same group or host id as in the configuration file
* @return list of hosts (or single host packed in a list).
*/
public List<SimHost> getHosts(String groupId);
}
......@@ -90,7 +90,7 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
/**
* Groups of hosts indexed by group ids.
*/
protected Map<String, List<SimHost>> groups;
protected final Map<String, List<SimHost>> groups = new LinkedHashMap<>();
protected int experimentSize;
......@@ -107,7 +107,6 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
* this or force its correctness...
*/
public void setExperimentSize(int size) {
groups = new LinkedHashMap<String, List<SimHost>>(size);
this.experimentSize = size;
}
......@@ -115,7 +114,8 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
* (non-Javadoc)
*
* @see de.tud.kom.p2psim.api.scenario.HostBuilder#getAllHostsWithGroupIDs()
*/
*/
@Override
public Map<String, List<SimHost>> getAllHostsWithGroupIDs() {
Map<String, List<SimHost>> hosts = new LinkedHashMap<String, List<SimHost>>(
groups);
......@@ -126,27 +126,19 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
* (non-Javadoc)
*
* @see de.tud.kom.p2psim.api.scenario.HostBuilder#getAllHosts()
*/
*/
@Override
public List<SimHost> getAllHosts() {
return hosts;
}
/*
* (non-Javadoc)
*
* @see
* de.tud.kom.p2psim.api.scenario.HostBuilder#getHosts(java.lang.String)
*/
public List<SimHost> getHosts(String groupId) {
return groups.get(groupId);
}
/*
* (non-Javadoc)
*
* @see de.tud.kom.p2psim.api.scenario.HostBuilder#parse(org.dom4j.Element,
* de.tud.kom.p2psim.api.scenario.Configurator)
*/
*/
@Override
public void parse(Element elem, Configurator config) {
DefaultConfigurator defaultConfigurator = (DefaultConfigurator) config;
......@@ -234,7 +226,7 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
}
for (HostComponentFactory cF : instanciatedLayers) {
HostComponent comp = cF.createComponent(host);
setComponent(host, comp);
host.registerComponent(comp);
}
}
group.add(host);
......@@ -290,10 +282,6 @@ public class DefaultHostBuilder implements HostBuilder, Builder {
*/
protected DefaultHost createNewDefaultHost() {
return new DefaultHost();
}
protected void setComponent(SimHost host, HostComponent comp) {
host.registerComponent(comp);
}
}
......@@ -156,11 +156,6 @@ public class SimCfgDefaultHostBuilder implements SimCfgHostBuilder, HostBuilder
}
}
@Override
public List<SimHost> getHosts(String groupId) {
return this.groups.get(groupId);
}
@Override
public Map<String, List<SimHost>> getAllHostsWithGroupIDs() {
return this.groups;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment