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
90029522
Commit
90029522
authored
Jun 12, 2018
by
Tobias Meuser
Browse files
Current version
parent
ce5b0342
Changes
22
Show whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkEdge.java
View file @
90029522
...
@@ -52,6 +52,8 @@ public class RoadNetworkEdge {
...
@@ -52,6 +52,8 @@ public class RoadNetworkEdge {
private
final
EdgeController
_edgeController
;
private
final
EdgeController
_edgeController
;
private
List
<
RoadNetworkEdgeListener
>
_listeners
=
new
ArrayList
<>();
public
RoadNetworkEdge
(
SerializableRoadNetworkEdge
pEdge
,
EdgeController
pEdgeController
)
{
public
RoadNetworkEdge
(
SerializableRoadNetworkEdge
pEdge
,
EdgeController
pEdgeController
)
{
_edgeController
=
pEdgeController
;
_edgeController
=
pEdgeController
;
...
@@ -73,12 +75,20 @@ public class RoadNetworkEdge {
...
@@ -73,12 +75,20 @@ public class RoadNetworkEdge {
_angle
=
pAngle
;
_angle
=
pAngle
;
}
}
public
void
registerEdgeListener
(
RoadNetworkEdgeListener
pListener
)
{
_listeners
.
add
(
pListener
);
}
public
void
addRoadProperty
(
RoadProperty
pProperty
)
{
public
void
addRoadProperty
(
RoadProperty
pProperty
)
{
_activeProperties
.
add
(
pProperty
);
_activeProperties
.
add
(
pProperty
);
if
(
pProperty
instanceof
JamProperty
)
{
if
(
pProperty
instanceof
JamProperty
)
{
setMaxSpeed
(((
JamProperty
)
pProperty
).
getAverageSpeed
());
setMaxSpeed
(((
JamProperty
)
pProperty
).
getAverageSpeed
());
}
}
for
(
RoadNetworkEdgeListener
roadNetworkEdgeListener
:
_listeners
)
{
roadNetworkEdgeListener
.
edgeActivated
(
this
,
pProperty
);
}
}
}
/**
/**
...
@@ -115,7 +125,7 @@ public class RoadNetworkEdge {
...
@@ -115,7 +125,7 @@ public class RoadNetworkEdge {
* @return
* @return
*/
*/
public
static
double
getCorrespondingState
(
double
pExpectation
)
{
public
static
double
getCorrespondingState
(
double
pExpectation
)
{
return
((
int
)
(
pExpectation
/
VectoralJamProperty
.
SCALING
))
*
VectoralJamProperty
.
SCALING
;
return
((
int
)
Math
.
round
(
pExpectation
/
VectoralJamProperty
.
SCALING
))
*
VectoralJamProperty
.
SCALING
;
}
}
public
void
removeRoadProperty
(
RoadProperty
pProperty
)
{
public
void
removeRoadProperty
(
RoadProperty
pProperty
)
{
...
@@ -124,6 +134,10 @@ public class RoadNetworkEdge {
...
@@ -124,6 +134,10 @@ public class RoadNetworkEdge {
if
(
pProperty
instanceof
JamProperty
)
{
if
(
pProperty
instanceof
JamProperty
)
{
setMaxSpeed
(
getOriginalMaxSpeed
());
setMaxSpeed
(
getOriginalMaxSpeed
());
}
}
for
(
RoadNetworkEdgeListener
roadNetworkEdgeListener
:
_listeners
)
{
roadNetworkEdgeListener
.
edgeDeactivated
(
this
,
pProperty
);
}
}
}
/**
/**
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkEdgeListener.java
0 → 100755
View file @
90029522
/*
* 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.roadnetwork
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.RoadProperty
;
public
interface
RoadNetworkEdgeListener
{
void
edgeActivated
(
RoadNetworkEdge
pEdge
,
RoadProperty
pProperty
);
void
edgeDeactivated
(
RoadNetworkEdge
pEdge
,
RoadProperty
pProperty
);
}
Prev
1
2
Next
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