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
34fcdf6b
Commit
34fcdf6b
authored
Oct 06, 2016
by
Nils Richerzhagen
Browse files
Added configurable Enable/Disable function to cellDesctruction in
5GTopology.
parent
b084c6d5
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/topology/views/fiveg/AbstractGridBasedTopologyDatabase.java
View file @
34fcdf6b
...
...
@@ -47,6 +47,8 @@ public abstract class AbstractGridBasedTopologyDatabase
private
final
Map
<
Integer
,
FiveGTopologyDatabase
.
Entry
>
cloudletEntries
;
public
static
int
_visId
=
1
;
private
boolean
enableCellDestruction
=
false
;
/**
* Grid-based {@link CellularTopologyDatabase} with a grid length (squares)
...
...
@@ -69,12 +71,17 @@ public abstract class AbstractGridBasedTopologyDatabase
public
void
eventOccurred
(
Object
content
,
int
type
)
{
VisualizationInjector
.
injectComponent
(
"5G "
+
_visId
++,
-
1
,
new
FiveGVisualization
(
AbstractGridBasedTopologyDatabase
.
this
),
AbstractGridBasedTopologyDatabase
.
this
,
enableCellDestruction
),
false
,
true
);
}
},
null
,
0
);
}
}
public
void
setEnableCellDestruction
(
boolean
enableCellDestruction
){
this
.
enableCellDestruction
=
enableCellDestruction
;
}
public
void
setGridSize
(
int
gridSize
)
{
this
.
gridSize
=
gridSize
;
...
...
@@ -176,19 +183,25 @@ public abstract class AbstractGridBasedTopologyDatabase
@Override
public
double
getDropProbability
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
return
1
;
if
(!
getConnectivity
()){
return
1
;
}
return
isUpload
?
dropUp
:
dropDown
;
}
@Override
public
long
getLatency
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
return
9999
*
Time
.
MILLISECOND
;
if
(!
getConnectivity
()){
return
9999
*
Time
.
MILLISECOND
;
}
return
isUpload
?
latencyUp
:
latencyDown
;
}
@Override
public
long
getBandwidth
(
boolean
isUpload
)
{
if
(!
getConnectivity
())
return
0
;
if
(!
getConnectivity
()){
return
0
;
}
return
isUpload
?
bandwidthUp
:
bandwidthDown
;
}
...
...
src/de/tud/kom/p2psim/impl/topology/views/fiveg/FiveGTopologyDatabase.java
View file @
34fcdf6b
...
...
@@ -24,8 +24,12 @@ import de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView;
import
de.tud.kom.p2psim.impl.topology.views.FiveGTopologyView.CellLink
;
/**
* Database for the {@link FiveGTopologyView} - containing a mapping of
* position IDs to the respective link characteristics.
* Database for the {@link FiveGTopologyView} - containing a mapping of position
* IDs to the respective link characteristics.
*
* 06.10.2016 added by Nils Richerzhagen, Clemens Krug Functionality to
* 'destroy' cells using SHIFT + Left-click. Enable/Disable using the
* enableCellDestruction boolean.
*
* @author Bjoern Richerzhagen
* @version 1.0, Nov 5, 2015
...
...
@@ -59,6 +63,17 @@ public interface FiveGTopologyDatabase {
public
FiveGTopologyDatabase
.
Entry
getEntryFor
(
int
segmentID
,
boolean
isCloudlet
);
/**
* If wanted one can 'destroy' cells using this method. Destroy means that
* the cell is not available for the communication mean specified within
* that TopologyView.
*
* To be set by configuration.
*
* @param enableCellDestruction
*/
public
void
setEnableCellDestruction
(
boolean
enableCellDestruction
);
/**
* Data structure for the network parameters of a given segment ID - these
* are directly accessed by the {@link CellLink} object on each call (so
...
...
@@ -104,16 +119,19 @@ public interface FiveGTopologyDatabase {
/**
* Connectivity of the cell.
*
* @return <code>false</code> if the cell is broken down/damaged and
upload/download isn't possible.
*
<code>true</code> otherwise.
*/
* @return <code>false</code> if the cell is broken down/damaged and
*
upload/download isn't possible.
<code>true</code> otherwise.
*/
boolean
getConnectivity
();
/**
* Set the connectivity of the cell. When set to <code>false</code>, it should be impossible to upload or
* download data via this cell. {@link CellLink} refers to this attribute when returning e.g. BW or drop rate.
* Set the connectivity of the cell. When set to <code>false</code>, it
* should be impossible to upload or download data via this cell.
* {@link CellLink} refers to this attribute when returning e.g. BW or
* drop rate.
*
* @param connectivity
*/
*/
void
setConnectivity
(
boolean
connectivity
);
}
...
...
src/de/tud/kom/p2psim/impl/topology/views/visualization/world/FiveGVisualization.java
View file @
34fcdf6b
...
...
@@ -35,18 +35,23 @@ import java.awt.image.BufferedImage;
/**
* Visualization for the {@link FiveGTopologyView}
*
* Added 06.10.2016 Nils Richerzhagen, Clemens Krug
* Functionality to 'destroy' cells using SHIFT + Left-click. Enable/Disable using the enableCellDestruction
*
* @author Bjoern Richerzhagen
* @version 1.0, Nov 5, 2015
*/
public
class
FiveGVisualization
extends
JComponent
implements
VisualizationInjector
.
MouseClickListener
{
private
final
boolean
enableCellDestruction
;
protected
BufferedImage
image
;
protected
volatile
boolean
needsRedraw
=
true
;
private
final
AbstractGridBasedTopologyDatabase
database
;
public
FiveGVisualization
(
AbstractGridBasedTopologyDatabase
database
)
{
public
FiveGVisualization
(
AbstractGridBasedTopologyDatabase
database
,
boolean
enableCellDestruction
)
{
setBounds
(
0
,
0
,
VisualizationInjector
.
getWorldX
(),
VisualizationInjector
.
getWorldY
());
setOpaque
(
true
);
...
...
@@ -56,6 +61,8 @@ public class FiveGVisualization extends JComponent implements VisualizationInjec
image
=
new
BufferedImage
(
VisualizationInjector
.
getWorldX
(),
VisualizationInjector
.
getWorldY
(),
BufferedImage
.
TYPE_INT_ARGB
);
this
.
enableCellDestruction
=
enableCellDestruction
;
VisualizationInjector
.
addMouseListener
(
this
);
}
...
...
@@ -169,7 +176,7 @@ public class FiveGVisualization extends JComponent implements VisualizationInjec
public
void
mouseClicked
(
int
x
,
int
y
,
int
modifier
)
{
// 17 == Shift
if
(
modifier
==
17
)
if
(
enableCellDestruction
&&
modifier
==
17
)
{
int
segID
=
database
.
getSegmentID
(
x
,
y
);
Entry
entry
=
database
.
getEntryFor
(
segID
,
false
);
...
...
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