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
7f590a14
Commit
7f590a14
authored
Nov 11, 2020
by
Julian Zobel
Browse files
sim iscram
parent
125d6756
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/movement/TracefileMovementModel.java
View file @
7f590a14
...
...
@@ -23,6 +23,7 @@ package de.tud.kom.p2psim.impl.topology.movement;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.util.LinkedHashMap
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Scanner
;
...
...
@@ -42,6 +43,7 @@ import de.tud.kom.p2psim.impl.topology.views.VisualizationTopologyView.Visualiza
import
de.tudarmstadt.maki.simonstrator.api.Event
;
import
de.tudarmstadt.maki.simonstrator.api.EventHandler
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor
;
import
de.tudarmstadt.maki.simonstrator.api.Monitor.Level
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.LifecycleComponent
;
...
...
@@ -75,13 +77,17 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
private
final
LinkedHashMap
<
SimLocationActuator
,
LinkedList
<
Step
>>
components
;
private
final
static
LinkedHashMap
<
SimLocationActuator
,
Integer
>
componentToStepSize
=
new
LinkedHashMap
<
SimLocationActuator
,
Integer
>();
private
final
LinkedHashSet
<
SimLocationActuator
>
unusedComponents
;
private
LinkedList
<
File
>
tracefiles
;
private
boolean
first
=
true
;
public
TracefileMovementModel
()
{
components
=
new
LinkedHashMap
<
SimLocationActuator
,
LinkedList
<
Step
>>();
tracefiles
=
new
LinkedList
<
File
>();
tracefiles
=
new
LinkedList
<
File
>();
unusedComponents
=
new
LinkedHashSet
<
SimLocationActuator
>();
}
public
void
initialize
()
{
...
...
@@ -127,7 +133,11 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
if
(
first
)
{
components
.
forEach
((
component
,
steps
)
->
{
shutdownComponent
(
component
);
});
});
unusedComponents
.
forEach
((
component
)
->
{
shutdownComponent
(
component
);
});
}
// as the files contain the timestamp in seconds, the current time needs to be converted in seconds
...
...
@@ -292,7 +302,10 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
private
void
associateTracefile
(
SimLocationActuator
actuator
)
{
if
(
tracefiles
.
isEmpty
())
{
throw
new
UnsupportedOperationException
(
"List of tracefiles is empty, thus cannot initiate the component!"
);
Monitor
.
log
(
this
.
getClass
(),
Level
.
WARN
,
"No unassociated trace file available. Skip."
,
actuator
);
//throw new UnsupportedOperationException("List of tracefiles is empty, thus cannot initiate the component!");
unusedComponents
.
add
(
actuator
);
return
;
}
if
(
components
.
containsKey
(
actuator
))
{
...
...
@@ -364,7 +377,7 @@ public class TracefileMovementModel implements MovementModel, EventHandler {
this
.
attractionpointVisualization
=
viz
;
}
public
void
setIAttraction
Generato
r
(
IAttractionProvider
attractionGenerator
)
{
public
void
setIAttraction
Provide
r
(
IAttractionProvider
attractionGenerator
)
{
if
(
attractionGenerator
==
null
)
{
throw
new
ConfigurationException
(
"AttractionGenerator is missing in ModularMovementModel!"
);
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/AttractionPointViz.java
View file @
7f590a14
...
...
@@ -101,7 +101,7 @@ public class AttractionPointViz extends JComponent
drawAttractionPoints
(
g2
);
}
if
(
tru
e
)
{
if
(
fals
e
)
{
drawClusters
(
g2
);
}
}
...
...
@@ -126,8 +126,13 @@ public class AttractionPointViz extends JComponent
for
(
LinkedList
<
SimHost
>
group
:
clusters
)
{
g2
.
setColor
(
colors
.
get
(
clusters
.
indexOf
(
group
)));
try
{
g2
.
setColor
(
colors
.
get
(
clusters
.
indexOf
(
group
)));
}
catch
(
Exception
e
)
{
g2
.
setColor
(
Color
.
black
);
}
for
(
SimHost
member
:
group
)
{
PositionVector
p
=
member
.
getTopologyComponent
().
getRealPosition
();
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/attraction/JSONAttractionGenerator.java
View file @
7f590a14
...
...
@@ -24,7 +24,6 @@ import java.io.FileInputStream;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.util.LinkedList
;
import
java.util.List
;
import
org.apache.commons.io.IOUtils
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
...
...
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