Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
PeerfactSim.KOM
Commits
191d6409
Commit
191d6409
authored
Oct 29, 2015
by
Björn Richerzhagen
Browse files
Slight refactoring of the HostBuilder, removed unused interface method
parent
c0e2cc2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/api/scenario/HostBuilder.java
View file @
191d6409
...
...
@@ -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
);
}
src/de/tud/kom/p2psim/impl/scenario/DefaultHostBuilder.java
View file @
191d6409
...
...
@@ -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
);
set
Component
(
host
,
comp
);
host
.
register
Component
(
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
);
}
}
src/de/tud/kom/p2psim/impl/scenario/simcfg2/utils/SimCfgDefaultHostBuilder.java
View file @
191d6409
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment