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
0fcbf535
Commit
0fcbf535
authored
May 15, 2018
by
Tobias Meuser
Browse files
Updated isJammed() function
parent
e67cede5
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/jam/JamProperty.java
View file @
0fcbf535
...
...
@@ -79,7 +79,7 @@ public class JamProperty implements RoadProperty {
}
public
boolean
isJammed
()
{
return
_jammed
;
return
JamProperty
.
isJammed
(
getEdge
(),
getAverageSpeed
())
;
}
public
double
getAverageSpeed
()
{
...
...
@@ -95,4 +95,15 @@ public class JamProperty implements RoadProperty {
return
new
JamProperty
(
_location
,
_edge
,
false
,
-
1
);
}
public
static
boolean
isJammed
(
RoadNetworkEdge
pEdge
,
double
pSpeed
)
{
if
(
pEdge
!=
null
)
{
double
originalMaxSpeed
=
pEdge
.
getOriginalMaxSpeed
();
if
(
pSpeed
<
originalMaxSpeed
*
0.675
)
{
return
true
;
}
}
return
false
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/jam/VectoralJamProperty.java
View file @
0fcbf535
...
...
@@ -176,17 +176,7 @@ public class VectoralJamProperty extends NumericVectoralProperty {
* @return
*/
public
boolean
isJammed
()
{
if
(
getEdge
()
!=
null
)
{
double
originalMaxSpeed
=
getEdge
().
getOriginalMaxSpeed
();
double
speed
=
getExpectation
();
if
(
speed
<
(((
int
)
(
originalMaxSpeed
*
0.375
/
VectoralJamProperty
.
SCALING
))
*
VectoralJamProperty
.
SCALING
))
{
return
true
;
}
}
return
false
;
return
JamProperty
.
isJammed
(
getEdge
(),
getExpectation
());
}
@Override
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/vehicular/roadnetwork/RoadNetworkEdge.java
View file @
0fcbf535
...
...
@@ -260,4 +260,13 @@ public class RoadNetworkEdge {
return
laneShapes
;
}
public
boolean
isJammed
()
{
for
(
RoadProperty
roadProperty
:
_activeProperties
)
{
if
(
roadProperty
instanceof
JamProperty
)
{
return
((
JamProperty
)
roadProperty
).
isJammed
();
}
}
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