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
4567cee4
Commit
4567cee4
authored
Aug 01, 2018
by
Tobias Meuser
Browse files
Implemented sending procedure
parent
8785fe21
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/processing/ProcessingServer.java
View file @
4567cee4
...
...
@@ -5,7 +5,7 @@ import java.util.List;
import
de.tudarmstadt.maki.simonstrator.api.component.HostComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
import
de.tudarmstadt.maki.simonstrator.
peerfact.application.vehicular.processing
.topic.ProcessedTopic
;
import
de.tudarmstadt.maki.simonstrator.
api.component.vehicular.subscriptions
.topic.ProcessedTopic
;
public
interface
ProcessingServer
extends
HostComponent
{
Topic
getServerTopic
();
...
...
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/GlobalTopic.java
deleted
100755 → 0
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
GlobalTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
public
GlobalTopic
(
Topic
pTopic
)
{
_topic
=
pTopic
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
GLOBAL
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
return
true
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
return
true
;
}
}
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/ProcessedTopic.java
deleted
100755 → 0
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
interface
ProcessedTopic
{
Topic
getTopic
();
SubscriptionTopicType
getTopicType
();
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
);
boolean
matchesHost
(
Host
pHost
);
}
src/de/tudarmstadt/maki/simonstrator/peerfact/application/vehicular/processing/topic/RoadBasedTopic.java
deleted
100755 → 0
View file @
8785fe21
package
de.tudarmstadt.maki.simonstrator.peerfact.application.vehicular.processing.topic
;
import
java.util.HashSet
;
import
java.util.Set
;
import
de.tudarmstadt.maki.simonstrator.api.Host
;
import
de.tudarmstadt.maki.simonstrator.api.component.ComponentNotAvailableException
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.PubSubComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.pubsub.attribute.Topic
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.VehicleInformationComponent
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.PointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.information.VehicularPointInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkRoute
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.subscriptions.SubscriptionTopicType
;
public
class
RoadBasedTopic
implements
ProcessedTopic
{
private
Topic
_topic
;
private
RoadNetworkEdge
_edge
;
public
RoadBasedTopic
(
PubSubComponent
pPubSub
,
RoadNetworkEdge
pEdge
)
{
_topic
=
pPubSub
.
createTopic
(
pEdge
.
getEdgeID
());
_edge
=
pEdge
;
}
@Override
public
Topic
getTopic
()
{
return
_topic
;
}
@Override
public
SubscriptionTopicType
getTopicType
()
{
return
SubscriptionTopicType
.
EDGE_BASED
;
}
@Override
public
boolean
matchesInformationRequirements
(
PointInformation
<?>
pInformation
)
{
if
(
pInformation
instanceof
VehicularPointInformation
)
{
VehicularPointInformation
<?>
vehicularInfo
=
(
VehicularPointInformation
<?>)
pInformation
;
return
_edge
.
equals
(
vehicularInfo
.
getEdge
());
}
return
false
;
}
@Override
public
boolean
matchesHost
(
Host
pHost
)
{
try
{
VehicleInformationComponent
vehicleInfo
=
pHost
.
getComponent
(
VehicleInformationComponent
.
class
);
RoadNetworkRoute
currentRoute
=
vehicleInfo
.
getCurrentRoute
();
RoadNetworkEdge
currentRoad
=
currentRoute
.
getStart
();
Set
<
RoadNetworkEdge
>
roads
=
new
HashSet
<>();
roads
.
add
(
currentRoad
);
roads
.
addAll
(
currentRoad
.
getAccessibleEdges
());
return
roads
.
contains
(
_edge
);
}
catch
(
ComponentNotAvailableException
e
)
{
}
return
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