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
4a2e7fa0
Commit
4a2e7fa0
authored
Oct 01, 2018
by
Tobias Meuser
Browse files
First working version of Gateway Selection
parent
71f24c26
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tud/kom/p2psim/impl/scenario/DefaultConfigurator.java
View file @
4a2e7fa0
...
...
@@ -2,17 +2,17 @@
* Copyright (c) 2005-2011 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/>.
*
...
...
@@ -70,11 +70,11 @@ import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
/**
* The default implementation of the configuration mechanism. For a detailed
* explanation, see {@link Configurator}.
*
*
* @author Konstantin Pussep
* @author Sebastian Kaune
* @version 3.0, 14.12.2007
*
*
*/
public
class
DefaultConfigurator
implements
Configurator
{
...
...
@@ -84,7 +84,7 @@ public class DefaultConfigurator implements Configurator {
* this name. They will be treated as if they were direct children of the
* parent of this fake container element.
* </p>
*
*
* <p>
* Needed to work around the lack of support for XPointer in the XInclude
* implementation of Apache Xerces (which should be the most common
...
...
@@ -148,7 +148,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Create new configurator instance with the configuration data in the given
* XML file.
*
*
* @param file
* XML config file
*/
...
...
@@ -158,7 +158,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Gets the name of the configuration file.
*
*
* @return Name of the configuration file.
*/
public
File
getConfigFile
()
{
...
...
@@ -167,7 +167,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Return a copy of the map with variables.
*
*
* @return A copy of stored variables.
*/
public
Map
<
String
,
String
>
getVariables
()
{
...
...
@@ -183,7 +183,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Register a specific component module by the provided name.
*
*
* @param name
* unique name for the component module
* @param component
...
...
@@ -203,7 +203,7 @@ public class DefaultConfigurator implements Configurator {
* Configure all components of the simulator. The single components are
* either registered via the <code>register(name, component)</code> method
* or specified in the config file.
*
*
* @return a collection of components.
* @throws ConfigurationException
*/
...
...
@@ -258,7 +258,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Process the XML subtree.
*
*
* @param parent
* root of the subtree
*/
...
...
@@ -281,7 +281,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Processes a <code><Default></code> Tag by setting the respective
* variables.
*
*
* @param defaultElement
*/
private
void
configureDefaults
(
Element
elem
)
{
...
...
@@ -304,7 +304,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Create (if not existent yet) and configure a configurable component by
* parsing the XML subtree.
*
*
* @param elem
* XML subtree with configuration data
* @return configured component
...
...
@@ -413,7 +413,7 @@ public class DefaultConfigurator implements Configurator {
}
/**
*
*
* @param component
* @param child
* @param consAttrs
...
...
@@ -585,7 +585,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Automagically convert the string value to desired type. Supported types
* are all simple types, i.e. boolean, int, long, double.
*
*
* @param value
* @param typeClass
* @return converted
...
...
@@ -628,8 +628,9 @@ public class DefaultConfigurator implements Configurator {
}
param
=
lvals
;
}
else
{
throw
new
IllegalArgumentException
(
"Parameter type "
+
typeClass
+
" is not supported"
);
param
=
value
;
// throw new IllegalArgumentException(
// "Parameter type " + typeClass + " is not supported");
}
return
param
;
}
...
...
@@ -645,7 +646,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Can be either a variable (if starts with $) or a plain value
*
*
* @param attr
* @return proper value
*/
...
...
@@ -693,7 +694,7 @@ public class DefaultConfigurator implements Configurator {
/*
* (non-Javadoc)
*
*
* @see
* de.tud.kom.p2psim.impl.scenario.ConfigurablesManager#getComponent(java
* .lang.String)
...
...
@@ -711,7 +712,7 @@ public class DefaultConfigurator implements Configurator {
* (full) class name and the optional method name. If the method name is
* null, the default constructor will be used. The method's signature should
* have no arguments.
*
*
* @param className
* @param staticMethod
* @param consAttrs
...
...
@@ -807,7 +808,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Set variables with values which replace the variable names in the
* configuration file. Default values will be overwritten.
*
*
* @param variables
*/
public
void
setVariables
(
Map
<
String
,
String
>
variables
)
{
...
...
@@ -823,11 +824,11 @@ public class DefaultConfigurator implements Configurator {
* number followed by a "ms", "s", "m" or "h" for milliseconds, seconds
* etc.. The conversion is done according to the constants defined in the
* {@link Time} class.
*
*
* If no time-unit is found, we search for bandwidth-units and parse
* according to the unit, and if that does not work as well, the long is
* returned.
*
*
* @param value
* - time value to parse
* @return parsed value
...
...
@@ -875,6 +876,9 @@ public class DefaultConfigurator implements Configurator {
}
else
{
throw
new
IllegalStateException
(
"Invalid bandwidth unit."
);
}
}
else
if
(
value
.
matches
(
"\\d+%"
)
||
value
.
matches
(
"\\d+\\.\\d+%"
))
{
factor
=
0.01
;
number
=
value
.
substring
(
0
,
value
.
length
()
-
1
);
}
// Size (Byte)
if
(
value
.
matches
(
"\\d+(B|KB|MB)"
))
{
...
...
@@ -910,11 +914,11 @@ public class DefaultConfigurator implements Configurator {
/**
* You can create elements like
*
*
* <IfEqualStr arg0="$variable" arg1="value"> [...your configuration
* ... ] </IfEqualStr>, and they will be applied only if the strings
* are equal.
*
*
* @param ifClause
* @param toExecuteOnTrue
* @return
...
...
@@ -952,11 +956,11 @@ public class DefaultConfigurator implements Configurator {
/**
* You can create elements like
*
*
* <IfNotEqualStr arg0="$variable" arg1="value"> [...your
* configuration ... ] </IfNotEqualStr>, and they will be applied only
* if the strings are NOT equal.
*
*
* @param ifClause
* @param toExecuteOnFalse
* @return
...
...
@@ -995,7 +999,7 @@ public class DefaultConfigurator implements Configurator {
/**
* Gets the parsed XML-Configuration File. So are the included tags
* resolved.
*
*
* @param configFile
* The File of the config
* @return The parsed config as text.
...
...
src/de/tud/kom/p2psim/impl/topology/movement/modularosm/transition/ITransitionStrategy.java
View file @
4a2e7fa0
...
...
@@ -2,17 +2,17 @@
* 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/>.
*
...
...
@@ -28,7 +28,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Attraction
/**
* This is the interface for the Transition Strategy.<br>
*
*
* @author Martin Hellwig
* @version 1.0, 03.07.2015
*/
...
...
@@ -36,19 +36,19 @@ public interface ITransitionStrategy {
/**
* Currently assigned attraction point.
*
*
* @param comp
* @return
*/
public
AttractionPoint
getAssignment
(
SimLocationActuator
comp
);
public
void
addAttractionAssignmentListener
(
AttractionAssignmentListener
listener
);
public
void
removeAttractionAssignmentListener
(
AttractionAssignmentListener
listener
);
/**
* Should be called first, to add the Attraction Points for the assignment!
*
*
* @param attractionPoints
*/
public
void
setAttractionPoints
(
...
...
@@ -56,14 +56,14 @@ public interface ITransitionStrategy {
/**
* Return a set of all attraction points
*
*
* @return
*/
public
Set
<
AttractionPoint
>
getAllAttractionPoints
();
/**
* Add the object and assign the MS to an {@link AttractionPoint}.
*
*
* @param ms
*/
public
void
addComponent
(
SimLocationActuator
ms
);
...
...
@@ -71,14 +71,14 @@ public interface ITransitionStrategy {
/**
* Notify the TransitionStrategy, that the component has reached an
* attraction point.
*
*
* @param ms
*/
public
void
reachedAttractionPoint
(
SimLocationActuator
ms
);
/**
* Updates the target attraction point of a component
*
*
* @param attractionPoint
*/
public
void
updateTargetAttractionPoint
(
SimLocationActuator
comp
,
...
...
@@ -89,7 +89,7 @@ public interface ITransitionStrategy {
/**
* Invoked after the assignment of AttractionPoints for the given
* component changed.
*
*
* @param component
* @param newAssignment
*/
...
...
src/de/tud/kom/p2psim/impl/vehicular/DefaultVehicleInformationComponent.java
View file @
4a2e7fa0
...
...
@@ -26,6 +26,7 @@ import java.util.Set;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.INodeID
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.VehicleProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.LocationListener
;
...
...
@@ -149,6 +150,12 @@ public class DefaultVehicleInformationComponent implements VehicleInformationCom
}
}
@Override
public
VehicleProperty
getVehicleProperty
()
{
return
new
VehicleProperty
(
host
.
getId
().
value
(),
getLastLocation
(),
getCurrentRoute
().
getStart
(),
getCurrentSpeed
());
}
@Override
public
void
setVehicleID
(
String
pVehicleID
)
{
vehicleID
=
pVehicleID
;
...
...
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