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
ef0afde5
Commit
ef0afde5
authored
Jun 03, 2019
by
Julian Zobel
Browse files
Updated Churn generator
parent
83c15c58
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/churn/MaxPeerCountChurnGenerator.java
View file @
ef0afde5
...
...
@@ -114,8 +114,17 @@ public class MaxPeerCountChurnGenerator
@XMLConfigurableConstructor
({
"file"
,
"maxNumberOfNodes"
})
public
MaxPeerCountChurnGenerator
(
String
file
,
int
maxNumberOfNodes
)
{
this
.
maxNumberOfNodes
=
maxNumberOfNodes
;
parseTrace
(
file
);
parseTrace
(
file
);
}
@XMLConfigurableConstructor
({
"churnStart"
,
"maxNumberOfNodes"
,
"burstLength"
})
public
MaxPeerCountChurnGenerator
(
long
churnStart
,
int
maxNumberOfNodes
,
long
burstLength
)
{
this
.
maxNumberOfNodes
=
maxNumberOfNodes
;
churnInfos
.
add
(
new
ChurnInfo
(
churnStart
,
burstLength
,
maxNumberOfNodes
));
this
.
setChurnStart
(
churnStart
);
}
/**
* A class that implements the {@link LifecycleComponent}-interface and can
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/EquidistantSquareAttractionGenerator.java
View file @
ef0afde5
...
...
@@ -25,6 +25,7 @@ import de.tud.kom.p2psim.api.topology.Topology;
import
de.tud.kom.p2psim.impl.topology.util.PositionVector
;
import
de.tudarmstadt.maki.simonstrator.api.Binder
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint
;
import
de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor
;
/**
* Implementation of the interface {@link AttractionGenerator}.
...
...
@@ -38,12 +39,15 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Attraction
public
class
EquidistantSquareAttractionGenerator
implements
IAttractionGenerator
{
private
PositionVector
worldDimension
;
private
double
squareSize
;
public
EquidistantSquareAttractionGenerator
()
{
@XMLConfigurableConstructor
({
"squareSize"
})
public
EquidistantSquareAttractionGenerator
(
double
squareSize
)
{
this
.
worldDimension
=
Binder
.
getComponentOrNull
(
Topology
.
class
)
.
getWorldDimensions
();
this
.
squareSize
=
squareSize
;
createAttractionPoints
();
}
...
...
@@ -56,23 +60,23 @@ public class EquidistantSquareAttractionGenerator implements IAttractionGenerato
}
private
void
createAttractionPoints
()
{
double
x
=
worldDimension
.
getX
()
/
2
;
double
y
=
worldDimension
.
getY
()
/
2
;
double
x
=
worldDimension
.
getX
();
double
y
=
worldDimension
.
getY
();
PositionVector
p1
=
new
PositionVector
(
x
/
4
,
y
/
4
);
PositionVector
p1
=
new
PositionVector
(
x
-
squareSize
,
y
-
squareSize
);
AttractionPoint
ap1
=
new
AttractionPointImpl
(
"AP1"
,
p1
);
attractionPoints
.
add
(
ap1
);
PositionVector
p2
=
new
PositionVector
(
x
/
4
+
x
/
2
,
y
/
4
);
PositionVector
p2
=
new
PositionVector
(
x
-
squareSize
,
y
+
squareSize
);
AttractionPoint
ap2
=
new
AttractionPointImpl
(
"AP2"
,
p2
);
attractionPoints
.
add
(
ap2
);
PositionVector
p3
=
new
PositionVector
(
x
/
4
+
x
/
2
,
y
/
4
+
y
/
2
);
PositionVector
p3
=
new
PositionVector
(
x
+
squareSize
,
y
-
squareSize
);
AttractionPoint
ap3
=
new
AttractionPointImpl
(
"AP3"
,
p3
);
attractionPoints
.
add
(
ap3
);
PositionVector
p4
=
new
PositionVector
(
x
/
4
,
y
/
4
+
y
/
2
);
PositionVector
p4
=
new
PositionVector
(
x
+
squareSize
,
y
+
squareSize
);
AttractionPoint
ap4
=
new
AttractionPointImpl
(
"AP4"
,
p4
);
attractionPoints
.
add
(
ap4
);
}
...
...
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