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
API
Commits
3330d3a1
Commit
3330d3a1
authored
Nov 13, 2017
by
Tobias Meuser
Browse files
Minor changes to Information Retrieval
parent
df3aa567
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/sis/type/SiSTypes.java
View file @
3330d3a1
...
...
@@ -30,6 +30,7 @@ import de.tudarmstadt.maki.simonstrator.api.common.graph.INode;
import
de.tudarmstadt.maki.simonstrator.api.component.network.NetworkComponent.NetInterfaceName
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.sis.type.aggregation.AbstractAggregation.AggregationDouble
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
/**
...
...
@@ -125,6 +126,11 @@ public final class SiSTypes {
*/
public
static
final
SiSType
<
RoadNetworkRoute
>
ROUTE
=
create
(
"ROUTE"
,
RoadNetworkRoute
.
class
,
null
);
/**
* [RoadNetworkRoute] Route of an entity for Vehicular Scenario by TM
*/
public
static
final
SiSType
<
RoadNetworkEdge
>
ROAD_EDGE
=
create
(
"EDGE"
,
RoadNetworkEdge
.
class
,
null
);
/**
*
* @param name
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/VehicleInformationComponent.java
View file @
3330d3a1
...
...
@@ -30,5 +30,7 @@ public interface VehicleInformationComponent
extends
HostComponent
,
VehicularRouteSensor
,
RouteActuator
,
SpeedSensor
,
SpeedActuator
{
void
setVehicleID
(
String
vehicleID
);
boolean
isValid
();
void
resetVehicleID
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/api/EdgeController.java
View file @
3330d3a1
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.api
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
/**
*
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
...
...
@@ -37,4 +39,42 @@ public interface EdgeController {
* the new maximum allowed speed
*/
void
setEdgeMaxSpeed
(
String
pEdgeID
,
double
pMaxSpeed
);
/**
*
* @param pEdgeID
* @return
*/
double
getLastStepMeanSpeed
(
String
pEdgeID
);
/**
* @param pEdgeID
* @return
*/
Location
getEdgeMeanPosition
(
String
pEdgeID
);
/**
* @return the startX
*/
public
double
getStartX
();
/**
* @return the startY
*/
public
double
getStartY
();
/**
* @return the endX
*/
public
double
getEndX
();
/**
* @return the endY
*/
public
double
getEndY
();
/**
* @return the observedAreaSet
*/
public
boolean
isObservedAreaSet
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/information/AvailableInformationAttributes.java
View file @
3330d3a1
...
...
@@ -21,5 +21,18 @@
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information
;
public
enum
AvailableInformationAttributes
{
OWNER
,
EDGE
,
TTL
POSITION
(
"position"
),
DATE
(
"date"
),
VALUE
(
"value"
),
OWNER
(
"owner"
),
EDGE
(
"edge"
),
TTL
(
"ttl"
);
private
final
String
attributeID
;
private
AvailableInformationAttributes
(
String
pAttributeID
)
{
this
.
attributeID
=
pAttributeID
;
}
/**
* @return the attributeID
*/
public
String
getAttributeID
()
{
return
attributeID
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/DefaultRelevanceBasedFilter.java
0 → 100755
View file @
3330d3a1
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.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.tudarmstadt.maki.simonstrator.api.component.vehicular.relevance
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayContact
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.Notification
;
/**
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
* @version 1.0 at 13.11.2017
*
*/
public
class
DefaultRelevanceBasedFilter
implements
RelevanceBasedFilter
{
@Override
public
void
startMechanism
(
Callback
pCb
)
{
pCb
.
finished
(
true
);
}
@Override
public
void
stopMechanism
(
Callback
pCb
)
{
pCb
.
finished
(
true
);
}
@Override
public
Set
<
OverlayContact
>
filterSubscribersBasedOnRelevance
(
Set
<
OverlayContact
>
pContacts
,
Notification
pNotification
)
{
return
pContacts
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/EventRelevanceCalculationComponent.java
View file @
3330d3a1
...
...
@@ -21,8 +21,8 @@
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.relevance
;
import
de.tudarmstadt.maki.simonstrator.api.component.HostComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* This interface provide methods to calculate the relevance of an event for a
...
...
@@ -37,11 +37,11 @@ public interface EventRelevanceCalculationComponent extends HostComponent {
* This method calculates the relevance of an event for a vehicle, combining
* the temporal and the geographical relevance.
*
* @param pVehicle
* The vehicle
for which the information is relevant.
* @param pVehicle
Position
* The vehicle
's position
* @param pInformation
* The information for which the relevance is calculated.
* @return The relevance of the event.
*/
double
calculateRelevance
(
VehicleInformationComponent
pVehicle
,
VehicularPointInformation
pInformation
);
double
calculateRelevance
(
RoadNetworkEdge
pVehicle
Position
,
VehicularPointInformation
pInformation
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/
IntersectionRelevanceCalculationComponent
.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/
RelevanceBasedFilter
.java
View file @
3330d3a1
...
...
@@ -18,8 +18,28 @@
*
*/
package
de.tudarmstadt.maki.simonstrator.api.component.vehicular.relevance
;
public
interface
IntersectionRelevanceCalculationComponent
{
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.component.overlay.OverlayContact
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.Notification
;
import
de.tudarmstadt.maki.simonstrator.api.component.transition.TransitionEnabled
;
/**
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
* @version 1.0 at 13.11.2017
*
*/
public
interface
RelevanceBasedFilter
extends
TransitionEnabled
{
/**
*
* @param pContacts
* @param pNotification
* @return
*/
Set
<
OverlayContact
>
filterSubscribersBasedOnRelevance
(
Set
<
OverlayContact
>
pContacts
,
Notification
pNotification
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/relevance/SimpleEventRelevanceCalculationComponent.java
0 → 100755
View file @
3330d3a1
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.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.tudarmstadt.maki.simonstrator.api.component.vehicular.relevance
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
public
class
SimpleEventRelevanceCalculationComponent
implements
EventRelevanceCalculationComponent
{
private
final
int
DEPTH
;
private
Host
_host
;
public
SimpleEventRelevanceCalculationComponent
(
Host
pHost
,
int
pDepth
)
{
_host
=
pHost
;
DEPTH
=
pDepth
;
}
public
SimpleEventRelevanceCalculationComponent
(
Host
pHost
)
{
this
(
pHost
,
5
);
}
@Override
public
double
calculateRelevance
(
RoadNetworkEdge
pVehiclePosition
,
VehicularPointInformation
pInformation
)
{
if
(
DEPTH
==
-
1
)
{
return
-
1
;
}
List
<
RoadNetworkEdge
>
availableEdges
=
new
ArrayList
<>();
availableEdges
.
add
(
pVehiclePosition
);
Set
<
RoadNetworkEdge
>
searchedEdges
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
DEPTH
;
i
++)
{
int
size
=
availableEdges
.
size
();
for
(
int
j
=
0
;
j
<
size
;
j
++)
{
RoadNetworkEdge
currentEdge
=
availableEdges
.
get
(
j
);
if
(
currentEdge
.
equals
(
pInformation
.
getEdge
()))
{
return
1
;
}
if
(!
searchedEdges
.
contains
(
currentEdge
))
{
searchedEdges
.
add
(
currentEdge
);
for
(
RoadNetworkEdge
roadNetworkEdge
:
currentEdge
.
getAccessibleEdges
())
{
if
(!
availableEdges
.
contains
(
roadNetworkEdge
))
{
availableEdges
.
add
(
roadNetworkEdge
);
}
}
}
}
}
return
0
;
}
/*
* (non-Javadoc)
*
* @see
* de.tudarmstadt.maki.simonstrator.api.component.HostComponent#initialize()
*/
@Override
public
void
initialize
()
{
}
/*
* (non-Javadoc)
*
* @see
* de.tudarmstadt.maki.simonstrator.api.component.HostComponent#shutdown()
*/
@Override
public
void
shutdown
()
{
}
/*
* (non-Javadoc)
*
* @see
* de.tudarmstadt.maki.simonstrator.api.component.HostComponent#getHost()
*/
@Override
public
Host
getHost
()
{
return
_host
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetwork.java
View file @
3330d3a1
...
...
@@ -25,10 +25,15 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.EdgeController
;
public
class
RoadNetwork
{
private
Map
<
String
,
RoadNetworkEdge
>
_roadNetwork
;
private
boolean
_changed
=
false
;
private
EdgeController
_edgeController
;
private
List
<
RoadNetworkEdge
>
_visibleEdges
=
null
;
public
RoadNetwork
(
SerializableRoadNetwork
pRoadNetwork
,
EdgeController
pEdgeController
)
{
_roadNetwork
=
new
HashMap
<>();
...
...
@@ -43,17 +48,62 @@ public class RoadNetwork {
roadNetworkEdge
.
addConnectedEdge
(
_roadNetwork
.
get
(
edgeID
));
}
}
_edgeController
=
pEdgeController
;
}
public
RoadNetwork
(
Map
<
String
,
RoadNetworkEdge
>
pRoadNetwork
)
{
public
RoadNetwork
(
Map
<
String
,
RoadNetworkEdge
>
pRoadNetwork
,
EdgeController
pEdgeController
)
{
_roadNetwork
=
pRoadNetwork
;
_edgeController
=
pEdgeController
;
}
/**
* @param pRoadNetwork
* @param pB
*/
public
RoadNetwork
(
Map
<
String
,
RoadNetworkEdge
>
pRoadNetwork
,
EdgeController
pEdgeController
,
boolean
pChanged
)
{
this
(
pRoadNetwork
,
pEdgeController
);
_changed
=
true
;
}
public
List
<
RoadNetworkEdge
>
getAvailableEdges
()
{
return
new
ArrayList
<>(
_roadNetwork
.
values
());
}
public
List
<
RoadNetworkEdge
>
getAvailableEdgesInObservedArea
()
{
if
(
_visibleEdges
==
null
)
{
if
(!
_edgeController
.
isObservedAreaSet
())
{
_visibleEdges
=
new
ArrayList
<>(
_roadNetwork
.
values
());
}
else
{
List
<
RoadNetworkEdge
>
allEdges
=
new
ArrayList
<>(
_roadNetwork
.
values
());
List
<
RoadNetworkEdge
>
result
=
new
ArrayList
<>();
for
(
RoadNetworkEdge
roadNetworkEdge
:
allEdges
)
{
Location
edgePosition
=
roadNetworkEdge
.
getEdgePosition
();
if
(
edgePosition
.
getLongitude
()
>=
_edgeController
.
getStartX
()
&&
edgePosition
.
getLongitude
()
<=
_edgeController
.
getEndX
()
&&
edgePosition
.
getLatitude
()
>=
_edgeController
.
getStartY
()
&&
edgePosition
.
getLatitude
()
<=
_edgeController
.
getEndY
())
{
result
.
add
(
roadNetworkEdge
);
}
}
_visibleEdges
=
result
;
}
}
return
_visibleEdges
;
}
public
RoadNetworkEdge
getEdge
(
String
pEdge
)
{
return
_roadNetwork
.
get
(
pEdge
);
}
/**
* @return
*/
public
boolean
hasChanged
()
{
return
_changed
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkEdge.java
View file @
3330d3a1
...
...
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.List
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.api.EdgeController
;
public
class
RoadNetworkEdge
{
...
...
@@ -50,6 +51,7 @@ public class RoadNetworkEdge {
}
_originalMaxSpeed
=
pEdge
.
getMaxSpeed
();
_maxSpeed
=
_originalMaxSpeed
;
}
public
RoadNetworkEdge
(
String
pEdgeID
,
double
pAngle
,
EdgeController
pEdgeController
)
{
...
...
@@ -67,6 +69,14 @@ public class RoadNetworkEdge {
return
_edgeID
;
}
public
Location
getEdgePosition
()
{
return
_edgeController
.
getEdgeMeanPosition
(
_edgeID
);
}
public
double
getLastStepMeanSpeed
()
{
return
_edgeController
.
getLastStepMeanSpeed
(
_edgeID
);
}
public
double
getAngle
()
{
return
_angle
;
}
...
...
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