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
e157b605
Commit
e157b605
authored
Sep 22, 2020
by
Tobias Meuser
Browse files
Merged tm/vehicular-services into master-integration
parents
8b80fdfa
0fbcbc65
Changes
140
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/AbstractRoadProperty.java
0 → 100755
View file @
e157b605
/*
* 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.aggregation.AggregationInformation
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
public
abstract
class
AbstractRoadProperty
implements
RoadProperty
,
AggregatedProperty
{
private
Location
_location
;
private
RoadNetworkEdge
_edge
;
private
long
_detectionDate
;
private
AggregationInformation
_aggregationInformation
;
private
long
_duration
;
public
AbstractRoadProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
)
{
_location
=
pLocation
;
_edge
=
pEdge
;
_detectionDate
=
Time
.
getCurrentTime
();
}
@Override
public
long
getDetectionDate
()
{
return
_detectionDate
;
}
@Override
public
void
setDetectionDate
(
long
pDate
)
{
_detectionDate
=
pDate
;
}
@Override
public
Location
getLocation
()
{
return
_location
;
}
@Override
public
void
setLocation
(
Location
pLocation
)
{
_location
=
pLocation
;
}
@Override
public
RoadNetworkEdge
getEdge
()
{
return
_edge
;
}
@Override
public
long
getDuration
()
{
return
_duration
;
}
@Override
public
void
setDuration
(
long
pDuration
)
{
_duration
=
pDuration
;
}
public
void
setEdge
(
RoadNetworkEdge
pEdge
)
{
_edge
=
pEdge
;
}
@Override
public
AggregationInformation
getAggregationInformation
()
{
return
_aggregationInformation
;
}
@Override
public
void
setAggregationInformation
(
AggregationInformation
pAggregationInformation
)
{
_aggregationInformation
=
pAggregationInformation
;
}
@Override
public
int
hashCode
()
{
if
(
_location
!=
null
)
{
return
_location
.
hashCode
()
*
31
+
Long
.
hashCode
(
getDetectionDate
());
}
else
{
return
_edge
.
hashCode
()
*
31
+
Long
.
hashCode
(
getDetectionDate
());
}
}
@Override
public
boolean
isAggregated
()
{
return
_aggregationInformation
!=
null
;
}
@Override
public
boolean
equalLocation
(
RoadProperty
pRoadProperty
)
{
return
pRoadProperty
.
getEdge
().
equals
(
_edge
)
&&
pRoadProperty
.
getLocation
().
equals
(
_location
);
}
@Override
public
int
compareTo
(
RoadProperty
pO
)
{
return
Long
.
compare
(
getDetectionDate
(),
pO
.
getDetectionDate
());
}
@Override
public
boolean
equals
(
Object
pObj
)
{
if
(
pObj
instanceof
AbstractRoadProperty
)
{
AbstractRoadProperty
property
=
(
AbstractRoadProperty
)
pObj
;
if
(
property
.
getClass
().
equals
(
getClass
()))
{
return
(
_location
==
property
.
_location
||
(
_location
!=
null
&&
_location
.
equals
(
property
.
_location
)))
&&
getValue
().
equals
(
property
.
getValue
())
&&
_edge
.
equals
(
property
.
_edge
)
&&
_detectionDate
==
property
.
_detectionDate
;
}
}
return
false
;
}
@Override
public
boolean
isDetourable
()
{
return
false
;
}
public
abstract
AbstractRoadProperty
clone
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/AggregatedProperty.java
0 → 100755
View file @
e157b605
/*
* 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.aggregation.AggregationInformation
;
public
interface
AggregatedProperty
{
AggregationInformation
getAggregationInformation
();
boolean
isAggregated
();
void
setAggregationInformation
(
AggregationInformation
pAggregationInformation
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/BumpProperty.java
0 → 100644
View file @
e157b605
/*
* Copyright (c) 2005-2018 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* @author Bjoern Bueschke
* @version 1.0 at 26.03.2018
*
*/
public
class
BumpProperty
extends
AbstractRoadProperty
{
private
final
boolean
_bump
;
public
BumpProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pBump
)
{
super
(
pLocation
,
pEdge
);
_bump
=
pBump
;
}
public
boolean
hasBump
()
{
return
_bump
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
BumpProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasBump
();
}
@Override
public
BumpProperty
clone
()
{
BumpProperty
property
=
new
BumpProperty
(
getLocation
(),
getEdge
(),
_bump
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/EnvironmentProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/
EnvironmentProperty.java
View file @
e157b605
...
...
@@ -19,7 +19,7 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties
;
/**
* @author Tobias Meuser (tobias.meuser@kom.tu-darmstadt.de)
...
...
@@ -30,4 +30,6 @@ public interface EnvironmentProperty {
// Enabler Interface
long
getDetectionDate
();
void
setDetectionDate
(
long
pDate
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/FogProperty.java
0 → 100644
View file @
e157b605
/*
* Copyright (c) 2005-2018 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* @author Bjoern Bueschke
* @version 1.0 at 27.03.2018
*
*/
public
class
FogProperty
extends
AbstractRoadProperty
{
private
final
boolean
_fog
;
public
FogProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pFog
)
{
super
(
pLocation
,
pEdge
);
_fog
=
pFog
;
}
public
boolean
hasFog
()
{
return
_fog
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
FogProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasFog
();
}
@Override
public
FogProperty
clone
()
{
FogProperty
property
=
new
FogProperty
(
getLocation
(),
getEdge
(),
_fog
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/HazardProperty.java
0 → 100644
View file @
e157b605
/*
* Copyright (c) 2005-2018 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* @author Bjoern Bueschke
* @version 1.0 at 26.03.2018
*
*/
public
class
HazardProperty
extends
AbstractRoadProperty
{
private
final
boolean
_hazard
;
public
HazardProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pHazard
)
{
super
(
pLocation
,
pEdge
);
_hazard
=
pHazard
;
}
public
boolean
hasHazard
()
{
return
_hazard
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
HazardProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasHazard
();
}
@Override
public
boolean
isDetourable
()
{
return
true
;
}
@Override
public
HazardProperty
clone
()
{
HazardProperty
property
=
new
HazardProperty
(
getLocation
(),
getEdge
(),
_hazard
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
jam
/JamProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties
/JamProperty.java
View file @
e157b605
...
...
@@ -19,11 +19,9 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.
jam
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.
properties
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.EnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -32,12 +30,9 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0 at 27.02.2018
*
*/
public
class
JamProperty
implem
en
t
s
RoadProperty
{
public
class
JamProperty
ext
en
d
s
Abstract
RoadProperty
{
private
final
Location
_location
;
private
final
RoadNetworkEdge
_edge
;
private
final
boolean
_jammed
;
private
long
_detectionDate
;
private
double
_averageSpeed
=
-
1
;
public
JamProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pJammed
)
{
...
...
@@ -51,48 +46,55 @@ public class JamProperty implements RoadProperty {
}
public
JamProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pJammed
,
double
pAverageSpeed
)
{
_location
=
pLocation
;
_edge
=
pEdge
;
_jammed
=
pJammed
;
_detectionDate
=
Time
.
getCurrentTime
();
super
(
pLocation
,
pEdge
);
_jammed
=
pJammed
;
_averageSpeed
=
pAverageSpeed
;
}
public
void
resetDetectionDate
()
{
_d
etectionDate
=
Time
.
getCurrentTime
();
setD
etectionDate
(
Time
.
getCurrentTime
()
)
;
}
@Override
public
long
getDetectionDate
()
{
return
_detectionDate
;
public
boolean
isJammed
()
{
return
JamProperty
.
isJammed
(
getEdge
(),
getAverageSpeed
());
}
@Override
public
Location
getLocation
()
{
return
_location
;
public
double
getAverageSpeed
()
{
return
_averageSpeed
;
}
@Override
public
RoadNetworkEdge
getEdge
()
{
return
_edge
;
public
void
setAverageSpeed
(
double
pAverageSpeed
)
{
_averageSpeed
=
pAverageSpeed
;
}
public
boolean
isJammed
()
{
return
_jammed
;
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
JamProperty
(
getLocation
(),
getEdge
(),
false
,
-
1
);
}
public
double
getAverageSpeed
()
{
return
_averageSpeed
;
public
static
boolean
isJammed
(
RoadNetworkEdge
pEdge
,
double
pSpeed
)
{
if
(
pEdge
!=
null
)
{
double
originalMaxSpeed
=
pEdge
.
getOriginalMaxSpeed
();
if
(
pSpeed
<
originalMaxSpeed
*
0.675
)
{
return
true
;
}
}
return
false
;
}
public
void
setAverageSpeed
(
double
pAverageSpeed
)
{
_averageSpeed
=
pAverageSpeed
;
@Override
public
Object
getValue
()
{
return
getAverageSpeed
();
}
@Override
public
EnvironmentProperty
getDefaultProperty
()
{
return
new
JamProperty
(
_location
,
_edge
,
false
,
-
1
);
public
JamProperty
clone
()
{
JamProperty
jamProperty
=
new
JamProperty
(
getLocation
(),
getEdge
(),
_jammed
,
_averageSpeed
);
jamProperty
.
setDuration
(
getDuration
());
jamProperty
.
setDetectionDate
(
getDetectionDate
());
return
jamProperty
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/LocationBasedEnvironmentProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/
LocationBasedEnvironmentProperty.java
View file @
e157b605
...
...
@@ -19,7 +19,7 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
...
...
@@ -30,4 +30,6 @@ import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
*/
public
interface
LocationBasedEnvironmentProperty
extends
EnvironmentProperty
{
Location
getLocation
();
void
setLocation
(
Location
pLocation
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/RainProperty.java
0 → 100644
View file @
e157b605
/*
* 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* @author Bjoern Bueschke
* @version 1.0 at 27.03.2018
*
*/
public
class
RainProperty
extends
AbstractRoadProperty
{
private
final
boolean
_rain
;
public
RainProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pRain
)
{
super
(
pLocation
,
pEdge
);
_rain
=
pRain
;
}
public
boolean
hasRain
()
{
return
_rain
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
RainProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasRain
();
}
@Override
public
RainProperty
clone
()
{
RainProperty
property
=
new
RainProperty
(
getLocation
(),
getEdge
(),
_rain
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/RoadProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/
RoadProperty.java
View file @
e157b605
...
...
@@ -19,7 +19,7 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -28,10 +28,25 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0 at 27.02.2018
*
*/
public
interface
RoadProperty
extends
LocationBasedEnvironmentProperty
{
public
interface
RoadProperty
extends
LocationBasedEnvironmentProperty
,
AggregatedProperty
,
Comparable
<
RoadProperty
>,
Cloneable
{
RoadNetworkEdge
getEdge
();
EnvironmentProperty
getDefaultProperty
();
void
setEdge
(
RoadNetworkEdge
pEdge
);
RoadProperty
getDefaultProperty
();
long
getDetectionDate
();
Object
getValue
();
boolean
equalLocation
(
RoadProperty
pRoadProperty
);
boolean
isDetourable
();
RoadProperty
clone
();
long
getDuration
();
void
setDuration
(
long
pDuration
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/properties/TrafficSignProperty.java
0 → 100644
View file @
e157b605
/*
* Copyright (c) 2005-2018 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.sensor.environment.data.properties
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
/**
* @author Bjoern Bueschke
* @version 1.0 at 26.03.2018
*
*/
public
class
TrafficSignProperty
extends
AbstractRoadProperty
{
private
final
boolean
_sign
;
public
TrafficSignProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
boolean
pSign
)
{
super
(
pLocation
,
pEdge
);
_sign
=
pSign
;
}
public
boolean
hasSign
()
{
return
_sign
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
TrafficSignProperty
(
getLocation
(),
getEdge
(),
false
);
}
@Override
public
Object
getValue
()
{
return
hasSign
();
}
@Override
public
TrafficSignProperty
clone
()
{
TrafficSignProperty
property
=
new
TrafficSignProperty
(
getLocation
(),
getEdge
(),
_sign
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/VehicleProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/
VehicleProperty.java
View file @
e157b605
...
...
@@ -19,9 +19,9 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties
;
import
de.tudarmstadt.maki.simonstrator.api.
Time
;
import
de.tudarmstadt.maki.simonstrator.api.
component.privacy.PrivacyLevel
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -30,42 +30,57 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0 at 27.02.2018
*
*/
public
class
VehicleProperty
implem
en
t
s
LocationBasedEnvironment
Property
{
public
class
VehicleProperty
ext
en
d
s
AbstractRoad
Property
{
private
final
long
_id
;
private
final
Location
_location
;
private
final
RoadNetworkEdge
_edge
;
private
final
double
_speed
;
private
long
_detectionDate
;
private
final
double
_length
;
public
VehicleProperty
(
long
pId
,
Location
pLocation
,
RoadNetworkEdge
pEdge
,
double
pSpeed
)
{
private
PrivacyLevel
_privacy
;
public
VehicleProperty
(
long
pId
,
Location
pLocation
,
RoadNetworkEdge
pEdge
,
double
pSpeed
,
double
pLength
)
{
this
(
pId
,
pLocation
,
pEdge
,
pSpeed
,
pLength
,
PrivacyLevel
.
NO_PRIVACY
);
}
public
VehicleProperty
(
long
pId
,
Location
pLocation
,
RoadNetworkEdge
pEdge
,
double
pSpeed
,
double
pLength
,
PrivacyLevel
pPrivacyLevel
)
{
super
(
pLocation
,
pEdge
);
_id
=
pId
;
_location
=
pLocation
;
_edge
=
pEdge
;
_speed
=
pSpeed
;
_detectionDate
=
Time
.
getCurrentTime
();
_length
=
pLength
;
_privacy
=
pPrivacyLevel
;
}
public
long
getId
()
{
return
_id
;
}
@Override
public
long
getDetectionDate
()
{
return
_detectionDate
;
public
double
getSpeed
()
{
return
_speed
;
}
@Override
public
Location
getLocation
()
{
return
_location
;
public
Object
getValue
()
{
return
getSpeed
()
;
}
public
RoadNetworkEdge
getEdge
()
{
return
_
edge
;
public
double
getLength
()
{
return
_
length
;
}
public
double
getSpeed
()
{
return
_speed
;
public
PrivacyLevel
getPrivacy
()
{
return
_privacy
;
}
@Override
public
RoadProperty
getDefaultProperty
()
{
return
null
;
}
@Override
public
VehicleProperty
clone
()
{
return
new
VehicleProperty
(
_id
,
getLocation
(),
getEdge
(),
_speed
,
_length
,
_privacy
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/NumericVectoralProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/vectoral/
NumericVectoralProperty.java
View file @
e157b605
...
...
@@ -19,7 +19,7 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties.vectoral
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
jam
/VectoralJamProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/vectoral
/VectoralJamProperty.java
View file @
e157b605
...
...
@@ -19,15 +19,16 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.
jam
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.
properties.vectoral
;
import
java.util.Arrays
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.EnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.NumericVectoralProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.ProbabilityDistribution
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.TemporalDependencyMatrix
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.jam.EventInformationContainer
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.JamProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -38,7 +39,7 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
*/
public
class
VectoralJamProperty
extends
NumericVectoralProperty
{
public
static
final
double
SCALING
=
6
;
p
rivate
static
final
int
DIMENSIONS
=
15
;
p
ublic
static
final
int
DIMENSIONS
=
15
;
// private static Map<Double, Double> _requiredStandardDeviation = new
// HashMap<>();
...
...
@@ -69,47 +70,19 @@ public class VectoralJamProperty extends NumericVectoralProperty {
// pAccuracy);
// break;
case
GAUSSIAN:
setGaussianWithAccuracy
(
pSpeed
/
VectoralJamProperty
.
SCALING
,
pAccuracy
);
setGaussianWithAccuracy
(
Math
.
min
(
pSpeed
/
VectoralJamProperty
.
SCALING
,
DIMENSIONS
-
1
),
pAccuracy
);
break
;
default
:
throw
new
AssertionError
(
"Unknown ProbablilityDistribution "
+
pDist
);
}
}
// private void setSimpleSpeed(double pSpeed, double pAccuracy) {
// double[] valueProbabilities = getValueProbabilities();
// Arrays.fill(valueProbabilities, 0);
// int index = (int) (pSpeed / SCALING);
// valueProbabilities[index] += pAccuracy;
//
// if (index + 1 < valueProbabilities.length) {
// valueProbabilities[index + 1] += (1 - pAccuracy) / 2.0;
// } else {
// valueProbabilities[index - 1] += (1 - pAccuracy) / 2.0;
// }
//
// if (index - 1 >= 1) {
// valueProbabilities[index - 1] += (1 - pAccuracy) / 2.0;
// } else {
// valueProbabilities[index + 1] += (1 - pAccuracy) / 2.0;
// }
// }
//
// public void setGaussianSpeedWithAccuracy(double pSpeed, double pAccuracy)
// {
// double deviation = determineCorrectDeviation(pSpeed, pAccuracy);
// setGaussianProbabilities(pSpeed / SCALING, deviation / SCALING);
// }
//
// public void setGaussianSpeed(double pSpeed, double pDeviation) {
// setGaussianProbabilities(pSpeed / SCALING, pDeviation / SCALING);
// }
@Override
public
VectoralJamProperty
clone
()
{
VectoralJamProperty
vectoralJamProperty
=
new
VectoralJamProperty
(
getLocation
(),
getEdge
());
vectoralJamProperty
.
setProbabilities
(
Arrays
.
copyOf
(
getValueProbabilities
(),
getValueProbabilities
().
length
));
vectoralJamProperty
.
setDetectionDate
(
getDetectionDate
());
vectoralJamProperty
.
setDuration
(
getDuration
());
return
vectoralJamProperty
;
}
...
...
@@ -119,8 +92,10 @@ public class VectoralJamProperty extends NumericVectoralProperty {
}
@Override
public
EnvironmentProperty
getDefaultProperty
()
{
return
new
VectoralJamProperty
(
getLocation
(),
getEdge
());
public
RoadProperty
getDefaultProperty
()
{
VectoralJamProperty
jamProperty
=
new
VectoralJamProperty
(
getLocation
(),
getEdge
());
jamProperty
.
setSpeed
(
getEdge
().
getOriginalMaxSpeedState
());
return
jamProperty
;
}
@Override
...
...
@@ -131,7 +106,7 @@ public class VectoralJamProperty extends NumericVectoralProperty {
@Override
public
int
getIndexForValue
(
Object
pValue
)
{
if
(
pValue
instanceof
Number
)
{
return
(
int
)
(((
Number
)
pValue
).
doubleValue
()
*
SCALING
);
return
(
int
)
(((
Number
)
pValue
).
doubleValue
()
/
SCALING
);
}
throw
new
AssertionError
(
"Unknown value!"
);
}
...
...
@@ -140,7 +115,8 @@ public class VectoralJamProperty extends NumericVectoralProperty {
public
TemporalDependencyMatrix
getDependencyMatrix
()
{
if
(
_temporalDependencyMatrix
==
null
)
{
TemporalDependencyMatrix
temporalDependencyMatrix
=
new
TemporalDependencyMatrix
(
DIMENSIONS
);
double
TEMPORAL_CHANGE
=
1
/
((
double
)
JamInformationContainer
.
EVENT_DURATION
/
Time
.
SECOND
)
/
2.0
;
double
TEMPORAL_CHANGE
=
1
/
((
double
)
EventInformationContainer
.
getEventDuration
(
JamProperty
.
class
)
/
Time
.
SECOND
)
/
2.0
;
for
(
int
x
=
0
;
x
<
DIMENSIONS
;
x
++)
{
double
[]
probabilities
=
new
double
[
DIMENSIONS
];
if
(
x
>
1
)
{
...
...
@@ -176,24 +152,9 @@ 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
public
int
hashCode
()
{
return
Double
.
hashCode
(
getMostProbableValue
());
}
@Override
public
boolean
equals
(
Object
pObj
)
{
if
(
pObj
instanceof
VectoralJamProperty
)
{
...
...
@@ -213,39 +174,4 @@ public class VectoralJamProperty extends NumericVectoralProperty {
return
(
int
)
(
RoadNetworkEdge
.
getCorrespondingState
(
getEdge
().
getOriginalMaxSpeed
())
/
SCALING
);
}
// public double determineCorrectDeviation(double speed, double pAccuracy) {
// if (!_requiredStandardDeviation.containsKey(speed)) {
// if (pAccuracy < 1) {
// VectoralJamProperty vectoralJamProperty = new VectoralJamProperty(null,
// null);
//
// double deviation = 10;
//
// boolean reduceChange = false;
// double currentChange = deviation / 2;
//
// do {
// vectoralJamProperty.setGaussianSpeed(speed, deviation);
// if (vectoralJamProperty.getProbabilityForValue(speed) > pAccuracy) {
// deviation += currentChange;
// } else {
// deviation -= currentChange;
// reduceChange = true;
// }
//
// if (reduceChange) {
// currentChange /= 2.0;
// }
// } while (Math.round(vectoralJamProperty.getProbabilityForValue(speed) *
// 10000) != Math
// .round(pAccuracy * 10000));
//
// _requiredStandardDeviation.put(speed, deviation);
// } else {
// _requiredStandardDeviation.put(speed, 0d);
// }
// }
//
// return _requiredStandardDeviation.get(speed);
// }
}
\ No newline at end of file
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/VectoralProperty.java
→
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/
properties/vectoral/
VectoralProperty.java
View file @
e157b605
...
...
@@ -19,13 +19,15 @@
*/
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
;
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data
.properties.vectoral
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.Map
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.ProbabilityDistribution
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.TemporalDependencyMatrix
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.AbstractRoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -34,25 +36,17 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0 at 27.02.2018
*
*/
public
abstract
class
VectoralProperty
implements
RoadProperty
,
Cloneable
{
private
static
final
boolean
TRIM_PROBABILITIES
=
false
;
private
static
final
double
MINIMAL_PROBABILITY
=
0.0001
;
public
abstract
class
VectoralProperty
extends
AbstractRoadProperty
implements
Cloneable
{
private
static
Map
<
DeviationIdentifier
,
Double
>
_requiredStandardDeviation
=
new
HashMap
<>();
private
final
Location
_location
;
private
final
RoadNetworkEdge
_edge
;
private
long
_detectionDate
;
private
double
[]
_valueProbabilities
;
public
VectoralProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
int
valueAmount
)
{
this
(
pLocation
,
pEdge
,
createProbabilityArray
(
valueAmount
));
}
public
VectoralProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
double
[]
values
)
{
_location
=
pLocation
;
_edge
=
pEdge
;
_detectionDate
=
Time
.
getCurrentTime
();
super
(
pLocation
,
pEdge
);
_valueProbabilities
=
values
;
}
...
...
@@ -67,9 +61,6 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
for
(
int
i
=
0
;
i
<
_valueProbabilities
.
length
;
i
++)
{
double
probability
=
1
/
(
2
*
Math
.
PI
*
Math
.
pow
(
pDeviation
,
2
))
*
Math
.
exp
(-
Math
.
pow
(
i
-
pMean
,
2
)
/
(
2
*
Math
.
pow
(
pDeviation
,
2
)));
if
(
probability
<
MINIMAL_PROBABILITY
&&
TRIM_PROBABILITIES
)
{
probability
=
MINIMAL_PROBABILITY
;
}
_valueProbabilities
[
i
]
=
probability
;
sum
+=
probability
;
}
...
...
@@ -81,15 +72,6 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
Arrays
.
fill
(
_valueProbabilities
,
0
);
_valueProbabilities
[(
int
)
Math
.
round
(
pMean
)]
=
1
;
// int lowerMean = (int) Math.floor(pMean);
// int higherMean = (int) Math.ceil(pMean);
// double difference = pMean - lowerMean;
//
// _valueProbabilities[lowerMean] = 1 - difference;
//
// if (lowerMean != higherMean) {
// _valueProbabilities[higherMean] = difference;
// }
}
}
...
...
@@ -99,25 +81,6 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
return
probabilities
;
}
@Override
public
long
getDetectionDate
()
{
return
_detectionDate
;
}
protected
void
setDetectionDate
(
long
pDetectionDate
)
{
_detectionDate
=
pDetectionDate
;
}
@Override
public
Location
getLocation
()
{
return
_location
;
}
@Override
public
RoadNetworkEdge
getEdge
()
{
return
_edge
;
}
public
double
[]
getValueProbabilities
()
{
return
_valueProbabilities
;
}
...
...
@@ -173,9 +136,6 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
double
sum
=
0
;
for
(
int
i
=
0
;
i
<
valueProbabilities
.
length
;
i
++)
{
if
(
valueProbabilities
[
i
]
<
MINIMAL_PROBABILITY
&&
TRIM_PROBABILITIES
)
{
valueProbabilities
[
i
]
=
MINIMAL_PROBABILITY
;
}
sum
+=
valueProbabilities
[
i
];
}
for
(
int
i
=
0
;
i
<
valueProbabilities
.
length
;
i
++)
{
...
...
@@ -202,9 +162,6 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
double
[]
valueProbabilities
=
result
.
getValueProbabilities
();
for
(
int
i
=
0
;
i
<
valueProbabilities
.
length
;
i
++)
{
valueProbabilities
[
i
]
*=
pVectoralProperty
.
getValueProbabilities
()[
i
];
if
(
valueProbabilities
[
i
]
<
MINIMAL_PROBABILITY
&&
TRIM_PROBABILITIES
)
{
valueProbabilities
[
i
]
=
MINIMAL_PROBABILITY
;
}
sum
+=
valueProbabilities
[
i
];
}
...
...
@@ -296,7 +253,20 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
public
abstract
int
getDefaultIndex
();
@Override
public
boolean
equals
(
Object
pObj
)
{
if
(
pObj
instanceof
VectoralProperty
)
{
VectoralProperty
vector
=
(
VectoralProperty
)
pObj
;
return
vector
.
getClass
().
equals
(
getClass
())
&&
vector
.
getEdge
().
equals
(
getEdge
())
&&
vector
.
getMostProbableIndex
()
==
getMostProbableIndex
();
}
return
super
.
equals
(
pObj
);
}
private
class
DeviationIdentifier
{
private
static
final
double
GRANULARITY
=
0.0001
;
private
Class
<?
extends
VectoralProperty
>
_propertyClass
;
private
int
_index
;
private
double
_accuracy
;
...
...
@@ -304,7 +274,7 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
public
DeviationIdentifier
(
Class
<?
extends
VectoralProperty
>
pPropertyClass
,
int
pIndex
,
double
pAccuracy
)
{
_propertyClass
=
pPropertyClass
;
_index
=
pIndex
;
_accuracy
=
pAccuracy
;
_accuracy
=
(
int
)
(
pAccuracy
/
GRANULARITY
)
*
GRANULARITY
;
}
public
Class
<?
extends
VectoralProperty
>
getPropertyClass
()
{
...
...
@@ -321,18 +291,32 @@ public abstract class VectoralProperty implements RoadProperty, Cloneable {
@Override
public
int
hashCode
()
{
return
_index
*
Double
.
hashCode
(
_accuracy
);
int
prime
=
31
;
return
Integer
.
hashCode
(
_index
)
*
prime
+
Double
.
hashCode
(
_accuracy
);
}
@Override
public
boolean
equals
(
Object
pObj
)
{
if
(
pObj
instanceof
DeviationIdentifier
)
{
DeviationIdentifier
identifier
=
(
DeviationIdentifier
)
pObj
;
return
_propertyClass
.
equals
(
identifier
.
getPropertyClass
())
&&
_index
==
identifier
.
getIndex
()
&&
_accuracy
==
identifier
.
getAccuracy
();
public
boolean
equals
(
Object
obj
)
{
if
(
obj
instanceof
DeviationIdentifier
)
{
DeviationIdentifier
deviationIdentifier
=
(
DeviationIdentifier
)
obj
;
return
deviationIdentifier
.
_accuracy
==
_accuracy
&&
deviationIdentifier
.
_index
==
_index
&&
deviationIdentifier
.
_propertyClass
.
equals
(
_propertyClass
);
}
return
super
.
equals
(
pObj
)
;
return
false
;
}
private
VectoralProperty
getOuterType
()
{
return
VectoralProperty
.
this
;
}
}
@Override
public
Object
getValue
()
{
return
getMostProbableValue
();
}
@Override
public
String
toString
()
{
return
Arrays
.
toString
(
_valueProbabilities
);
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/roadcondition/RoadConditionProperty.java
View file @
e157b605
...
...
@@ -21,9 +21,8 @@
package
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.roadcondition
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.EnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.AbstractRoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -32,11 +31,8 @@ import de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.Road
* @version 1.0 at 27.02.2018
*
*/
public
class
RoadConditionProperty
implem
en
t
s
RoadProperty
{
public
class
RoadConditionProperty
ext
en
d
s
Abstract
RoadProperty
{
private
final
Location
_location
;
private
final
RoadNetworkEdge
_edge
;
private
long
_detectionDate
;
private
RoadCondition
_roadCondition
;
public
RoadConditionProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
)
{
...
...
@@ -44,39 +40,34 @@ public class RoadConditionProperty implements RoadProperty {
}
public
RoadConditionProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
,
RoadCondition
pRoadCondition
)
{
_location
=
pLocation
;
_edge
=
pEdge
;
_detectionDate
=
Time
.
getCurrentTime
();
super
(
pLocation
,
pEdge
);
_roadCondition
=
pRoadCondition
;
}
@Override
public
long
getDetectionDate
()
{
return
_detectionDate
;
public
RoadCondition
getRoadCondition
()
{
return
_roadCondition
;
}
@Override
public
Location
getLocation
()
{
return
_location
;
public
void
setRoadCondition
(
RoadCondition
pRoadCondition
)
{
_roadCondition
=
pRoadCondition
;
}
@Override
public
RoadNetworkEdge
getEdg
e
()
{
return
_edge
;
public
Object
getValu
e
()
{
return
getRoadCondition
()
;
}
public
RoadCondition
getRoadCondition
()
{
return
_roadCondition
;
}
public
void
setRoadCondition
(
RoadCondition
pRoadCondition
)
{
_roadCondition
=
pRoadCondition
;
@Override
public
RoadProperty
getDefaultProperty
()
{
return
new
RoadConditionProperty
(
getLocation
(),
getEdge
(),
RoadCondition
.
DRY
);
}
@Override
public
EnvironmentProperty
getDefaultProperty
()
{
return
new
RoadConditionProperty
(
_location
,
_edge
,
RoadCondition
.
DRY
);
public
RoadConditionProperty
clone
()
{
RoadConditionProperty
property
=
new
RoadConditionProperty
(
getLocation
(),
getEdge
(),
_roadCondition
);
property
.
setDuration
(
getDuration
());
property
.
setDetectionDate
(
getDetectionDate
());
return
property
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/data/roadcondition/VectoralRoadConditionProperty.java
View file @
e157b605
...
...
@@ -24,11 +24,11 @@ package de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.r
import
java.util.Arrays
;
import
de.tudarmstadt.maki.simonstrator.api.Time
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.EnvironmentProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.ProbabilityDistribution
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.TemporalDependencyMatrix
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.VectoralProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.jam.JamInformationContainer
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.jam.EventInformationContainer
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.vectoral.VectoralProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
...
...
@@ -71,6 +71,7 @@ public class VectoralRoadConditionProperty extends VectoralProperty {
VectoralRoadConditionProperty
vectoralJamProperty
=
new
VectoralRoadConditionProperty
(
getLocation
(),
getEdge
());
vectoralJamProperty
.
setProbabilities
(
Arrays
.
copyOf
(
getValueProbabilities
(),
getValueProbabilities
().
length
));
vectoralJamProperty
.
setDetectionDate
(
getDetectionDate
());
vectoralJamProperty
.
setDuration
(
getDuration
());
return
vectoralJamProperty
;
}
...
...
@@ -80,7 +81,7 @@ public class VectoralRoadConditionProperty extends VectoralProperty {
}
@Override
public
Environment
Property
getDefaultProperty
()
{
public
Road
Property
getDefaultProperty
()
{
return
new
VectoralRoadConditionProperty
(
getLocation
(),
getEdge
());
}
...
...
@@ -98,7 +99,9 @@ public class VectoralRoadConditionProperty extends VectoralProperty {
public
TemporalDependencyMatrix
getDependencyMatrix
()
{
if
(
_temporalDependencyMatrix
==
null
)
{
TemporalDependencyMatrix
temporalDependencyMatrix
=
new
TemporalDependencyMatrix
(
DIMENSIONS
);
double
TEMPORAL_CHANGE
=
1
/
((
double
)
JamInformationContainer
.
EVENT_DURATION
/
Time
.
SECOND
)
/
2.0
;
double
TEMPORAL_CHANGE
=
1
/
((
double
)
EventInformationContainer
.
getEventDuration
(
RoadConditionProperty
.
class
)
/
Time
.
SECOND
)
/
2.0
;
{
double
[]
probabilities
=
new
double
[
DIMENSIONS
];
...
...
@@ -141,25 +144,6 @@ public class VectoralRoadConditionProperty extends VectoralProperty {
return
0
;
}
@Override
public
int
hashCode
()
{
return
getMostProbableValue
().
hashCode
();
}
@Override
public
boolean
equals
(
Object
pObj
)
{
if
(
pObj
instanceof
VectoralRoadConditionProperty
)
{
VectoralRoadConditionProperty
property
=
(
VectoralRoadConditionProperty
)
pObj
;
if
(
property
.
getMostProbableValue
().
equals
(
getMostProbableValue
()))
{
return
true
;
}
return
false
;
}
return
super
.
equals
(
pObj
);
}
@Override
public
int
getDefaultIndex
()
{
return
0
;
...
...
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/BumpPropertyGenerator.java
0 → 100755
View file @
e157b605
/*
* 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.sensor.environment.generator
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.BumpProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
public
class
BumpPropertyGenerator
implements
RoadPropertyGenerator
{
@Override
public
RoadProperty
generateProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
)
{
return
new
BumpProperty
(
pLocation
,
pEdge
,
true
);
}
@Override
public
Class
<?
extends
RoadProperty
>
getGenerateClass
()
{
return
BumpProperty
.
class
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/FogPropertyGenerator.java
0 → 100755
View file @
e157b605
/*
* 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.sensor.environment.generator
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.FogProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
public
class
FogPropertyGenerator
implements
RoadPropertyGenerator
{
@Override
public
RoadProperty
generateProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
)
{
return
new
FogProperty
(
pLocation
,
pEdge
,
true
);
}
@Override
public
Class
<?
extends
RoadProperty
>
getGenerateClass
()
{
return
FogProperty
.
class
;
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/sensor/environment/generator/HazardPropertyGenerator.java
0 → 100755
View file @
e157b605
/*
* 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.sensor.environment.generator
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.HazardProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.environment.data.properties.RoadProperty
;
import
de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location
;
import
de.tudarmstadt.maki.simonstrator.api.component.vehicular.roadnetwork.RoadNetworkEdge
;
public
class
HazardPropertyGenerator
implements
RoadPropertyGenerator
{
@Override
public
RoadProperty
generateProperty
(
Location
pLocation
,
RoadNetworkEdge
pEdge
)
{
return
new
HazardProperty
(
pLocation
,
pEdge
,
true
);
}
@Override
public
Class
<?
extends
RoadProperty
>
getGenerateClass
()
{
return
HazardProperty
.
class
;
}
}
Prev
1
2
3
4
5
6
7
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