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
cdfeb324
Commit
cdfeb324
authored
Dec 11, 2015
by
Björn Richerzhagen
Browse files
Altered Attraction Generator interface
enabled direct instantiation of custom attraction points in the XML config
parent
7470eda8
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/AttractionPoint.java
View file @
cdfeb324
...
...
@@ -24,10 +24,12 @@ import java.util.Random;
import
de.tud.kom.p2psim.impl.topology.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.Randoms
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
/**
* This is the implementation of a AttractionPoint. This type of {@link AttractionPoint} has not the
* ability to be moved. Its data come from osm-POIs, which are static locations
* This is the implementation of a AttractionPoint. This type of
* {@link AttractionPoint} has not the ability to be moved. Its data come from
* osm-POIs, which are static locations
*
* @author Martin Hellwig
* @version 1.0, 02.07.2015
...
...
@@ -36,8 +38,14 @@ public class AttractionPoint {
protected
static
Random
rnd
=
Randoms
.
getRandom
(
AttractionPoint
.
class
);
private
PositionVector
posVec
;
private
String
name
;
@XMLConfigurableConstructor
({
"x"
,
"y"
,
"name"
})
public
AttractionPoint
(
int
x
,
int
y
,
String
name
)
{
this
(
new
PositionVector
(
x
,
y
),
name
);
}
public
AttractionPoint
(
PositionVector
posVec
,
String
name
)
{
this
.
posVec
=
posVec
;
this
.
name
=
name
;
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/ConfigAttractionGenerator.java
0 → 100644
View file @
cdfeb324
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction
;
import
java.util.LinkedList
;
import
java.util.List
;
/**
* For simple scenarios: add attraction points by specifying a coordinate.
*
* @author Bjoern Richerzhagen
* @version 1.0, Dec 11, 2015
*/
public
class
ConfigAttractionGenerator
implements
IAttractionGenerator
{
private
final
List
<
AttractionPoint
>
points
=
new
LinkedList
<>();
@Override
public
List
<
AttractionPoint
>
getAttractionPoints
()
{
return
points
;
}
public
void
setAttractionPoint
(
AttractionPoint
point
)
{
this
.
points
.
add
(
point
);
}
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/IAttractionGenerator.java
View file @
cdfeb324
...
...
@@ -32,7 +32,6 @@ import java.util.List;
*/
public
interface
IAttractionGenerator
{
public
void
setNumberOfAttractionPoints
(
int
maxNumberOfAttractionPoints
);
public
List
<
AttractionPoint
>
getAttractionPoints
();
}
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/JSONAttractionGenerator.java
View file @
cdfeb324
...
...
@@ -86,7 +86,6 @@ public class JSONAttractionGenerator implements IAttractionGenerator {
return
new
PositionVector
(
x
,
y
);
}
@Override
public
void
setNumberOfAttractionPoints
(
int
numberOfAttractionPoints
)
{
this
.
maxNumberOfAttractionPoints
=
numberOfAttractionPoints
;
}
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/OnlineJSONAttractionGenerator.java
View file @
cdfeb324
...
...
@@ -89,7 +89,6 @@ public class OnlineJSONAttractionGenerator implements IAttractionGenerator {
return
new
PositionVector
(
x
,
y
);
}
@Override
public
void
setNumberOfAttractionPoints
(
int
numberOfAttractionPoints
)
{
this
.
maxNumberOfAttractionPoints
=
numberOfAttractionPoints
;
}
...
...
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