From 0263c6b40d4cc843efa34baf05d4d7d77b8ce53e Mon Sep 17 00:00:00 2001 From: "U-TTG\\pego" Date: Mon, 14 Jul 2014 16:53:47 +0200 Subject: Initial version of TrafficIncidentsService API, documentation and PoC --- src/traffic-incidents-service/ReadMe.txt | 250 +++ .../org.genivi.basetypes-model/.classpath | 9 + .../org.genivi.basetypes-model/.project | 21 + .../META-INF/MANIFEST.MF | 18 + .../org.genivi.basetypes-model/ReadMe.confluence | 1 + .../org.genivi.basetypes-model/build.properties | 14 + .../model/Basetypes.ecore | 165 ++ .../model/Basetypes.ecorediag | 429 ++++ .../model/Basetypes.genmodel | 64 + .../org.genivi.basetypes-model/plugin.properties | 8 + .../org.genivi.basetypes-model/plugin.xml | 29 + .../org.genivi.basetypes-model/pom.xml | 34 + .../src/org/genivi/common/CommonFactory.java | 74 + .../src/org/genivi/common/CommonPackage.java | 582 +++++ .../src/org/genivi/common/Coordinate.java | 110 + .../src/org/genivi/common/LocalizedString.java | 190 ++ .../src/org/genivi/common/RectangularArea.java | 92 + .../src/org/genivi/common/Version.java | 263 +++ .../org/genivi/common/impl/CommonFactoryImpl.java | 135 ++ .../org/genivi/common/impl/CommonPackageImpl.java | 413 ++++ .../src/org/genivi/common/impl/CoordinateImpl.java | 272 +++ .../genivi/common/impl/LocalizedStringImpl.java | 380 ++++ .../genivi/common/impl/RectangularAreaImpl.java | 247 +++ .../src/org/genivi/common/impl/VersionImpl.java | 468 ++++ .../genivi/common/util/CommonAdapterFactory.java | 181 ++ .../src/org/genivi/common/util/CommonSwitch.java | 182 ++ .../src/org/genivi/location/AreaLocation.java | 29 + .../src/org/genivi/location/AreaLocationInfo.java | 24 + .../src/org/genivi/location/LinearLocation.java | 161 ++ .../org/genivi/location/LinearLocationInfo.java | 157 ++ .../src/org/genivi/location/Location.java | 29 + .../src/org/genivi/location/LocationFactory.java | 112 + .../src/org/genivi/location/LocationInfo.java | 86 + .../src/org/genivi/location/LocationPackage.java | 796 +++++++ .../src/org/genivi/location/PointLocation.java | 29 + .../src/org/genivi/location/PointLocationInfo.java | 59 + .../src/org/genivi/location/PointLocationType.java | 269 +++ .../org/genivi/location/impl/AreaLocationImpl.java | 46 + .../genivi/location/impl/AreaLocationInfoImpl.java | 46 + .../genivi/location/impl/LinearLocationImpl.java | 332 +++ .../location/impl/LinearLocationInfoImpl.java | 391 ++++ .../genivi/location/impl/LocationFactoryImpl.java | 230 ++ .../src/org/genivi/location/impl/LocationImpl.java | 48 + .../org/genivi/location/impl/LocationInfoImpl.java | 252 +++ .../genivi/location/impl/LocationPackageImpl.java | 484 +++++ .../genivi/location/impl/PointLocationImpl.java | 46 + .../location/impl/PointLocationInfoImpl.java | 170 ++ .../location/util/LocationAdapterFactory.java | 253 +++ .../org/genivi/location/util/LocationSwitch.java | 276 +++ .../org.genivi.booleanexpr-model/.classpath | 16 + .../org.genivi.booleanexpr-model/.project | 23 + .../META-INF/MANIFEST.MF | 19 + .../org.genivi.booleanexpr-model/ReadMe.confluence | 6 + .../org.genivi.booleanexpr-model/build.properties | 14 + .../model/Family.ecore | 45 + .../model/Family.ecorediag | 186 ++ .../model/Family.genmodel | 37 + .../model/FilterExpr.ecore | 186 ++ .../model/FilterExpr.ecorediag | 694 ++++++ .../model/FilterExpr.genmodel | 110 + .../org.genivi.booleanexpr-model/plugin.properties | 8 + .../org.genivi.booleanexpr-model/plugin.xml | 28 + .../org.genivi.booleanexpr-model/pom.xml | 42 + .../org/genivi/booleanexpr/BooleanExpression.java | 47 + .../org/genivi/booleanexpr/BooleanLiteral.java | 87 + .../org/genivi/booleanexpr/ClassAttribute.java | 225 ++ .../org/genivi/booleanexpr/ComparisonOperator.java | 326 +++ .../genivi/booleanexpr/ComparisonPredicate.java | 118 ++ .../org/genivi/booleanexpr/DownCastPredicate.java | 143 ++ .../org/genivi/booleanexpr/DyadicExpression.java | 199 ++ .../genivi/booleanexpr/DyadicLogicalOperator.java | 219 ++ .../org/genivi/booleanexpr/FilterexprFactory.java | 148 ++ .../org/genivi/booleanexpr/FilterexprPackage.java | 1559 ++++++++++++++ .../java/org/genivi/booleanexpr/InOperator.java | 218 ++ .../java/org/genivi/booleanexpr/InPredicate.java | 186 ++ .../org/genivi/booleanexpr/IsSetPredicate.java | 60 + .../java/org/genivi/booleanexpr/ListOperator.java | 243 +++ .../main/java/org/genivi/booleanexpr/Literal.java | 25 + .../java/org/genivi/booleanexpr/MetaOperator.java | 188 ++ .../genivi/booleanexpr/MultiplicityPredicate.java | 194 ++ .../java/org/genivi/booleanexpr/Predicate.java | 28 + .../genivi/booleanexpr/SignedIntegerLiteral.java | 87 + .../java/org/genivi/booleanexpr/StringLiteral.java | 87 + .../org/genivi/booleanexpr/SubClassPredicate.java | 141 ++ .../org/genivi/booleanexpr/UnaryExpression.java | 91 + .../genivi/booleanexpr/UnaryLogicalOperator.java | 191 ++ .../booleanexpr/impl/BooleanExpressionImpl.java | 67 + .../booleanexpr/impl/BooleanLiteralImpl.java | 204 ++ .../booleanexpr/impl/ClassAttributeImpl.java | 587 +++++ .../booleanexpr/impl/ComparisonPredicateImpl.java | 580 +++++ .../booleanexpr/impl/DownCastPredicateImpl.java | 412 ++++ .../booleanexpr/impl/DyadicExpressionImpl.java | 593 ++++++ .../booleanexpr/impl/FilterexprFactoryImpl.java | 394 ++++ .../booleanexpr/impl/FilterexprPackageImpl.java | 934 ++++++++ .../genivi/booleanexpr/impl/InPredicateImpl.java | 613 ++++++ .../booleanexpr/impl/IsSetPredicateImpl.java | 245 +++ .../org/genivi/booleanexpr/impl/LiteralImpl.java | 57 + .../impl/MultiplicityPredicateImpl.java | 638 ++++++ .../org/genivi/booleanexpr/impl/PredicateImpl.java | 60 + .../booleanexpr/impl/SignedIntegerLiteralImpl.java | 204 ++ .../genivi/booleanexpr/impl/StringLiteralImpl.java | 207 ++ .../booleanexpr/impl/SubClassPredicateImpl.java | 462 ++++ .../booleanexpr/impl/UnaryExpressionImpl.java | 306 +++ .../genivi/booleanexpr/util/FilterExprUtil.java | 714 +++++++ .../booleanexpr/util/FilterexprAdapterFactory.java | 379 ++++ .../genivi/booleanexpr/util/FilterexprSwitch.java | 429 ++++ .../org/genivi/booleanexpr/BooleanExprTests.java | 439 ++++ .../src/test/java/org/genivi/family/Address.java | 84 + .../src/test/java/org/genivi/family/Car.java | 84 + .../src/test/java/org/genivi/family/Family.java | 282 +++ .../test/java/org/genivi/family/FamilyFactory.java | 85 + .../test/java/org/genivi/family/FamilyPackage.java | 707 +++++++ .../src/test/java/org/genivi/family/Person.java | 160 ++ .../src/test/java/org/genivi/family/Sexe.java | 215 ++ .../test/java/org/genivi/family/WealthyFamily.java | 83 + .../java/org/genivi/family/impl/AddressImpl.java | 204 ++ .../test/java/org/genivi/family/impl/CarImpl.java | 204 ++ .../org/genivi/family/impl/FamilyFactoryImpl.java | 197 ++ .../java/org/genivi/family/impl/FamilyImpl.java | 604 ++++++ .../org/genivi/family/impl/FamilyPackageImpl.java | 437 ++++ .../java/org/genivi/family/impl/PersonImpl.java | 352 +++ .../org/genivi/family/impl/WealthyFamilyImpl.java | 200 ++ .../genivi/family/util/FamilyAdapterFactory.java | 199 ++ .../java/org/genivi/family/util/FamilySwitch.java | 202 ++ .../org.genivi.iconset-model/.classpath | 9 + .../org.genivi.iconset-model/.project | 21 + .../org.genivi.iconset-model/META-INF/MANIFEST.MF | 15 + .../org.genivi.iconset-model/ReadMe.confluence | 5 + .../org.genivi.iconset-model/build.properties | 14 + .../org.genivi.iconset-model/model/IconSet.ecore | 67 + .../model/IconSet.ecorediag | 260 +++ .../model/IconSet.genmodel | 53 + .../org.genivi.iconset-model/plugin.properties | 8 + .../org.genivi.iconset-model/plugin.xml | 20 + .../org.genivi.iconset-model/pom.xml | 34 + .../src/org/genivi/iconset/ColorType.java | 323 +++ .../src/org/genivi/iconset/IconData.java | 84 + .../src/org/genivi/iconset/IconDefinition.java | 138 ++ .../src/org/genivi/iconset/IconDescriptor.java | 138 ++ .../src/org/genivi/iconset/IconDimension.java | 215 ++ .../src/org/genivi/iconset/IconInfo.java | 138 ++ .../src/org/genivi/iconset/IconSet.java | 456 ++++ .../src/org/genivi/iconset/IconSize.java | 192 ++ .../src/org/genivi/iconset/IconsetFactory.java | 94 + .../src/org/genivi/iconset/IconsetPackage.java | 890 ++++++++ .../src/org/genivi/iconset/impl/IconDataImpl.java | 204 ++ .../genivi/iconset/impl/IconDefinitionImpl.java | 372 ++++ .../genivi/iconset/impl/IconDescriptorImpl.java | 289 +++ .../src/org/genivi/iconset/impl/IconInfoImpl.java | 309 +++ .../src/org/genivi/iconset/impl/IconSetImpl.java | 851 ++++++++ .../src/org/genivi/iconset/impl/IconSizeImpl.java | 380 ++++ .../genivi/iconset/impl/IconsetFactoryImpl.java | 232 ++ .../genivi/iconset/impl/IconsetPackageImpl.java | 549 +++++ .../genivi/iconset/util/IconsetAdapterFactory.java | 217 ++ .../src/org/genivi/iconset/util/IconsetSwitch.java | 222 ++ .../org.genivi.locref-model/.classpath | 10 + .../org.genivi.locref-model/.project | 23 + .../org.genivi.locref-model/META-INF/MANIFEST.MF | 16 + .../org.genivi.locref-model/ReadMe.confluence | 4 + .../org.genivi.locref-model/build.properties | 14 + .../model/LocationReference.ecore | 41 + .../model/LocationReference.ecorediag | 131 ++ .../model/LocationReference.genmodel | 42 + .../org.genivi.locref-model/plugin.properties | 8 + .../org.genivi.locref-model/plugin.xml | 20 + .../org.genivi.locref-model/pom.xml | 38 + .../src/org/genivi/locref/LocationReference.java | 138 ++ .../locref/LocationReferenceDecodingService.java | 49 + .../LocationReferenceDecodingServiceListener.java | 43 + .../org/genivi/locref/LocationReferenceType.java | 215 ++ .../org/genivi/locref/LocationReferenceTypes.java | 16 + .../impl/LocationReferenceDecodingServiceImpl.java | 83 + ...cationReferenceDecodingServiceListenerImpl.java | 73 + .../genivi/locref/impl/LocationReferenceImpl.java | 292 +++ .../org/genivi/locref/impl/locrefFactoryImpl.java | 175 ++ .../org/genivi/locref/impl/locrefPackageImpl.java | 314 +++ .../src/org/genivi/locref/locrefFactory.java | 67 + .../src/org/genivi/locref/locrefPackage.java | 295 +++ .../genivi/locref/util/locrefAdapterFactory.java | 163 ++ .../src/org/genivi/locref/util/locrefSwitch.java | 159 ++ .../.classpath | 30 + .../.project | 28 + .../ReadMe.confluence | 1 + .../pom.xml | 60 + .../dbus/impl/DBusTrafficIncidentsService.java | 108 + .../.classpath | 29 + .../.project | 27 + .../ReadMe.confluence | 1 + .../pom.xml | 39 + .../trafficincidentfeed/dbus/AdviceStruct.java | 36 + .../dbus/ApplicabilityStruct.java | 28 + .../dbus/CauseDiscriminatedVariant.java | 29 + .../trafficincidentfeed/dbus/CauseStruct.java | 15 + .../trafficincidentfeed/dbus/CauseType.java | 33 + .../dbus/DirectCauseStruct.java | 54 + .../dbus/LaneRestrictionsStruct.java | 25 + .../dbus/LinkedCauseStruct.java | 25 + .../dbus/LocalizedStringStruct.java | 30 + .../dbus/LocationReferenceStruct.java | 25 + .../dbus/TemporarySpeedLimitSectionStruct.java | 32 + .../dbus/TemporarySpeedLimitStruct.java | 38 + .../dbus/TrafficIncidentFeedDBus.java | 46 + .../dbus/TrafficIncidentStruct.java | 106 + .../dbus/VehicleRelatedRestrictionStruct.java | 36 + .../trafficincidentfeed/dbus/VersionStruct.java | 35 + .../trafficincidentfeed/dbus/impl/StructUtil.java | 1447 +++++++++++++ .../dbus/impl/TrafficIncidentFeedDBusProxy.java | 319 +++ .../dbus/impl/TrafficIncidentsUpdatesAdaptor.java | 363 ++++ .../trafficincidents/dbus/AdviceStruct.java | 36 + .../trafficincidents/dbus/ApplicabilityStruct.java | 28 + .../dbus/AreaLocationInfoStruct.java | 28 + .../trafficincidents/dbus/AreaLocationStruct.java | 12 + .../dbus/CategoryDefinitionStruct.java | 39 + .../dbus/CauseDiscriminatedVariant.java | 29 + .../trafficincidents/dbus/CauseStruct.java | 15 + .../trafficincidents/dbus/CauseType.java | 33 + .../trafficincidents/dbus/CoordinateStruct.java | 29 + .../trafficincidents/dbus/DirectCauseStruct.java | 54 + .../dbus/FeedInformationStruct.java | 40 + .../trafficincidents/dbus/IconDataStruct.java | 22 + .../dbus/IconDefinitionStruct.java | 26 + .../dbus/IconDescriptorStruct.java | 26 + .../trafficincidents/dbus/IconInfoStruct.java | 25 + .../trafficincidents/dbus/IconSetStruct.java | 52 + .../trafficincidents/dbus/IconSizeStruct.java | 30 + .../dbus/LaneRestrictionsStruct.java | 25 + .../dbus/LinearLocationInfoStruct.java | 51 + .../dbus/LinearLocationStruct.java | 33 + .../trafficincidents/dbus/LinkedCauseStruct.java | 25 + .../dbus/LocalizedStringStruct.java | 30 + .../dbus/LocationDiscriminatedVariant.java | 30 + .../dbus/LocationInfoDiscriminatedVariant.java | 34 + .../trafficincidents/dbus/LocationInfoStruct.java | 15 + .../trafficincidents/dbus/LocationInfoType.java | 34 + .../trafficincidents/dbus/LocationStruct.java | 14 + .../trafficincidents/dbus/LocationType.java | 34 + .../dbus/PointLocationInfoStruct.java | 32 + .../trafficincidents/dbus/PointLocationStruct.java | 12 + .../dbus/RectangularAreaStruct.java | 26 + .../dbus/TemporarySpeedLimitSectionStruct.java | 32 + .../dbus/TemporarySpeedLimitStruct.java | 38 + .../dbus/TrafficIncidentStruct.java | 138 ++ .../dbus/TrafficIncidentsDBus.java | 145 ++ .../trafficincidents/dbus/TwoTuple.java | 24 + .../dbus/VehicleRelatedRestrictionStruct.java | 36 + .../trafficincidents/dbus/VersionStruct.java | 35 + .../trafficincidents/dbus/impl/StructUtil.java | 2236 ++++++++++++++++++++ .../dbus/impl/TrafficIncidentsAdaptor.java | 1578 ++++++++++++++ .../dbus/impl/TrafficIncidentsDBusProxy.java | 1623 ++++++++++++++ .../dbus/impl/TrafficIncidentsListenerProxy.java | 131 ++ .../.classpath | 12 + .../.project | 25 + .../META-INF/MANIFEST.MF | 18 + .../ReadMe.confluence | 3 + .../build.properties | 14 + .../model/XTrafficIncident.ecore | 139 ++ .../model/XTrafficIncident.ecorediag | 529 +++++ .../model/XTrafficIncident.genmodel | 64 + .../plugin.properties | 8 + .../plugin.xml | 21 + .../pom.xml | 46 + .../trafficincident/Advice.java | 224 ++ .../trafficincident/Applicability.java | 129 ++ .../trafficincidentfeed/trafficincident/Cause.java | 87 + .../trafficincident/DirectCause.java | 398 ++++ .../trafficincident/LaneRestrictions.java | 141 ++ .../trafficincident/LinkedCause.java | 80 + .../trafficincident/TemporarySpeedLimit.java | 145 ++ .../TemporarySpeedLimitSection.java | 190 ++ .../trafficincident/TrafficIncident.java | 886 ++++++++ .../trafficincident/VehicleRelatedRestriction.java | 197 ++ .../trafficincident/XTrafficIncidentFactory.java | 128 ++ .../trafficincident/XTrafficIncidentPackage.java | 1730 +++++++++++++++ .../trafficincident/impl/AdviceImpl.java | 425 ++++ .../trafficincident/impl/ApplicabilityImpl.java | 281 +++ .../trafficincident/impl/CauseImpl.java | 204 ++ .../trafficincident/impl/DirectCauseImpl.java | 761 +++++++ .../trafficincident/impl/LaneRestrictionsImpl.java | 292 +++ .../trafficincident/impl/LinkedCauseImpl.java | 201 ++ .../impl/TemporarySpeedLimitImpl.java | 352 +++ .../impl/TemporarySpeedLimitSectionImpl.java | 378 ++++ .../trafficincident/impl/TrafficIncidentImpl.java | 1527 +++++++++++++ .../impl/VehicleRelatedRestrictionImpl.java | 435 ++++ .../impl/XTrafficIncidentFactoryImpl.java | 199 ++ .../impl/XTrafficIncidentPackageImpl.java | 882 ++++++++ .../util/XTrafficIncidentAdapterFactory.java | 287 +++ .../util/XTrafficIncidentSwitch.java | 306 +++ .../.classpath | 11 + .../.project | 24 + .../META-INF/MANIFEST.MF | 17 + .../ReadMe.confluence | 3 + .../build.properties | 14 + .../model/TrafficIncident.ecore | 150 ++ .../model/TrafficIncident.ecorediag | 568 +++++ .../model/TrafficIncident.genmodel | 70 + .../plugin.properties | 8 + .../plugin.xml | 21 + .../pom.xml | 42 + .../trafficincidents/trafficincident/Advice.java | 236 +++ .../trafficincident/Applicability.java | 129 ++ .../trafficincidents/trafficincident/Cause.java | 87 + .../trafficincident/DirectCause.java | 408 ++++ .../trafficincident/LaneRestrictions.java | 141 ++ .../trafficincident/LinkedCause.java | 80 + .../trafficincident/TemporarySpeedLimit.java | 172 ++ .../TemporarySpeedLimitSection.java | 190 ++ .../trafficincident/TrafficIncident.java | 1107 ++++++++++ .../trafficincident/VehicleRelatedRestriction.java | 197 ++ .../trafficincident/impl/AdviceImpl.java | 451 ++++ .../trafficincident/impl/ApplicabilityImpl.java | 275 +++ .../trafficincident/impl/CauseImpl.java | 200 ++ .../trafficincident/impl/DirectCauseImpl.java | 781 +++++++ .../trafficincident/impl/LaneRestrictionsImpl.java | 288 +++ .../trafficincident/impl/LinkedCauseImpl.java | 198 ++ .../impl/TemporarySpeedLimitImpl.java | 386 ++++ .../impl/TemporarySpeedLimitSectionImpl.java | 378 ++++ .../trafficincident/impl/TrafficIncidentImpl.java | 1914 +++++++++++++++++ .../impl/VehicleRelatedRestrictionImpl.java | 430 ++++ .../impl/trafficincidentFactoryImpl.java | 199 ++ .../impl/trafficincidentPackageImpl.java | 947 +++++++++ .../trafficincident/trafficincidentFactory.java | 128 ++ .../trafficincident/trafficincidentPackage.java | 1898 +++++++++++++++++ .../util/trafficincidentAdapterFactory.java | 287 +++ .../util/trafficincidentSwitch.java | 306 +++ .../.classpath | 22 + .../.project | 30 + .../META-INF/MANIFEST.MF | 24 + .../ReadMe.confluence | 3 + .../build.properties | 14 + .../model/TrafficIncidentsService.ecore | 683 ++++++ .../model/TrafficIncidentsService.ecorediag | 696 ++++++ .../model/TrafficIncidentsService.genmodel | 348 +++ .../plugin.properties | 8 + .../plugin.xml | 22 + .../pom.xml | 58 + .../CategoryDefinition.java | 218 ++ .../trafficincidentsservice/FeedInformation.java | 321 +++ .../genivi/trafficincidentsservice/LengthUnit.java | 213 ++ .../genivi/trafficincidentsservice/SpeedUnit.java | 213 ++ .../trafficincidentsservice/TextDetailLevel.java | 213 ++ .../TrafficIncidentFeed.java | 116 + .../TrafficIncidentFeedListener.java | 74 + .../TrafficIncidentFeedStatus.java | 245 +++ .../TrafficIncidentField.java | 718 +++++++ .../trafficincidentsservice/TrafficIncidents.java | 383 ++++ .../TrafficIncidentsListener.java | 422 ++++ .../TrafficIncidentsStatus.java | 241 +++ .../genivi/trafficincidentsservice/WeightUnit.java | 213 ++ .../impl/CategoryDefinitionImpl.java | 464 ++++ .../impl/FeedInformationImpl.java | 556 +++++ .../impl/TrafficIncidentFeedImpl.java | 141 ++ .../impl/TrafficIncidentFeedListenerImpl.java | 103 + .../impl/TrafficIncidentsImpl.java | 441 ++++ .../impl/TrafficIncidentsListenerImpl.java | 488 +++++ .../impl/trafficincidentsserviceFactoryImpl.java | 362 ++++ .../impl/trafficincidentsservicePackageImpl.java | 903 ++++++++ .../trafficincidentsserviceFactory.java | 92 + .../trafficincidentsservicePackage.java | 788 +++++++ .../trafficincidentsserviceAdapterFactory.java | 219 ++ .../util/trafficincidentsserviceSwitch.java | 225 ++ .../.classpath | 10 + .../.project | 23 + .../META-INF/MANIFEST.MF | 15 + .../ReadMe.confluence | 3 + .../build.properties | 14 + .../model/TrafficIncidentTables.ecore | 348 +++ .../model/TrafficIncidentTables.ecorediag | 1726 +++++++++++++++ .../model/TrafficIncidentTables.genmodel | 352 +++ .../plugin.properties | 8 + .../plugin.xml | 21 + .../pom.xml | 38 + .../trafficincidenttables/Accident.java | 348 +++ .../trafficincidenttables/AdviceCode.java | 618 ++++++ .../trafficincidenttables/AnimalsOnRoadway.java | 267 +++ .../trafficincidenttables/BrokenDownVehicles.java | 213 ++ .../trafficincidenttables/CauseCode.java | 996 +++++++++ .../trafficincidenttables/DangerousEndOfQueue.java | 267 +++ .../DoNotLeaveYourVehicle.java | 213 ++ .../trafficincidenttables/DriveCarefully.java | 240 +++ .../trafficincidenttables/DrivingNotAllowed.java | 186 ++ .../trafficincidenttables/EffectCode.java | 348 +++ .../ExtremeWeatherConditions.java | 321 +++ .../trafficincidenttables/Fire.java | 213 ++ .../trafficincidenttables/FollowDiversion.java | 186 ++ .../GivingPathVehiclesFromBehind.java | 213 ++ .../HazardousDrivingConditions.java | 402 ++++ .../trafficincidenttables/Impassibility.java | 321 +++ .../trafficincidenttables/LaneRestrictionType.java | 267 +++ .../trafficincidenttables/MajorEvent.java | 402 ++++ .../MalfunctioningRoadsideEquipment.java | 294 +++ .../trafficincidenttables/NarrowLanes.java | 267 +++ .../trafficincidenttables/ObjectsOnTheRoad.java | 348 +++ .../OvertakingNotAllowed.java | 267 +++ .../trafficincidenttables/PeopleOnRoadway.java | 240 +++ .../trafficincidenttables/PoliceCheckpoint.java | 213 ++ .../trafficincidenttables/Precipitation.java | 240 +++ .../trafficincidenttables/RecklessPersons.java | 240 +++ .../trafficincidenttables/RegulatoryMeasure.java | 319 +++ .../RescueAndRecoveryWorkInProgress.java | 294 +++ .../trafficincidenttables/RestrictionType.java | 905 ++++++++ .../trafficincidenttables/RiskOfFire.java | 213 ++ .../trafficincidenttables/RoadWorks.java | 240 +++ .../trafficincidenttables/ServiceNotOperating.java | 267 +++ .../trafficincidenttables/ServiceNotUsable.java | 294 +++ .../trafficincidenttables/SlipperyRoad.java | 429 ++++ .../trafficincidenttables/SlowMovingVehicles.java | 375 ++++ .../trafficincidenttables/Tendency.java | 348 +++ .../trafficincidenttables/TimeDelay.java | 240 +++ .../trafficincidenttables/TrafficCongestion.java | 186 ++ .../trafficincidenttables/UseTollLanes.java | 213 ++ .../trafficincidenttables/VehicleType.java | 456 ++++ .../trafficincidenttables/VisibilityReduced.java | 375 ++++ .../trafficincidenttables/WarningLevel.java | 267 +++ .../impl/trafficincidenttablesFactoryImpl.java | 1124 ++++++++++ .../impl/trafficincidenttablesPackageImpl.java | 1267 +++++++++++ .../trafficincidenttablesFactory.java | 38 + .../trafficincidenttablesPackage.java | 1347 ++++++++++++ .../org.genivi.trafficinfo.dbus-java/.classpath | 7 + .../org.genivi.trafficinfo.dbus-java/.project | 16 + .../ReadMe.confluence | 5 + .../org.genivi.trafficinfo.dbus-java/pom.xml | 28 + .../src/main/java/AUTHORS | 37 + .../src/main/java/COPYING | 680 ++++++ .../src/main/java/CreateInterface.bat | 10 + .../src/main/java/CreateInterface.sgml | 182 ++ .../src/main/java/CreateInterface.sh | 10 + .../src/main/java/DBusCall.bat | 10 + .../src/main/java/DBusCall.sgml | 126 ++ .../src/main/java/DBusCall.sh | 10 + .../src/main/java/DBusDaemon.bat | 10 + .../src/main/java/DBusDaemon.sgml | 212 ++ .../src/main/java/DBusDaemon.sh | 10 + .../src/main/java/DBusViewer.bat | 10 + .../src/main/java/DBusViewer.sgml | 107 + .../src/main/java/DBusViewer.sh | 10 + .../src/main/java/INSTALL | 101 + .../src/main/java/ListDBus.bat | 10 + .../src/main/java/ListDBus.sgml | 177 ++ .../src/main/java/ListDBus.sh | 10 + .../src/main/java/Makefile | 328 +++ .../src/main/java/README | 32 + .../src/main/java/changelog | 342 +++ .../src/main/java/compile.bat | 17 + .../src/main/java/dbus-java.tex | 1266 +++++++++++ .../src/main/java/org/freedesktop/DBus.java | 490 +++++ .../org/freedesktop/dbus/AbstractConnection.java | 1075 ++++++++++ .../main/java/org/freedesktop/dbus/ArrayFrob.java | 173 ++ .../main/java/org/freedesktop/dbus/BusAddress.java | 41 + .../java/org/freedesktop/dbus/CallbackHandler.java | 22 + .../main/java/org/freedesktop/dbus/Container.java | 88 + .../java/org/freedesktop/dbus/DBusAsyncReply.java | 111 + .../java/org/freedesktop/dbus/DBusCallInfo.java | 51 + .../java/org/freedesktop/dbus/DBusConnection.java | 780 +++++++ .../java/org/freedesktop/dbus/DBusInterface.java | 31 + .../org/freedesktop/dbus/DBusInterfaceName.java | 27 + .../main/java/org/freedesktop/dbus/DBusMap.java | 152 ++ .../java/org/freedesktop/dbus/DBusMatchRule.java | 143 ++ .../java/org/freedesktop/dbus/DBusMemberName.java | 27 + .../org/freedesktop/dbus/DBusSerializable.java | 38 + .../java/org/freedesktop/dbus/DBusSigHandler.java | 25 + .../main/java/org/freedesktop/dbus/DBusSignal.java | 276 +++ .../org/freedesktop/dbus/DirectConnection.java | 251 +++ .../java/org/freedesktop/dbus/EfficientMap.java | 116 + .../java/org/freedesktop/dbus/EfficientQueue.java | 107 + .../src/main/java/org/freedesktop/dbus/Error.java | 142 ++ .../java/org/freedesktop/dbus/ExportedObject.java | 166 ++ .../main/java/org/freedesktop/dbus/Gettext.java | 31 + .../java/org/freedesktop/dbus/InternalSignal.java | 20 + .../java/org/freedesktop/dbus/Marshalling.java | 629 ++++++ .../main/java/org/freedesktop/dbus/Message.java | 1225 +++++++++++ .../java/org/freedesktop/dbus/MessageReader.java | 175 ++ .../java/org/freedesktop/dbus/MessageWriter.java | 72 + .../main/java/org/freedesktop/dbus/MethodCall.java | 126 ++ .../java/org/freedesktop/dbus/MethodReturn.java | 69 + .../java/org/freedesktop/dbus/MethodTuple.java | 38 + .../main/java/org/freedesktop/dbus/ObjectPath.java | 23 + .../main/java/org/freedesktop/dbus/ObjectTree.java | 163 ++ .../src/main/java/org/freedesktop/dbus/Path.java | 40 + .../main/java/org/freedesktop/dbus/Position.java | 28 + .../freedesktop/dbus/RemoteInvocationHandler.java | 191 ++ .../java/org/freedesktop/dbus/RemoteObject.java | 56 + .../java/org/freedesktop/dbus/SignalTuple.java | 51 + .../java/org/freedesktop/dbus/StrongReference.java | 43 + .../src/main/java/org/freedesktop/dbus/Struct.java | 23 + .../main/java/org/freedesktop/dbus/Transport.java | 825 ++++++++ .../src/main/java/org/freedesktop/dbus/Tuple.java | 24 + .../java/org/freedesktop/dbus/TypeSignature.java | 37 + .../src/main/java/org/freedesktop/dbus/UInt16.java | 79 + .../src/main/java/org/freedesktop/dbus/UInt32.java | 79 + .../src/main/java/org/freedesktop/dbus/UInt64.java | 151 ++ .../main/java/org/freedesktop/dbus/Variant.java | 112 + .../main/java/org/freedesktop/dbus/bin/Caller.java | 83 + .../org/freedesktop/dbus/bin/CreateInterface.java | 711 +++++++ .../java/org/freedesktop/dbus/bin/DBusDaemon.java | 878 ++++++++ .../freedesktop/dbus/bin/IdentifierMangler.java | 43 + .../org/freedesktop/dbus/bin/IterableNodeList.java | 29 + .../java/org/freedesktop/dbus/bin/ListDBus.java | 74 + .../org/freedesktop/dbus/bin/NodeListIterator.java | 38 + .../org/freedesktop/dbus/bin/StructStruct.java | 54 + .../freedesktop/dbus/exceptions/DBusException.java | 26 + .../dbus/exceptions/DBusExecutionException.java | 40 + .../dbus/exceptions/FatalDBusException.java | 20 + .../dbus/exceptions/FatalException.java | 15 + .../dbus/exceptions/InternalMessageException.java | 20 + .../dbus/exceptions/MarshallingException.java | 20 + .../dbus/exceptions/MessageFormatException.java | 23 + .../MessageProtocolVersionException.java | 22 + .../dbus/exceptions/MessageTypeException.java | 22 + .../dbus/exceptions/NonFatalException.java | 15 + .../freedesktop/dbus/exceptions/NotConnected.java | 23 + .../dbus/exceptions/UnknownTypeCodeException.java | 21 + .../org/freedesktop/dbus/test/ProfileStruct.java | 32 + .../java/org/freedesktop/dbus/test/Profiler.java | 40 + .../freedesktop/dbus/test/ProfilerInstance.java | 28 + .../org/freedesktop/dbus/test/TestException.java | 24 + .../freedesktop/dbus/test/TestNewInterface.java | 26 + .../freedesktop/dbus/test/TestRemoteInterface.java | 57 + .../dbus/test/TestRemoteInterface2.java | 54 + .../freedesktop/dbus/test/TestSerializable.java | 48 + .../freedesktop/dbus/test/TestSignalInterface.java | 97 + .../dbus/test/TestSignalInterface2.java | 45 + .../java/org/freedesktop/dbus/test/TestStruct.java | 32 + .../org/freedesktop/dbus/test/TestStruct2.java | 31 + .../org/freedesktop/dbus/test/TestStruct3.java | 30 + .../java/org/freedesktop/dbus/test/TestTuple.java | 30 + .../freedesktop/dbus/test/TwoPartInterface.java | 29 + .../org/freedesktop/dbus/test/TwoPartObject.java | 18 + .../freedesktop/dbus/test/cross_test_client.java | 512 +++++ .../freedesktop/dbus/test/cross_test_server.java | 344 +++ .../java/org/freedesktop/dbus/test/profile.java | 381 ++++ .../main/java/org/freedesktop/dbus/test/test.java | 965 +++++++++ .../org/freedesktop/dbus/test/test_low_level.java | 56 + .../org/freedesktop/dbus/test/test_p2p_client.java | 42 + .../org/freedesktop/dbus/test/test_p2p_server.java | 94 + .../dbus/test/two_part_test_client.java | 42 + .../dbus/test/two_part_test_server.java | 55 + .../org/freedesktop/dbus/types/DBusListType.java | 44 + .../org/freedesktop/dbus/types/DBusMapType.java | 47 + .../org/freedesktop/dbus/types/DBusStructType.java | 44 + .../org/freedesktop/dbus/viewer/DBusEntry.java | 123 ++ .../freedesktop/dbus/viewer/DBusTableModel.java | 127 ++ .../org/freedesktop/dbus/viewer/DBusViewer.java | 363 ++++ .../org/freedesktop/dbus/viewer/FileSaver.java | 191 ++ .../freedesktop/dbus/viewer/IntrospectAction.java | 148 ++ .../org/freedesktop/dbus/viewer/SaveAllAction.java | 62 + .../freedesktop/dbus/viewer/SaveFileAction.java | 85 + .../dbus/viewer/StringStreamFactory.java | 47 + .../freedesktop/dbus/viewer/TabbedSaveAction.java | 108 + .../java/org/freedesktop/dbus/viewer/TextFile.java | 49 + .../src/main/java/tmp-session.conf | 31 + .../src/main/java/translations/en_GB.po | 213 ++ .../org.genivi.trafficinfo.demo/.classpath | 6 + .../org.genivi.trafficinfo.demo/.project | 17 + .../org.genivi.trafficinfo.demo/ReadMe.confluence | 24 + .../org.genivi.trafficinfo.demo/pom.xml | 22 + .../DataReceptionListener.java | 14 + .../Async2WayCommunicationChannelClient.java | 16 + ...yCommunicationChannelDataReceptionListener.java | 14 + .../Async2WayCommunicationChannelServer.java | 21 + .../impl/DummyAsyn2WayCommunicationChannel.java | 83 + .../broadcastchannel/Broadcast.java | 15 + .../broadcastchannel/BroadcastReception.java | 17 + .../impl/DummyBroadcastChannel.java | 65 + .../demo/logging/EclipseConsoleFormatter.java | 75 + .../demo/logging/EclipseConsoleFormatterDemo.java | 43 + .../uml/CommunicationChannel.png | Bin 0 -> 39088 bytes .../org.genivi.trafficinfo.libmatthew/.classpath | 6 + .../org.genivi.trafficinfo.libmatthew/.project | 14 + .../ReadMe.confluence | 4 + .../org.genivi.trafficinfo.libmatthew/pom.xml | 24 + .../src/main/java/COPYING | 21 + .../src/main/java/INSTALL | 10 + .../src/main/java/Makefile | 142 ++ .../src/main/java/README | 41 + .../src/main/java/cgi-java.c | 64 + .../src/main/java/changelog | 73 + .../src/main/java/cx/ath/matthew/cgi/CGI.java | 565 +++++ .../java/cx/ath/matthew/cgi/CGIErrorHandler.java | 41 + .../cx/ath/matthew/cgi/CGIHeaderSentException.java | 39 + .../cgi/CGIInvalidContentFormatException.java | 39 + .../src/main/java/cx/ath/matthew/cgi/CGITools.java | 48 + .../src/main/java/cx/ath/matthew/cgi/CheckBox.java | 46 + .../cx/ath/matthew/cgi/DefaultErrorHandler.java | 67 + .../main/java/cx/ath/matthew/cgi/DisplayField.java | 46 + .../src/main/java/cx/ath/matthew/cgi/DropDown.java | 131 ++ .../src/main/java/cx/ath/matthew/cgi/Field.java | 38 + .../src/main/java/cx/ath/matthew/cgi/HTMLForm.java | 141 ++ .../main/java/cx/ath/matthew/cgi/HiddenField.java | 46 + .../java/cx/ath/matthew/cgi/MultipleDropDown.java | 115 + .../src/main/java/cx/ath/matthew/cgi/NewTable.java | 42 + .../src/main/java/cx/ath/matthew/cgi/Password.java | 46 + .../src/main/java/cx/ath/matthew/cgi/Radio.java | 46 + .../main/java/cx/ath/matthew/cgi/SubmitButton.java | 54 + .../src/main/java/cx/ath/matthew/cgi/TextArea.java | 57 + .../main/java/cx/ath/matthew/cgi/TextField.java | 69 + .../src/main/java/cx/ath/matthew/cgi/testcgi.java | 78 + .../src/main/java/cx/ath/matthew/debug/Debug.class | Bin 0 -> 5845 bytes .../src/main/java/cx/ath/matthew/debug/Debug.java | 597 ++++++ .../src/main/java/cx/ath/matthew/debug/Debug.jpp | 597 ++++++ .../main/java/cx/ath/matthew/io/DOMPrinter.java | 114 + .../java/cx/ath/matthew/io/ExecInputStream.java | 142 ++ .../java/cx/ath/matthew/io/ExecOutputStream.java | 137 ++ .../main/java/cx/ath/matthew/io/InOutCopier.java | 115 + .../java/cx/ath/matthew/io/TeeInputStream.java | 155 ++ .../java/cx/ath/matthew/io/TeeOutputStream.java | 141 ++ .../src/main/java/cx/ath/matthew/io/test.java | 48 + .../src/main/java/cx/ath/matthew/io/test2.java | 39 + .../src/main/java/cx/ath/matthew/io/test3.java | 45 + .../cx/ath/matthew/unix/NotConnectedException.java | 37 + .../java/cx/ath/matthew/unix/USInputStream.java | 84 + .../java/cx/ath/matthew/unix/USOutputStream.java | 69 + .../java/cx/ath/matthew/unix/UnixIOException.java | 44 + .../java/cx/ath/matthew/unix/UnixServerSocket.java | 129 ++ .../main/java/cx/ath/matthew/unix/UnixSocket.java | 320 +++ .../cx/ath/matthew/unix/UnixSocketAddress.java | 85 + .../src/main/java/cx/ath/matthew/unix/java-unix.h | 112 + .../main/java/cx/ath/matthew/unix/testclient.java | 51 + .../main/java/cx/ath/matthew/unix/testserver.java | 55 + .../main/java/cx/ath/matthew/utils/Hexdump.java | 149 ++ .../src/main/java/unix-java.c | 464 ++++ .../org.genivi.trafficinfo.maven-parent/.project | 11 + .../org.genivi.trafficinfo.maven-parent/pom.xml | 182 ++ .../org.genivi.trafficinfo/.classpath | 28 + .../org.genivi.trafficinfo/.project | 26 + .../org.genivi.trafficinfo/OpenLR-encoder.log | 0 .../org.genivi.trafficinfo/ReadMe.confluence | 33 + .../org.genivi.trafficinfo/TextParts.properties | 1 + .../TextParts_en_US.properties | 1 + .../doc/Category definitions screenshot 1.png | Bin 0 -> 24120 bytes .../doc/Icons and Iconsets screenshot 1.png | Bin 0 -> 34923 bytes .../doc/List Client screenshot - status only.png | Bin 0 -> 7209 bytes .../doc/List Client screenshot 1.png | Bin 0 -> 64516 bytes .../doc/Map Client screenshot 1.png | Bin 0 -> 444466 bytes .../org.genivi.trafficinfo/doc/Thumbs.db | Bin 0 -> 31232 bytes .../doc/Warning Client screenshot 1.png | Bin 0 -> 17547 bytes .../org.genivi.trafficinfo/icons/Thumbs.db | Bin 0 -> 8192 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId1.png | Bin 0 -> 201 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId2.png | Bin 0 -> 211 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId3.png | Bin 0 -> 207 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId4.png | Bin 0 -> 206 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId5.png | Bin 0 -> 210 bytes ...0_RGB888_D_2D_night_themeId44_32x32_iconId6.png | Bin 0 -> 207 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId1.png | Bin 0 -> 161 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId2.png | Bin 0 -> 170 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId3.png | Bin 0 -> 168 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId4.png | Bin 0 -> 168 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId5.png | Bin 0 -> 171 bytes ...Id1_GRAY_8_D_2D_day_themeId28_32x32_iconId6.png | Bin 0 -> 172 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId1.png | Bin 0 -> 168 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId2.png | Bin 0 -> 177 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId3.png | Bin 0 -> 181 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId4.png | Bin 0 -> 183 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId5.png | Bin 0 -> 188 bytes ...Id2_RGB888_D_2D_day_themeId28_32x32_iconId6.png | Bin 0 -> 184 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId1.png | Bin 0 -> 169 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId2.png | Bin 0 -> 174 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId3.png | Bin 0 -> 170 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId4.png | Bin 0 -> 174 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId5.png | Bin 0 -> 181 bytes ...3_GRAY_8_D_2D_night_themeId28_32x32_iconId6.png | Bin 0 -> 172 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId1.png | Bin 0 -> 166 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId2.png | Bin 0 -> 174 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId3.png | Bin 0 -> 172 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId4.png | Bin 0 -> 178 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId5.png | Bin 0 -> 178 bytes ...4_RGB888_D_2D_night_themeId28_32x32_iconId6.png | Bin 0 -> 179 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId1.png | Bin 0 -> 216 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId2.png | Bin 0 -> 233 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId3.png | Bin 0 -> 237 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId4.png | Bin 0 -> 227 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId5.png | Bin 0 -> 229 bytes ...5_RGB888_D_2_5D_day_themeId28_32x32_iconId6.png | Bin 0 -> 231 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId1.png | Bin 0 -> 216 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId2.png | Bin 0 -> 230 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId3.png | Bin 0 -> 232 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId4.png | Bin 0 -> 222 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId5.png | Bin 0 -> 235 bytes ...RGB888_D_2_5D_night_themeId28_32x32_iconId6.png | Bin 0 -> 229 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId1.png | Bin 0 -> 190 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId2.png | Bin 0 -> 198 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId3.png | Bin 0 -> 196 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId4.png | Bin 0 -> 199 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId5.png | Bin 0 -> 200 bytes ...Id7_GRAY_8_D_2D_day_themeId44_32x32_iconId6.png | Bin 0 -> 202 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId1.png | Bin 0 -> 193 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId2.png | Bin 0 -> 202 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId3.png | Bin 0 -> 198 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId4.png | Bin 0 -> 201 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId5.png | Bin 0 -> 206 bytes ...Id8_RGB888_D_2D_day_themeId44_32x32_iconId6.png | Bin 0 -> 202 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId1.png | Bin 0 -> 198 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId2.png | Bin 0 -> 204 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId3.png | Bin 0 -> 203 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId4.png | Bin 0 -> 206 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId5.png | Bin 0 -> 210 bytes ...9_GRAY_8_D_2D_night_themeId44_32x32_iconId6.png | Bin 0 -> 206 bytes .../nsis/GENIVI_TomTom_64x64.bmp | Bin 0 -> 12342 bytes .../nsis/GENIVI_TomTom_64x64.png | Bin 0 -> 4369 bytes .../org.genivi.trafficinfo/nsis/Thumbs.db | Bin 0 -> 7680 bytes .../nsis/TomTom GENIVI Traffic Info license.rtf | 172 ++ .../org.genivi.trafficinfo/nsis/TrafficInfo.nsi | 223 ++ .../nsis/TrafficInfoBackground.bmp | Bin 0 -> 1029654 bytes .../nsis/TrafficInfo_32x32.ico | Bin 0 -> 4286 bytes .../nsis/genivi_chrome_1_transparent.png | Bin 0 -> 261894 bytes .../org.genivi.trafficinfo/nsis/notify.wav | Bin 0 -> 119384 bytes .../org.genivi.trafficinfo/nsis/road-smaller.png | Bin 0 -> 109872 bytes .../org.genivi.trafficinfo/nsis/road.jpg | Bin 0 -> 41204 bytes .../org.genivi.trafficinfo/pom.xml | 72 + .../resources/Traffic Info demo.sh | 1 + .../org/genivi/locref/decoder/LocationData.java | 30 + .../locref/decoder/LocationReferenceDecoder.java | 25 + .../locref/decoder/openlr/OpenLRDecoder.java | 359 ++++ .../LocationReferenceDecodingHandlerRefImpl.java | 79 + .../DefaultTrafficIncidentsListener.java | 258 +++ .../DefaultTrafficIncidentsUpdatesListener.java | 54 + .../refimpl/AreasFilter.java | 56 + .../refimpl/ExpirationHandler.java | 48 + .../refimpl/ExpressionFilter.java | 45 + .../trafficincidentsservice/refimpl/Filter.java | 67 + .../refimpl/LocationReferenceHandler.java | 193 ++ .../refimpl/ManagedTrafficIncident.java | 40 + .../refimpl/RectangularAreaUtils.java | 34 + .../refimpl/TrafficIncidentConvertor.java | 272 +++ .../refimpl/TrafficIncidentFilterUtils.java | 85 + .../refimpl/TrafficIncidentsService.java | 1426 +++++++++++++ .../refimpl/UpdateListenerInfo.java | 70 + .../TrafficIncidentTextGenerator.java | 50 + .../basictextgenerator/BasicTextGenerator.java | 877 ++++++++ .../basictextgenerator/TextParts.java | 38 + .../basictextgenerator/TextParts_en.java | 38 + .../basictextgenerator/TextParts_en_US.java | 38 + .../basictextgenerator/TextParts_nl.java | 39 + 732 files changed, 132522 insertions(+) create mode 100755 src/traffic-incidents-service/ReadMe.txt create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecore create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Coordinate.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/LocalizedString.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/RectangularArea.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Version.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CoordinateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/LocalizedStringImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/RectangularAreaImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/VersionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocation.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocationInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocation.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocationInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/Location.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocation.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationType.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationInfoImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationInfoImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationInfoImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationInfoImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecore create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecore create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanExpression.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanLiteral.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ClassAttribute.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DownCastPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicExpression.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicLogicalOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/IsSetPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ListOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Literal.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MetaOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MultiplicityPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Predicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SignedIntegerLiteral.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/StringLiteral.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SubClassPredicate.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryExpression.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryLogicalOperator.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanExpressionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanLiteralImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ClassAttributeImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ComparisonPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DownCastPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DyadicExpressionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/InPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/IsSetPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/LiteralImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/MultiplicityPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/PredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SignedIntegerLiteralImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/StringLiteralImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SubClassPredicateImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/UnaryExpressionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterExprUtil.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/booleanexpr/BooleanExprTests.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Address.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Car.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Family.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Person.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Sexe.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/WealthyFamily.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/AddressImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/CarImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/PersonImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/WealthyFamilyImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilyAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilySwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecore create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/ColorType.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconData.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDefinition.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDescriptor.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDimension.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSet.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSize.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDataImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDefinitionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDescriptorImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconInfoImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSetImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSizeImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecore create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReference.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingService.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingServiceListener.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceType.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceTypes.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceListenerImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/src/main/java/org/genivi/trafficincidentsservice/dbus/impl/DBusTrafficIncidentsService.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/AdviceStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/ApplicabilityStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseDiscriminatedVariant.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/DirectCauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LaneRestrictionsStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LinkedCauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocalizedStringStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocationReferenceStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitSectionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentFeedDBus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VehicleRelatedRestrictionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VersionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/StructUtil.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentFeedDBusProxy.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentsUpdatesAdaptor.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AdviceStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/ApplicabilityStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationInfoStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CategoryDefinitionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseDiscriminatedVariant.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CoordinateStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/DirectCauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/FeedInformationStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDataStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDefinitionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDescriptorStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconInfoStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSetStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSizeStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LaneRestrictionsStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationInfoStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinkedCauseStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocalizedStringStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationDiscriminatedVariant.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoDiscriminatedVariant.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationInfoStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/RectangularAreaStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitSectionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentsDBus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TwoTuple.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VehicleRelatedRestrictionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VersionStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/StructUtil.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsAdaptor.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsDBusProxy.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsListenerProxy.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecore create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Advice.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Applicability.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Cause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/DirectCause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LaneRestrictions.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LinkedCause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimit.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimitSection.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TrafficIncident.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/VehicleRelatedRestriction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/AdviceImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/ApplicabilityImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/CauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/DirectCauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LaneRestrictionsImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LinkedCauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitSectionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TrafficIncidentImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/VehicleRelatedRestrictionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecore create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Advice.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Applicability.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Cause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/DirectCause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LaneRestrictions.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LinkedCause.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimit.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimitSection.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TrafficIncident.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/VehicleRelatedRestriction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/AdviceImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/ApplicabilityImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/CauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/DirectCauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LaneRestrictionsImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LinkedCauseImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitSectionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TrafficIncidentImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/VehicleRelatedRestrictionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecore create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/CategoryDefinition.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/FeedInformation.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/LengthUnit.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/SpeedUnit.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TextDetailLevel.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeed.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedStatus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentField.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidents.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsStatus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/WeightUnit.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/CategoryDefinitionImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/FeedInformationImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedListenerImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsListenerImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsserviceFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsservicePackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsserviceFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsservicePackage.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceAdapterFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceSwitch.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/META-INF/MANIFEST.MF create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/build.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecore create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecorediag create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.genmodel create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Accident.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AdviceCode.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AnimalsOnRoadway.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/BrokenDownVehicles.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/CauseCode.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DangerousEndOfQueue.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DoNotLeaveYourVehicle.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DriveCarefully.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DrivingNotAllowed.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/EffectCode.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ExtremeWeatherConditions.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Fire.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/FollowDiversion.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/GivingPathVehiclesFromBehind.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/HazardousDrivingConditions.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Impassibility.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/LaneRestrictionType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MajorEvent.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MalfunctioningRoadsideEquipment.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/NarrowLanes.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ObjectsOnTheRoad.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/OvertakingNotAllowed.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PeopleOnRoadway.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PoliceCheckpoint.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Precipitation.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RecklessPersons.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RegulatoryMeasure.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RescueAndRecoveryWorkInProgress.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RestrictionType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RiskOfFire.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RoadWorks.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotOperating.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotUsable.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlipperyRoad.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlowMovingVehicles.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Tendency.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TimeDelay.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TrafficCongestion.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/UseTollLanes.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VehicleType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VisibilityReduced.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/WarningLevel.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesFactoryImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesPackageImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesPackage.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/AUTHORS create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/COPYING create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sgml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sgml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sgml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sgml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/INSTALL create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sgml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/Makefile create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/README create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/changelog create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/compile.bat create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/dbus-java.tex create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/DBus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/AbstractConnection.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ArrayFrob.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/BusAddress.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/CallbackHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Container.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusAsyncReply.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusCallInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusConnection.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterfaceName.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMap.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMatchRule.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMemberName.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSerializable.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSigHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSignal.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DirectConnection.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientMap.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientQueue.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Error.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ExportedObject.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Gettext.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/InternalSignal.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Message.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageReader.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageWriter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodCall.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodReturn.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodTuple.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectPath.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectTree.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Path.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Position.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteInvocationHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteObject.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/SignalTuple.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/StrongReference.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Struct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Transport.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Tuple.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/TypeSignature.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt16.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt32.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt64.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Variant.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/Caller.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/CreateInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/DBusDaemon.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IdentifierMangler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IterableNodeList.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/ListDBus.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/NodeListIterator.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/StructStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusExecutionException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalDBusException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/InternalMessageException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MarshallingException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageFormatException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageProtocolVersionException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageTypeException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NonFatalException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NotConnected.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/UnknownTypeCodeException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfileStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/Profiler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfilerInstance.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestNewInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface2.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSerializable.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface2.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct2.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct3.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestTuple.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartInterface.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartObject.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_client.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_server.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/profile.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_low_level.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_server.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_client.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_server.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusListType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusMapType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusStructType.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusEntry.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusTableModel.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusViewer.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/FileSaver.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/IntrospectAction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveAllAction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveFileAction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/StringStreamFactory.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TabbedSaveAction.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TextFile.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/tmp-session.conf create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/translations/en_GB.po create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/DataReceptionListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelClient.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelDataReceptionListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelServer.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/impl/DummyAsyn2WayCommunicationChannel.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/Broadcast.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/BroadcastReception.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/impl/DummyBroadcastChannel.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatterDemo.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.demo/uml/CommunicationChannel.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/COPYING create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/INSTALL create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/Makefile create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/README create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cgi-java.c create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/changelog create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGI.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGITools.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CheckBox.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DisplayField.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DropDown.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Field.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HTMLForm.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HiddenField.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/MultipleDropDown.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/NewTable.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Password.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Radio.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/SubmitButton.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextArea.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextField.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/testcgi.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.class create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.jpp create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/DOMPrinter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecInputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecOutputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/InOutCopier.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeInputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeOutputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test2.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test3.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/NotConnectedException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USInputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USOutputStream.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixIOException.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixServerSocket.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocket.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocketAddress.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/java-unix.h create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testclient.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testserver.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/utils/Hexdump.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/unix-java.c create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/.classpath create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/.project create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/OpenLR-encoder.log create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/ReadMe.confluence create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/TextParts.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/TextParts_en_US.properties create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/Category definitions screenshot 1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/Icons and Iconsets screenshot 1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot - status only.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot 1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/Map Client screenshot 1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/Thumbs.db create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/doc/Warning Client screenshot 1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/Thumbs.db create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId1.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId2.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId3.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId4.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId5.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId6.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.bmp create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/Thumbs.db create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TomTom GENIVI Traffic Info license.rtf create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo.nsi create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfoBackground.bmp create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo_32x32.ico create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/genivi_chrome_1_transparent.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/notify.wav create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road-smaller.png create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road.jpg create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/pom.xml create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/resources/Traffic Info demo.sh create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationData.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationReferenceDecoder.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/openlr/OpenLRDecoder.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/refimpl/LocationReferenceDecodingHandlerRefImpl.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsUpdatesListener.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/AreasFilter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpirationHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpressionFilter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/Filter.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/LocationReferenceHandler.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ManagedTrafficIncident.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/RectangularAreaUtils.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentConvertor.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentFilterUtils.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentsService.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/UpdateListenerInfo.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/TrafficIncidentTextGenerator.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/BasicTextGenerator.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en_US.java create mode 100755 src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_nl.java (limited to 'src/traffic-incidents-service') diff --git a/src/traffic-incidents-service/ReadMe.txt b/src/traffic-incidents-service/ReadMe.txt new file mode 100755 index 0000000..c75c6f7 --- /dev/null +++ b/src/traffic-incidents-service/ReadMe.txt @@ -0,0 +1,250 @@ +Introduction +============ +This folder contains a Java Proof of Concept implementation of the GENIVI TrafficIncidentsService, and a proxy library as a convenience for Java clients of this service. +See 'ivi-navigation/test/traffic-incidents-service' for examples of running this service (without D-Bus) with a test Feed and several clients within Eclipse, and for running the same (with D-Bus) on Linux. + + +Project structure +================= +This project consists of a number of Eclipse projects. +Data models are created with the Eclipse Modeling Framework (EMF), so EMF has to be installed in your Eclipse in order to compile and run the projects. All projects which contain an EMF model, have an extension '-model'. +Each project has a 'ReadMe.confluence' file, which provides basic information on the project. +The following package naming convention is used: + +org.genivi: +Basename for all packages. + + trafficincidentsservice: + All files related to the TrafficIncidentsService (interfaces, data models and implementation). + + booleanexpr, common, iconset, location, locref: + Classes that could be re-used in GENIVI. + + trafficinfo: + All other code of this PoC, i.e. code to demonstrate the use of the TrafficIncidentsService. + + +Building the complete PoC in Eclipse (no D-Bus) +=========================================================== +The repository contains the Eclipse projects, but not an Eclipse WorkSpace. So this has to be created manually. +Start Eclipse and chose your 'ivi-navigation/src/traffic-incidents-service' folder as WorkSpace. Import all the projects. + + + +Eclipse projects +================ + +org.genivi.basetypes-model +-------------------------- +This project defines basic data types, which should become generic GENIVI data types. +Packages: + +org.genivi.common +Common classes: Coordinate, LocalizedString, RectangularArea. + +org.genivi.common.impl +Implementation of org.genivi.common + +org.genivi.common.util +Utility classes related to org.genivi.common + +org.genivi.location +Classes describing locations. + +org.genivi.location.impl +Implementation of org.genivi.location + +org.genivi.location.util +Utility classes related to org.genivi.location + + +org.genivi.booleanexpr-model +---------------------------- +This project defines a Boolean Expression. These expressions are used in the TrafficIncidents interface, but can also be used in other locations where hierarchical data is used. +Packages: + +org.genivi.booleanexpr +The interface definition for Boolean Expressions. + +org.genivi.booleanexpr.impl +Implementation of org.genivi.booleanexpr + +org.genivi.booleanexpr.util +Utility classes related to org.genivi.booleanexpr + + +org.genivi.iconset-model +------------------------ +This project defines an Icon Set. Icon Sets are used in the TrafficIncidents interface, but can also be used in other locations where icons are used. +Packages: + +org.genivi.iconset +The interface definition for Icon Sets. + +org.genivi.iconset.impl +Implementation of org.genivi.iconset + +org.genivi.iconset.util +Utility classes related to org.genivi.iconset + + +org.genivi.locref-model +----------------------- +This project defines an interface for decoding Location References. Currently this is an internal interface within the TrafficIncidentsService. However, in the future, they may be a separate component for decoding Location References (as part of Map Data Access). +Packages: + +org.genivi.locref +The interface definition for decoding Location References. + +org.genivi.locref.impl +Implementation of org.genivi.locref + +org.genivi.locref.util +Utility classes related to org.genivi.locref + + +org.genivi.trafficincidentsservice-model +---------------------------------------- +This project defines the main interfaces of the TrafficIncidentsService. The data models for traffic incidents are in sub packages. +Packages: + +org.genivi.trafficincidentsservice +The main interfaces of the TrafficIncidentsService. + +org.genivi.trafficincidentsservice.impl +The generated implementation of org.genivi.trafficincidentsservice. From here the generated implementations TrafficIncidentsImpl.java and TrafficIncidentFeed.java are not used. + +org.genivi.trafficincidentsservice.util +Utility classes related to org.genivi.trafficincidentsservice. + + +org.genivi.trafficincidentsservice.dbus.impl +-------------------------------------------- +This project contains a class to wrap the TrafficIncidentsService from org.genivi.trafficincidentsservice.refimpl into a D-Bus service. +Packages: + +org.genivi.trafficincidentsservice.dbus.impl +The class to wrap the TrafficIncidentsService into a D-Bus service. + + +org.genivi.trafficincidentsservice.dbuswrapper +---------------------------------------------- +This project defines the D-Bus version of the interfaces of the TrafficIncidentsService and it contains the Proxies and Adaptors to connect the D-Bus interfaces to the plain java interfaces. +Packages: + +org.genivi.trafficincidentsservice.trafficincidents.dbus +D-Bus interface definition for the TrafficIncidents interface. + +org.genivi.trafficincidentsservice.trafficincidents.dbus.impl +Glue between the java version and the D-Bus version of the TrafficIncidents interface (Proxy and Adaptor). + +org.genivi.trafficincidentsservice.trafficincidentfeed.dbus +D-Bus interface definition for the TrafficIncidentFeed interface. + +org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.impl +Glue between the java version and the D-Bus version of the TrafficIncidentFeed interface (Proxy and Adaptor). + + +org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model +------------------------------------------------------------------------------------------------ +This project defines the TrafficIncident data model as used in the TrafficIncidentFeed interface. +Packages: + +org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident +The TrafficIncident data model. + +org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl +Implementation of the TrafficIncident data model. + +org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.util +Utility classes related to the TrafficIncident data model. + + +org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model +------------------------------------------------------------------------------------------ +This project defines the TrafficIncident data model as used in the TrafficIncidents interface. +Packages: + +org.genivi.trafficincidentsservice.trafficincidents.trafficincident +The TrafficIncident data model. + +org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl +Implementation of the TrafficIncident data model. + +org.genivi.trafficincidentsservice.trafficincidents.trafficincident.util +Utility classes related to the TrafficIncident data model. + + +org.genivi.trafficincidentsservice.trafficincidenttables-model +-------------------------------------------------------------- +This project defines the tables that are used in the Traffic Incident definitions of both the TrafficIncidents interface and the TrafficIncidentFeed interface. +Packages: + +org.genivi.trafficincidentsservice.trafficincidenttables +The tables that are used in the Traffic Incident definitions. + +org.genivi.trafficincidentsservice.trafficincidenttables.impl +Implementation related to org.genivi.trafficincidentsservice.trafficincidenttables. + + +org.genivi.trafficinfo +---------------------- +This project contains the main part of the Java only PoC for the TrafficIncidentsService. It makes use of several data models which are defined in other packages. +On top of this there are projects to add D-Bus layers between the components. +Packages + +org.genivi.locref.decoder +Interface definition for Location Reference decoders. This interface is used in the implementation of org.genivi.locref.LocationReferenceDecodingService. + +org.genivi.locref.decoder.openlr +OpenLR implementation of decoder interface defined in org.genivi.locref.decoder. + +org.genivi.locref.refimpl +Reference implementation of org.genivi.locref.LocationReferenceDecodingService + +org.genivi.trafficincidentsservice +Contains default implementations for TrafficIncidentsListener and TrafficIncidentFeedListener. + +org.genivi.trafficincidentsservice.refimpl +Reference implementation of a TrafficIncidentsService (without any D-Bus binding). + +org.genivi.trafficincidentsservice.textgenerator +Defines an interface for a text generator, as a sub component of the TrafficIncidentsService. + +org.genivi.trafficincidentsservice.textgenerator.basictextgenerator +Basic implementation of a textgenerator. + + +org.genivi.trafficinfo.dbus-java +-------------------------------- +This project is a copy of the dbus-java project by Matthew Johnson, with small modifications needed to get the TrafficIncidentsService PoC running. Therefore there is no further description of this project. + + +org.genivi.trafficinfo.demo +--------------------------- +This project contains classes which can be used in demo's and prototypes. +Packages: + +org.genivi.trafficinfo.demo.communicationchannel +Contains classes for communication channels (Used to simulation the communication channels between the server and the client) + +org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel +Defines the interfaces for a 2 way communication channel (currently not used in this PoC). + +org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel.impl +Provides a dummy implementation for a 2 way communication channel. + +org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel +Defines the interfaces for a broadcast channel. + +org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.impl +Provides a dummy implementation for a broadcast channel. + +org.genivi.trafficinfo.demo.logging +Provides a formatter, which creates a link to the Java code in Eclipse console output. + + +org.genivi.trafficinfo.libmatthew +--------------------------------- +This is an unmodified copy of the 'libmatthew' project by Matthew Johnson. Therefore there is no further description of this project. +This project is copied here as it is used by the dbus-java project. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/.classpath b/src/traffic-incidents-service/org.genivi.basetypes-model/.classpath new file mode 100755 index 0000000..1bf6a1d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/.project b/src/traffic-incidents-service/org.genivi.basetypes-model/.project new file mode 100755 index 0000000..46923a1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/.project @@ -0,0 +1,21 @@ + + + org.genivi.basetypes-model + This project contains types that should be common types in GENIVI. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.basetypes-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..86efe56 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.basetypes-model;singleton:=true +Bundle-Version: 1.0.0 +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.common, + org.genivi.common.impl, + org.genivi.common.util, + org.genivi.location, + org.genivi.location.impl, + org.genivi.location.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.basetypes-model/ReadMe.confluence new file mode 100755 index 0000000..bd18258 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/ReadMe.confluence @@ -0,0 +1 @@ +This project defines basic data types, which should become generic GENIVI data types. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/build.properties b/src/traffic-incidents-service/org.genivi.basetypes-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecore b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecore new file mode 100755 index 0000000..593b416 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecore @@ -0,0 +1,165 @@ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + + +
+ + + +
+ + +
+
+ + + + +
+ + +
+
+ + + + +
+ + +
+
+ + + + +
+ + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecorediag b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecorediag new file mode 100755 index 0000000..7fadab3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.ecorediag @@ -0,0 +1,429 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.genmodel b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.genmodel new file mode 100755 index 0000000..c149388 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/model/Basetypes.genmodel @@ -0,0 +1,64 @@ + + + Basetypes.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.properties b/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.properties new file mode 100755 index 0000000..b6ff1c0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = Basetypes Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.xml b/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.xml new file mode 100755 index 0000000..8d03986 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/plugin.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/pom.xml b/src/traffic-incidents-service/org.genivi.basetypes-model/pom.xml new file mode 100755 index 0000000..ea6909c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + org.genivi + basetypes-model + jar + 1.0-SNAPSHOT + GENIVI Base Types + This project contains types that should be common types in GENIVI. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonFactory.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonFactory.java new file mode 100755 index 0000000..ede045e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonFactory.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.common.CommonPackage + * @generated + */ +public interface CommonFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + CommonFactory eINSTANCE = org.genivi.common.impl.CommonFactoryImpl.init(); + + /** + * Returns a new object of class 'Coordinate'. + * + * + * @return a new object of class 'Coordinate'. + * @generated + */ + Coordinate createCoordinate(); + + /** + * Returns a new object of class 'Rectangular Area'. + * + * + * @return a new object of class 'Rectangular Area'. + * @generated + */ + RectangularArea createRectangularArea(); + + /** + * Returns a new object of class 'Version'. + * + * + * @return a new object of class 'Version'. + * @generated + */ + Version createVersion(); + + /** + * Returns a new object of class 'Localized String'. + * + * + * @return a new object of class 'Localized String'. + * @generated + */ + LocalizedString createLocalizedString(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + CommonPackage getCommonPackage(); + +} //CommonFactory diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonPackage.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonPackage.java new file mode 100755 index 0000000..c9f4e8b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/CommonPackage.java @@ -0,0 +1,582 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.common.CommonFactory + * @model kind="package" + * @generated + */ +public interface CommonPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "common"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.common"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "model"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + CommonPackage eINSTANCE = org.genivi.common.impl.CommonPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.common.impl.CoordinateImpl Coordinate}' class. + * + * + * @see org.genivi.common.impl.CoordinateImpl + * @see org.genivi.common.impl.CommonPackageImpl#getCoordinate() + * @generated + */ + int COORDINATE = 0; + + /** + * The feature id for the 'Latitude' attribute. + * + * + * @generated + * @ordered + */ + int COORDINATE__LATITUDE = 0; + + /** + * The feature id for the 'Longitude' attribute. + * + * + * @generated + * @ordered + */ + int COORDINATE__LONGITUDE = 1; + + /** + * The feature id for the 'Altitude' attribute. + * + * + * @generated + * @ordered + */ + int COORDINATE__ALTITUDE = 2; + + /** + * The number of structural features of the 'Coordinate' class. + * + * + * @generated + * @ordered + */ + int COORDINATE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.genivi.common.impl.RectangularAreaImpl Rectangular Area}' class. + * + * + * @see org.genivi.common.impl.RectangularAreaImpl + * @see org.genivi.common.impl.CommonPackageImpl#getRectangularArea() + * @generated + */ + int RECTANGULAR_AREA = 1; + + /** + * The feature id for the 'Bottom Left' containment reference. + * + * + * @generated + * @ordered + */ + int RECTANGULAR_AREA__BOTTOM_LEFT = 0; + + /** + * The feature id for the 'Top Right' containment reference. + * + * + * @generated + * @ordered + */ + int RECTANGULAR_AREA__TOP_RIGHT = 1; + + /** + * The number of structural features of the 'Rectangular Area' class. + * + * + * @generated + * @ordered + */ + int RECTANGULAR_AREA_FEATURE_COUNT = 2; + + + /** + * The meta object id for the '{@link org.genivi.common.impl.VersionImpl Version}' class. + * + * + * @see org.genivi.common.impl.VersionImpl + * @see org.genivi.common.impl.CommonPackageImpl#getVersion() + * @generated + */ + int VERSION = 2; + + /** + * The feature id for the 'Major' attribute. + * + * + * @generated + * @ordered + */ + int VERSION__MAJOR = 0; + + /** + * The feature id for the 'Minor' attribute. + * + * + * @generated + * @ordered + */ + int VERSION__MINOR = 1; + + /** + * The feature id for the 'Micro' attribute. + * + * + * @generated + * @ordered + */ + int VERSION__MICRO = 2; + + /** + * The feature id for the 'Date' attribute. + * + * + * @generated + * @ordered + */ + int VERSION__DATE = 3; + + /** + * The number of structural features of the 'Version' class. + * + * + * @generated + * @ordered + */ + int VERSION_FEATURE_COUNT = 4; + + + /** + * The meta object id for the '{@link org.genivi.common.impl.LocalizedStringImpl Localized String}' class. + * + * + * @see org.genivi.common.impl.LocalizedStringImpl + * @see org.genivi.common.impl.CommonPackageImpl#getLocalizedString() + * @generated + */ + int LOCALIZED_STRING = 3; + + /** + * The feature id for the 'Language Code' attribute. + * + * + * @generated + * @ordered + */ + int LOCALIZED_STRING__LANGUAGE_CODE = 0; + + /** + * The feature id for the 'Country Code' attribute. + * + * + * @generated + * @ordered + */ + int LOCALIZED_STRING__COUNTRY_CODE = 1; + + /** + * The feature id for the 'String' attribute. + * + * + * @generated + * @ordered + */ + int LOCALIZED_STRING__STRING = 2; + + /** + * The number of structural features of the 'Localized String' class. + * + * + * @generated + * @ordered + */ + int LOCALIZED_STRING_FEATURE_COUNT = 3; + + + /** + * Returns the meta object for class '{@link org.genivi.common.Coordinate Coordinate}'. + * + * + * @return the meta object for class 'Coordinate'. + * @see org.genivi.common.Coordinate + * @generated + */ + EClass getCoordinate(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Coordinate#getLatitude Latitude}'. + * + * + * @return the meta object for the attribute 'Latitude'. + * @see org.genivi.common.Coordinate#getLatitude() + * @see #getCoordinate() + * @generated + */ + EAttribute getCoordinate_Latitude(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Coordinate#getLongitude Longitude}'. + * + * + * @return the meta object for the attribute 'Longitude'. + * @see org.genivi.common.Coordinate#getLongitude() + * @see #getCoordinate() + * @generated + */ + EAttribute getCoordinate_Longitude(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Coordinate#getAltitude Altitude}'. + * + * + * @return the meta object for the attribute 'Altitude'. + * @see org.genivi.common.Coordinate#getAltitude() + * @see #getCoordinate() + * @generated + */ + EAttribute getCoordinate_Altitude(); + + /** + * Returns the meta object for class '{@link org.genivi.common.RectangularArea Rectangular Area}'. + * + * + * @return the meta object for class 'Rectangular Area'. + * @see org.genivi.common.RectangularArea + * @generated + */ + EClass getRectangularArea(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.common.RectangularArea#getBottomLeft Bottom Left}'. + * + * + * @return the meta object for the containment reference 'Bottom Left'. + * @see org.genivi.common.RectangularArea#getBottomLeft() + * @see #getRectangularArea() + * @generated + */ + EReference getRectangularArea_BottomLeft(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.common.RectangularArea#getTopRight Top Right}'. + * + * + * @return the meta object for the containment reference 'Top Right'. + * @see org.genivi.common.RectangularArea#getTopRight() + * @see #getRectangularArea() + * @generated + */ + EReference getRectangularArea_TopRight(); + + /** + * Returns the meta object for class '{@link org.genivi.common.Version Version}'. + * + * + * @return the meta object for class 'Version'. + * @see org.genivi.common.Version + * @generated + */ + EClass getVersion(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Version#getMajor Major}'. + * + * + * @return the meta object for the attribute 'Major'. + * @see org.genivi.common.Version#getMajor() + * @see #getVersion() + * @generated + */ + EAttribute getVersion_Major(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Version#getMinor Minor}'. + * + * + * @return the meta object for the attribute 'Minor'. + * @see org.genivi.common.Version#getMinor() + * @see #getVersion() + * @generated + */ + EAttribute getVersion_Minor(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Version#getMicro Micro}'. + * + * + * @return the meta object for the attribute 'Micro'. + * @see org.genivi.common.Version#getMicro() + * @see #getVersion() + * @generated + */ + EAttribute getVersion_Micro(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.Version#getDate Date}'. + * + * + * @return the meta object for the attribute 'Date'. + * @see org.genivi.common.Version#getDate() + * @see #getVersion() + * @generated + */ + EAttribute getVersion_Date(); + + /** + * Returns the meta object for class '{@link org.genivi.common.LocalizedString Localized String}'. + * + * + * @return the meta object for class 'Localized String'. + * @see org.genivi.common.LocalizedString + * @generated + */ + EClass getLocalizedString(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.LocalizedString#getLanguageCode Language Code}'. + * + * + * @return the meta object for the attribute 'Language Code'. + * @see org.genivi.common.LocalizedString#getLanguageCode() + * @see #getLocalizedString() + * @generated + */ + EAttribute getLocalizedString_LanguageCode(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.LocalizedString#getCountryCode Country Code}'. + * + * + * @return the meta object for the attribute 'Country Code'. + * @see org.genivi.common.LocalizedString#getCountryCode() + * @see #getLocalizedString() + * @generated + */ + EAttribute getLocalizedString_CountryCode(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.common.LocalizedString#getString String}'. + * + * + * @return the meta object for the attribute 'String'. + * @see org.genivi.common.LocalizedString#getString() + * @see #getLocalizedString() + * @generated + */ + EAttribute getLocalizedString_String(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + CommonFactory getCommonFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.common.impl.CoordinateImpl Coordinate}' class. + * + * + * @see org.genivi.common.impl.CoordinateImpl + * @see org.genivi.common.impl.CommonPackageImpl#getCoordinate() + * @generated + */ + EClass COORDINATE = eINSTANCE.getCoordinate(); + + /** + * The meta object literal for the 'Latitude' attribute feature. + * + * + * @generated + */ + EAttribute COORDINATE__LATITUDE = eINSTANCE.getCoordinate_Latitude(); + + /** + * The meta object literal for the 'Longitude' attribute feature. + * + * + * @generated + */ + EAttribute COORDINATE__LONGITUDE = eINSTANCE.getCoordinate_Longitude(); + + /** + * The meta object literal for the 'Altitude' attribute feature. + * + * + * @generated + */ + EAttribute COORDINATE__ALTITUDE = eINSTANCE.getCoordinate_Altitude(); + + /** + * The meta object literal for the '{@link org.genivi.common.impl.RectangularAreaImpl Rectangular Area}' class. + * + * + * @see org.genivi.common.impl.RectangularAreaImpl + * @see org.genivi.common.impl.CommonPackageImpl#getRectangularArea() + * @generated + */ + EClass RECTANGULAR_AREA = eINSTANCE.getRectangularArea(); + + /** + * The meta object literal for the 'Bottom Left' containment reference feature. + * + * + * @generated + */ + EReference RECTANGULAR_AREA__BOTTOM_LEFT = eINSTANCE.getRectangularArea_BottomLeft(); + + /** + * The meta object literal for the 'Top Right' containment reference feature. + * + * + * @generated + */ + EReference RECTANGULAR_AREA__TOP_RIGHT = eINSTANCE.getRectangularArea_TopRight(); + + /** + * The meta object literal for the '{@link org.genivi.common.impl.VersionImpl Version}' class. + * + * + * @see org.genivi.common.impl.VersionImpl + * @see org.genivi.common.impl.CommonPackageImpl#getVersion() + * @generated + */ + EClass VERSION = eINSTANCE.getVersion(); + + /** + * The meta object literal for the 'Major' attribute feature. + * + * + * @generated + */ + EAttribute VERSION__MAJOR = eINSTANCE.getVersion_Major(); + + /** + * The meta object literal for the 'Minor' attribute feature. + * + * + * @generated + */ + EAttribute VERSION__MINOR = eINSTANCE.getVersion_Minor(); + + /** + * The meta object literal for the 'Micro' attribute feature. + * + * + * @generated + */ + EAttribute VERSION__MICRO = eINSTANCE.getVersion_Micro(); + + /** + * The meta object literal for the 'Date' attribute feature. + * + * + * @generated + */ + EAttribute VERSION__DATE = eINSTANCE.getVersion_Date(); + + /** + * The meta object literal for the '{@link org.genivi.common.impl.LocalizedStringImpl Localized String}' class. + * + * + * @see org.genivi.common.impl.LocalizedStringImpl + * @see org.genivi.common.impl.CommonPackageImpl#getLocalizedString() + * @generated + */ + EClass LOCALIZED_STRING = eINSTANCE.getLocalizedString(); + + /** + * The meta object literal for the 'Language Code' attribute feature. + * + * + * @generated + */ + EAttribute LOCALIZED_STRING__LANGUAGE_CODE = eINSTANCE.getLocalizedString_LanguageCode(); + + /** + * The meta object literal for the 'Country Code' attribute feature. + * + * + * @generated + */ + EAttribute LOCALIZED_STRING__COUNTRY_CODE = eINSTANCE.getLocalizedString_CountryCode(); + + /** + * The meta object literal for the 'String' attribute feature. + * + * + * @generated + */ + EAttribute LOCALIZED_STRING__STRING = eINSTANCE.getLocalizedString_String(); + + } + +} //CommonPackage diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Coordinate.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Coordinate.java new file mode 100755 index 0000000..7bed8d4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Coordinate.java @@ -0,0 +1,110 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Coordinate'. + * + * + * + * This data type represents a 3D WGS84 coordinate. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.common.Coordinate#getLatitude Latitude}
  • + *
  • {@link org.genivi.common.Coordinate#getLongitude Longitude}
  • + *
  • {@link org.genivi.common.Coordinate#getAltitude Altitude}
  • + *
+ *

+ * + * @see org.genivi.common.CommonPackage#getCoordinate() + * @model + * @generated + */ +public interface Coordinate extends EObject { + /** + * Returns the value of the 'Latitude' attribute. + * + * + * + * latitude >= -90 and <= 90 + * + * @return the value of the 'Latitude' attribute. + * @see #setLatitude(double) + * @see org.genivi.common.CommonPackage#getCoordinate_Latitude() + * @model required="true" + * @generated + */ + double getLatitude(); + + /** + * Sets the value of the '{@link org.genivi.common.Coordinate#getLatitude Latitude}' attribute. + * + * + * @param value the new value of the 'Latitude' attribute. + * @see #getLatitude() + * @generated + */ + void setLatitude(double value); + + /** + * Returns the value of the 'Longitude' attribute. + * + * + * + * longitude >= -180 and <= 180 + * + * @return the value of the 'Longitude' attribute. + * @see #setLongitude(double) + * @see org.genivi.common.CommonPackage#getCoordinate_Longitude() + * @model required="true" + * @generated + */ + double getLongitude(); + + /** + * Sets the value of the '{@link org.genivi.common.Coordinate#getLongitude Longitude}' attribute. + * + * + * @param value the new value of the 'Longitude' attribute. + * @see #getLongitude() + * @generated + */ + void setLongitude(double value); + + /** + * Returns the value of the 'Altitude' attribute. + * + * + * + * altitude values are in meters above sea level + * + * @return the value of the 'Altitude' attribute. + * @see #setAltitude(int) + * @see org.genivi.common.CommonPackage#getCoordinate_Altitude() + * @model + * @generated + */ + int getAltitude(); + + /** + * Sets the value of the '{@link org.genivi.common.Coordinate#getAltitude Altitude}' attribute. + * + * + * @param value the new value of the 'Altitude' attribute. + * @see #getAltitude() + * @generated + */ + void setAltitude(int value); + +} // Coordinate diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/LocalizedString.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/LocalizedString.java new file mode 100755 index 0000000..b1cc4da --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/LocalizedString.java @@ -0,0 +1,190 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Localized String'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.common.LocalizedString#getLanguageCode Language Code}
  • + *
  • {@link org.genivi.common.LocalizedString#getCountryCode Country Code}
  • + *
  • {@link org.genivi.common.LocalizedString#getString String}
  • + *
+ *

+ * + * @see org.genivi.common.CommonPackage#getLocalizedString() + * @model + * @generated + */ +public interface LocalizedString extends EObject { + /** + * Returns the value of the 'Language Code' attribute. + * + *

+ * If the meaning of the 'Language Code' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Language Code' attribute. + * @see #isSetLanguageCode() + * @see #unsetLanguageCode() + * @see #setLanguageCode(String) + * @see org.genivi.common.CommonPackage#getLocalizedString_LanguageCode() + * @model unsettable="true" required="true" + * @generated + */ + String getLanguageCode(); + + /** + * Sets the value of the '{@link org.genivi.common.LocalizedString#getLanguageCode Language Code}' attribute. + * + * + * @param value the new value of the 'Language Code' attribute. + * @see #isSetLanguageCode() + * @see #unsetLanguageCode() + * @see #getLanguageCode() + * @generated + */ + void setLanguageCode(String value); + + /** + * Unsets the value of the '{@link org.genivi.common.LocalizedString#getLanguageCode Language Code}' attribute. + * + * + * @see #isSetLanguageCode() + * @see #getLanguageCode() + * @see #setLanguageCode(String) + * @generated + */ + void unsetLanguageCode(); + + /** + * Returns whether the value of the '{@link org.genivi.common.LocalizedString#getLanguageCode Language Code}' attribute is set. + * + * + * @return whether the value of the 'Language Code' attribute is set. + * @see #unsetLanguageCode() + * @see #getLanguageCode() + * @see #setLanguageCode(String) + * @generated + */ + boolean isSetLanguageCode(); + + /** + * Returns the value of the 'Country Code' attribute. + * + *

+ * If the meaning of the 'Country Code' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Country Code' attribute. + * @see #isSetCountryCode() + * @see #unsetCountryCode() + * @see #setCountryCode(String) + * @see org.genivi.common.CommonPackage#getLocalizedString_CountryCode() + * @model unsettable="true" + * @generated + */ + String getCountryCode(); + + /** + * Sets the value of the '{@link org.genivi.common.LocalizedString#getCountryCode Country Code}' attribute. + * + * + * @param value the new value of the 'Country Code' attribute. + * @see #isSetCountryCode() + * @see #unsetCountryCode() + * @see #getCountryCode() + * @generated + */ + void setCountryCode(String value); + + /** + * Unsets the value of the '{@link org.genivi.common.LocalizedString#getCountryCode Country Code}' attribute. + * + * + * @see #isSetCountryCode() + * @see #getCountryCode() + * @see #setCountryCode(String) + * @generated + */ + void unsetCountryCode(); + + /** + * Returns whether the value of the '{@link org.genivi.common.LocalizedString#getCountryCode Country Code}' attribute is set. + * + * + * @return whether the value of the 'Country Code' attribute is set. + * @see #unsetCountryCode() + * @see #getCountryCode() + * @see #setCountryCode(String) + * @generated + */ + boolean isSetCountryCode(); + + /** + * Returns the value of the 'String' attribute. + * + *

+ * If the meaning of the 'String' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'String' attribute. + * @see #isSetString() + * @see #unsetString() + * @see #setString(String) + * @see org.genivi.common.CommonPackage#getLocalizedString_String() + * @model unsettable="true" required="true" + * @generated + */ + String getString(); + + /** + * Sets the value of the '{@link org.genivi.common.LocalizedString#getString String}' attribute. + * + * + * @param value the new value of the 'String' attribute. + * @see #isSetString() + * @see #unsetString() + * @see #getString() + * @generated + */ + void setString(String value); + + /** + * Unsets the value of the '{@link org.genivi.common.LocalizedString#getString String}' attribute. + * + * + * @see #isSetString() + * @see #getString() + * @see #setString(String) + * @generated + */ + void unsetString(); + + /** + * Returns whether the value of the '{@link org.genivi.common.LocalizedString#getString String}' attribute is set. + * + * + * @return whether the value of the 'String' attribute is set. + * @see #unsetString() + * @see #getString() + * @see #setString(String) + * @generated + */ + boolean isSetString(); + +} // LocalizedString diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/RectangularArea.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/RectangularArea.java new file mode 100755 index 0000000..1a09d6b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/RectangularArea.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Rectangular Area'. + * + * + * + * This datatype represents a rectangular area. The area is defined by the WGS84 coordinates of its bottomLeft and topRight corners. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.common.RectangularArea#getBottomLeft Bottom Left}
  • + *
  • {@link org.genivi.common.RectangularArea#getTopRight Top Right}
  • + *
+ *

+ * + * @see org.genivi.common.CommonPackage#getRectangularArea() + * @model + * @generated + */ +public interface RectangularArea extends EObject { + + /** + * Returns the value of the 'Bottom Left' containment reference. + * + *

+ * If the meaning of the 'Bottom Left' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * + * The bottom-left corner of the area. + * + * @return the value of the 'Bottom Left' containment reference. + * @see #setBottomLeft(Coordinate) + * @see org.genivi.common.CommonPackage#getRectangularArea_BottomLeft() + * @model containment="true" required="true" + * @generated + */ + Coordinate getBottomLeft(); + + /** + * Sets the value of the '{@link org.genivi.common.RectangularArea#getBottomLeft Bottom Left}' containment reference. + * + * + * @param value the new value of the 'Bottom Left' containment reference. + * @see #getBottomLeft() + * @generated + */ + void setBottomLeft(Coordinate value); + + /** + * Returns the value of the 'Top Right' containment reference. + * + *

+ * If the meaning of the 'Top Right' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * + * The top-right corner of the area. + * + * @return the value of the 'Top Right' containment reference. + * @see #setTopRight(Coordinate) + * @see org.genivi.common.CommonPackage#getRectangularArea_TopRight() + * @model containment="true" required="true" + * @generated + */ + Coordinate getTopRight(); + + /** + * Sets the value of the '{@link org.genivi.common.RectangularArea#getTopRight Top Right}' containment reference. + * + * + * @param value the new value of the 'Top Right' containment reference. + * @see #getTopRight() + * @generated + */ + void setTopRight(Coordinate value); +} // RectangularArea diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Version.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Version.java new file mode 100755 index 0000000..32adcc5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/Version.java @@ -0,0 +1,263 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.common; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Version'. + * + * + * + * This datatype is used to provide version information. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.common.Version#getMajor Major}
  • + *
  • {@link org.genivi.common.Version#getMinor Minor}
  • + *
  • {@link org.genivi.common.Version#getMicro Micro}
  • + *
  • {@link org.genivi.common.Version#getDate Date}
  • + *
+ *

+ * + * @see org.genivi.common.CommonPackage#getVersion() + * @model + * @generated + */ +public interface Version extends EObject { + /** + * Returns the value of the 'Major' attribute. + * + *

+ * If the meaning of the 'Major' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The major version number. + * + * @return the value of the 'Major' attribute. + * @see #isSetMajor() + * @see #unsetMajor() + * @see #setMajor(int) + * @see org.genivi.common.CommonPackage#getVersion_Major() + * @model unsettable="true" required="true" + * annotation="http://www.tomtom.com/emfidl/2012/GenModel valueMin='0' valueMax='32767'" + * @generated + */ + int getMajor(); + + /** + * Sets the value of the '{@link org.genivi.common.Version#getMajor Major}' attribute. + * + * + * @param value the new value of the 'Major' attribute. + * @see #isSetMajor() + * @see #unsetMajor() + * @see #getMajor() + * @generated + */ + void setMajor(int value); + + /** + * Unsets the value of the '{@link org.genivi.common.Version#getMajor Major}' attribute. + * + * + * @see #isSetMajor() + * @see #getMajor() + * @see #setMajor(int) + * @generated + */ + void unsetMajor(); + + /** + * Returns whether the value of the '{@link org.genivi.common.Version#getMajor Major}' attribute is set. + * + * + * @return whether the value of the 'Major' attribute is set. + * @see #unsetMajor() + * @see #getMajor() + * @see #setMajor(int) + * @generated + */ + boolean isSetMajor(); + + /** + * Returns the value of the 'Minor' attribute. + * + *

+ * If the meaning of the 'Minor' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The minor version number. + * + * @return the value of the 'Minor' attribute. + * @see #isSetMinor() + * @see #unsetMinor() + * @see #setMinor(int) + * @see org.genivi.common.CommonPackage#getVersion_Minor() + * @model unsettable="true" required="true" + * annotation="http://www.tomtom.com/emfidl/2012/GenModel valueMin='0' valueMax='32767'" + * @generated + */ + int getMinor(); + + /** + * Sets the value of the '{@link org.genivi.common.Version#getMinor Minor}' attribute. + * + * + * @param value the new value of the 'Minor' attribute. + * @see #isSetMinor() + * @see #unsetMinor() + * @see #getMinor() + * @generated + */ + void setMinor(int value); + + /** + * Unsets the value of the '{@link org.genivi.common.Version#getMinor Minor}' attribute. + * + * + * @see #isSetMinor() + * @see #getMinor() + * @see #setMinor(int) + * @generated + */ + void unsetMinor(); + + /** + * Returns whether the value of the '{@link org.genivi.common.Version#getMinor Minor}' attribute is set. + * + * + * @return whether the value of the 'Minor' attribute is set. + * @see #unsetMinor() + * @see #getMinor() + * @see #setMinor(int) + * @generated + */ + boolean isSetMinor(); + + /** + * Returns the value of the 'Micro' attribute. + * + *

+ * If the meaning of the 'Micro' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The micro version number. + * + * @return the value of the 'Micro' attribute. + * @see #isSetMicro() + * @see #unsetMicro() + * @see #setMicro(int) + * @see org.genivi.common.CommonPackage#getVersion_Micro() + * @model unsettable="true" required="true" + * annotation="http://www.tomtom.com/emfidl/2012/GenModel valueMin='0' valueMax='32767'" + * @generated + */ + int getMicro(); + + /** + * Sets the value of the '{@link org.genivi.common.Version#getMicro Micro}' attribute. + * + * + * @param value the new value of the 'Micro' attribute. + * @see #isSetMicro() + * @see #unsetMicro() + * @see #getMicro() + * @generated + */ + void setMicro(int value); + + /** + * Unsets the value of the '{@link org.genivi.common.Version#getMicro Micro}' attribute. + * + * + * @see #isSetMicro() + * @see #getMicro() + * @see #setMicro(int) + * @generated + */ + void unsetMicro(); + + /** + * Returns whether the value of the '{@link org.genivi.common.Version#getMicro Micro}' attribute is set. + * + * + * @return whether the value of the 'Micro' attribute is set. + * @see #unsetMicro() + * @see #getMicro() + * @see #setMicro(int) + * @generated + */ + boolean isSetMicro(); + + /** + * Returns the value of the 'Date' attribute. + * + *

+ * If the meaning of the 'Date' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The date of this version. + * + * @return the value of the 'Date' attribute. + * @see #isSetDate() + * @see #unsetDate() + * @see #setDate(String) + * @see org.genivi.common.CommonPackage#getVersion_Date() + * @model unsettable="true" required="true" + * @generated + */ + String getDate(); + + /** + * Sets the value of the '{@link org.genivi.common.Version#getDate Date}' attribute. + * + * + * @param value the new value of the 'Date' attribute. + * @see #isSetDate() + * @see #unsetDate() + * @see #getDate() + * @generated + */ + void setDate(String value); + + /** + * Unsets the value of the '{@link org.genivi.common.Version#getDate Date}' attribute. + * + * + * @see #isSetDate() + * @see #getDate() + * @see #setDate(String) + * @generated + */ + void unsetDate(); + + /** + * Returns whether the value of the '{@link org.genivi.common.Version#getDate Date}' attribute is set. + * + * + * @return whether the value of the 'Date' attribute is set. + * @see #unsetDate() + * @see #getDate() + * @see #setDate(String) + * @generated + */ + boolean isSetDate(); + +} // Version diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonFactoryImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonFactoryImpl.java new file mode 100755 index 0000000..a1760d9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonFactoryImpl.java @@ -0,0 +1,135 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.common.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class CommonFactoryImpl extends EFactoryImpl implements CommonFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static CommonFactory init() { + try { + CommonFactory theCommonFactory = (CommonFactory)EPackage.Registry.INSTANCE.getEFactory(CommonPackage.eNS_URI); + if (theCommonFactory != null) { + return theCommonFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new CommonFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public CommonFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case CommonPackage.COORDINATE: return createCoordinate(); + case CommonPackage.RECTANGULAR_AREA: return createRectangularArea(); + case CommonPackage.VERSION: return createVersion(); + case CommonPackage.LOCALIZED_STRING: return createLocalizedString(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Coordinate createCoordinate() { + CoordinateImpl coordinate = new CoordinateImpl(); + return coordinate; + } + + /** + * + * + * @generated + */ + public RectangularArea createRectangularArea() { + RectangularAreaImpl rectangularArea = new RectangularAreaImpl(); + return rectangularArea; + } + + /** + * + * + * @generated + */ + public Version createVersion() { + VersionImpl version = new VersionImpl(); + return version; + } + + /** + * + * + * @generated + */ + public LocalizedString createLocalizedString() { + LocalizedStringImpl localizedString = new LocalizedStringImpl(); + return localizedString; + } + + /** + * + * + * @generated + */ + public CommonPackage getCommonPackage() { + return (CommonPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static CommonPackage getPackage() { + return CommonPackage.eINSTANCE; + } + +} //CommonFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonPackageImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonPackageImpl.java new file mode 100755 index 0000000..f8f8ecc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CommonPackageImpl.java @@ -0,0 +1,413 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.common.CommonFactory; +import org.genivi.common.CommonPackage; +import org.genivi.common.Coordinate; +import org.genivi.common.LocalizedString; +import org.genivi.common.RectangularArea; + +import org.genivi.common.Version; +import org.genivi.location.LocationPackage; + +import org.genivi.location.impl.LocationPackageImpl; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class CommonPackageImpl extends EPackageImpl implements CommonPackage { + /** + * + * + * @generated + */ + private EClass coordinateEClass = null; + + /** + * + * + * @generated + */ + private EClass rectangularAreaEClass = null; + + /** + * + * + * @generated + */ + private EClass versionEClass = null; + + /** + * + * + * @generated + */ + private EClass localizedStringEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.common.CommonPackage#eNS_URI + * @see #init() + * @generated + */ + private CommonPackageImpl() { + super(eNS_URI, CommonFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link CommonPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static CommonPackage init() { + if (isInited) return (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI); + + // Obtain or create and register package + CommonPackageImpl theCommonPackage = (CommonPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof CommonPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new CommonPackageImpl()); + + isInited = true; + + // Obtain or create and register interdependencies + LocationPackageImpl theLocationPackage = (LocationPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(LocationPackage.eNS_URI) instanceof LocationPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(LocationPackage.eNS_URI) : LocationPackage.eINSTANCE); + + // Create package meta-data objects + theCommonPackage.createPackageContents(); + theLocationPackage.createPackageContents(); + + // Initialize created meta-data + theCommonPackage.initializePackageContents(); + theLocationPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theCommonPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(CommonPackage.eNS_URI, theCommonPackage); + return theCommonPackage; + } + + /** + * + * + * @generated + */ + public EClass getCoordinate() { + return coordinateEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getCoordinate_Latitude() { + return (EAttribute)coordinateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getCoordinate_Longitude() { + return (EAttribute)coordinateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getCoordinate_Altitude() { + return (EAttribute)coordinateEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getRectangularArea() { + return rectangularAreaEClass; + } + + /** + * + * + * @generated + */ + public EReference getRectangularArea_BottomLeft() { + return (EReference)rectangularAreaEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getRectangularArea_TopRight() { + return (EReference)rectangularAreaEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getVersion() { + return versionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getVersion_Major() { + return (EAttribute)versionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getVersion_Minor() { + return (EAttribute)versionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getVersion_Micro() { + return (EAttribute)versionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getVersion_Date() { + return (EAttribute)versionEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getLocalizedString() { + return localizedStringEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLocalizedString_LanguageCode() { + return (EAttribute)localizedStringEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLocalizedString_CountryCode() { + return (EAttribute)localizedStringEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getLocalizedString_String() { + return (EAttribute)localizedStringEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public CommonFactory getCommonFactory() { + return (CommonFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + coordinateEClass = createEClass(COORDINATE); + createEAttribute(coordinateEClass, COORDINATE__LATITUDE); + createEAttribute(coordinateEClass, COORDINATE__LONGITUDE); + createEAttribute(coordinateEClass, COORDINATE__ALTITUDE); + + rectangularAreaEClass = createEClass(RECTANGULAR_AREA); + createEReference(rectangularAreaEClass, RECTANGULAR_AREA__BOTTOM_LEFT); + createEReference(rectangularAreaEClass, RECTANGULAR_AREA__TOP_RIGHT); + + versionEClass = createEClass(VERSION); + createEAttribute(versionEClass, VERSION__MAJOR); + createEAttribute(versionEClass, VERSION__MINOR); + createEAttribute(versionEClass, VERSION__MICRO); + createEAttribute(versionEClass, VERSION__DATE); + + localizedStringEClass = createEClass(LOCALIZED_STRING); + createEAttribute(localizedStringEClass, LOCALIZED_STRING__LANGUAGE_CODE); + createEAttribute(localizedStringEClass, LOCALIZED_STRING__COUNTRY_CODE); + createEAttribute(localizedStringEClass, LOCALIZED_STRING__STRING); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(coordinateEClass, Coordinate.class, "Coordinate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCoordinate_Latitude(), ecorePackage.getEDouble(), "latitude", null, 1, 1, Coordinate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCoordinate_Longitude(), ecorePackage.getEDouble(), "longitude", null, 1, 1, Coordinate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCoordinate_Altitude(), ecorePackage.getEInt(), "altitude", null, 0, 1, Coordinate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(rectangularAreaEClass, RectangularArea.class, "RectangularArea", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getRectangularArea_BottomLeft(), this.getCoordinate(), null, "bottomLeft", null, 1, 1, RectangularArea.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getRectangularArea_TopRight(), this.getCoordinate(), null, "topRight", null, 1, 1, RectangularArea.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(versionEClass, Version.class, "Version", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getVersion_Major(), ecorePackage.getEInt(), "major", null, 1, 1, Version.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVersion_Minor(), ecorePackage.getEInt(), "minor", null, 1, 1, Version.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVersion_Micro(), ecorePackage.getEInt(), "micro", null, 1, 1, Version.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVersion_Date(), ecorePackage.getEString(), "date", null, 1, 1, Version.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(localizedStringEClass, LocalizedString.class, "LocalizedString", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLocalizedString_LanguageCode(), ecorePackage.getEString(), "languageCode", null, 1, 1, LocalizedString.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLocalizedString_CountryCode(), ecorePackage.getEString(), "countryCode", null, 0, 1, LocalizedString.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLocalizedString_String(), ecorePackage.getEString(), "string", null, 1, 1, LocalizedString.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // http://www.tomtom.com/emfidl/2012/GenModel + createGenModel_1Annotations(); + } + + /** + * Initializes the annotations for http://www.tomtom.com/emfidl/2012/GenModel. + * + * + * @generated + */ + protected void createGenModel_1Annotations() { + String source = "http://www.tomtom.com/emfidl/2012/GenModel"; + addAnnotation + (getVersion_Major(), + source, + new String[] { + "valueMin", "0", + "valueMax", "32767" + }); + addAnnotation + (getVersion_Minor(), + source, + new String[] { + "valueMin", "0", + "valueMax", "32767" + }); + addAnnotation + (getVersion_Micro(), + source, + new String[] { + "valueMin", "0", + "valueMax", "32767" + }); + } + +} //CommonPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CoordinateImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CoordinateImpl.java new file mode 100755 index 0000000..38caa05 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/CoordinateImpl.java @@ -0,0 +1,272 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.CommonPackage; +import org.genivi.common.Coordinate; + +/** + * + * An implementation of the model object 'Coordinate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.common.impl.CoordinateImpl#getLatitude Latitude}
  • + *
  • {@link org.genivi.common.impl.CoordinateImpl#getLongitude Longitude}
  • + *
  • {@link org.genivi.common.impl.CoordinateImpl#getAltitude Altitude}
  • + *
+ *

+ * + * @generated + */ +public class CoordinateImpl extends EObjectImpl implements Coordinate { + /** + * The default value of the '{@link #getLatitude() Latitude}' attribute. + * + * + * @see #getLatitude() + * @generated + * @ordered + */ + protected static final double LATITUDE_EDEFAULT = 0.0; + /** + * The cached value of the '{@link #getLatitude() Latitude}' attribute. + * + * + * @see #getLatitude() + * @generated + * @ordered + */ + protected double latitude = LATITUDE_EDEFAULT; + /** + * The default value of the '{@link #getLongitude() Longitude}' attribute. + * + * + * @see #getLongitude() + * @generated + * @ordered + */ + protected static final double LONGITUDE_EDEFAULT = 0.0; + /** + * The cached value of the '{@link #getLongitude() Longitude}' attribute. + * + * + * @see #getLongitude() + * @generated + * @ordered + */ + protected double longitude = LONGITUDE_EDEFAULT; + /** + * The default value of the '{@link #getAltitude() Altitude}' attribute. + * + * + * @see #getAltitude() + * @generated + * @ordered + */ + protected static final int ALTITUDE_EDEFAULT = 0; + /** + * The cached value of the '{@link #getAltitude() Altitude}' attribute. + * + * + * @see #getAltitude() + * @generated + * @ordered + */ + protected int altitude = ALTITUDE_EDEFAULT; + + /** + * + * + * @generated + */ + protected CoordinateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return CommonPackage.Literals.COORDINATE; + } + + /** + * + * + * @generated + */ + public double getLatitude() { + return latitude; + } + + /** + * + * + * @generated + */ + public void setLatitude(double newLatitude) { + double oldLatitude = latitude; + latitude = newLatitude; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.COORDINATE__LATITUDE, oldLatitude, latitude)); + } + + /** + * + * + * @generated + */ + public double getLongitude() { + return longitude; + } + + /** + * + * + * @generated + */ + public void setLongitude(double newLongitude) { + double oldLongitude = longitude; + longitude = newLongitude; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.COORDINATE__LONGITUDE, oldLongitude, longitude)); + } + + /** + * + * + * @generated + */ + public int getAltitude() { + return altitude; + } + + /** + * + * + * @generated + */ + public void setAltitude(int newAltitude) { + int oldAltitude = altitude; + altitude = newAltitude; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.COORDINATE__ALTITUDE, oldAltitude, altitude)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CommonPackage.COORDINATE__LATITUDE: + return getLatitude(); + case CommonPackage.COORDINATE__LONGITUDE: + return getLongitude(); + case CommonPackage.COORDINATE__ALTITUDE: + return getAltitude(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CommonPackage.COORDINATE__LATITUDE: + setLatitude((Double)newValue); + return; + case CommonPackage.COORDINATE__LONGITUDE: + setLongitude((Double)newValue); + return; + case CommonPackage.COORDINATE__ALTITUDE: + setAltitude((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CommonPackage.COORDINATE__LATITUDE: + setLatitude(LATITUDE_EDEFAULT); + return; + case CommonPackage.COORDINATE__LONGITUDE: + setLongitude(LONGITUDE_EDEFAULT); + return; + case CommonPackage.COORDINATE__ALTITUDE: + setAltitude(ALTITUDE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CommonPackage.COORDINATE__LATITUDE: + return latitude != LATITUDE_EDEFAULT; + case CommonPackage.COORDINATE__LONGITUDE: + return longitude != LONGITUDE_EDEFAULT; + case CommonPackage.COORDINATE__ALTITUDE: + return altitude != ALTITUDE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (latitude: "); + result.append(latitude); + result.append(", longitude: "); + result.append(longitude); + result.append(", altitude: "); + result.append(altitude); + result.append(')'); + return result.toString(); + } + +} //CoordinateImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/LocalizedStringImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/LocalizedStringImpl.java new file mode 100755 index 0000000..8f6743a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/LocalizedStringImpl.java @@ -0,0 +1,380 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.CommonPackage; +import org.genivi.common.LocalizedString; + +/** + * + * An implementation of the model object 'Localized String'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.common.impl.LocalizedStringImpl#getLanguageCode Language Code}
  • + *
  • {@link org.genivi.common.impl.LocalizedStringImpl#getCountryCode Country Code}
  • + *
  • {@link org.genivi.common.impl.LocalizedStringImpl#getString String}
  • + *
+ *

+ * + * @generated + */ +public class LocalizedStringImpl extends EObjectImpl implements LocalizedString { + /** + * The default value of the '{@link #getLanguageCode() Language Code}' attribute. + * + * + * @see #getLanguageCode() + * @generated + * @ordered + */ + protected static final String LANGUAGE_CODE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLanguageCode() Language Code}' attribute. + * + * + * @see #getLanguageCode() + * @generated + * @ordered + */ + protected String languageCode = LANGUAGE_CODE_EDEFAULT; + + /** + * This is true if the Language Code attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean languageCodeESet; + + /** + * The default value of the '{@link #getCountryCode() Country Code}' attribute. + * + * + * @see #getCountryCode() + * @generated + * @ordered + */ + protected static final String COUNTRY_CODE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCountryCode() Country Code}' attribute. + * + * + * @see #getCountryCode() + * @generated + * @ordered + */ + protected String countryCode = COUNTRY_CODE_EDEFAULT; + + /** + * This is true if the Country Code attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean countryCodeESet; + + /** + * The default value of the '{@link #getString() String}' attribute. + * + * + * @see #getString() + * @generated + * @ordered + */ + protected static final String STRING_EDEFAULT = null; + + /** + * The cached value of the '{@link #getString() String}' attribute. + * + * + * @see #getString() + * @generated + * @ordered + */ + protected String string = STRING_EDEFAULT; + + /** + * This is true if the String attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean stringESet; + + /** + * + * + * @generated + */ + protected LocalizedStringImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return CommonPackage.Literals.LOCALIZED_STRING; + } + + /** + * + * + * @generated + */ + public String getLanguageCode() { + return languageCode; + } + + /** + * + * + * @generated + */ + public void setLanguageCode(String newLanguageCode) { + String oldLanguageCode = languageCode; + languageCode = newLanguageCode; + boolean oldLanguageCodeESet = languageCodeESet; + languageCodeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE, oldLanguageCode, languageCode, !oldLanguageCodeESet)); + } + + /** + * + * + * @generated + */ + public void unsetLanguageCode() { + String oldLanguageCode = languageCode; + boolean oldLanguageCodeESet = languageCodeESet; + languageCode = LANGUAGE_CODE_EDEFAULT; + languageCodeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE, oldLanguageCode, LANGUAGE_CODE_EDEFAULT, oldLanguageCodeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLanguageCode() { + return languageCodeESet; + } + + /** + * + * + * @generated + */ + public String getCountryCode() { + return countryCode; + } + + /** + * + * + * @generated + */ + public void setCountryCode(String newCountryCode) { + String oldCountryCode = countryCode; + countryCode = newCountryCode; + boolean oldCountryCodeESet = countryCodeESet; + countryCodeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.LOCALIZED_STRING__COUNTRY_CODE, oldCountryCode, countryCode, !oldCountryCodeESet)); + } + + /** + * + * + * @generated + */ + public void unsetCountryCode() { + String oldCountryCode = countryCode; + boolean oldCountryCodeESet = countryCodeESet; + countryCode = COUNTRY_CODE_EDEFAULT; + countryCodeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.LOCALIZED_STRING__COUNTRY_CODE, oldCountryCode, COUNTRY_CODE_EDEFAULT, oldCountryCodeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCountryCode() { + return countryCodeESet; + } + + /** + * + * + * @generated + */ + public String getString() { + return string; + } + + /** + * + * + * @generated + */ + public void setString(String newString) { + String oldString = string; + string = newString; + boolean oldStringESet = stringESet; + stringESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.LOCALIZED_STRING__STRING, oldString, string, !oldStringESet)); + } + + /** + * + * + * @generated + */ + public void unsetString() { + String oldString = string; + boolean oldStringESet = stringESet; + string = STRING_EDEFAULT; + stringESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.LOCALIZED_STRING__STRING, oldString, STRING_EDEFAULT, oldStringESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetString() { + return stringESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE: + return getLanguageCode(); + case CommonPackage.LOCALIZED_STRING__COUNTRY_CODE: + return getCountryCode(); + case CommonPackage.LOCALIZED_STRING__STRING: + return getString(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE: + setLanguageCode((String)newValue); + return; + case CommonPackage.LOCALIZED_STRING__COUNTRY_CODE: + setCountryCode((String)newValue); + return; + case CommonPackage.LOCALIZED_STRING__STRING: + setString((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE: + unsetLanguageCode(); + return; + case CommonPackage.LOCALIZED_STRING__COUNTRY_CODE: + unsetCountryCode(); + return; + case CommonPackage.LOCALIZED_STRING__STRING: + unsetString(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CommonPackage.LOCALIZED_STRING__LANGUAGE_CODE: + return isSetLanguageCode(); + case CommonPackage.LOCALIZED_STRING__COUNTRY_CODE: + return isSetCountryCode(); + case CommonPackage.LOCALIZED_STRING__STRING: + return isSetString(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (languageCode: "); + if (languageCodeESet) result.append(languageCode); else result.append(""); + result.append(", countryCode: "); + if (countryCodeESet) result.append(countryCode); else result.append(""); + result.append(", string: "); + if (stringESet) result.append(string); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LocalizedStringImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/RectangularAreaImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/RectangularAreaImpl.java new file mode 100755 index 0000000..8eb3254 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/RectangularAreaImpl.java @@ -0,0 +1,247 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.CommonPackage; +import org.genivi.common.Coordinate; +import org.genivi.common.RectangularArea; + +/** + * + * An implementation of the model object 'Rectangular Area'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.common.impl.RectangularAreaImpl#getBottomLeft Bottom Left}
  • + *
  • {@link org.genivi.common.impl.RectangularAreaImpl#getTopRight Top Right}
  • + *
+ *

+ * + * @generated + */ +public class RectangularAreaImpl extends EObjectImpl implements RectangularArea { + /** + * The cached value of the '{@link #getBottomLeft() Bottom Left}' containment reference. + * + * + * @see #getBottomLeft() + * @generated + * @ordered + */ + protected Coordinate bottomLeft; + /** + * The cached value of the '{@link #getTopRight() Top Right}' containment reference. + * + * + * @see #getTopRight() + * @generated + * @ordered + */ + protected Coordinate topRight; + + /** + * + * + * @generated + */ + protected RectangularAreaImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return CommonPackage.Literals.RECTANGULAR_AREA; + } + + /** + * + * + * @generated + */ + public Coordinate getBottomLeft() { + return bottomLeft; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetBottomLeft(Coordinate newBottomLeft, NotificationChain msgs) { + Coordinate oldBottomLeft = bottomLeft; + bottomLeft = newBottomLeft; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT, oldBottomLeft, newBottomLeft); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setBottomLeft(Coordinate newBottomLeft) { + if (newBottomLeft != bottomLeft) { + NotificationChain msgs = null; + if (bottomLeft != null) + msgs = ((InternalEObject)bottomLeft).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT, null, msgs); + if (newBottomLeft != null) + msgs = ((InternalEObject)newBottomLeft).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT, null, msgs); + msgs = basicSetBottomLeft(newBottomLeft, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT, newBottomLeft, newBottomLeft)); + } + + /** + * + * + * @generated + */ + public Coordinate getTopRight() { + return topRight; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetTopRight(Coordinate newTopRight, NotificationChain msgs) { + Coordinate oldTopRight = topRight; + topRight = newTopRight; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, CommonPackage.RECTANGULAR_AREA__TOP_RIGHT, oldTopRight, newTopRight); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setTopRight(Coordinate newTopRight) { + if (newTopRight != topRight) { + NotificationChain msgs = null; + if (topRight != null) + msgs = ((InternalEObject)topRight).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - CommonPackage.RECTANGULAR_AREA__TOP_RIGHT, null, msgs); + if (newTopRight != null) + msgs = ((InternalEObject)newTopRight).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - CommonPackage.RECTANGULAR_AREA__TOP_RIGHT, null, msgs); + msgs = basicSetTopRight(newTopRight, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.RECTANGULAR_AREA__TOP_RIGHT, newTopRight, newTopRight)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT: + return basicSetBottomLeft(null, msgs); + case CommonPackage.RECTANGULAR_AREA__TOP_RIGHT: + return basicSetTopRight(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT: + return getBottomLeft(); + case CommonPackage.RECTANGULAR_AREA__TOP_RIGHT: + return getTopRight(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT: + setBottomLeft((Coordinate)newValue); + return; + case CommonPackage.RECTANGULAR_AREA__TOP_RIGHT: + setTopRight((Coordinate)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT: + setBottomLeft((Coordinate)null); + return; + case CommonPackage.RECTANGULAR_AREA__TOP_RIGHT: + setTopRight((Coordinate)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CommonPackage.RECTANGULAR_AREA__BOTTOM_LEFT: + return bottomLeft != null; + case CommonPackage.RECTANGULAR_AREA__TOP_RIGHT: + return topRight != null; + } + return super.eIsSet(featureID); + } + +} //RectangularAreaImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/VersionImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/VersionImpl.java new file mode 100755 index 0000000..a70edc8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/impl/VersionImpl.java @@ -0,0 +1,468 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.CommonPackage; +import org.genivi.common.Version; + +/** + * + * An implementation of the model object 'Version'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.common.impl.VersionImpl#getMajor Major}
  • + *
  • {@link org.genivi.common.impl.VersionImpl#getMinor Minor}
  • + *
  • {@link org.genivi.common.impl.VersionImpl#getMicro Micro}
  • + *
  • {@link org.genivi.common.impl.VersionImpl#getDate Date}
  • + *
+ *

+ * + * @generated + */ +public class VersionImpl extends EObjectImpl implements Version { + /** + * The default value of the '{@link #getMajor() Major}' attribute. + * + * + * @see #getMajor() + * @generated + * @ordered + */ + protected static final int MAJOR_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMajor() Major}' attribute. + * + * + * @see #getMajor() + * @generated + * @ordered + */ + protected int major = MAJOR_EDEFAULT; + + /** + * This is true if the Major attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean majorESet; + + /** + * The default value of the '{@link #getMinor() Minor}' attribute. + * + * + * @see #getMinor() + * @generated + * @ordered + */ + protected static final int MINOR_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMinor() Minor}' attribute. + * + * + * @see #getMinor() + * @generated + * @ordered + */ + protected int minor = MINOR_EDEFAULT; + + /** + * This is true if the Minor attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean minorESet; + + /** + * The default value of the '{@link #getMicro() Micro}' attribute. + * + * + * @see #getMicro() + * @generated + * @ordered + */ + protected static final int MICRO_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getMicro() Micro}' attribute. + * + * + * @see #getMicro() + * @generated + * @ordered + */ + protected int micro = MICRO_EDEFAULT; + + /** + * This is true if the Micro attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean microESet; + + /** + * The default value of the '{@link #getDate() Date}' attribute. + * + * + * @see #getDate() + * @generated + * @ordered + */ + protected static final String DATE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDate() Date}' attribute. + * + * + * @see #getDate() + * @generated + * @ordered + */ + protected String date = DATE_EDEFAULT; + + /** + * This is true if the Date attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dateESet; + + /** + * + * + * @generated + */ + protected VersionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return CommonPackage.Literals.VERSION; + } + + /** + * + * + * @generated + */ + public int getMajor() { + return major; + } + + /** + * + * + * @generated + */ + public void setMajor(int newMajor) { + int oldMajor = major; + major = newMajor; + boolean oldMajorESet = majorESet; + majorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.VERSION__MAJOR, oldMajor, major, !oldMajorESet)); + } + + /** + * + * + * @generated + */ + public void unsetMajor() { + int oldMajor = major; + boolean oldMajorESet = majorESet; + major = MAJOR_EDEFAULT; + majorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.VERSION__MAJOR, oldMajor, MAJOR_EDEFAULT, oldMajorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMajor() { + return majorESet; + } + + /** + * + * + * @generated + */ + public int getMinor() { + return minor; + } + + /** + * + * + * @generated + */ + public void setMinor(int newMinor) { + int oldMinor = minor; + minor = newMinor; + boolean oldMinorESet = minorESet; + minorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.VERSION__MINOR, oldMinor, minor, !oldMinorESet)); + } + + /** + * + * + * @generated + */ + public void unsetMinor() { + int oldMinor = minor; + boolean oldMinorESet = minorESet; + minor = MINOR_EDEFAULT; + minorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.VERSION__MINOR, oldMinor, MINOR_EDEFAULT, oldMinorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMinor() { + return minorESet; + } + + /** + * + * + * @generated + */ + public int getMicro() { + return micro; + } + + /** + * + * + * @generated + */ + public void setMicro(int newMicro) { + int oldMicro = micro; + micro = newMicro; + boolean oldMicroESet = microESet; + microESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.VERSION__MICRO, oldMicro, micro, !oldMicroESet)); + } + + /** + * + * + * @generated + */ + public void unsetMicro() { + int oldMicro = micro; + boolean oldMicroESet = microESet; + micro = MICRO_EDEFAULT; + microESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.VERSION__MICRO, oldMicro, MICRO_EDEFAULT, oldMicroESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMicro() { + return microESet; + } + + /** + * + * + * @generated + */ + public String getDate() { + return date; + } + + /** + * + * + * @generated + */ + public void setDate(String newDate) { + String oldDate = date; + date = newDate; + boolean oldDateESet = dateESet; + dateESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, CommonPackage.VERSION__DATE, oldDate, date, !oldDateESet)); + } + + /** + * + * + * @generated + */ + public void unsetDate() { + String oldDate = date; + boolean oldDateESet = dateESet; + date = DATE_EDEFAULT; + dateESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, CommonPackage.VERSION__DATE, oldDate, DATE_EDEFAULT, oldDateESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDate() { + return dateESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case CommonPackage.VERSION__MAJOR: + return getMajor(); + case CommonPackage.VERSION__MINOR: + return getMinor(); + case CommonPackage.VERSION__MICRO: + return getMicro(); + case CommonPackage.VERSION__DATE: + return getDate(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case CommonPackage.VERSION__MAJOR: + setMajor((Integer)newValue); + return; + case CommonPackage.VERSION__MINOR: + setMinor((Integer)newValue); + return; + case CommonPackage.VERSION__MICRO: + setMicro((Integer)newValue); + return; + case CommonPackage.VERSION__DATE: + setDate((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case CommonPackage.VERSION__MAJOR: + unsetMajor(); + return; + case CommonPackage.VERSION__MINOR: + unsetMinor(); + return; + case CommonPackage.VERSION__MICRO: + unsetMicro(); + return; + case CommonPackage.VERSION__DATE: + unsetDate(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case CommonPackage.VERSION__MAJOR: + return isSetMajor(); + case CommonPackage.VERSION__MINOR: + return isSetMinor(); + case CommonPackage.VERSION__MICRO: + return isSetMicro(); + case CommonPackage.VERSION__DATE: + return isSetDate(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (major: "); + if (majorESet) result.append(major); else result.append(""); + result.append(", minor: "); + if (minorESet) result.append(minor); else result.append(""); + result.append(", micro: "); + if (microESet) result.append(micro); else result.append(""); + result.append(", date: "); + if (dateESet) result.append(date); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //VersionImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonAdapterFactory.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonAdapterFactory.java new file mode 100755 index 0000000..9876412 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonAdapterFactory.java @@ -0,0 +1,181 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.common.CommonPackage + * @generated + */ +public class CommonAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static CommonPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public CommonAdapterFactory() { + if (modelPackage == null) { + modelPackage = CommonPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected CommonSwitch modelSwitch = + new CommonSwitch() { + @Override + public Adapter caseCoordinate(Coordinate object) { + return createCoordinateAdapter(); + } + @Override + public Adapter caseRectangularArea(RectangularArea object) { + return createRectangularAreaAdapter(); + } + @Override + public Adapter caseVersion(Version object) { + return createVersionAdapter(); + } + @Override + public Adapter caseLocalizedString(LocalizedString object) { + return createLocalizedStringAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.common.Coordinate Coordinate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.common.Coordinate + * @generated + */ + public Adapter createCoordinateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.common.RectangularArea Rectangular Area}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.common.RectangularArea + * @generated + */ + public Adapter createRectangularAreaAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.common.Version Version}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.common.Version + * @generated + */ + public Adapter createVersionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.common.LocalizedString Localized String}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.common.LocalizedString + * @generated + */ + public Adapter createLocalizedStringAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //CommonAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonSwitch.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonSwitch.java new file mode 100755 index 0000000..2d06273 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/common/util/CommonSwitch.java @@ -0,0 +1,182 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.common.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.genivi.common.CommonPackage; +import org.genivi.common.Coordinate; +import org.genivi.common.LocalizedString; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.common.CommonPackage + * @generated + */ +public class CommonSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static CommonPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public CommonSwitch() { + if (modelPackage == null) { + modelPackage = CommonPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case CommonPackage.COORDINATE: { + Coordinate coordinate = (Coordinate)theEObject; + T result = caseCoordinate(coordinate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CommonPackage.RECTANGULAR_AREA: { + RectangularArea rectangularArea = (RectangularArea)theEObject; + T result = caseRectangularArea(rectangularArea); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CommonPackage.VERSION: { + Version version = (Version)theEObject; + T result = caseVersion(version); + if (result == null) result = defaultCase(theEObject); + return result; + } + case CommonPackage.LOCALIZED_STRING: { + LocalizedString localizedString = (LocalizedString)theEObject; + T result = caseLocalizedString(localizedString); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Coordinate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Coordinate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCoordinate(Coordinate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Rectangular Area'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Rectangular Area'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseRectangularArea(RectangularArea object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Version'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Version'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseVersion(Version object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Localized String'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Localized String'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocalizedString(LocalizedString object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //CommonSwitch diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocation.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocation.java new file mode 100755 index 0000000..88db67d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocation.java @@ -0,0 +1,29 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + + +/** + * + * A representation of the model object 'Area Location'. + * + * + * + * The location is an area, e.g. an area with fog. + * TODO Work out the AreaLocation class + * + * + * + * @see org.genivi.location.LocationPackage#getAreaLocation() + * @model + * @generated + */ +public interface AreaLocation extends Location { +} // AreaLocation diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocationInfo.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocationInfo.java new file mode 100755 index 0000000..4bead9d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/AreaLocationInfo.java @@ -0,0 +1,24 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + + +/** + * + * A representation of the model object 'Area Location Info'. + * + * + * + * @see org.genivi.location.LocationPackage#getAreaLocationInfo() + * @model + * @generated + */ +public interface AreaLocationInfo extends LocationInfo { +} // AreaLocationInfo diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocation.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocation.java new file mode 100755 index 0000000..ea5bcd6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocation.java @@ -0,0 +1,161 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.common.util.EList; + + +/** + * + * A representation of the model object 'Linear Location'. + * + * + * + * The location is a road stretch, e.g. the road stretch where there is a traffic jam. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.location.LinearLocation#getSegments Segments}
  • + *
  • {@link org.genivi.location.LinearLocation#getPositiveOffset Positive Offset}
  • + *
  • {@link org.genivi.location.LinearLocation#getNegativeOffset Negative Offset}
  • + *
+ *

+ * + * @see org.genivi.location.LocationPackage#getLinearLocation() + * @model + * @generated + */ +public interface LinearLocation extends Location { + + /** + * Returns the value of the 'Segments' attribute list. + * The list contents are of type {@link java.lang.Long}. + * + *

+ * If the meaning of the 'Segments' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * + * The database segments of the location. + * + * @return the value of the 'Segments' attribute list. + * @see org.genivi.location.LocationPackage#getLinearLocation_Segments() + * @model required="true" + * @generated + */ + EList getSegments(); + + /** + * Returns the value of the 'Positive Offset' attribute. + * + * + * + * The positive offset is the distance (in meters) between the begin node of the first segment and the start point of the actual location. + * + * @return the value of the 'Positive Offset' attribute. + * @see #isSetPositiveOffset() + * @see #unsetPositiveOffset() + * @see #setPositiveOffset(long) + * @see org.genivi.location.LocationPackage#getLinearLocation_PositiveOffset() + * @model unsettable="true" + * @generated + */ + long getPositiveOffset(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocation#getPositiveOffset Positive Offset}' attribute. + * + * + * @param value the new value of the 'Positive Offset' attribute. + * @see #isSetPositiveOffset() + * @see #unsetPositiveOffset() + * @see #getPositiveOffset() + * @generated + */ + void setPositiveOffset(long value); + + /** + * Unsets the value of the '{@link org.genivi.location.LinearLocation#getPositiveOffset Positive Offset}' attribute. + * + * + * @see #isSetPositiveOffset() + * @see #getPositiveOffset() + * @see #setPositiveOffset(long) + * @generated + */ + void unsetPositiveOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.location.LinearLocation#getPositiveOffset Positive Offset}' attribute is set. + * + * + * @return whether the value of the 'Positive Offset' attribute is set. + * @see #unsetPositiveOffset() + * @see #getPositiveOffset() + * @see #setPositiveOffset(long) + * @generated + */ + boolean isSetPositiveOffset(); + + /** + * Returns the value of the 'Negative Offset' attribute. + * + * + * + * The negative offset is the distance (in meters) between the end point of the actual location and the end node of the last segment. + * + * @return the value of the 'Negative Offset' attribute. + * @see #isSetNegativeOffset() + * @see #unsetNegativeOffset() + * @see #setNegativeOffset(long) + * @see org.genivi.location.LocationPackage#getLinearLocation_NegativeOffset() + * @model unsettable="true" + * @generated + */ + long getNegativeOffset(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocation#getNegativeOffset Negative Offset}' attribute. + * + * + * @param value the new value of the 'Negative Offset' attribute. + * @see #isSetNegativeOffset() + * @see #unsetNegativeOffset() + * @see #getNegativeOffset() + * @generated + */ + void setNegativeOffset(long value); + + /** + * Unsets the value of the '{@link org.genivi.location.LinearLocation#getNegativeOffset Negative Offset}' attribute. + * + * + * @see #isSetNegativeOffset() + * @see #getNegativeOffset() + * @see #setNegativeOffset(long) + * @generated + */ + void unsetNegativeOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.location.LinearLocation#getNegativeOffset Negative Offset}' attribute is set. + * + * + * @return whether the value of the 'Negative Offset' attribute is set. + * @see #unsetNegativeOffset() + * @see #getNegativeOffset() + * @see #setNegativeOffset(long) + * @generated + */ + boolean isSetNegativeOffset(); +} // LinearLocation diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocationInfo.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocationInfo.java new file mode 100755 index 0000000..d933d3c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LinearLocationInfo.java @@ -0,0 +1,157 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.common.util.EList; + +import org.genivi.common.Coordinate; + +/** + * + * A representation of the model object 'Linear Location Info'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.location.LinearLocationInfo#getFromLocationName From Location Name}
  • + *
  • {@link org.genivi.location.LinearLocationInfo#getFromLocationParentName From Location Parent Name}
  • + *
  • {@link org.genivi.location.LinearLocationInfo#getToLocationName To Location Name}
  • + *
  • {@link org.genivi.location.LinearLocationInfo#getToLocationParentName To Location Parent Name}
  • + *
  • {@link org.genivi.location.LinearLocationInfo#getCoordinates Coordinates}
  • + *
+ *

+ * + * @see org.genivi.location.LocationPackage#getLinearLocationInfo() + * @model + * @generated + */ +public interface LinearLocationInfo extends LocationInfo { + /** + * Returns the value of the 'From Location Name' attribute. + * + *

+ * If the meaning of the 'From Location Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'From Location Name' attribute. + * @see #setFromLocationName(String) + * @see org.genivi.location.LocationPackage#getLinearLocationInfo_FromLocationName() + * @model + * @generated + */ + String getFromLocationName(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocationInfo#getFromLocationName From Location Name}' attribute. + * + * + * @param value the new value of the 'From Location Name' attribute. + * @see #getFromLocationName() + * @generated + */ + void setFromLocationName(String value); + + /** + * Returns the value of the 'From Location Parent Name' attribute. + * + *

+ * If the meaning of the 'From Location Parent Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'From Location Parent Name' attribute. + * @see #setFromLocationParentName(String) + * @see org.genivi.location.LocationPackage#getLinearLocationInfo_FromLocationParentName() + * @model + * @generated + */ + String getFromLocationParentName(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocationInfo#getFromLocationParentName From Location Parent Name}' attribute. + * + * + * @param value the new value of the 'From Location Parent Name' attribute. + * @see #getFromLocationParentName() + * @generated + */ + void setFromLocationParentName(String value); + + /** + * Returns the value of the 'To Location Name' attribute. + * + *

+ * If the meaning of the 'To Location Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'To Location Name' attribute. + * @see #setToLocationName(String) + * @see org.genivi.location.LocationPackage#getLinearLocationInfo_ToLocationName() + * @model + * @generated + */ + String getToLocationName(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocationInfo#getToLocationName To Location Name}' attribute. + * + * + * @param value the new value of the 'To Location Name' attribute. + * @see #getToLocationName() + * @generated + */ + void setToLocationName(String value); + + /** + * Returns the value of the 'To Location Parent Name' attribute. + * + *

+ * If the meaning of the 'To Location Parent Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'To Location Parent Name' attribute. + * @see #setToLocationParentName(String) + * @see org.genivi.location.LocationPackage#getLinearLocationInfo_ToLocationParentName() + * @model + * @generated + */ + String getToLocationParentName(); + + /** + * Sets the value of the '{@link org.genivi.location.LinearLocationInfo#getToLocationParentName To Location Parent Name}' attribute. + * + * + * @param value the new value of the 'To Location Parent Name' attribute. + * @see #getToLocationParentName() + * @generated + */ + void setToLocationParentName(String value); + + /** + * Returns the value of the 'Coordinates' containment reference list. + * The list contents are of type {@link org.genivi.common.Coordinate}. + * + *

+ * If the meaning of the 'Coordinates' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Coordinates' containment reference list. + * @see org.genivi.location.LocationPackage#getLinearLocationInfo_Coordinates() + * @model containment="true" + * @generated + */ + EList getCoordinates(); + +} // LinearLocationInfo diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/Location.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/Location.java new file mode 100755 index 0000000..2ff6ed7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/Location.java @@ -0,0 +1,29 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Location'. + * + * + * + * Common parent for all location types. + * + * + * + * @see org.genivi.location.LocationPackage#getLocation() + * @model + * @generated + */ +public interface Location extends EObject { +} // Location diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationFactory.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationFactory.java new file mode 100755 index 0000000..3fdbc0c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationFactory.java @@ -0,0 +1,112 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.location.LocationPackage + * @generated + */ +public interface LocationFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + LocationFactory eINSTANCE = org.genivi.location.impl.LocationFactoryImpl.init(); + + /** + * Returns a new object of class 'Location'. + * + * + * @return a new object of class 'Location'. + * @generated + */ + Location createLocation(); + + /** + * Returns a new object of class 'Point Location'. + * + * + * @return a new object of class 'Point Location'. + * @generated + */ + PointLocation createPointLocation(); + + /** + * Returns a new object of class 'Area Location'. + * + * + * @return a new object of class 'Area Location'. + * @generated + */ + AreaLocation createAreaLocation(); + + /** + * Returns a new object of class 'Linear Location'. + * + * + * @return a new object of class 'Linear Location'. + * @generated + */ + LinearLocation createLinearLocation(); + + /** + * Returns a new object of class 'Info'. + * + * + * @return a new object of class 'Info'. + * @generated + */ + LocationInfo createLocationInfo(); + + /** + * Returns a new object of class 'Point Location Info'. + * + * + * @return a new object of class 'Point Location Info'. + * @generated + */ + PointLocationInfo createPointLocationInfo(); + + /** + * Returns a new object of class 'Linear Location Info'. + * + * + * @return a new object of class 'Linear Location Info'. + * @generated + */ + LinearLocationInfo createLinearLocationInfo(); + + /** + * Returns a new object of class 'Area Location Info'. + * + * + * @return a new object of class 'Area Location Info'. + * @generated + */ + AreaLocationInfo createAreaLocationInfo(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + LocationPackage getLocationPackage(); + +} //LocationFactory diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationInfo.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationInfo.java new file mode 100755 index 0000000..002f811 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationInfo.java @@ -0,0 +1,86 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.Coordinate; + +/** + * + * A representation of the model object 'Info'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.location.LocationInfo#getName Name}
  • + *
  • {@link org.genivi.location.LocationInfo#getMainLocation Main Location}
  • + *
+ *

+ * + * @see org.genivi.location.LocationPackage#getLocationInfo() + * @model + * @generated + */ +public interface LocationInfo extends EObject { + /** + * Returns the value of the 'Name' attribute. + * + *

+ * If the meaning of the 'Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Name' attribute. + * @see #setName(String) + * @see org.genivi.location.LocationPackage#getLocationInfo_Name() + * @model + * @generated + */ + String getName(); + + /** + * Sets the value of the '{@link org.genivi.location.LocationInfo#getName Name}' attribute. + * + * + * @param value the new value of the 'Name' attribute. + * @see #getName() + * @generated + */ + void setName(String value); + + /** + * Returns the value of the 'Main Location' containment reference. + * + *

+ * If the meaning of the 'Main Location' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Main Location' containment reference. + * @see #setMainLocation(Coordinate) + * @see org.genivi.location.LocationPackage#getLocationInfo_MainLocation() + * @model containment="true" + * @generated + */ + Coordinate getMainLocation(); + + /** + * Sets the value of the '{@link org.genivi.location.LocationInfo#getMainLocation Main Location}' containment reference. + * + * + * @param value the new value of the 'Main Location' containment reference. + * @see #getMainLocation() + * @generated + */ + void setMainLocation(Coordinate value); + +} // LocationInfo diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationPackage.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationPackage.java new file mode 100755 index 0000000..fe6e3df --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/LocationPackage.java @@ -0,0 +1,796 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.location.LocationFactory + * @model kind="package" + * @generated + */ +public interface LocationPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "location"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.location"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "common"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + LocationPackage eINSTANCE = org.genivi.location.impl.LocationPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.location.impl.LocationImpl Location}' class. + * + * + * @see org.genivi.location.impl.LocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLocation() + * @generated + */ + int LOCATION = 0; + + /** + * The number of structural features of the 'Location' class. + * + * + * @generated + * @ordered + */ + int LOCATION_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.location.impl.PointLocationImpl Point Location}' class. + * + * + * @see org.genivi.location.impl.PointLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocation() + * @generated + */ + int POINT_LOCATION = 1; + + /** + * The number of structural features of the 'Point Location' class. + * + * + * @generated + * @ordered + */ + int POINT_LOCATION_FEATURE_COUNT = LOCATION_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.genivi.location.impl.AreaLocationImpl Area Location}' class. + * + * + * @see org.genivi.location.impl.AreaLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getAreaLocation() + * @generated + */ + int AREA_LOCATION = 2; + + /** + * The number of structural features of the 'Area Location' class. + * + * + * @generated + * @ordered + */ + int AREA_LOCATION_FEATURE_COUNT = LOCATION_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.genivi.location.impl.LinearLocationImpl Linear Location}' class. + * + * + * @see org.genivi.location.impl.LinearLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLinearLocation() + * @generated + */ + int LINEAR_LOCATION = 3; + + /** + * The feature id for the 'Segments' attribute list. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION__SEGMENTS = LOCATION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Positive Offset' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION__POSITIVE_OFFSET = LOCATION_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Negative Offset' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION__NEGATIVE_OFFSET = LOCATION_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Linear Location' class. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_FEATURE_COUNT = LOCATION_FEATURE_COUNT + 3; + + + /** + * The meta object id for the '{@link org.genivi.location.impl.LocationInfoImpl Info}' class. + * + * + * @see org.genivi.location.impl.LocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLocationInfo() + * @generated + */ + int LOCATION_INFO = 4; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int LOCATION_INFO__NAME = 0; + + /** + * The feature id for the 'Main Location' containment reference. + * + * + * @generated + * @ordered + */ + int LOCATION_INFO__MAIN_LOCATION = 1; + + /** + * The number of structural features of the 'Info' class. + * + * + * @generated + * @ordered + */ + int LOCATION_INFO_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.location.impl.PointLocationInfoImpl Point Location Info}' class. + * + * + * @see org.genivi.location.impl.PointLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocationInfo() + * @generated + */ + int POINT_LOCATION_INFO = 5; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int POINT_LOCATION_INFO__NAME = LOCATION_INFO__NAME; + + /** + * The feature id for the 'Main Location' containment reference. + * + * + * @generated + * @ordered + */ + int POINT_LOCATION_INFO__MAIN_LOCATION = LOCATION_INFO__MAIN_LOCATION; + + /** + * The feature id for the 'Location Type' attribute. + * + * + * @generated + * @ordered + */ + int POINT_LOCATION_INFO__LOCATION_TYPE = LOCATION_INFO_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Point Location Info' class. + * + * + * @generated + * @ordered + */ + int POINT_LOCATION_INFO_FEATURE_COUNT = LOCATION_INFO_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.location.impl.LinearLocationInfoImpl Linear Location Info}' class. + * + * + * @see org.genivi.location.impl.LinearLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLinearLocationInfo() + * @generated + */ + int LINEAR_LOCATION_INFO = 6; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__NAME = LOCATION_INFO__NAME; + + /** + * The feature id for the 'Main Location' containment reference. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__MAIN_LOCATION = LOCATION_INFO__MAIN_LOCATION; + + /** + * The feature id for the 'From Location Name' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__FROM_LOCATION_NAME = LOCATION_INFO_FEATURE_COUNT + 0; + + /** + * The feature id for the 'From Location Parent Name' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME = LOCATION_INFO_FEATURE_COUNT + 1; + + /** + * The feature id for the 'To Location Name' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__TO_LOCATION_NAME = LOCATION_INFO_FEATURE_COUNT + 2; + + /** + * The feature id for the 'To Location Parent Name' attribute. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME = LOCATION_INFO_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Coordinates' containment reference list. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO__COORDINATES = LOCATION_INFO_FEATURE_COUNT + 4; + + /** + * The number of structural features of the 'Linear Location Info' class. + * + * + * @generated + * @ordered + */ + int LINEAR_LOCATION_INFO_FEATURE_COUNT = LOCATION_INFO_FEATURE_COUNT + 5; + + /** + * The meta object id for the '{@link org.genivi.location.impl.AreaLocationInfoImpl Area Location Info}' class. + * + * + * @see org.genivi.location.impl.AreaLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getAreaLocationInfo() + * @generated + */ + int AREA_LOCATION_INFO = 7; + + /** + * The feature id for the 'Name' attribute. + * + * + * @generated + * @ordered + */ + int AREA_LOCATION_INFO__NAME = LOCATION_INFO__NAME; + + /** + * The feature id for the 'Main Location' containment reference. + * + * + * @generated + * @ordered + */ + int AREA_LOCATION_INFO__MAIN_LOCATION = LOCATION_INFO__MAIN_LOCATION; + + /** + * The number of structural features of the 'Area Location Info' class. + * + * + * @generated + * @ordered + */ + int AREA_LOCATION_INFO_FEATURE_COUNT = LOCATION_INFO_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.genivi.location.PointLocationType Point Location Type}' enum. + * + * + * @see org.genivi.location.PointLocationType + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocationType() + * @generated + */ + int POINT_LOCATION_TYPE = 8; + + + /** + * Returns the meta object for class '{@link org.genivi.location.Location Location}'. + * + * + * @return the meta object for class 'Location'. + * @see org.genivi.location.Location + * @generated + */ + EClass getLocation(); + + /** + * Returns the meta object for class '{@link org.genivi.location.PointLocation Point Location}'. + * + * + * @return the meta object for class 'Point Location'. + * @see org.genivi.location.PointLocation + * @generated + */ + EClass getPointLocation(); + + /** + * Returns the meta object for class '{@link org.genivi.location.AreaLocation Area Location}'. + * + * + * @return the meta object for class 'Area Location'. + * @see org.genivi.location.AreaLocation + * @generated + */ + EClass getAreaLocation(); + + /** + * Returns the meta object for class '{@link org.genivi.location.LinearLocation Linear Location}'. + * + * + * @return the meta object for class 'Linear Location'. + * @see org.genivi.location.LinearLocation + * @generated + */ + EClass getLinearLocation(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.location.LinearLocation#getSegments Segments}'. + * + * + * @return the meta object for the attribute list 'Segments'. + * @see org.genivi.location.LinearLocation#getSegments() + * @see #getLinearLocation() + * @generated + */ + EAttribute getLinearLocation_Segments(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocation#getPositiveOffset Positive Offset}'. + * + * + * @return the meta object for the attribute 'Positive Offset'. + * @see org.genivi.location.LinearLocation#getPositiveOffset() + * @see #getLinearLocation() + * @generated + */ + EAttribute getLinearLocation_PositiveOffset(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocation#getNegativeOffset Negative Offset}'. + * + * + * @return the meta object for the attribute 'Negative Offset'. + * @see org.genivi.location.LinearLocation#getNegativeOffset() + * @see #getLinearLocation() + * @generated + */ + EAttribute getLinearLocation_NegativeOffset(); + + /** + * Returns the meta object for class '{@link org.genivi.location.LocationInfo Info}'. + * + * + * @return the meta object for class 'Info'. + * @see org.genivi.location.LocationInfo + * @generated + */ + EClass getLocationInfo(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LocationInfo#getName Name}'. + * + * + * @return the meta object for the attribute 'Name'. + * @see org.genivi.location.LocationInfo#getName() + * @see #getLocationInfo() + * @generated + */ + EAttribute getLocationInfo_Name(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.location.LocationInfo#getMainLocation Main Location}'. + * + * + * @return the meta object for the containment reference 'Main Location'. + * @see org.genivi.location.LocationInfo#getMainLocation() + * @see #getLocationInfo() + * @generated + */ + EReference getLocationInfo_MainLocation(); + + /** + * Returns the meta object for class '{@link org.genivi.location.PointLocationInfo Point Location Info}'. + * + * + * @return the meta object for class 'Point Location Info'. + * @see org.genivi.location.PointLocationInfo + * @generated + */ + EClass getPointLocationInfo(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.PointLocationInfo#getLocationType Location Type}'. + * + * + * @return the meta object for the attribute 'Location Type'. + * @see org.genivi.location.PointLocationInfo#getLocationType() + * @see #getPointLocationInfo() + * @generated + */ + EAttribute getPointLocationInfo_LocationType(); + + /** + * Returns the meta object for class '{@link org.genivi.location.LinearLocationInfo Linear Location Info}'. + * + * + * @return the meta object for class 'Linear Location Info'. + * @see org.genivi.location.LinearLocationInfo + * @generated + */ + EClass getLinearLocationInfo(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocationInfo#getFromLocationName From Location Name}'. + * + * + * @return the meta object for the attribute 'From Location Name'. + * @see org.genivi.location.LinearLocationInfo#getFromLocationName() + * @see #getLinearLocationInfo() + * @generated + */ + EAttribute getLinearLocationInfo_FromLocationName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocationInfo#getFromLocationParentName From Location Parent Name}'. + * + * + * @return the meta object for the attribute 'From Location Parent Name'. + * @see org.genivi.location.LinearLocationInfo#getFromLocationParentName() + * @see #getLinearLocationInfo() + * @generated + */ + EAttribute getLinearLocationInfo_FromLocationParentName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocationInfo#getToLocationName To Location Name}'. + * + * + * @return the meta object for the attribute 'To Location Name'. + * @see org.genivi.location.LinearLocationInfo#getToLocationName() + * @see #getLinearLocationInfo() + * @generated + */ + EAttribute getLinearLocationInfo_ToLocationName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.location.LinearLocationInfo#getToLocationParentName To Location Parent Name}'. + * + * + * @return the meta object for the attribute 'To Location Parent Name'. + * @see org.genivi.location.LinearLocationInfo#getToLocationParentName() + * @see #getLinearLocationInfo() + * @generated + */ + EAttribute getLinearLocationInfo_ToLocationParentName(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.location.LinearLocationInfo#getCoordinates Coordinates}'. + * + * + * @return the meta object for the containment reference list 'Coordinates'. + * @see org.genivi.location.LinearLocationInfo#getCoordinates() + * @see #getLinearLocationInfo() + * @generated + */ + EReference getLinearLocationInfo_Coordinates(); + + /** + * Returns the meta object for class '{@link org.genivi.location.AreaLocationInfo Area Location Info}'. + * + * + * @return the meta object for class 'Area Location Info'. + * @see org.genivi.location.AreaLocationInfo + * @generated + */ + EClass getAreaLocationInfo(); + + /** + * Returns the meta object for enum '{@link org.genivi.location.PointLocationType Point Location Type}'. + * + * + * @return the meta object for enum 'Point Location Type'. + * @see org.genivi.location.PointLocationType + * @generated + */ + EEnum getPointLocationType(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + LocationFactory getLocationFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.location.impl.LocationImpl Location}' class. + * + * + * @see org.genivi.location.impl.LocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLocation() + * @generated + */ + EClass LOCATION = eINSTANCE.getLocation(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.PointLocationImpl Point Location}' class. + * + * + * @see org.genivi.location.impl.PointLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocation() + * @generated + */ + EClass POINT_LOCATION = eINSTANCE.getPointLocation(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.AreaLocationImpl Area Location}' class. + * + * + * @see org.genivi.location.impl.AreaLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getAreaLocation() + * @generated + */ + EClass AREA_LOCATION = eINSTANCE.getAreaLocation(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.LinearLocationImpl Linear Location}' class. + * + * + * @see org.genivi.location.impl.LinearLocationImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLinearLocation() + * @generated + */ + EClass LINEAR_LOCATION = eINSTANCE.getLinearLocation(); + + /** + * The meta object literal for the 'Segments' attribute list feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION__SEGMENTS = eINSTANCE.getLinearLocation_Segments(); + + /** + * The meta object literal for the 'Positive Offset' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION__POSITIVE_OFFSET = eINSTANCE.getLinearLocation_PositiveOffset(); + + /** + * The meta object literal for the 'Negative Offset' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION__NEGATIVE_OFFSET = eINSTANCE.getLinearLocation_NegativeOffset(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.LocationInfoImpl Info}' class. + * + * + * @see org.genivi.location.impl.LocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLocationInfo() + * @generated + */ + EClass LOCATION_INFO = eINSTANCE.getLocationInfo(); + + /** + * The meta object literal for the 'Name' attribute feature. + * + * + * @generated + */ + EAttribute LOCATION_INFO__NAME = eINSTANCE.getLocationInfo_Name(); + + /** + * The meta object literal for the 'Main Location' containment reference feature. + * + * + * @generated + */ + EReference LOCATION_INFO__MAIN_LOCATION = eINSTANCE.getLocationInfo_MainLocation(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.PointLocationInfoImpl Point Location Info}' class. + * + * + * @see org.genivi.location.impl.PointLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocationInfo() + * @generated + */ + EClass POINT_LOCATION_INFO = eINSTANCE.getPointLocationInfo(); + + /** + * The meta object literal for the 'Location Type' attribute feature. + * + * + * @generated + */ + EAttribute POINT_LOCATION_INFO__LOCATION_TYPE = eINSTANCE.getPointLocationInfo_LocationType(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.LinearLocationInfoImpl Linear Location Info}' class. + * + * + * @see org.genivi.location.impl.LinearLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getLinearLocationInfo() + * @generated + */ + EClass LINEAR_LOCATION_INFO = eINSTANCE.getLinearLocationInfo(); + + /** + * The meta object literal for the 'From Location Name' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION_INFO__FROM_LOCATION_NAME = eINSTANCE.getLinearLocationInfo_FromLocationName(); + + /** + * The meta object literal for the 'From Location Parent Name' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME = eINSTANCE.getLinearLocationInfo_FromLocationParentName(); + + /** + * The meta object literal for the 'To Location Name' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION_INFO__TO_LOCATION_NAME = eINSTANCE.getLinearLocationInfo_ToLocationName(); + + /** + * The meta object literal for the 'To Location Parent Name' attribute feature. + * + * + * @generated + */ + EAttribute LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME = eINSTANCE.getLinearLocationInfo_ToLocationParentName(); + + /** + * The meta object literal for the 'Coordinates' containment reference list feature. + * + * + * @generated + */ + EReference LINEAR_LOCATION_INFO__COORDINATES = eINSTANCE.getLinearLocationInfo_Coordinates(); + + /** + * The meta object literal for the '{@link org.genivi.location.impl.AreaLocationInfoImpl Area Location Info}' class. + * + * + * @see org.genivi.location.impl.AreaLocationInfoImpl + * @see org.genivi.location.impl.LocationPackageImpl#getAreaLocationInfo() + * @generated + */ + EClass AREA_LOCATION_INFO = eINSTANCE.getAreaLocationInfo(); + + /** + * The meta object literal for the '{@link org.genivi.location.PointLocationType Point Location Type}' enum. + * + * + * @see org.genivi.location.PointLocationType + * @see org.genivi.location.impl.LocationPackageImpl#getPointLocationType() + * @generated + */ + EEnum POINT_LOCATION_TYPE = eINSTANCE.getPointLocationType(); + + } + +} //LocationPackage diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocation.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocation.java new file mode 100755 index 0000000..3ab3484 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocation.java @@ -0,0 +1,29 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + + +/** + * + * A representation of the model object 'Point Location'. + * + * + * + * The location is a single point (along the road), e.g. the location of a broken down vehicle. + * TODO Work out the PointLocation class + * + * + * + * @see org.genivi.location.LocationPackage#getPointLocation() + * @model + * @generated + */ +public interface PointLocation extends Location { +} // PointLocation diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationInfo.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationInfo.java new file mode 100755 index 0000000..f4c1bc3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationInfo.java @@ -0,0 +1,59 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + + +/** + * + * A representation of the model object 'Point Location Info'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.location.PointLocationInfo#getLocationType Location Type}
  • + *
+ *

+ * + * @see org.genivi.location.LocationPackage#getPointLocationInfo() + * @model + * @generated + */ +public interface PointLocationInfo extends LocationInfo { + /** + * Returns the value of the 'Location Type' attribute. + * The literals are from the enumeration {@link org.genivi.location.PointLocationType}. + * + *

+ * If the meaning of the 'Location Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location Type' attribute. + * @see org.genivi.location.PointLocationType + * @see #setLocationType(PointLocationType) + * @see org.genivi.location.LocationPackage#getPointLocationInfo_LocationType() + * @model + * @generated + */ + PointLocationType getLocationType(); + + /** + * Sets the value of the '{@link org.genivi.location.PointLocationInfo#getLocationType Location Type}' attribute. + * + * + * @param value the new value of the 'Location Type' attribute. + * @see org.genivi.location.PointLocationType + * @see #getLocationType() + * @generated + */ + void setLocationType(PointLocationType value); + +} // PointLocationInfo diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationType.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationType.java new file mode 100755 index 0000000..cadb417 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/PointLocationType.java @@ -0,0 +1,269 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Point Location Type', + * and utility methods for working with them. + * + * @see org.genivi.location.LocationPackage#getPointLocationType() + * @model + * @generated + */ +public enum PointLocationType implements Enumerator { + /** + * The 'MOTORWAY EXIT' literal object. + * + * + * @see #MOTORWAY_EXIT_VALUE + * @generated + * @ordered + */ + MOTORWAY_EXIT(0, "MOTORWAY_EXIT", "MOTORWAY_EXIT"), + + /** + * The 'MOTORWAY TRIANGLE' literal object. + * + * + * @see #MOTORWAY_TRIANGLE_VALUE + * @generated + * @ordered + */ + MOTORWAY_TRIANGLE(1, "MOTORWAY_TRIANGLE", "MOTORWAY_TRIANGLE"), + + /** + * The 'MOTORWAY CROSSING' literal object. + * + * + * @see #MOTORWAY_CROSSING_VALUE + * @generated + * @ordered + */ + MOTORWAY_CROSSING(2, "MOTORWAY_CROSSING", "MOTORWAY_CROSSING"), + + /** + * The 'MOTORWAY ENTRY' literal object. + * + * + * @see #MOTORWAY_ENTRY_VALUE + * @generated + * @ordered + */ + MOTORWAY_ENTRY(3, "MOTORWAY_ENTRY", "MOTORWAY_ENTRY"); + + /** + * The 'MOTORWAY EXIT' literal value. + * + *

+ * If the meaning of 'MOTORWAY EXIT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTORWAY_EXIT + * @model + * @generated + * @ordered + */ + public static final int MOTORWAY_EXIT_VALUE = 0; + + /** + * The 'MOTORWAY TRIANGLE' literal value. + * + *

+ * If the meaning of 'MOTORWAY TRIANGLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTORWAY_TRIANGLE + * @model + * @generated + * @ordered + */ + public static final int MOTORWAY_TRIANGLE_VALUE = 1; + + /** + * The 'MOTORWAY CROSSING' literal value. + * + *

+ * If the meaning of 'MOTORWAY CROSSING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTORWAY_CROSSING + * @model + * @generated + * @ordered + */ + public static final int MOTORWAY_CROSSING_VALUE = 2; + + /** + * The 'MOTORWAY ENTRY' literal value. + * + *

+ * If the meaning of 'MOTORWAY ENTRY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTORWAY_ENTRY + * @model + * @generated + * @ordered + */ + public static final int MOTORWAY_ENTRY_VALUE = 3; + + /** + * An array of all the 'Point Location Type' enumerators. + * + * + * @generated + */ + private static final PointLocationType[] VALUES_ARRAY = + new PointLocationType[] { + MOTORWAY_EXIT, + MOTORWAY_TRIANGLE, + MOTORWAY_CROSSING, + MOTORWAY_ENTRY, + }; + + /** + * A public read-only list of all the 'Point Location Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Point Location Type' literal with the specified literal value. + * + * + * @generated + */ + public static PointLocationType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PointLocationType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Point Location Type' literal with the specified name. + * + * + * @generated + */ + public static PointLocationType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PointLocationType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Point Location Type' literal with the specified integer value. + * + * + * @generated + */ + public static PointLocationType get(int value) { + switch (value) { + case MOTORWAY_EXIT_VALUE: return MOTORWAY_EXIT; + case MOTORWAY_TRIANGLE_VALUE: return MOTORWAY_TRIANGLE; + case MOTORWAY_CROSSING_VALUE: return MOTORWAY_CROSSING; + case MOTORWAY_ENTRY_VALUE: return MOTORWAY_ENTRY; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private PointLocationType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //PointLocationType diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationImpl.java new file mode 100755 index 0000000..7c5fcff --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationImpl.java @@ -0,0 +1,46 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.genivi.location.AreaLocation; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Area Location'. + * + *

+ *

+ * + * @generated + */ +public class AreaLocationImpl extends LocationImpl implements AreaLocation { + /** + * + * + * @generated + */ + protected AreaLocationImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.AREA_LOCATION; + } + +} //AreaLocationImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationInfoImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationInfoImpl.java new file mode 100755 index 0000000..5d2ae54 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/AreaLocationInfoImpl.java @@ -0,0 +1,46 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.genivi.location.AreaLocationInfo; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Area Location Info'. + * + *

+ *

+ * + * @generated + */ +public class AreaLocationInfoImpl extends LocationInfoImpl implements AreaLocationInfo { + /** + * + * + * @generated + */ + protected AreaLocationInfoImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.AREA_LOCATION_INFO; + } + +} //AreaLocationInfoImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationImpl.java new file mode 100755 index 0000000..bc9a435 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationImpl.java @@ -0,0 +1,332 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.genivi.location.LinearLocation; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Linear Location'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.location.impl.LinearLocationImpl#getSegments Segments}
  • + *
  • {@link org.genivi.location.impl.LinearLocationImpl#getPositiveOffset Positive Offset}
  • + *
  • {@link org.genivi.location.impl.LinearLocationImpl#getNegativeOffset Negative Offset}
  • + *
+ *

+ * + * @generated + */ +public class LinearLocationImpl extends LocationImpl implements LinearLocation { + /** + * The cached value of the '{@link #getSegments() Segments}' attribute list. + * + * + * @see #getSegments() + * @generated + * @ordered + */ + protected EList segments; + + /** + * The default value of the '{@link #getPositiveOffset() Positive Offset}' attribute. + * + * + * @see #getPositiveOffset() + * @generated + * @ordered + */ + protected static final long POSITIVE_OFFSET_EDEFAULT = 0L; + /** + * The cached value of the '{@link #getPositiveOffset() Positive Offset}' attribute. + * + * + * @see #getPositiveOffset() + * @generated + * @ordered + */ + protected long positiveOffset = POSITIVE_OFFSET_EDEFAULT; + /** + * This is true if the Positive Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean positiveOffsetESet; + /** + * The default value of the '{@link #getNegativeOffset() Negative Offset}' attribute. + * + * + * @see #getNegativeOffset() + * @generated + * @ordered + */ + protected static final long NEGATIVE_OFFSET_EDEFAULT = 0L; + /** + * The cached value of the '{@link #getNegativeOffset() Negative Offset}' attribute. + * + * + * @see #getNegativeOffset() + * @generated + * @ordered + */ + protected long negativeOffset = NEGATIVE_OFFSET_EDEFAULT; + /** + * This is true if the Negative Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean negativeOffsetESet; + + /** + * + * + * @generated + */ + protected LinearLocationImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.LINEAR_LOCATION; + } + + /** + * + * + * @generated + */ + public EList getSegments() { + if (segments == null) { + segments = new EDataTypeUniqueEList(Long.class, this, LocationPackage.LINEAR_LOCATION__SEGMENTS); + } + return segments; + } + + /** + * + * + * @generated + */ + public long getPositiveOffset() { + return positiveOffset; + } + + /** + * + * + * @generated + */ + public void setPositiveOffset(long newPositiveOffset) { + long oldPositiveOffset = positiveOffset; + positiveOffset = newPositiveOffset; + boolean oldPositiveOffsetESet = positiveOffsetESet; + positiveOffsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET, oldPositiveOffset, positiveOffset, !oldPositiveOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetPositiveOffset() { + long oldPositiveOffset = positiveOffset; + boolean oldPositiveOffsetESet = positiveOffsetESet; + positiveOffset = POSITIVE_OFFSET_EDEFAULT; + positiveOffsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET, oldPositiveOffset, POSITIVE_OFFSET_EDEFAULT, oldPositiveOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetPositiveOffset() { + return positiveOffsetESet; + } + + /** + * + * + * @generated + */ + public long getNegativeOffset() { + return negativeOffset; + } + + /** + * + * + * @generated + */ + public void setNegativeOffset(long newNegativeOffset) { + long oldNegativeOffset = negativeOffset; + negativeOffset = newNegativeOffset; + boolean oldNegativeOffsetESet = negativeOffsetESet; + negativeOffsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET, oldNegativeOffset, negativeOffset, !oldNegativeOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetNegativeOffset() { + long oldNegativeOffset = negativeOffset; + boolean oldNegativeOffsetESet = negativeOffsetESet; + negativeOffset = NEGATIVE_OFFSET_EDEFAULT; + negativeOffsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET, oldNegativeOffset, NEGATIVE_OFFSET_EDEFAULT, oldNegativeOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNegativeOffset() { + return negativeOffsetESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION__SEGMENTS: + return getSegments(); + case LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET: + return getPositiveOffset(); + case LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET: + return getNegativeOffset(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION__SEGMENTS: + getSegments().clear(); + getSegments().addAll((Collection)newValue); + return; + case LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET: + setPositiveOffset((Long)newValue); + return; + case LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET: + setNegativeOffset((Long)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION__SEGMENTS: + getSegments().clear(); + return; + case LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET: + unsetPositiveOffset(); + return; + case LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET: + unsetNegativeOffset(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION__SEGMENTS: + return segments != null && !segments.isEmpty(); + case LocationPackage.LINEAR_LOCATION__POSITIVE_OFFSET: + return isSetPositiveOffset(); + case LocationPackage.LINEAR_LOCATION__NEGATIVE_OFFSET: + return isSetNegativeOffset(); + } + return super.eIsSet(featureID); + } + + /** + * + * + */ + @Override + public String toString() { +// if (eIsProxy()) return super.toString(); +// +// StringBuffer result = new StringBuffer(super.toString()); +// result.append(" (segments: "); +// result.append(segments); +// result.append(')'); +// return result.toString(); + StringBuffer result = new StringBuffer(); + + boolean first = true; + for (long segment: segments) { + if (first) { + first = false; + } else { + result.append(","); + } + result.append(segment); + } + + return result.toString(); + } + +} //LinearLocationImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationInfoImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationInfoImpl.java new file mode 100755 index 0000000..27a8837 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LinearLocationInfoImpl.java @@ -0,0 +1,391 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.common.Coordinate; + +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Linear Location Info'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.location.impl.LinearLocationInfoImpl#getFromLocationName From Location Name}
  • + *
  • {@link org.genivi.location.impl.LinearLocationInfoImpl#getFromLocationParentName From Location Parent Name}
  • + *
  • {@link org.genivi.location.impl.LinearLocationInfoImpl#getToLocationName To Location Name}
  • + *
  • {@link org.genivi.location.impl.LinearLocationInfoImpl#getToLocationParentName To Location Parent Name}
  • + *
  • {@link org.genivi.location.impl.LinearLocationInfoImpl#getCoordinates Coordinates}
  • + *
+ *

+ * + * @generated + */ +public class LinearLocationInfoImpl extends LocationInfoImpl implements LinearLocationInfo { + /** + * The default value of the '{@link #getFromLocationName() From Location Name}' attribute. + * + * + * @see #getFromLocationName() + * @generated + * @ordered + */ + protected static final String FROM_LOCATION_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFromLocationName() From Location Name}' attribute. + * + * + * @see #getFromLocationName() + * @generated + * @ordered + */ + protected String fromLocationName = FROM_LOCATION_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getFromLocationParentName() From Location Parent Name}' attribute. + * + * + * @see #getFromLocationParentName() + * @generated + * @ordered + */ + protected static final String FROM_LOCATION_PARENT_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFromLocationParentName() From Location Parent Name}' attribute. + * + * + * @see #getFromLocationParentName() + * @generated + * @ordered + */ + protected String fromLocationParentName = FROM_LOCATION_PARENT_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getToLocationName() To Location Name}' attribute. + * + * + * @see #getToLocationName() + * @generated + * @ordered + */ + protected static final String TO_LOCATION_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getToLocationName() To Location Name}' attribute. + * + * + * @see #getToLocationName() + * @generated + * @ordered + */ + protected String toLocationName = TO_LOCATION_NAME_EDEFAULT; + + /** + * The default value of the '{@link #getToLocationParentName() To Location Parent Name}' attribute. + * + * + * @see #getToLocationParentName() + * @generated + * @ordered + */ + protected static final String TO_LOCATION_PARENT_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getToLocationParentName() To Location Parent Name}' attribute. + * + * + * @see #getToLocationParentName() + * @generated + * @ordered + */ + protected String toLocationParentName = TO_LOCATION_PARENT_NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getCoordinates() Coordinates}' containment reference list. + * + * + * @see #getCoordinates() + * @generated + * @ordered + */ + protected EList coordinates; + + /** + * + * + * @generated + */ + protected LinearLocationInfoImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.LINEAR_LOCATION_INFO; + } + + /** + * + * + * @generated + */ + public String getFromLocationName() { + return fromLocationName; + } + + /** + * + * + * @generated + */ + public void setFromLocationName(String newFromLocationName) { + String oldFromLocationName = fromLocationName; + fromLocationName = newFromLocationName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_NAME, oldFromLocationName, fromLocationName)); + } + + /** + * + * + * @generated + */ + public String getFromLocationParentName() { + return fromLocationParentName; + } + + /** + * + * + * @generated + */ + public void setFromLocationParentName(String newFromLocationParentName) { + String oldFromLocationParentName = fromLocationParentName; + fromLocationParentName = newFromLocationParentName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME, oldFromLocationParentName, fromLocationParentName)); + } + + /** + * + * + * @generated + */ + public String getToLocationName() { + return toLocationName; + } + + /** + * + * + * @generated + */ + public void setToLocationName(String newToLocationName) { + String oldToLocationName = toLocationName; + toLocationName = newToLocationName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_NAME, oldToLocationName, toLocationName)); + } + + /** + * + * + * @generated + */ + public String getToLocationParentName() { + return toLocationParentName; + } + + /** + * + * + * @generated + */ + public void setToLocationParentName(String newToLocationParentName) { + String oldToLocationParentName = toLocationParentName; + toLocationParentName = newToLocationParentName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME, oldToLocationParentName, toLocationParentName)); + } + + /** + * + * + * @generated + */ + public EList getCoordinates() { + if (coordinates == null) { + coordinates = new EObjectContainmentEList(Coordinate.class, this, LocationPackage.LINEAR_LOCATION_INFO__COORDINATES); + } + return coordinates; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION_INFO__COORDINATES: + return ((InternalEList)getCoordinates()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_NAME: + return getFromLocationName(); + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME: + return getFromLocationParentName(); + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_NAME: + return getToLocationName(); + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME: + return getToLocationParentName(); + case LocationPackage.LINEAR_LOCATION_INFO__COORDINATES: + return getCoordinates(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_NAME: + setFromLocationName((String)newValue); + return; + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME: + setFromLocationParentName((String)newValue); + return; + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_NAME: + setToLocationName((String)newValue); + return; + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME: + setToLocationParentName((String)newValue); + return; + case LocationPackage.LINEAR_LOCATION_INFO__COORDINATES: + getCoordinates().clear(); + getCoordinates().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_NAME: + setFromLocationName(FROM_LOCATION_NAME_EDEFAULT); + return; + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME: + setFromLocationParentName(FROM_LOCATION_PARENT_NAME_EDEFAULT); + return; + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_NAME: + setToLocationName(TO_LOCATION_NAME_EDEFAULT); + return; + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME: + setToLocationParentName(TO_LOCATION_PARENT_NAME_EDEFAULT); + return; + case LocationPackage.LINEAR_LOCATION_INFO__COORDINATES: + getCoordinates().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_NAME: + return FROM_LOCATION_NAME_EDEFAULT == null ? fromLocationName != null : !FROM_LOCATION_NAME_EDEFAULT.equals(fromLocationName); + case LocationPackage.LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME: + return FROM_LOCATION_PARENT_NAME_EDEFAULT == null ? fromLocationParentName != null : !FROM_LOCATION_PARENT_NAME_EDEFAULT.equals(fromLocationParentName); + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_NAME: + return TO_LOCATION_NAME_EDEFAULT == null ? toLocationName != null : !TO_LOCATION_NAME_EDEFAULT.equals(toLocationName); + case LocationPackage.LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME: + return TO_LOCATION_PARENT_NAME_EDEFAULT == null ? toLocationParentName != null : !TO_LOCATION_PARENT_NAME_EDEFAULT.equals(toLocationParentName); + case LocationPackage.LINEAR_LOCATION_INFO__COORDINATES: + return coordinates != null && !coordinates.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (fromLocationName: "); + result.append(fromLocationName); + result.append(", fromLocationParentName: "); + result.append(fromLocationParentName); + result.append(", toLocationName: "); + result.append(toLocationName); + result.append(", toLocationParentName: "); + result.append(toLocationParentName); + result.append(')'); + return result.toString(); + } + +} //LinearLocationInfoImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationFactoryImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationFactoryImpl.java new file mode 100755 index 0000000..e5202cd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationFactoryImpl.java @@ -0,0 +1,230 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.location.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class LocationFactoryImpl extends EFactoryImpl implements LocationFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static LocationFactory init() { + try { + LocationFactory theLocationFactory = (LocationFactory)EPackage.Registry.INSTANCE.getEFactory(LocationPackage.eNS_URI); + if (theLocationFactory != null) { + return theLocationFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new LocationFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public LocationFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case LocationPackage.LOCATION: return createLocation(); + case LocationPackage.POINT_LOCATION: return createPointLocation(); + case LocationPackage.AREA_LOCATION: return createAreaLocation(); + case LocationPackage.LINEAR_LOCATION: return createLinearLocation(); + case LocationPackage.LOCATION_INFO: return createLocationInfo(); + case LocationPackage.POINT_LOCATION_INFO: return createPointLocationInfo(); + case LocationPackage.LINEAR_LOCATION_INFO: return createLinearLocationInfo(); + case LocationPackage.AREA_LOCATION_INFO: return createAreaLocationInfo(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case LocationPackage.POINT_LOCATION_TYPE: + return createPointLocationTypeFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case LocationPackage.POINT_LOCATION_TYPE: + return convertPointLocationTypeToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Location createLocation() { + LocationImpl location = new LocationImpl(); + return location; + } + + /** + * + * + * @generated + */ + public PointLocation createPointLocation() { + PointLocationImpl pointLocation = new PointLocationImpl(); + return pointLocation; + } + + /** + * + * + * @generated + */ + public AreaLocation createAreaLocation() { + AreaLocationImpl areaLocation = new AreaLocationImpl(); + return areaLocation; + } + + /** + * + * + * @generated + */ + public LinearLocation createLinearLocation() { + LinearLocationImpl linearLocation = new LinearLocationImpl(); + return linearLocation; + } + + /** + * + * + * @generated + */ + public LocationInfo createLocationInfo() { + LocationInfoImpl locationInfo = new LocationInfoImpl(); + return locationInfo; + } + + /** + * + * + * @generated + */ + public PointLocationInfo createPointLocationInfo() { + PointLocationInfoImpl pointLocationInfo = new PointLocationInfoImpl(); + return pointLocationInfo; + } + + /** + * + * + * @generated + */ + public LinearLocationInfo createLinearLocationInfo() { + LinearLocationInfoImpl linearLocationInfo = new LinearLocationInfoImpl(); + return linearLocationInfo; + } + + /** + * + * + * @generated + */ + public AreaLocationInfo createAreaLocationInfo() { + AreaLocationInfoImpl areaLocationInfo = new AreaLocationInfoImpl(); + return areaLocationInfo; + } + + /** + * + * + * @generated + */ + public PointLocationType createPointLocationTypeFromString(EDataType eDataType, String initialValue) { + PointLocationType result = PointLocationType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertPointLocationTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public LocationPackage getLocationPackage() { + return (LocationPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static LocationPackage getPackage() { + return LocationPackage.eINSTANCE; + } + +} //LocationFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationImpl.java new file mode 100755 index 0000000..926cae5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationImpl.java @@ -0,0 +1,48 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.location.Location; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Location'. + * + *

+ *

+ * + * @generated + */ +public class LocationImpl extends EObjectImpl implements Location { + /** + * + * + * @generated + */ + protected LocationImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.LOCATION; + } + +} //LocationImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationInfoImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationInfoImpl.java new file mode 100755 index 0000000..9675527 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationInfoImpl.java @@ -0,0 +1,252 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.Coordinate; + +import org.genivi.location.LocationInfo; +import org.genivi.location.LocationPackage; + +/** + * + * An implementation of the model object 'Info'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.location.impl.LocationInfoImpl#getName Name}
  • + *
  • {@link org.genivi.location.impl.LocationInfoImpl#getMainLocation Main Location}
  • + *
+ *

+ * + * @generated + */ +public class LocationInfoImpl extends EObjectImpl implements LocationInfo { + /** + * The default value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected static final String NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getName() Name}' attribute. + * + * + * @see #getName() + * @generated + * @ordered + */ + protected String name = NAME_EDEFAULT; + + /** + * The cached value of the '{@link #getMainLocation() Main Location}' containment reference. + * + * + * @see #getMainLocation() + * @generated + * @ordered + */ + protected Coordinate mainLocation; + + /** + * + * + * @generated + */ + protected LocationInfoImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.LOCATION_INFO; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public void setName(String newName) { + String oldName = name; + name = newName; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LOCATION_INFO__NAME, oldName, name)); + } + + /** + * + * + * @generated + */ + public Coordinate getMainLocation() { + return mainLocation; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetMainLocation(Coordinate newMainLocation, NotificationChain msgs) { + Coordinate oldMainLocation = mainLocation; + mainLocation = newMainLocation; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, LocationPackage.LOCATION_INFO__MAIN_LOCATION, oldMainLocation, newMainLocation); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setMainLocation(Coordinate newMainLocation) { + if (newMainLocation != mainLocation) { + NotificationChain msgs = null; + if (mainLocation != null) + msgs = ((InternalEObject)mainLocation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - LocationPackage.LOCATION_INFO__MAIN_LOCATION, null, msgs); + if (newMainLocation != null) + msgs = ((InternalEObject)newMainLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - LocationPackage.LOCATION_INFO__MAIN_LOCATION, null, msgs); + msgs = basicSetMainLocation(newMainLocation, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.LOCATION_INFO__MAIN_LOCATION, newMainLocation, newMainLocation)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case LocationPackage.LOCATION_INFO__MAIN_LOCATION: + return basicSetMainLocation(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LocationPackage.LOCATION_INFO__NAME: + return getName(); + case LocationPackage.LOCATION_INFO__MAIN_LOCATION: + return getMainLocation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LocationPackage.LOCATION_INFO__NAME: + setName((String)newValue); + return; + case LocationPackage.LOCATION_INFO__MAIN_LOCATION: + setMainLocation((Coordinate)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LocationPackage.LOCATION_INFO__NAME: + setName(NAME_EDEFAULT); + return; + case LocationPackage.LOCATION_INFO__MAIN_LOCATION: + setMainLocation((Coordinate)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LocationPackage.LOCATION_INFO__NAME: + return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case LocationPackage.LOCATION_INFO__MAIN_LOCATION: + return mainLocation != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (name: "); + result.append(name); + result.append(')'); + return result.toString(); + } + +} //LocationInfoImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationPackageImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationPackageImpl.java new file mode 100755 index 0000000..fa85423 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/LocationPackageImpl.java @@ -0,0 +1,484 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.genivi.common.CommonPackage; +import org.genivi.common.impl.CommonPackageImpl; +import org.genivi.location.AreaLocation; +import org.genivi.location.AreaLocationInfo; +import org.genivi.location.LinearLocation; +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.Location; +import org.genivi.location.LocationFactory; +import org.genivi.location.LocationInfo; +import org.genivi.location.LocationPackage; +import org.genivi.location.PointLocation; +import org.genivi.location.PointLocationInfo; +import org.genivi.location.PointLocationType; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class LocationPackageImpl extends EPackageImpl implements LocationPackage { + /** + * + * + * @generated + */ + private EClass locationEClass = null; + + /** + * + * + * @generated + */ + private EClass pointLocationEClass = null; + + /** + * + * + * @generated + */ + private EClass areaLocationEClass = null; + + /** + * + * + * @generated + */ + private EClass linearLocationEClass = null; + + /** + * + * + * @generated + */ + private EClass locationInfoEClass = null; + + /** + * + * + * @generated + */ + private EClass pointLocationInfoEClass = null; + + /** + * + * + * @generated + */ + private EClass linearLocationInfoEClass = null; + + /** + * + * + * @generated + */ + private EClass areaLocationInfoEClass = null; + + /** + * + * + * @generated + */ + private EEnum pointLocationTypeEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.location.LocationPackage#eNS_URI + * @see #init() + * @generated + */ + private LocationPackageImpl() { + super(eNS_URI, LocationFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link LocationPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static LocationPackage init() { + if (isInited) return (LocationPackage)EPackage.Registry.INSTANCE.getEPackage(LocationPackage.eNS_URI); + + // Obtain or create and register package + LocationPackageImpl theLocationPackage = (LocationPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof LocationPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new LocationPackageImpl()); + + isInited = true; + + // Obtain or create and register interdependencies + CommonPackageImpl theCommonPackage = (CommonPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) instanceof CommonPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI) : CommonPackage.eINSTANCE); + + // Create package meta-data objects + theLocationPackage.createPackageContents(); + theCommonPackage.createPackageContents(); + + // Initialize created meta-data + theLocationPackage.initializePackageContents(); + theCommonPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theLocationPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(LocationPackage.eNS_URI, theLocationPackage); + return theLocationPackage; + } + + /** + * + * + * @generated + */ + public EClass getLocation() { + return locationEClass; + } + + /** + * + * + * @generated + */ + public EClass getPointLocation() { + return pointLocationEClass; + } + + /** + * + * + * @generated + */ + public EClass getAreaLocation() { + return areaLocationEClass; + } + + /** + * + * + * @generated + */ + public EClass getLinearLocation() { + return linearLocationEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocation_Segments() { + return (EAttribute)linearLocationEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocation_PositiveOffset() { + return (EAttribute)linearLocationEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocation_NegativeOffset() { + return (EAttribute)linearLocationEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getLocationInfo() { + return locationInfoEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLocationInfo_Name() { + return (EAttribute)locationInfoEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getLocationInfo_MainLocation() { + return (EReference)locationInfoEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getPointLocationInfo() { + return pointLocationInfoEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getPointLocationInfo_LocationType() { + return (EAttribute)pointLocationInfoEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getLinearLocationInfo() { + return linearLocationInfoEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocationInfo_FromLocationName() { + return (EAttribute)linearLocationInfoEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocationInfo_FromLocationParentName() { + return (EAttribute)linearLocationInfoEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocationInfo_ToLocationName() { + return (EAttribute)linearLocationInfoEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getLinearLocationInfo_ToLocationParentName() { + return (EAttribute)linearLocationInfoEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getLinearLocationInfo_Coordinates() { + return (EReference)linearLocationInfoEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EClass getAreaLocationInfo() { + return areaLocationInfoEClass; + } + + /** + * + * + * @generated + */ + public EEnum getPointLocationType() { + return pointLocationTypeEEnum; + } + + /** + * + * + * @generated + */ + public LocationFactory getLocationFactory() { + return (LocationFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + locationEClass = createEClass(LOCATION); + + pointLocationEClass = createEClass(POINT_LOCATION); + + areaLocationEClass = createEClass(AREA_LOCATION); + + linearLocationEClass = createEClass(LINEAR_LOCATION); + createEAttribute(linearLocationEClass, LINEAR_LOCATION__SEGMENTS); + createEAttribute(linearLocationEClass, LINEAR_LOCATION__POSITIVE_OFFSET); + createEAttribute(linearLocationEClass, LINEAR_LOCATION__NEGATIVE_OFFSET); + + locationInfoEClass = createEClass(LOCATION_INFO); + createEAttribute(locationInfoEClass, LOCATION_INFO__NAME); + createEReference(locationInfoEClass, LOCATION_INFO__MAIN_LOCATION); + + pointLocationInfoEClass = createEClass(POINT_LOCATION_INFO); + createEAttribute(pointLocationInfoEClass, POINT_LOCATION_INFO__LOCATION_TYPE); + + linearLocationInfoEClass = createEClass(LINEAR_LOCATION_INFO); + createEAttribute(linearLocationInfoEClass, LINEAR_LOCATION_INFO__FROM_LOCATION_NAME); + createEAttribute(linearLocationInfoEClass, LINEAR_LOCATION_INFO__FROM_LOCATION_PARENT_NAME); + createEAttribute(linearLocationInfoEClass, LINEAR_LOCATION_INFO__TO_LOCATION_NAME); + createEAttribute(linearLocationInfoEClass, LINEAR_LOCATION_INFO__TO_LOCATION_PARENT_NAME); + createEReference(linearLocationInfoEClass, LINEAR_LOCATION_INFO__COORDINATES); + + areaLocationInfoEClass = createEClass(AREA_LOCATION_INFO); + + // Create enums + pointLocationTypeEEnum = createEEnum(POINT_LOCATION_TYPE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + pointLocationEClass.getESuperTypes().add(this.getLocation()); + areaLocationEClass.getESuperTypes().add(this.getLocation()); + linearLocationEClass.getESuperTypes().add(this.getLocation()); + pointLocationInfoEClass.getESuperTypes().add(this.getLocationInfo()); + linearLocationInfoEClass.getESuperTypes().add(this.getLocationInfo()); + areaLocationInfoEClass.getESuperTypes().add(this.getLocationInfo()); + + // Initialize classes and features; add operations and parameters + initEClass(locationEClass, Location.class, "Location", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(pointLocationEClass, PointLocation.class, "PointLocation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(areaLocationEClass, AreaLocation.class, "AreaLocation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(linearLocationEClass, LinearLocation.class, "LinearLocation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLinearLocation_Segments(), ecorePackage.getELong(), "segments", null, 1, -1, LinearLocation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLinearLocation_PositiveOffset(), ecorePackage.getELong(), "positiveOffset", null, 0, 1, LinearLocation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLinearLocation_NegativeOffset(), ecorePackage.getELong(), "negativeOffset", null, 0, 1, LinearLocation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(locationInfoEClass, LocationInfo.class, "LocationInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLocationInfo_Name(), ecorePackage.getEString(), "name", null, 0, 1, LocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getLocationInfo_MainLocation(), theCommonPackage.getCoordinate(), null, "mainLocation", null, 0, 1, LocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(pointLocationInfoEClass, PointLocationInfo.class, "PointLocationInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPointLocationInfo_LocationType(), this.getPointLocationType(), "locationType", null, 0, 1, PointLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(linearLocationInfoEClass, LinearLocationInfo.class, "LinearLocationInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLinearLocationInfo_FromLocationName(), ecorePackage.getEString(), "fromLocationName", null, 0, 1, LinearLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLinearLocationInfo_FromLocationParentName(), ecorePackage.getEString(), "fromLocationParentName", null, 0, 1, LinearLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLinearLocationInfo_ToLocationName(), ecorePackage.getEString(), "toLocationName", null, 0, 1, LinearLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLinearLocationInfo_ToLocationParentName(), ecorePackage.getEString(), "toLocationParentName", null, 0, 1, LinearLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getLinearLocationInfo_Coordinates(), theCommonPackage.getCoordinate(), null, "coordinates", null, 0, -1, LinearLocationInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(areaLocationInfoEClass, AreaLocationInfo.class, "AreaLocationInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + // Initialize enums and add enum literals + initEEnum(pointLocationTypeEEnum, PointLocationType.class, "PointLocationType"); + addEEnumLiteral(pointLocationTypeEEnum, PointLocationType.MOTORWAY_EXIT); + addEEnumLiteral(pointLocationTypeEEnum, PointLocationType.MOTORWAY_TRIANGLE); + addEEnumLiteral(pointLocationTypeEEnum, PointLocationType.MOTORWAY_CROSSING); + addEEnumLiteral(pointLocationTypeEEnum, PointLocationType.MOTORWAY_ENTRY); + + // Create resource + createResource(eNS_URI); + } + +} //LocationPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationImpl.java new file mode 100755 index 0000000..226eb33 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationImpl.java @@ -0,0 +1,46 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.genivi.location.LocationPackage; +import org.genivi.location.PointLocation; + +/** + * + * An implementation of the model object 'Point Location'. + * + *

+ *

+ * + * @generated + */ +public class PointLocationImpl extends LocationImpl implements PointLocation { + /** + * + * + * @generated + */ + protected PointLocationImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.POINT_LOCATION; + } + +} //PointLocationImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationInfoImpl.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationInfoImpl.java new file mode 100755 index 0000000..6648e28 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/impl/PointLocationInfoImpl.java @@ -0,0 +1,170 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.location.LocationPackage; +import org.genivi.location.PointLocationInfo; +import org.genivi.location.PointLocationType; + +/** + * + * An implementation of the model object 'Point Location Info'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.location.impl.PointLocationInfoImpl#getLocationType Location Type}
  • + *
+ *

+ * + * @generated + */ +public class PointLocationInfoImpl extends LocationInfoImpl implements PointLocationInfo { + /** + * The default value of the '{@link #getLocationType() Location Type}' attribute. + * + * + * @see #getLocationType() + * @generated + * @ordered + */ + protected static final PointLocationType LOCATION_TYPE_EDEFAULT = PointLocationType.MOTORWAY_EXIT; + + /** + * The cached value of the '{@link #getLocationType() Location Type}' attribute. + * + * + * @see #getLocationType() + * @generated + * @ordered + */ + protected PointLocationType locationType = LOCATION_TYPE_EDEFAULT; + + /** + * + * + * @generated + */ + protected PointLocationInfoImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return LocationPackage.Literals.POINT_LOCATION_INFO; + } + + /** + * + * + * @generated + */ + public PointLocationType getLocationType() { + return locationType; + } + + /** + * + * + * @generated + */ + public void setLocationType(PointLocationType newLocationType) { + PointLocationType oldLocationType = locationType; + locationType = newLocationType == null ? LOCATION_TYPE_EDEFAULT : newLocationType; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, LocationPackage.POINT_LOCATION_INFO__LOCATION_TYPE, oldLocationType, locationType)); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case LocationPackage.POINT_LOCATION_INFO__LOCATION_TYPE: + return getLocationType(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case LocationPackage.POINT_LOCATION_INFO__LOCATION_TYPE: + setLocationType((PointLocationType)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case LocationPackage.POINT_LOCATION_INFO__LOCATION_TYPE: + setLocationType(LOCATION_TYPE_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case LocationPackage.POINT_LOCATION_INFO__LOCATION_TYPE: + return locationType != LOCATION_TYPE_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (locationType: "); + result.append(locationType); + result.append(')'); + return result.toString(); + } + +} //PointLocationInfoImpl diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationAdapterFactory.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationAdapterFactory.java new file mode 100755 index 0000000..8deec54 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationAdapterFactory.java @@ -0,0 +1,253 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.location.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.location.LocationPackage + * @generated + */ +public class LocationAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static LocationPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public LocationAdapterFactory() { + if (modelPackage == null) { + modelPackage = LocationPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected LocationSwitch modelSwitch = + new LocationSwitch() { + @Override + public Adapter caseLocation(Location object) { + return createLocationAdapter(); + } + @Override + public Adapter casePointLocation(PointLocation object) { + return createPointLocationAdapter(); + } + @Override + public Adapter caseAreaLocation(AreaLocation object) { + return createAreaLocationAdapter(); + } + @Override + public Adapter caseLinearLocation(LinearLocation object) { + return createLinearLocationAdapter(); + } + @Override + public Adapter caseLocationInfo(LocationInfo object) { + return createLocationInfoAdapter(); + } + @Override + public Adapter casePointLocationInfo(PointLocationInfo object) { + return createPointLocationInfoAdapter(); + } + @Override + public Adapter caseLinearLocationInfo(LinearLocationInfo object) { + return createLinearLocationInfoAdapter(); + } + @Override + public Adapter caseAreaLocationInfo(AreaLocationInfo object) { + return createAreaLocationInfoAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.Location Location}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.Location + * @generated + */ + public Adapter createLocationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.PointLocation Point Location}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.PointLocation + * @generated + */ + public Adapter createPointLocationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.AreaLocation Area Location}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.AreaLocation + * @generated + */ + public Adapter createAreaLocationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.LinearLocation Linear Location}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.LinearLocation + * @generated + */ + public Adapter createLinearLocationAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.LocationInfo Info}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.LocationInfo + * @generated + */ + public Adapter createLocationInfoAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.PointLocationInfo Point Location Info}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.PointLocationInfo + * @generated + */ + public Adapter createPointLocationInfoAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.LinearLocationInfo Linear Location Info}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.LinearLocationInfo + * @generated + */ + public Adapter createLinearLocationInfoAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.location.AreaLocationInfo Area Location Info}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.location.AreaLocationInfo + * @generated + */ + public Adapter createAreaLocationInfoAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //LocationAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationSwitch.java b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationSwitch.java new file mode 100755 index 0000000..0608191 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.basetypes-model/src/org/genivi/location/util/LocationSwitch.java @@ -0,0 +1,276 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.location.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.genivi.location.AreaLocation; +import org.genivi.location.AreaLocationInfo; +import org.genivi.location.LinearLocation; +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; +import org.genivi.location.LocationPackage; +import org.genivi.location.PointLocation; +import org.genivi.location.PointLocationInfo; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.location.LocationPackage + * @generated + */ +public class LocationSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static LocationPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public LocationSwitch() { + if (modelPackage == null) { + modelPackage = LocationPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case LocationPackage.LOCATION: { + Location location = (Location)theEObject; + T result = caseLocation(location); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.POINT_LOCATION: { + PointLocation pointLocation = (PointLocation)theEObject; + T result = casePointLocation(pointLocation); + if (result == null) result = caseLocation(pointLocation); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.AREA_LOCATION: { + AreaLocation areaLocation = (AreaLocation)theEObject; + T result = caseAreaLocation(areaLocation); + if (result == null) result = caseLocation(areaLocation); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.LINEAR_LOCATION: { + LinearLocation linearLocation = (LinearLocation)theEObject; + T result = caseLinearLocation(linearLocation); + if (result == null) result = caseLocation(linearLocation); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.LOCATION_INFO: { + LocationInfo locationInfo = (LocationInfo)theEObject; + T result = caseLocationInfo(locationInfo); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.POINT_LOCATION_INFO: { + PointLocationInfo pointLocationInfo = (PointLocationInfo)theEObject; + T result = casePointLocationInfo(pointLocationInfo); + if (result == null) result = caseLocationInfo(pointLocationInfo); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.LINEAR_LOCATION_INFO: { + LinearLocationInfo linearLocationInfo = (LinearLocationInfo)theEObject; + T result = caseLinearLocationInfo(linearLocationInfo); + if (result == null) result = caseLocationInfo(linearLocationInfo); + if (result == null) result = defaultCase(theEObject); + return result; + } + case LocationPackage.AREA_LOCATION_INFO: { + AreaLocationInfo areaLocationInfo = (AreaLocationInfo)theEObject; + T result = caseAreaLocationInfo(areaLocationInfo); + if (result == null) result = caseLocationInfo(areaLocationInfo); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Location'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Location'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocation(Location object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Point Location'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Point Location'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePointLocation(PointLocation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Area Location'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Area Location'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAreaLocation(AreaLocation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Linear Location'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Linear Location'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLinearLocation(LinearLocation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Info'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Info'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocationInfo(LocationInfo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Point Location Info'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Point Location Info'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePointLocationInfo(PointLocationInfo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Linear Location Info'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Linear Location Info'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLinearLocationInfo(LinearLocationInfo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Area Location Info'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Area Location Info'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAreaLocationInfo(AreaLocationInfo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //LocationSwitch diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/.classpath b/src/traffic-incidents-service/org.genivi.booleanexpr-model/.classpath new file mode 100755 index 0000000..90776db --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/.classpath @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/.project b/src/traffic-incidents-service/org.genivi.booleanexpr-model/.project new file mode 100755 index 0000000..dcce263 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/.project @@ -0,0 +1,23 @@ + + + org.genivi.booleanexpr-model + This project contains a Filter Expression to be used in GENIVI. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.trafficinfo.demo + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.booleanexpr-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..ab264c9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.booleanexpr-model;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.booleanexpr, + org.genivi.booleanexpr.impl, + org.genivi.booleanexpr.util, + org.genivi.family, + org.genivi.family.impl, + org.genivi.family.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.junit +Bundle-ActivationPolicy: lazy diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.booleanexpr-model/ReadMe.confluence new file mode 100755 index 0000000..dfca2ca --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/ReadMe.confluence @@ -0,0 +1,6 @@ +This project defines a Boolean Expression. +These expressions are used in the TrafficIncidents interface, but can also be used in other locations where hierarchical data is used. +Detailed information can be found in the "GENIVI TrafficIncidentsService Component Specification". + +In the model folder, FilterExpr.ecore defines the Boolean Expressions. The Family.ecore model is only used for testing. +FilterExpr.ecorediag provides a good overview of the structure of a Boolean Expression. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/build.properties b/src/traffic-incidents-service/org.genivi.booleanexpr-model/build.properties new file mode 100755 index 0000000..3343fc7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = srcOld/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecore b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecore new file mode 100755 index 0000000..989b003 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecore @@ -0,0 +1,45 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecorediag b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecorediag new file mode 100755 index 0000000..2feb3d1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.ecorediag @@ -0,0 +1,186 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.genmodel b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.genmodel new file mode 100755 index 0000000..aa64cd6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/Family.genmodel @@ -0,0 +1,37 @@ + + + Family.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecore b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecore new file mode 100755 index 0000000..e473c9f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecore @@ -0,0 +1,186 @@ + + + +
+ + + +
+ + + + + + + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + +
+ + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + +
+ + + + + + + + + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + + + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ + + + + + +
+ + + + + + + + + + + +
+ + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecorediag b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecorediag new file mode 100755 index 0000000..5300a00 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.ecorediag @@ -0,0 +1,694 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.genmodel b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.genmodel new file mode 100755 index 0000000..a351c26 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/model/FilterExpr.genmodel @@ -0,0 +1,110 @@ + + + FilterExpr.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.properties b/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.properties new file mode 100755 index 0000000..080a377 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = FilterExpr Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.xml b/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.xml new file mode 100755 index 0000000..3b56839 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/plugin.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/pom.xml b/src/traffic-incidents-service/org.genivi.booleanexpr-model/pom.xml new file mode 100755 index 0000000..f7f823a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + org.genivi + booleanexpr-model + jar + 1.0-SNAPSHOT + GENIVI Filter Expression + This project contains a Filter Expression to be used in GENIVI. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + junit + junit + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi.trafficinfo + demo + + + + src/main/java + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanExpression.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanExpression.java new file mode 100755 index 0000000..ba61597 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanExpression.java @@ -0,0 +1,47 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.ecore.EObject; + + +/** + * + * A representation of the model object 'Filter Expression'. + * + * + * + * This is the top level class for boolean expressions. + * + * + * + * @see org.genivi.booleanexpr.FilterexprPackage#getBooleanExpression() + * @model abstract="true" + * @generated + */ +public interface BooleanExpression extends EObject { + + /** + * + * + * @model + * @generated + */ + boolean evaluate(Object object); + + /** + * + * + * @model + * @generated + */ + String format(String indent, String indentSize); + +} // FilterExpression diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanLiteral.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanLiteral.java new file mode 100755 index 0000000..3cce8c1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/BooleanLiteral.java @@ -0,0 +1,87 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Boolean Literal'. + * + * + * + * This class represents the boolean literal values 'true' and 'false'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.BooleanLiteral#isValue Value}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getBooleanLiteral() + * @model + * @generated + */ +public interface BooleanLiteral extends Literal { + /** + * Returns the value of the 'Value' attribute. + * + *

+ * If the meaning of the 'Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #setValue(boolean) + * @see org.genivi.booleanexpr.FilterexprPackage#getBooleanLiteral_Value() + * @model unsettable="true" required="true" + * @generated + */ + boolean isValue(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.BooleanLiteral#isValue Value}' attribute. + * + * + * @param value the new value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #isValue() + * @generated + */ + void setValue(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.BooleanLiteral#isValue Value}' attribute. + * + * + * @see #isSetValue() + * @see #isValue() + * @see #setValue(boolean) + * @generated + */ + void unsetValue(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.BooleanLiteral#isValue Value}' attribute is set. + * + * + * @return whether the value of the 'Value' attribute is set. + * @see #unsetValue() + * @see #isValue() + * @see #setValue(boolean) + * @generated + */ + boolean isSetValue(); + +} // BooleanLiteral diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ClassAttribute.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ClassAttribute.java new file mode 100755 index 0000000..63c4871 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ClassAttribute.java @@ -0,0 +1,225 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + + +/** + * + * A representation of the model object 'Class Attribute'. + * + * + * + * This class represents an attribute of a class of a data model. The attribute is identified by its name. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.ClassAttribute#getAttributeName Attribute Name}
  • + *
  • {@link org.genivi.booleanexpr.ClassAttribute#getMetaOperator Meta Operator}
  • + *
  • {@link org.genivi.booleanexpr.ClassAttribute#getIndex Index}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getClassAttribute() + * @model + * @generated + */ +public interface ClassAttribute extends EObject { + /** + * Returns the value of the 'Attribute Name' attribute. + * + *

+ * If the meaning of the 'Attribute Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Attribute Name' attribute. + * @see #isSetAttributeName() + * @see #unsetAttributeName() + * @see #setAttributeName(String) + * @see org.genivi.booleanexpr.FilterexprPackage#getClassAttribute_AttributeName() + * @model unsettable="true" required="true" + * @generated + */ + String getAttributeName(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getAttributeName Attribute Name}' attribute. + * + * + * @param value the new value of the 'Attribute Name' attribute. + * @see #isSetAttributeName() + * @see #unsetAttributeName() + * @see #getAttributeName() + * @generated + */ + void setAttributeName(String value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getAttributeName Attribute Name}' attribute. + * + * + * @see #isSetAttributeName() + * @see #getAttributeName() + * @see #setAttributeName(String) + * @generated + */ + void unsetAttributeName(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getAttributeName Attribute Name}' attribute is set. + * + * + * @return whether the value of the 'Attribute Name' attribute is set. + * @see #unsetAttributeName() + * @see #getAttributeName() + * @see #setAttributeName(String) + * @generated + */ + boolean isSetAttributeName(); + + /** + * Returns the value of the 'Meta Operator' attribute. + * The literals are from the enumeration {@link org.genivi.booleanexpr.MetaOperator}. + * + *

+ * If the meaning of the 'Meta Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Meta Operator' attribute. + * @see org.genivi.booleanexpr.MetaOperator + * @see #isSetMetaOperator() + * @see #unsetMetaOperator() + * @see #setMetaOperator(MetaOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getClassAttribute_MetaOperator() + * @model unsettable="true" + * @generated + */ + MetaOperator getMetaOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getMetaOperator Meta Operator}' attribute. + * + * + * @param value the new value of the 'Meta Operator' attribute. + * @see org.genivi.booleanexpr.MetaOperator + * @see #isSetMetaOperator() + * @see #unsetMetaOperator() + * @see #getMetaOperator() + * @generated + */ + void setMetaOperator(MetaOperator value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getMetaOperator Meta Operator}' attribute. + * + * + * @see #isSetMetaOperator() + * @see #getMetaOperator() + * @see #setMetaOperator(MetaOperator) + * @generated + */ + void unsetMetaOperator(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getMetaOperator Meta Operator}' attribute is set. + * + * + * @return whether the value of the 'Meta Operator' attribute is set. + * @see #unsetMetaOperator() + * @see #getMetaOperator() + * @see #setMetaOperator(MetaOperator) + * @generated + */ + boolean isSetMetaOperator(); + + /** + * Returns the value of the 'Index' attribute. + * + *

+ * If the meaning of the 'Index' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Index' attribute. + * @see #isSetIndex() + * @see #unsetIndex() + * @see #setIndex(int) + * @see org.genivi.booleanexpr.FilterexprPackage#getClassAttribute_Index() + * @model unsettable="true" + * @generated + */ + int getIndex(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getIndex Index}' attribute. + * + * + * @param value the new value of the 'Index' attribute. + * @see #isSetIndex() + * @see #unsetIndex() + * @see #getIndex() + * @generated + */ + void setIndex(int value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getIndex Index}' attribute. + * + * + * @see #isSetIndex() + * @see #getIndex() + * @see #setIndex(int) + * @generated + */ + void unsetIndex(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.ClassAttribute#getIndex Index}' attribute is set. + * + * + * @return whether the value of the 'Index' attribute is set. + * @see #unsetIndex() + * @see #getIndex() + * @see #setIndex(int) + * @generated + */ + boolean isSetIndex(); + + /** + * + * + * @model + * @generated + */ + boolean isSet(EObject object); + + /** + * + * + * @model many="false" + * @generated + */ + EList getListValue(Object object); + + /** + * + * + * @model + * @generated + */ + Object getValue(Object object); + +} // ClassAttribute diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonOperator.java new file mode 100755 index 0000000..b1dacc2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonOperator.java @@ -0,0 +1,326 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Comparison Operator', + * and utility methods for working with them. + * + * + * This enumeration defines the operators for comparison. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getComparisonOperator() + * @model + * @generated + */ +public enum ComparisonOperator implements Enumerator { + /** + * The 'EQUAL' literal object. + * + * + * @see #EQUAL_VALUE + * @generated + * @ordered + */ + EQUAL(0, "EQUAL", "EQUAL"), + + /** + * The 'NOT EQUAL' literal object. + * + * + * @see #NOT_EQUAL_VALUE + * @generated + * @ordered + */ + NOT_EQUAL(1, "NOT_EQUAL", "NOT_EQUAL"), + + /** + * The 'GREATER THEN' literal object. + * + * + * @see #GREATER_THEN_VALUE + * @generated + * @ordered + */ + GREATER_THEN(2, "GREATER_THEN", "GREATER_THEN"), + + /** + * The 'GREATER OR EQUAL THAN' literal object. + * + * + * @see #GREATER_OR_EQUAL_THAN_VALUE + * @generated + * @ordered + */ + GREATER_OR_EQUAL_THAN(3, "GREATER_OR_EQUAL_THAN", "GREATER_OR_EQUAL_THAN"), + + /** + * The 'LESS THAN' literal object. + * + * + * @see #LESS_THAN_VALUE + * @generated + * @ordered + */ + LESS_THAN(4, "LESS_THAN", "LESS_THAN"), + + /** + * The 'LESS OR EQUAL THAN' literal object. + * + * + * @see #LESS_OR_EQUAL_THAN_VALUE + * @generated + * @ordered + */ + LESS_OR_EQUAL_THAN(5, "LESS_OR_EQUAL_THAN", "LESS_OR_EQUAL_THAN"); + + /** + * The 'EQUAL' literal value. + * + *

+ * If the meaning of 'EQUAL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EQUAL + * @model + * @generated + * @ordered + */ + public static final int EQUAL_VALUE = 0; + + /** + * The 'NOT EQUAL' literal value. + * + *

+ * If the meaning of 'NOT EQUAL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NOT_EQUAL + * @model + * @generated + * @ordered + */ + public static final int NOT_EQUAL_VALUE = 1; + + /** + * The 'GREATER THEN' literal value. + * + *

+ * If the meaning of 'GREATER THEN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GREATER_THEN + * @model + * @generated + * @ordered + */ + public static final int GREATER_THEN_VALUE = 2; + + /** + * The 'GREATER OR EQUAL THAN' literal value. + * + *

+ * If the meaning of 'GREATER OR EQUAL THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GREATER_OR_EQUAL_THAN + * @model + * @generated + * @ordered + */ + public static final int GREATER_OR_EQUAL_THAN_VALUE = 3; + + /** + * The 'LESS THAN' literal value. + * + *

+ * If the meaning of 'LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int LESS_THAN_VALUE = 4; + + /** + * The 'LESS OR EQUAL THAN' literal value. + * + *

+ * If the meaning of 'LESS OR EQUAL THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LESS_OR_EQUAL_THAN + * @model + * @generated + * @ordered + */ + public static final int LESS_OR_EQUAL_THAN_VALUE = 5; + + /** + * An array of all the 'Comparison Operator' enumerators. + * + * + * @generated + */ + private static final ComparisonOperator[] VALUES_ARRAY = + new ComparisonOperator[] { + EQUAL, + NOT_EQUAL, + GREATER_THEN, + GREATER_OR_EQUAL_THAN, + LESS_THAN, + LESS_OR_EQUAL_THAN, + }; + + /** + * A public read-only list of all the 'Comparison Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Comparison Operator' literal with the specified literal value. + * + * + * @generated + */ + public static ComparisonOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ComparisonOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Comparison Operator' literal with the specified name. + * + * + * @generated + */ + public static ComparisonOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ComparisonOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Comparison Operator' literal with the specified integer value. + * + * + * @generated + */ + public static ComparisonOperator get(int value) { + switch (value) { + case EQUAL_VALUE: return EQUAL; + case NOT_EQUAL_VALUE: return NOT_EQUAL; + case GREATER_THEN_VALUE: return GREATER_THEN; + case GREATER_OR_EQUAL_THAN_VALUE: return GREATER_OR_EQUAL_THAN; + case LESS_THAN_VALUE: return LESS_THAN; + case LESS_OR_EQUAL_THAN_VALUE: return LESS_OR_EQUAL_THAN; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ComparisonOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ComparisonOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonPredicate.java new file mode 100755 index 0000000..ce24fb2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ComparisonPredicate.java @@ -0,0 +1,118 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Comparison Predicate'. + * + * + * + * This predicate compares the value of an attribute of a class to a literal value (a constant). + * For example "myAttribute == 22". + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.ComparisonPredicate#getLiteral Literal}
  • + *
  • {@link org.genivi.booleanexpr.ComparisonPredicate#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.ComparisonPredicate#getComparisonOperator Comparison Operator}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getComparisonPredicate() + * @model + * @generated + */ +public interface ComparisonPredicate extends Predicate { + /** + * Returns the value of the 'Comparison Operator' attribute. + * The literals are from the enumeration {@link org.genivi.booleanexpr.ComparisonOperator}. + * + *

+ * If the meaning of the 'Comparison Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Comparison Operator' attribute. + * @see org.genivi.booleanexpr.ComparisonOperator + * @see #setComparisonOperator(ComparisonOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getComparisonPredicate_ComparisonOperator() + * @model required="true" + * @generated + */ + ComparisonOperator getComparisonOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ComparisonPredicate#getComparisonOperator Comparison Operator}' attribute. + * + * + * @param value the new value of the 'Comparison Operator' attribute. + * @see org.genivi.booleanexpr.ComparisonOperator + * @see #getComparisonOperator() + * @generated + */ + void setComparisonOperator(ComparisonOperator value); + + /** + * Returns the value of the 'Literal' containment reference. + * + *

+ * If the meaning of the 'Literal' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Literal' containment reference. + * @see #setLiteral(Literal) + * @see org.genivi.booleanexpr.FilterexprPackage#getComparisonPredicate_Literal() + * @model containment="true" required="true" + * @generated + */ + Literal getLiteral(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ComparisonPredicate#getLiteral Literal}' containment reference. + * + * + * @param value the new value of the 'Literal' containment reference. + * @see #getLiteral() + * @generated + */ + void setLiteral(Literal value); + + /** + * Returns the value of the 'Attribute' containment reference. + * + *

+ * If the meaning of the 'Attribute' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Attribute' containment reference. + * @see #setAttribute(ClassAttribute) + * @see org.genivi.booleanexpr.FilterexprPackage#getComparisonPredicate_Attribute() + * @model containment="true" required="true" + * @generated + */ + ClassAttribute getAttribute(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.ComparisonPredicate#getAttribute Attribute}' containment reference. + * + * + * @param value the new value of the 'Attribute' containment reference. + * @see #getAttribute() + * @generated + */ + void setAttribute(ClassAttribute value); + +} // ComparisonPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DownCastPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DownCastPredicate.java new file mode 100755 index 0000000..8d2ea0f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DownCastPredicate.java @@ -0,0 +1,143 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Down Cast Predicate'. + * + * + * + * This predicate is used to handle expressions on classes which extend a base class. + * Example: Class Person has one attribute 'name'. Class Driver extends Person and adds an attribute 'driversLicenseNo'. + * Now anywhere that Person can be used in a data model, it may also be a Driver. But to use a Driver specific attribute, the Person has to be downcast to a Driver. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.DownCastPredicate#getClassName Class Name}
  • + *
  • {@link org.genivi.booleanexpr.DownCastPredicate#getExpression Expression}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getDownCastPredicate() + * @model + * @generated + */ +public interface DownCastPredicate extends Predicate { + /** + * Returns the value of the 'Class Name' attribute. + * + *

+ * If the meaning of the 'Class Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Class Name' attribute. + * @see #isSetClassName() + * @see #unsetClassName() + * @see #setClassName(String) + * @see org.genivi.booleanexpr.FilterexprPackage#getDownCastPredicate_ClassName() + * @model unsettable="true" required="true" + * @generated + */ + String getClassName(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getClassName Class Name}' attribute. + * + * + * @param value the new value of the 'Class Name' attribute. + * @see #isSetClassName() + * @see #unsetClassName() + * @see #getClassName() + * @generated + */ + void setClassName(String value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getClassName Class Name}' attribute. + * + * + * @see #isSetClassName() + * @see #getClassName() + * @see #setClassName(String) + * @generated + */ + void unsetClassName(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getClassName Class Name}' attribute is set. + * + * + * @return whether the value of the 'Class Name' attribute is set. + * @see #unsetClassName() + * @see #getClassName() + * @see #setClassName(String) + * @generated + */ + boolean isSetClassName(); + + /** + * Returns the value of the 'Expression' containment reference. + * + *

+ * If the meaning of the 'Expression' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expression' containment reference. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #setExpression(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getDownCastPredicate_Expression() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + BooleanExpression getExpression(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getExpression Expression}' containment reference. + * + * + * @param value the new value of the 'Expression' containment reference. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #getExpression() + * @generated + */ + void setExpression(BooleanExpression value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getExpression Expression}' containment reference. + * + * + * @see #isSetExpression() + * @see #getExpression() + * @see #setExpression(BooleanExpression) + * @generated + */ + void unsetExpression(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.DownCastPredicate#getExpression Expression}' containment reference is set. + * + * + * @return whether the value of the 'Expression' containment reference is set. + * @see #unsetExpression() + * @see #getExpression() + * @see #setExpression(BooleanExpression) + * @generated + */ + boolean isSetExpression(); + +} // DownCastPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicExpression.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicExpression.java new file mode 100755 index 0000000..53d2972 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicExpression.java @@ -0,0 +1,199 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Dyadic Expression'. + * + * + * + * This is an expression of the form 'expression' DyadicLogicalOperator 'expression', like 'expression' AND 'expression'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.DyadicExpression#getLogicalOperator Logical Operator}
  • + *
  • {@link org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm Left Hand Term}
  • + *
  • {@link org.genivi.booleanexpr.DyadicExpression#getRightHandTerm Right Hand Term}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getDyadicExpression() + * @model + * @generated + */ +public interface DyadicExpression extends BooleanExpression { + /** + * Returns the value of the 'Logical Operator' attribute. + * The default value is "AND". + * The literals are from the enumeration {@link org.genivi.booleanexpr.DyadicLogicalOperator}. + * + *

+ * If the meaning of the 'Logical Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Logical Operator' attribute. + * @see org.genivi.booleanexpr.DyadicLogicalOperator + * @see #isSetLogicalOperator() + * @see #unsetLogicalOperator() + * @see #setLogicalOperator(DyadicLogicalOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getDyadicExpression_LogicalOperator() + * @model default="AND" unsettable="true" required="true" + * @generated + */ + DyadicLogicalOperator getLogicalOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLogicalOperator Logical Operator}' attribute. + * + * + * @param value the new value of the 'Logical Operator' attribute. + * @see org.genivi.booleanexpr.DyadicLogicalOperator + * @see #isSetLogicalOperator() + * @see #unsetLogicalOperator() + * @see #getLogicalOperator() + * @generated + */ + void setLogicalOperator(DyadicLogicalOperator value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLogicalOperator Logical Operator}' attribute. + * + * + * @see #isSetLogicalOperator() + * @see #getLogicalOperator() + * @see #setLogicalOperator(DyadicLogicalOperator) + * @generated + */ + void unsetLogicalOperator(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLogicalOperator Logical Operator}' attribute is set. + * + * + * @return whether the value of the 'Logical Operator' attribute is set. + * @see #unsetLogicalOperator() + * @see #getLogicalOperator() + * @see #setLogicalOperator(DyadicLogicalOperator) + * @generated + */ + boolean isSetLogicalOperator(); + + /** + * Returns the value of the 'Left Hand Term' containment reference. + * + *

+ * If the meaning of the 'Left Hand Term' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Left Hand Term' containment reference. + * @see #isSetLeftHandTerm() + * @see #unsetLeftHandTerm() + * @see #setLeftHandTerm(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getDyadicExpression_LeftHandTerm() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + BooleanExpression getLeftHandTerm(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm Left Hand Term}' containment reference. + * + * + * @param value the new value of the 'Left Hand Term' containment reference. + * @see #isSetLeftHandTerm() + * @see #unsetLeftHandTerm() + * @see #getLeftHandTerm() + * @generated + */ + void setLeftHandTerm(BooleanExpression value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm Left Hand Term}' containment reference. + * + * + * @see #isSetLeftHandTerm() + * @see #getLeftHandTerm() + * @see #setLeftHandTerm(BooleanExpression) + * @generated + */ + void unsetLeftHandTerm(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm Left Hand Term}' containment reference is set. + * + * + * @return whether the value of the 'Left Hand Term' containment reference is set. + * @see #unsetLeftHandTerm() + * @see #getLeftHandTerm() + * @see #setLeftHandTerm(BooleanExpression) + * @generated + */ + boolean isSetLeftHandTerm(); + + /** + * Returns the value of the 'Right Hand Term' containment reference. + * + *

+ * If the meaning of the 'Right Hand Term' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Right Hand Term' containment reference. + * @see #isSetRightHandTerm() + * @see #unsetRightHandTerm() + * @see #setRightHandTerm(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getDyadicExpression_RightHandTerm() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + BooleanExpression getRightHandTerm(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getRightHandTerm Right Hand Term}' containment reference. + * + * + * @param value the new value of the 'Right Hand Term' containment reference. + * @see #isSetRightHandTerm() + * @see #unsetRightHandTerm() + * @see #getRightHandTerm() + * @generated + */ + void setRightHandTerm(BooleanExpression value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getRightHandTerm Right Hand Term}' containment reference. + * + * + * @see #isSetRightHandTerm() + * @see #getRightHandTerm() + * @see #setRightHandTerm(BooleanExpression) + * @generated + */ + void unsetRightHandTerm(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.DyadicExpression#getRightHandTerm Right Hand Term}' containment reference is set. + * + * + * @return whether the value of the 'Right Hand Term' containment reference is set. + * @see #unsetRightHandTerm() + * @see #getRightHandTerm() + * @see #setRightHandTerm(BooleanExpression) + * @generated + */ + boolean isSetRightHandTerm(); + +} // DyadicExpression diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicLogicalOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicLogicalOperator.java new file mode 100755 index 0000000..1785bef --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/DyadicLogicalOperator.java @@ -0,0 +1,219 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Dyadic Logical Operator', + * and utility methods for working with them. + * + * + * This enumeration defines the operators for DyadicExpressions. + * AND has a higher precedence than OR. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getDyadicLogicalOperator() + * @model + * @generated + */ +public enum DyadicLogicalOperator implements Enumerator { + /** + * The 'AND' literal object. + * + * + * @see #AND_VALUE + * @generated + * @ordered + */ + AND(0, "AND", "AND"), + + /** + * The 'OR' literal object. + * + * + * @see #OR_VALUE + * @generated + * @ordered + */ + OR(1, "OR", "OR"); + + /** + * The 'AND' literal value. + * + *

+ * If the meaning of 'AND' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AND + * @model + * @generated + * @ordered + */ + public static final int AND_VALUE = 0; + + /** + * The 'OR' literal value. + * + *

+ * If the meaning of 'OR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OR + * @model + * @generated + * @ordered + */ + public static final int OR_VALUE = 1; + + /** + * An array of all the 'Dyadic Logical Operator' enumerators. + * + * + * @generated + */ + private static final DyadicLogicalOperator[] VALUES_ARRAY = + new DyadicLogicalOperator[] { + AND, + OR, + }; + + /** + * A public read-only list of all the 'Dyadic Logical Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Dyadic Logical Operator' literal with the specified literal value. + * + * + * @generated + */ + public static DyadicLogicalOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DyadicLogicalOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Dyadic Logical Operator' literal with the specified name. + * + * + * @generated + */ + public static DyadicLogicalOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DyadicLogicalOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Dyadic Logical Operator' literal with the specified integer value. + * + * + * @generated + */ + public static DyadicLogicalOperator get(int value) { + switch (value) { + case AND_VALUE: return AND; + case OR_VALUE: return OR; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private DyadicLogicalOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //DyadicLogicalOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprFactory.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprFactory.java new file mode 100755 index 0000000..8943b73 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprFactory.java @@ -0,0 +1,148 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.booleanexpr.FilterexprPackage + * @generated + */ +public interface FilterexprFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + FilterexprFactory eINSTANCE = org.genivi.booleanexpr.impl.FilterexprFactoryImpl.init(); + + /** + * Returns a new object of class 'Unary Expression'. + * + * + * @return a new object of class 'Unary Expression'. + * @generated + */ + UnaryExpression createUnaryExpression(); + + /** + * Returns a new object of class 'Dyadic Expression'. + * + * + * @return a new object of class 'Dyadic Expression'. + * @generated + */ + DyadicExpression createDyadicExpression(); + + /** + * Returns a new object of class 'Comparison Predicate'. + * + * + * @return a new object of class 'Comparison Predicate'. + * @generated + */ + ComparisonPredicate createComparisonPredicate(); + + /** + * Returns a new object of class 'In Predicate'. + * + * + * @return a new object of class 'In Predicate'. + * @generated + */ + InPredicate createInPredicate(); + + /** + * Returns a new object of class 'Signed Integer Literal'. + * + * + * @return a new object of class 'Signed Integer Literal'. + * @generated + */ + SignedIntegerLiteral createSignedIntegerLiteral(); + + /** + * Returns a new object of class 'String Literal'. + * + * + * @return a new object of class 'String Literal'. + * @generated + */ + StringLiteral createStringLiteral(); + + /** + * Returns a new object of class 'Boolean Literal'. + * + * + * @return a new object of class 'Boolean Literal'. + * @generated + */ + BooleanLiteral createBooleanLiteral(); + + /** + * Returns a new object of class 'Sub Class Predicate'. + * + * + * @return a new object of class 'Sub Class Predicate'. + * @generated + */ + SubClassPredicate createSubClassPredicate(); + + /** + * Returns a new object of class 'Class Attribute'. + * + * + * @return a new object of class 'Class Attribute'. + * @generated + */ + ClassAttribute createClassAttribute(); + + /** + * Returns a new object of class 'Down Cast Predicate'. + * + * + * @return a new object of class 'Down Cast Predicate'. + * @generated + */ + DownCastPredicate createDownCastPredicate(); + + /** + * Returns a new object of class 'Multiplicity Predicate'. + * + * + * @return a new object of class 'Multiplicity Predicate'. + * @generated + */ + MultiplicityPredicate createMultiplicityPredicate(); + + /** + * Returns a new object of class 'Is Set Predicate'. + * + * + * @return a new object of class 'Is Set Predicate'. + * @generated + */ + IsSetPredicate createIsSetPredicate(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + FilterexprPackage getFilterexprPackage(); + +} //FilterexprFactory diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprPackage.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprPackage.java new file mode 100755 index 0000000..c507f74 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/FilterexprPackage.java @@ -0,0 +1,1559 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.booleanexpr.FilterexprFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface FilterexprPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "booleanexpr"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.booleanexpr"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "booleanexpr"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + FilterexprPackage eINSTANCE = org.genivi.booleanexpr.impl.FilterexprPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.BooleanExpressionImpl Boolean Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.BooleanExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getBooleanExpression() + * @generated + */ + int BOOLEAN_EXPRESSION = 0; + + /** + * The number of structural features of the 'Boolean Expression' class. + * + * + * @generated + * @ordered + */ + int BOOLEAN_EXPRESSION_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.UnaryExpressionImpl Unary Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.UnaryExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getUnaryExpression() + * @generated + */ + int UNARY_EXPRESSION = 1; + + /** + * The feature id for the 'Unary Operator' attribute. + * + * + * @generated + * @ordered + */ + int UNARY_EXPRESSION__UNARY_OPERATOR = BOOLEAN_EXPRESSION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Expression' containment reference. + * + * + * @generated + * @ordered + */ + int UNARY_EXPRESSION__EXPRESSION = BOOLEAN_EXPRESSION_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Unary Expression' class. + * + * + * @generated + * @ordered + */ + int UNARY_EXPRESSION_FEATURE_COUNT = BOOLEAN_EXPRESSION_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.PredicateImpl Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.PredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getPredicate() + * @generated + */ + int PREDICATE = 2; + + /** + * The number of structural features of the 'Predicate' class. + * + * + * @generated + * @ordered + */ + int PREDICATE_FEATURE_COUNT = BOOLEAN_EXPRESSION_FEATURE_COUNT + 0; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.DyadicExpressionImpl Dyadic Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.DyadicExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDyadicExpression() + * @generated + */ + int DYADIC_EXPRESSION = 3; + + /** + * The feature id for the 'Logical Operator' attribute. + * + * + * @generated + * @ordered + */ + int DYADIC_EXPRESSION__LOGICAL_OPERATOR = BOOLEAN_EXPRESSION_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Left Hand Term' containment reference. + * + * + * @generated + * @ordered + */ + int DYADIC_EXPRESSION__LEFT_HAND_TERM = BOOLEAN_EXPRESSION_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Right Hand Term' containment reference. + * + * + * @generated + * @ordered + */ + int DYADIC_EXPRESSION__RIGHT_HAND_TERM = BOOLEAN_EXPRESSION_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Dyadic Expression' class. + * + * + * @generated + * @ordered + */ + int DYADIC_EXPRESSION_FEATURE_COUNT = BOOLEAN_EXPRESSION_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.ComparisonPredicateImpl Comparison Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.ComparisonPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getComparisonPredicate() + * @generated + */ + int COMPARISON_PREDICATE = 4; + + /** + * The feature id for the 'Literal' containment reference. + * + * + * @generated + * @ordered + */ + int COMPARISON_PREDICATE__LITERAL = PREDICATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Attribute' containment reference. + * + * + * @generated + * @ordered + */ + int COMPARISON_PREDICATE__ATTRIBUTE = PREDICATE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Comparison Operator' attribute. + * + * + * @generated + * @ordered + */ + int COMPARISON_PREDICATE__COMPARISON_OPERATOR = PREDICATE_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Comparison Predicate' class. + * + * + * @generated + * @ordered + */ + int COMPARISON_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.InPredicateImpl In Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.InPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getInPredicate() + * @generated + */ + int IN_PREDICATE = 5; + + /** + * The feature id for the 'Attribute' containment reference. + * + * + * @generated + * @ordered + */ + int IN_PREDICATE__ATTRIBUTE = PREDICATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'In Operator' attribute. + * + * + * @generated + * @ordered + */ + int IN_PREDICATE__IN_OPERATOR = PREDICATE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Literals' containment reference list. + * + * + * @generated + * @ordered + */ + int IN_PREDICATE__LITERALS = PREDICATE_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'In Predicate' class. + * + * + * @generated + * @ordered + */ + int IN_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.LiteralImpl Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.LiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getLiteral() + * @generated + */ + int LITERAL = 6; + + /** + * The number of structural features of the 'Literal' class. + * + * + * @generated + * @ordered + */ + int LITERAL_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.SignedIntegerLiteralImpl Signed Integer Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.SignedIntegerLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getSignedIntegerLiteral() + * @generated + */ + int SIGNED_INTEGER_LITERAL = 7; + + /** + * The feature id for the 'Value' attribute. + * + * + * @generated + * @ordered + */ + int SIGNED_INTEGER_LITERAL__VALUE = LITERAL_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Signed Integer Literal' class. + * + * + * @generated + * @ordered + */ + int SIGNED_INTEGER_LITERAL_FEATURE_COUNT = LITERAL_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.StringLiteralImpl String Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.StringLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getStringLiteral() + * @generated + */ + int STRING_LITERAL = 8; + + /** + * The feature id for the 'Value' attribute. + * + * + * @generated + * @ordered + */ + int STRING_LITERAL__VALUE = LITERAL_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'String Literal' class. + * + * + * @generated + * @ordered + */ + int STRING_LITERAL_FEATURE_COUNT = LITERAL_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.BooleanLiteralImpl Boolean Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.BooleanLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getBooleanLiteral() + * @generated + */ + int BOOLEAN_LITERAL = 9; + + /** + * The feature id for the 'Value' attribute. + * + * + * @generated + * @ordered + */ + int BOOLEAN_LITERAL__VALUE = LITERAL_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Boolean Literal' class. + * + * + * @generated + * @ordered + */ + int BOOLEAN_LITERAL_FEATURE_COUNT = LITERAL_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.SubClassPredicateImpl Sub Class Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.SubClassPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getSubClassPredicate() + * @generated + */ + int SUB_CLASS_PREDICATE = 10; + + /** + * The feature id for the 'Sub Class Expression' containment reference. + * + * + * @generated + * @ordered + */ + int SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION = PREDICATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Sub Class Attribute' containment reference. + * + * + * @generated + * @ordered + */ + int SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE = PREDICATE_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Sub Class Predicate' class. + * + * + * @generated + * @ordered + */ + int SUB_CLASS_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.ClassAttributeImpl Class Attribute}' class. + * + * + * @see org.genivi.booleanexpr.impl.ClassAttributeImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getClassAttribute() + * @generated + */ + int CLASS_ATTRIBUTE = 11; + + /** + * The feature id for the 'Attribute Name' attribute. + * + * + * @generated + * @ordered + */ + int CLASS_ATTRIBUTE__ATTRIBUTE_NAME = 0; + + /** + * The feature id for the 'Meta Operator' attribute. + * + * + * @generated + * @ordered + */ + int CLASS_ATTRIBUTE__META_OPERATOR = 1; + + /** + * The feature id for the 'Index' attribute. + * + * + * @generated + * @ordered + */ + int CLASS_ATTRIBUTE__INDEX = 2; + + /** + * The number of structural features of the 'Class Attribute' class. + * + * + * @generated + * @ordered + */ + int CLASS_ATTRIBUTE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.DownCastPredicateImpl Down Cast Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.DownCastPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDownCastPredicate() + * @generated + */ + int DOWN_CAST_PREDICATE = 12; + + /** + * The feature id for the 'Class Name' attribute. + * + * + * @generated + * @ordered + */ + int DOWN_CAST_PREDICATE__CLASS_NAME = PREDICATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Expression' containment reference. + * + * + * @generated + * @ordered + */ + int DOWN_CAST_PREDICATE__EXPRESSION = PREDICATE_FEATURE_COUNT + 1; + + /** + * The number of structural features of the 'Down Cast Predicate' class. + * + * + * @generated + * @ordered + */ + int DOWN_CAST_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 2; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.MultiplicityPredicateImpl Multiplicity Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.MultiplicityPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getMultiplicityPredicate() + * @generated + */ + int MULTIPLICITY_PREDICATE = 13; + + /** + * The feature id for the 'Expression' containment reference. + * + * + * @generated + * @ordered + */ + int MULTIPLICITY_PREDICATE__EXPRESSION = PREDICATE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Attribute' containment reference. + * + * + * @generated + * @ordered + */ + int MULTIPLICITY_PREDICATE__ATTRIBUTE = PREDICATE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'List Operator' attribute. + * + * + * @generated + * @ordered + */ + int MULTIPLICITY_PREDICATE__LIST_OPERATOR = PREDICATE_FEATURE_COUNT + 2; + + /** + * The number of structural features of the 'Multiplicity Predicate' class. + * + * + * @generated + * @ordered + */ + int MULTIPLICITY_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 3; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.impl.IsSetPredicateImpl Is Set Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.IsSetPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getIsSetPredicate() + * @generated + */ + int IS_SET_PREDICATE = 14; + + /** + * The feature id for the 'Attribute' containment reference. + * + * + * @generated + * @ordered + */ + int IS_SET_PREDICATE__ATTRIBUTE = PREDICATE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Is Set Predicate' class. + * + * + * @generated + * @ordered + */ + int IS_SET_PREDICATE_FEATURE_COUNT = PREDICATE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.DyadicLogicalOperator Dyadic Logical Operator}' enum. + * + * + * @see org.genivi.booleanexpr.DyadicLogicalOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDyadicLogicalOperator() + * @generated + */ + int DYADIC_LOGICAL_OPERATOR = 15; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.UnaryLogicalOperator Unary Logical Operator}' enum. + * + * + * @see org.genivi.booleanexpr.UnaryLogicalOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getUnaryLogicalOperator() + * @generated + */ + int UNARY_LOGICAL_OPERATOR = 16; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.ComparisonOperator Comparison Operator}' enum. + * + * + * @see org.genivi.booleanexpr.ComparisonOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getComparisonOperator() + * @generated + */ + int COMPARISON_OPERATOR = 17; + + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.ListOperator List Operator}' enum. + * + * + * @see org.genivi.booleanexpr.ListOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getListOperator() + * @generated + */ + int LIST_OPERATOR = 18; + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.InOperator In Operator}' enum. + * + * + * @see org.genivi.booleanexpr.InOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getInOperator() + * @generated + */ + int IN_OPERATOR = 19; + + + /** + * The meta object id for the '{@link org.genivi.booleanexpr.MetaOperator Meta Operator}' enum. + * + * + * @see org.genivi.booleanexpr.MetaOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getMetaOperator() + * @generated + */ + int META_OPERATOR = 20; + + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.BooleanExpression Boolean Expression}'. + * + * + * @return the meta object for class 'Boolean Expression'. + * @see org.genivi.booleanexpr.BooleanExpression + * @generated + */ + EClass getBooleanExpression(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.UnaryExpression Unary Expression}'. + * + * + * @return the meta object for class 'Unary Expression'. + * @see org.genivi.booleanexpr.UnaryExpression + * @generated + */ + EClass getUnaryExpression(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.UnaryExpression#getUnaryOperator Unary Operator}'. + * + * + * @return the meta object for the attribute 'Unary Operator'. + * @see org.genivi.booleanexpr.UnaryExpression#getUnaryOperator() + * @see #getUnaryExpression() + * @generated + */ + EAttribute getUnaryExpression_UnaryOperator(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.UnaryExpression#getExpression Expression}'. + * + * + * @return the meta object for the containment reference 'Expression'. + * @see org.genivi.booleanexpr.UnaryExpression#getExpression() + * @see #getUnaryExpression() + * @generated + */ + EReference getUnaryExpression_Expression(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.Predicate Predicate}'. + * + * + * @return the meta object for class 'Predicate'. + * @see org.genivi.booleanexpr.Predicate + * @generated + */ + EClass getPredicate(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.DyadicExpression Dyadic Expression}'. + * + * + * @return the meta object for class 'Dyadic Expression'. + * @see org.genivi.booleanexpr.DyadicExpression + * @generated + */ + EClass getDyadicExpression(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.DyadicExpression#getLogicalOperator Logical Operator}'. + * + * + * @return the meta object for the attribute 'Logical Operator'. + * @see org.genivi.booleanexpr.DyadicExpression#getLogicalOperator() + * @see #getDyadicExpression() + * @generated + */ + EAttribute getDyadicExpression_LogicalOperator(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm Left Hand Term}'. + * + * + * @return the meta object for the containment reference 'Left Hand Term'. + * @see org.genivi.booleanexpr.DyadicExpression#getLeftHandTerm() + * @see #getDyadicExpression() + * @generated + */ + EReference getDyadicExpression_LeftHandTerm(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.DyadicExpression#getRightHandTerm Right Hand Term}'. + * + * + * @return the meta object for the containment reference 'Right Hand Term'. + * @see org.genivi.booleanexpr.DyadicExpression#getRightHandTerm() + * @see #getDyadicExpression() + * @generated + */ + EReference getDyadicExpression_RightHandTerm(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.ComparisonPredicate Comparison Predicate}'. + * + * + * @return the meta object for class 'Comparison Predicate'. + * @see org.genivi.booleanexpr.ComparisonPredicate + * @generated + */ + EClass getComparisonPredicate(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.ComparisonPredicate#getComparisonOperator Comparison Operator}'. + * + * + * @return the meta object for the attribute 'Comparison Operator'. + * @see org.genivi.booleanexpr.ComparisonPredicate#getComparisonOperator() + * @see #getComparisonPredicate() + * @generated + */ + EAttribute getComparisonPredicate_ComparisonOperator(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.ComparisonPredicate#getLiteral Literal}'. + * + * + * @return the meta object for the containment reference 'Literal'. + * @see org.genivi.booleanexpr.ComparisonPredicate#getLiteral() + * @see #getComparisonPredicate() + * @generated + */ + EReference getComparisonPredicate_Literal(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.ComparisonPredicate#getAttribute Attribute}'. + * + * + * @return the meta object for the containment reference 'Attribute'. + * @see org.genivi.booleanexpr.ComparisonPredicate#getAttribute() + * @see #getComparisonPredicate() + * @generated + */ + EReference getComparisonPredicate_Attribute(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.InPredicate In Predicate}'. + * + * + * @return the meta object for class 'In Predicate'. + * @see org.genivi.booleanexpr.InPredicate + * @generated + */ + EClass getInPredicate(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.InPredicate#getAttribute Attribute}'. + * + * + * @return the meta object for the containment reference 'Attribute'. + * @see org.genivi.booleanexpr.InPredicate#getAttribute() + * @see #getInPredicate() + * @generated + */ + EReference getInPredicate_Attribute(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.InPredicate#getInOperator In Operator}'. + * + * + * @return the meta object for the attribute 'In Operator'. + * @see org.genivi.booleanexpr.InPredicate#getInOperator() + * @see #getInPredicate() + * @generated + */ + EAttribute getInPredicate_InOperator(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.booleanexpr.InPredicate#getLiterals Literals}'. + * + * + * @return the meta object for the containment reference list 'Literals'. + * @see org.genivi.booleanexpr.InPredicate#getLiterals() + * @see #getInPredicate() + * @generated + */ + EReference getInPredicate_Literals(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.Literal Literal}'. + * + * + * @return the meta object for class 'Literal'. + * @see org.genivi.booleanexpr.Literal + * @generated + */ + EClass getLiteral(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.SignedIntegerLiteral Signed Integer Literal}'. + * + * + * @return the meta object for class 'Signed Integer Literal'. + * @see org.genivi.booleanexpr.SignedIntegerLiteral + * @generated + */ + EClass getSignedIntegerLiteral(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.SignedIntegerLiteral#getValue Value}'. + * + * + * @return the meta object for the attribute 'Value'. + * @see org.genivi.booleanexpr.SignedIntegerLiteral#getValue() + * @see #getSignedIntegerLiteral() + * @generated + */ + EAttribute getSignedIntegerLiteral_Value(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.StringLiteral String Literal}'. + * + * + * @return the meta object for class 'String Literal'. + * @see org.genivi.booleanexpr.StringLiteral + * @generated + */ + EClass getStringLiteral(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.StringLiteral#getValue Value}'. + * + * + * @return the meta object for the attribute 'Value'. + * @see org.genivi.booleanexpr.StringLiteral#getValue() + * @see #getStringLiteral() + * @generated + */ + EAttribute getStringLiteral_Value(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.BooleanLiteral Boolean Literal}'. + * + * + * @return the meta object for class 'Boolean Literal'. + * @see org.genivi.booleanexpr.BooleanLiteral + * @generated + */ + EClass getBooleanLiteral(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.BooleanLiteral#isValue Value}'. + * + * + * @return the meta object for the attribute 'Value'. + * @see org.genivi.booleanexpr.BooleanLiteral#isValue() + * @see #getBooleanLiteral() + * @generated + */ + EAttribute getBooleanLiteral_Value(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.SubClassPredicate Sub Class Predicate}'. + * + * + * @return the meta object for class 'Sub Class Predicate'. + * @see org.genivi.booleanexpr.SubClassPredicate + * @generated + */ + EClass getSubClassPredicate(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression Sub Class Expression}'. + * + * + * @return the meta object for the containment reference 'Sub Class Expression'. + * @see org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression() + * @see #getSubClassPredicate() + * @generated + */ + EReference getSubClassPredicate_SubClassExpression(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute Sub Class Attribute}'. + * + * + * @return the meta object for the containment reference 'Sub Class Attribute'. + * @see org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute() + * @see #getSubClassPredicate() + * @generated + */ + EReference getSubClassPredicate_SubClassAttribute(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.ClassAttribute Class Attribute}'. + * + * + * @return the meta object for class 'Class Attribute'. + * @see org.genivi.booleanexpr.ClassAttribute + * @generated + */ + EClass getClassAttribute(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.ClassAttribute#getAttributeName Attribute Name}'. + * + * + * @return the meta object for the attribute 'Attribute Name'. + * @see org.genivi.booleanexpr.ClassAttribute#getAttributeName() + * @see #getClassAttribute() + * @generated + */ + EAttribute getClassAttribute_AttributeName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.ClassAttribute#getMetaOperator Meta Operator}'. + * + * + * @return the meta object for the attribute 'Meta Operator'. + * @see org.genivi.booleanexpr.ClassAttribute#getMetaOperator() + * @see #getClassAttribute() + * @generated + */ + EAttribute getClassAttribute_MetaOperator(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.ClassAttribute#getIndex Index}'. + * + * + * @return the meta object for the attribute 'Index'. + * @see org.genivi.booleanexpr.ClassAttribute#getIndex() + * @see #getClassAttribute() + * @generated + */ + EAttribute getClassAttribute_Index(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.DownCastPredicate Down Cast Predicate}'. + * + * + * @return the meta object for class 'Down Cast Predicate'. + * @see org.genivi.booleanexpr.DownCastPredicate + * @generated + */ + EClass getDownCastPredicate(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.DownCastPredicate#getClassName Class Name}'. + * + * + * @return the meta object for the attribute 'Class Name'. + * @see org.genivi.booleanexpr.DownCastPredicate#getClassName() + * @see #getDownCastPredicate() + * @generated + */ + EAttribute getDownCastPredicate_ClassName(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.DownCastPredicate#getExpression Expression}'. + * + * + * @return the meta object for the containment reference 'Expression'. + * @see org.genivi.booleanexpr.DownCastPredicate#getExpression() + * @see #getDownCastPredicate() + * @generated + */ + EReference getDownCastPredicate_Expression(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.MultiplicityPredicate Multiplicity Predicate}'. + * + * + * @return the meta object for class 'Multiplicity Predicate'. + * @see org.genivi.booleanexpr.MultiplicityPredicate + * @generated + */ + EClass getMultiplicityPredicate(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.MultiplicityPredicate#getExpression Expression}'. + * + * + * @return the meta object for the containment reference 'Expression'. + * @see org.genivi.booleanexpr.MultiplicityPredicate#getExpression() + * @see #getMultiplicityPredicate() + * @generated + */ + EReference getMultiplicityPredicate_Expression(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.booleanexpr.MultiplicityPredicate#getListOperator List Operator}'. + * + * + * @return the meta object for the attribute 'List Operator'. + * @see org.genivi.booleanexpr.MultiplicityPredicate#getListOperator() + * @see #getMultiplicityPredicate() + * @generated + */ + EAttribute getMultiplicityPredicate_ListOperator(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.MultiplicityPredicate#getAttribute Attribute}'. + * + * + * @return the meta object for the containment reference 'Attribute'. + * @see org.genivi.booleanexpr.MultiplicityPredicate#getAttribute() + * @see #getMultiplicityPredicate() + * @generated + */ + EReference getMultiplicityPredicate_Attribute(); + + /** + * Returns the meta object for class '{@link org.genivi.booleanexpr.IsSetPredicate Is Set Predicate}'. + * + * + * @return the meta object for class 'Is Set Predicate'. + * @see org.genivi.booleanexpr.IsSetPredicate + * @generated + */ + EClass getIsSetPredicate(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.booleanexpr.IsSetPredicate#getAttribute Attribute}'. + * + * + * @return the meta object for the containment reference 'Attribute'. + * @see org.genivi.booleanexpr.IsSetPredicate#getAttribute() + * @see #getIsSetPredicate() + * @generated + */ + EReference getIsSetPredicate_Attribute(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.DyadicLogicalOperator Dyadic Logical Operator}'. + * + * + * @return the meta object for enum 'Dyadic Logical Operator'. + * @see org.genivi.booleanexpr.DyadicLogicalOperator + * @generated + */ + EEnum getDyadicLogicalOperator(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.UnaryLogicalOperator Unary Logical Operator}'. + * + * + * @return the meta object for enum 'Unary Logical Operator'. + * @see org.genivi.booleanexpr.UnaryLogicalOperator + * @generated + */ + EEnum getUnaryLogicalOperator(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.ComparisonOperator Comparison Operator}'. + * + * + * @return the meta object for enum 'Comparison Operator'. + * @see org.genivi.booleanexpr.ComparisonOperator + * @generated + */ + EEnum getComparisonOperator(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.ListOperator List Operator}'. + * + * + * @return the meta object for enum 'List Operator'. + * @see org.genivi.booleanexpr.ListOperator + * @generated + */ + EEnum getListOperator(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.InOperator In Operator}'. + * + * + * @return the meta object for enum 'In Operator'. + * @see org.genivi.booleanexpr.InOperator + * @generated + */ + EEnum getInOperator(); + + /** + * Returns the meta object for enum '{@link org.genivi.booleanexpr.MetaOperator Meta Operator}'. + * + * + * @return the meta object for enum 'Meta Operator'. + * @see org.genivi.booleanexpr.MetaOperator + * @generated + */ + EEnum getMetaOperator(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + FilterexprFactory getFilterexprFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.BooleanExpressionImpl Boolean Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.BooleanExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getBooleanExpression() + * @generated + */ + EClass BOOLEAN_EXPRESSION = eINSTANCE.getBooleanExpression(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.UnaryExpressionImpl Unary Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.UnaryExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getUnaryExpression() + * @generated + */ + EClass UNARY_EXPRESSION = eINSTANCE.getUnaryExpression(); + + /** + * The meta object literal for the 'Unary Operator' attribute feature. + * + * + * @generated + */ + EAttribute UNARY_EXPRESSION__UNARY_OPERATOR = eINSTANCE.getUnaryExpression_UnaryOperator(); + + /** + * The meta object literal for the 'Expression' containment reference feature. + * + * + * @generated + */ + EReference UNARY_EXPRESSION__EXPRESSION = eINSTANCE.getUnaryExpression_Expression(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.PredicateImpl Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.PredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getPredicate() + * @generated + */ + EClass PREDICATE = eINSTANCE.getPredicate(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.DyadicExpressionImpl Dyadic Expression}' class. + * + * + * @see org.genivi.booleanexpr.impl.DyadicExpressionImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDyadicExpression() + * @generated + */ + EClass DYADIC_EXPRESSION = eINSTANCE.getDyadicExpression(); + + /** + * The meta object literal for the 'Logical Operator' attribute feature. + * + * + * @generated + */ + EAttribute DYADIC_EXPRESSION__LOGICAL_OPERATOR = eINSTANCE.getDyadicExpression_LogicalOperator(); + + /** + * The meta object literal for the 'Left Hand Term' containment reference feature. + * + * + * @generated + */ + EReference DYADIC_EXPRESSION__LEFT_HAND_TERM = eINSTANCE.getDyadicExpression_LeftHandTerm(); + + /** + * The meta object literal for the 'Right Hand Term' containment reference feature. + * + * + * @generated + */ + EReference DYADIC_EXPRESSION__RIGHT_HAND_TERM = eINSTANCE.getDyadicExpression_RightHandTerm(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.ComparisonPredicateImpl Comparison Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.ComparisonPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getComparisonPredicate() + * @generated + */ + EClass COMPARISON_PREDICATE = eINSTANCE.getComparisonPredicate(); + + /** + * The meta object literal for the 'Comparison Operator' attribute feature. + * + * + * @generated + */ + EAttribute COMPARISON_PREDICATE__COMPARISON_OPERATOR = eINSTANCE.getComparisonPredicate_ComparisonOperator(); + + /** + * The meta object literal for the 'Literal' containment reference feature. + * + * + * @generated + */ + EReference COMPARISON_PREDICATE__LITERAL = eINSTANCE.getComparisonPredicate_Literal(); + + /** + * The meta object literal for the 'Attribute' containment reference feature. + * + * + * @generated + */ + EReference COMPARISON_PREDICATE__ATTRIBUTE = eINSTANCE.getComparisonPredicate_Attribute(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.InPredicateImpl In Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.InPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getInPredicate() + * @generated + */ + EClass IN_PREDICATE = eINSTANCE.getInPredicate(); + + /** + * The meta object literal for the 'Attribute' containment reference feature. + * + * + * @generated + */ + EReference IN_PREDICATE__ATTRIBUTE = eINSTANCE.getInPredicate_Attribute(); + + /** + * The meta object literal for the 'In Operator' attribute feature. + * + * + * @generated + */ + EAttribute IN_PREDICATE__IN_OPERATOR = eINSTANCE.getInPredicate_InOperator(); + + /** + * The meta object literal for the 'Literals' containment reference list feature. + * + * + * @generated + */ + EReference IN_PREDICATE__LITERALS = eINSTANCE.getInPredicate_Literals(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.LiteralImpl Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.LiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getLiteral() + * @generated + */ + EClass LITERAL = eINSTANCE.getLiteral(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.SignedIntegerLiteralImpl Signed Integer Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.SignedIntegerLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getSignedIntegerLiteral() + * @generated + */ + EClass SIGNED_INTEGER_LITERAL = eINSTANCE.getSignedIntegerLiteral(); + + /** + * The meta object literal for the 'Value' attribute feature. + * + * + * @generated + */ + EAttribute SIGNED_INTEGER_LITERAL__VALUE = eINSTANCE.getSignedIntegerLiteral_Value(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.StringLiteralImpl String Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.StringLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getStringLiteral() + * @generated + */ + EClass STRING_LITERAL = eINSTANCE.getStringLiteral(); + + /** + * The meta object literal for the 'Value' attribute feature. + * + * + * @generated + */ + EAttribute STRING_LITERAL__VALUE = eINSTANCE.getStringLiteral_Value(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.BooleanLiteralImpl Boolean Literal}' class. + * + * + * @see org.genivi.booleanexpr.impl.BooleanLiteralImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getBooleanLiteral() + * @generated + */ + EClass BOOLEAN_LITERAL = eINSTANCE.getBooleanLiteral(); + + /** + * The meta object literal for the 'Value' attribute feature. + * + * + * @generated + */ + EAttribute BOOLEAN_LITERAL__VALUE = eINSTANCE.getBooleanLiteral_Value(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.SubClassPredicateImpl Sub Class Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.SubClassPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getSubClassPredicate() + * @generated + */ + EClass SUB_CLASS_PREDICATE = eINSTANCE.getSubClassPredicate(); + + /** + * The meta object literal for the 'Sub Class Expression' containment reference feature. + * + * + * @generated + */ + EReference SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION = eINSTANCE.getSubClassPredicate_SubClassExpression(); + + /** + * The meta object literal for the 'Sub Class Attribute' containment reference feature. + * + * + * @generated + */ + EReference SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE = eINSTANCE.getSubClassPredicate_SubClassAttribute(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.ClassAttributeImpl Class Attribute}' class. + * + * + * @see org.genivi.booleanexpr.impl.ClassAttributeImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getClassAttribute() + * @generated + */ + EClass CLASS_ATTRIBUTE = eINSTANCE.getClassAttribute(); + + /** + * The meta object literal for the 'Attribute Name' attribute feature. + * + * + * @generated + */ + EAttribute CLASS_ATTRIBUTE__ATTRIBUTE_NAME = eINSTANCE.getClassAttribute_AttributeName(); + + /** + * The meta object literal for the 'Meta Operator' attribute feature. + * + * + * @generated + */ + EAttribute CLASS_ATTRIBUTE__META_OPERATOR = eINSTANCE.getClassAttribute_MetaOperator(); + + /** + * The meta object literal for the 'Index' attribute feature. + * + * + * @generated + */ + EAttribute CLASS_ATTRIBUTE__INDEX = eINSTANCE.getClassAttribute_Index(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.DownCastPredicateImpl Down Cast Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.DownCastPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDownCastPredicate() + * @generated + */ + EClass DOWN_CAST_PREDICATE = eINSTANCE.getDownCastPredicate(); + + /** + * The meta object literal for the 'Class Name' attribute feature. + * + * + * @generated + */ + EAttribute DOWN_CAST_PREDICATE__CLASS_NAME = eINSTANCE.getDownCastPredicate_ClassName(); + + /** + * The meta object literal for the 'Expression' containment reference feature. + * + * + * @generated + */ + EReference DOWN_CAST_PREDICATE__EXPRESSION = eINSTANCE.getDownCastPredicate_Expression(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.MultiplicityPredicateImpl Multiplicity Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.MultiplicityPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getMultiplicityPredicate() + * @generated + */ + EClass MULTIPLICITY_PREDICATE = eINSTANCE.getMultiplicityPredicate(); + + /** + * The meta object literal for the 'Expression' containment reference feature. + * + * + * @generated + */ + EReference MULTIPLICITY_PREDICATE__EXPRESSION = eINSTANCE.getMultiplicityPredicate_Expression(); + + /** + * The meta object literal for the 'List Operator' attribute feature. + * + * + * @generated + */ + EAttribute MULTIPLICITY_PREDICATE__LIST_OPERATOR = eINSTANCE.getMultiplicityPredicate_ListOperator(); + + /** + * The meta object literal for the 'Attribute' containment reference feature. + * + * + * @generated + */ + EReference MULTIPLICITY_PREDICATE__ATTRIBUTE = eINSTANCE.getMultiplicityPredicate_Attribute(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.impl.IsSetPredicateImpl Is Set Predicate}' class. + * + * + * @see org.genivi.booleanexpr.impl.IsSetPredicateImpl + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getIsSetPredicate() + * @generated + */ + EClass IS_SET_PREDICATE = eINSTANCE.getIsSetPredicate(); + + /** + * The meta object literal for the 'Attribute' containment reference feature. + * + * + * @generated + */ + EReference IS_SET_PREDICATE__ATTRIBUTE = eINSTANCE.getIsSetPredicate_Attribute(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.DyadicLogicalOperator Dyadic Logical Operator}' enum. + * + * + * @see org.genivi.booleanexpr.DyadicLogicalOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getDyadicLogicalOperator() + * @generated + */ + EEnum DYADIC_LOGICAL_OPERATOR = eINSTANCE.getDyadicLogicalOperator(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.UnaryLogicalOperator Unary Logical Operator}' enum. + * + * + * @see org.genivi.booleanexpr.UnaryLogicalOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getUnaryLogicalOperator() + * @generated + */ + EEnum UNARY_LOGICAL_OPERATOR = eINSTANCE.getUnaryLogicalOperator(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.ComparisonOperator Comparison Operator}' enum. + * + * + * @see org.genivi.booleanexpr.ComparisonOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getComparisonOperator() + * @generated + */ + EEnum COMPARISON_OPERATOR = eINSTANCE.getComparisonOperator(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.ListOperator List Operator}' enum. + * + * + * @see org.genivi.booleanexpr.ListOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getListOperator() + * @generated + */ + EEnum LIST_OPERATOR = eINSTANCE.getListOperator(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.InOperator In Operator}' enum. + * + * + * @see org.genivi.booleanexpr.InOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getInOperator() + * @generated + */ + EEnum IN_OPERATOR = eINSTANCE.getInOperator(); + + /** + * The meta object literal for the '{@link org.genivi.booleanexpr.MetaOperator Meta Operator}' enum. + * + * + * @see org.genivi.booleanexpr.MetaOperator + * @see org.genivi.booleanexpr.impl.FilterexprPackageImpl#getMetaOperator() + * @generated + */ + EEnum META_OPERATOR = eINSTANCE.getMetaOperator(); + + } + +} //FilterexprPackage diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InOperator.java new file mode 100755 index 0000000..390aec2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InOperator.java @@ -0,0 +1,218 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'In Operator', + * and utility methods for working with them. + * + * + * This enumeration defines the operators for an InPredicate. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getInOperator() + * @model + * @generated + */ +public enum InOperator implements Enumerator { + /** + * The 'IN' literal object. + * + * + * @see #IN_VALUE + * @generated + * @ordered + */ + IN(0, "IN", "IN"), + + /** + * The 'NOT IN' literal object. + * + * + * @see #NOT_IN_VALUE + * @generated + * @ordered + */ + NOT_IN(1, "NOT_IN", "NOT_IN"); + + /** + * The 'IN' literal value. + * + *

+ * If the meaning of 'IN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #IN + * @model + * @generated + * @ordered + */ + public static final int IN_VALUE = 0; + + /** + * The 'NOT IN' literal value. + * + *

+ * If the meaning of 'NOT IN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NOT_IN + * @model + * @generated + * @ordered + */ + public static final int NOT_IN_VALUE = 1; + + /** + * An array of all the 'In Operator' enumerators. + * + * + * @generated + */ + private static final InOperator[] VALUES_ARRAY = + new InOperator[] { + IN, + NOT_IN, + }; + + /** + * A public read-only list of all the 'In Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'In Operator' literal with the specified literal value. + * + * + * @generated + */ + public static InOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + InOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'In Operator' literal with the specified name. + * + * + * @generated + */ + public static InOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + InOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'In Operator' literal with the specified integer value. + * + * + * @generated + */ + public static InOperator get(int value) { + switch (value) { + case IN_VALUE: return IN; + case NOT_IN_VALUE: return NOT_IN; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private InOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //InOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InPredicate.java new file mode 100755 index 0000000..abd13a0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/InPredicate.java @@ -0,0 +1,186 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.common.util.EList; + + +/** + * + * A representation of the model object 'In Predicate'. + * + * + * + * This predicate checks whether an attribute value is in, or not in, a set of values. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.InPredicate#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.InPredicate#getInOperator In Operator}
  • + *
  • {@link org.genivi.booleanexpr.InPredicate#getLiterals Literals}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getInPredicate() + * @model + * @generated + */ +public interface InPredicate extends Predicate { + + /** + * Returns the value of the 'Attribute' containment reference. + * + *

+ * If the meaning of the 'Attribute' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Attribute' containment reference. + * @see #isSetAttribute() + * @see #unsetAttribute() + * @see #setAttribute(ClassAttribute) + * @see org.genivi.booleanexpr.FilterexprPackage#getInPredicate_Attribute() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + ClassAttribute getAttribute(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.InPredicate#getAttribute Attribute}' containment reference. + * + * + * @param value the new value of the 'Attribute' containment reference. + * @see #isSetAttribute() + * @see #unsetAttribute() + * @see #getAttribute() + * @generated + */ + void setAttribute(ClassAttribute value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.InPredicate#getAttribute Attribute}' containment reference. + * + * + * @see #isSetAttribute() + * @see #getAttribute() + * @see #setAttribute(ClassAttribute) + * @generated + */ + void unsetAttribute(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.InPredicate#getAttribute Attribute}' containment reference is set. + * + * + * @return whether the value of the 'Attribute' containment reference is set. + * @see #unsetAttribute() + * @see #getAttribute() + * @see #setAttribute(ClassAttribute) + * @generated + */ + boolean isSetAttribute(); + + /** + * Returns the value of the 'In Operator' attribute. + * The literals are from the enumeration {@link org.genivi.booleanexpr.InOperator}. + * + *

+ * If the meaning of the 'In Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'In Operator' attribute. + * @see org.genivi.booleanexpr.InOperator + * @see #isSetInOperator() + * @see #unsetInOperator() + * @see #setInOperator(InOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getInPredicate_InOperator() + * @model unsettable="true" required="true" + * @generated + */ + InOperator getInOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.InPredicate#getInOperator In Operator}' attribute. + * + * + * @param value the new value of the 'In Operator' attribute. + * @see org.genivi.booleanexpr.InOperator + * @see #isSetInOperator() + * @see #unsetInOperator() + * @see #getInOperator() + * @generated + */ + void setInOperator(InOperator value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.InPredicate#getInOperator In Operator}' attribute. + * + * + * @see #isSetInOperator() + * @see #getInOperator() + * @see #setInOperator(InOperator) + * @generated + */ + void unsetInOperator(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.InPredicate#getInOperator In Operator}' attribute is set. + * + * + * @return whether the value of the 'In Operator' attribute is set. + * @see #unsetInOperator() + * @see #getInOperator() + * @see #setInOperator(InOperator) + * @generated + */ + boolean isSetInOperator(); + + /** + * Returns the value of the 'Literals' containment reference list. + * The list contents are of type {@link org.genivi.booleanexpr.Literal}. + * + *

+ * If the meaning of the 'Literals' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Literals' containment reference list. + * @see #isSetLiterals() + * @see #unsetLiterals() + * @see org.genivi.booleanexpr.FilterexprPackage#getInPredicate_Literals() + * @model containment="true" unsettable="true" + * @generated + */ + EList getLiterals(); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.InPredicate#getLiterals Literals}' containment reference list. + * + * + * @see #isSetLiterals() + * @see #getLiterals() + * @generated + */ + void unsetLiterals(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.InPredicate#getLiterals Literals}' containment reference list is set. + * + * + * @return whether the value of the 'Literals' containment reference list is set. + * @see #unsetLiterals() + * @see #getLiterals() + * @generated + */ + boolean isSetLiterals(); +} // InPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/IsSetPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/IsSetPredicate.java new file mode 100755 index 0000000..5b8ec7e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/IsSetPredicate.java @@ -0,0 +1,60 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Is Set Predicate'. + * + * + * + * This predicate checks whether an optional value is set or not. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.IsSetPredicate#getAttribute Attribute}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getIsSetPredicate() + * @model + * @generated + */ +public interface IsSetPredicate extends Predicate { + /** + * Returns the value of the 'Attribute' containment reference. + * + *

+ * If the meaning of the 'Attribute' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Attribute' containment reference. + * @see #setAttribute(ClassAttribute) + * @see org.genivi.booleanexpr.FilterexprPackage#getIsSetPredicate_Attribute() + * @model containment="true" required="true" + * @generated + */ + ClassAttribute getAttribute(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.IsSetPredicate#getAttribute Attribute}' containment reference. + * + * + * @param value the new value of the 'Attribute' containment reference. + * @see #getAttribute() + * @generated + */ + void setAttribute(ClassAttribute value); + +} // IsSetPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ListOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ListOperator.java new file mode 100755 index 0000000..1c966b1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/ListOperator.java @@ -0,0 +1,243 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'List Operator', + * and utility methods for working with them. + * + * + * This enumeration defines the operators for a MultiplicityPredicate. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getListOperator() + * @model + * @generated + */ +public enum ListOperator implements Enumerator { + /** + * The 'ANY' literal object. + * + * + * @see #ANY_VALUE + * @generated + * @ordered + */ + ANY(0, "ANY", "ANY"), + + /** + * The 'ALL' literal object. + * + * + * @see #ALL_VALUE + * @generated + * @ordered + */ + ALL(1, "ALL", "ALL"), /** + * The 'NONE' literal object. + * + * + * @see #NONE_VALUE + * @generated + * @ordered + */ + NONE(2, "NONE", "NONE"); + + /** + * The 'ANY' literal value. + * + *

+ * If the meaning of 'ANY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ANY + * @model + * @generated + * @ordered + */ + public static final int ANY_VALUE = 0; + + /** + * The 'ALL' literal value. + * + *

+ * If the meaning of 'ALL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ALL + * @model + * @generated + * @ordered + */ + public static final int ALL_VALUE = 1; + + /** + * The 'NONE' literal value. + * + *

+ * If the meaning of 'NONE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NONE + * @model + * @generated + * @ordered + */ + public static final int NONE_VALUE = 2; + + /** + * An array of all the 'List Operator' enumerators. + * + * + * @generated + */ + private static final ListOperator[] VALUES_ARRAY = + new ListOperator[] { + ANY, + ALL, + NONE, + }; + + /** + * A public read-only list of all the 'List Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'List Operator' literal with the specified literal value. + * + * + * @generated + */ + public static ListOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ListOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'List Operator' literal with the specified name. + * + * + * @generated + */ + public static ListOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ListOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'List Operator' literal with the specified integer value. + * + * + * @generated + */ + public static ListOperator get(int value) { + switch (value) { + case ANY_VALUE: return ANY; + case ALL_VALUE: return ALL; + case NONE_VALUE: return NONE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ListOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ListOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Literal.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Literal.java new file mode 100755 index 0000000..cba102d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Literal.java @@ -0,0 +1,25 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Literal'. + * + * + * + * @see org.genivi.booleanexpr.FilterexprPackage#getLiteral() + * @model abstract="true" + * @generated + */ +public interface Literal extends EObject { +} // Literal diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MetaOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MetaOperator.java new file mode 100755 index 0000000..1093295 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MetaOperator.java @@ -0,0 +1,188 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Meta Operator', + * and utility methods for working with them. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getMetaOperator() + * @model + * @generated + */ +public enum MetaOperator implements Enumerator { + /** + * The 'SIZE' literal object. + * + * + * @see #SIZE_VALUE + * @generated + * @ordered + */ + SIZE(0, "SIZE", "SIZE"); + + /** + * The 'SIZE' literal value. + * + *

+ * If the meaning of 'SIZE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SIZE + * @model + * @generated + * @ordered + */ + public static final int SIZE_VALUE = 0; + + /** + * An array of all the 'Meta Operator' enumerators. + * + * + * @generated + */ + private static final MetaOperator[] VALUES_ARRAY = + new MetaOperator[] { + SIZE, + }; + + /** + * A public read-only list of all the 'Meta Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Meta Operator' literal with the specified literal value. + * + * + * @generated + */ + public static MetaOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MetaOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Meta Operator' literal with the specified name. + * + * + * @generated + */ + public static MetaOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MetaOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Meta Operator' literal with the specified integer value. + * + * + * @generated + */ + public static MetaOperator get(int value) { + switch (value) { + case SIZE_VALUE: return SIZE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private MetaOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //MetaOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MultiplicityPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MultiplicityPredicate.java new file mode 100755 index 0000000..f51bc0b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/MultiplicityPredicate.java @@ -0,0 +1,194 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Multiplicity Predicate'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.MultiplicityPredicate#getExpression Expression}
  • + *
  • {@link org.genivi.booleanexpr.MultiplicityPredicate#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.MultiplicityPredicate#getListOperator List Operator}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getMultiplicityPredicate() + * @model + * @generated + */ +public interface MultiplicityPredicate extends Predicate { + /** + * Returns the value of the 'Expression' containment reference. + * + *

+ * If the meaning of the 'Expression' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expression' containment reference. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #setExpression(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getMultiplicityPredicate_Expression() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + BooleanExpression getExpression(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getExpression Expression}' containment reference. + * + * + * @param value the new value of the 'Expression' containment reference. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #getExpression() + * @generated + */ + void setExpression(BooleanExpression value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getExpression Expression}' containment reference. + * + * + * @see #isSetExpression() + * @see #getExpression() + * @see #setExpression(BooleanExpression) + * @generated + */ + void unsetExpression(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getExpression Expression}' containment reference is set. + * + * + * @return whether the value of the 'Expression' containment reference is set. + * @see #unsetExpression() + * @see #getExpression() + * @see #setExpression(BooleanExpression) + * @generated + */ + boolean isSetExpression(); + + /** + * Returns the value of the 'List Operator' attribute. + * The literals are from the enumeration {@link org.genivi.booleanexpr.ListOperator}. + * + *

+ * If the meaning of the 'List Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'List Operator' attribute. + * @see org.genivi.booleanexpr.ListOperator + * @see #isSetListOperator() + * @see #unsetListOperator() + * @see #setListOperator(ListOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getMultiplicityPredicate_ListOperator() + * @model unsettable="true" required="true" + * @generated + */ + ListOperator getListOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getListOperator List Operator}' attribute. + * + * + * @param value the new value of the 'List Operator' attribute. + * @see org.genivi.booleanexpr.ListOperator + * @see #isSetListOperator() + * @see #unsetListOperator() + * @see #getListOperator() + * @generated + */ + void setListOperator(ListOperator value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getListOperator List Operator}' attribute. + * + * + * @see #isSetListOperator() + * @see #getListOperator() + * @see #setListOperator(ListOperator) + * @generated + */ + void unsetListOperator(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getListOperator List Operator}' attribute is set. + * + * + * @return whether the value of the 'List Operator' attribute is set. + * @see #unsetListOperator() + * @see #getListOperator() + * @see #setListOperator(ListOperator) + * @generated + */ + boolean isSetListOperator(); + + /** + * Returns the value of the 'Attribute' containment reference. + * + *

+ * If the meaning of the 'Attribute' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Attribute' containment reference. + * @see #isSetAttribute() + * @see #unsetAttribute() + * @see #setAttribute(ClassAttribute) + * @see org.genivi.booleanexpr.FilterexprPackage#getMultiplicityPredicate_Attribute() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + ClassAttribute getAttribute(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getAttribute Attribute}' containment reference. + * + * + * @param value the new value of the 'Attribute' containment reference. + * @see #isSetAttribute() + * @see #unsetAttribute() + * @see #getAttribute() + * @generated + */ + void setAttribute(ClassAttribute value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getAttribute Attribute}' containment reference. + * + * + * @see #isSetAttribute() + * @see #getAttribute() + * @see #setAttribute(ClassAttribute) + * @generated + */ + void unsetAttribute(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.MultiplicityPredicate#getAttribute Attribute}' containment reference is set. + * + * + * @return whether the value of the 'Attribute' containment reference is set. + * @see #unsetAttribute() + * @see #getAttribute() + * @see #setAttribute(ClassAttribute) + * @generated + */ + boolean isSetAttribute(); + +} // MultiplicityPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Predicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Predicate.java new file mode 100755 index 0000000..7248fe4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/Predicate.java @@ -0,0 +1,28 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Predicate'. + * + * + * + * This is the top level class for predicates. + * + * + * + * @see org.genivi.booleanexpr.FilterexprPackage#getPredicate() + * @model abstract="true" + * @generated + */ +public interface Predicate extends BooleanExpression { +} // Predicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SignedIntegerLiteral.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SignedIntegerLiteral.java new file mode 100755 index 0000000..263f1b7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SignedIntegerLiteral.java @@ -0,0 +1,87 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Signed Integer Literal'. + * + * + * + * An optionally signed integer values. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.SignedIntegerLiteral#getValue Value}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getSignedIntegerLiteral() + * @model + * @generated + */ +public interface SignedIntegerLiteral extends Literal { + /** + * Returns the value of the 'Value' attribute. + * + *

+ * If the meaning of the 'Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #setValue(long) + * @see org.genivi.booleanexpr.FilterexprPackage#getSignedIntegerLiteral_Value() + * @model unsettable="true" required="true" + * @generated + */ + long getValue(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.SignedIntegerLiteral#getValue Value}' attribute. + * + * + * @param value the new value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #getValue() + * @generated + */ + void setValue(long value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.SignedIntegerLiteral#getValue Value}' attribute. + * + * + * @see #isSetValue() + * @see #getValue() + * @see #setValue(long) + * @generated + */ + void unsetValue(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.SignedIntegerLiteral#getValue Value}' attribute is set. + * + * + * @return whether the value of the 'Value' attribute is set. + * @see #unsetValue() + * @see #getValue() + * @see #setValue(long) + * @generated + */ + boolean isSetValue(); + +} // SignedIntegerLiteral diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/StringLiteral.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/StringLiteral.java new file mode 100755 index 0000000..e38e37f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/StringLiteral.java @@ -0,0 +1,87 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'String Literal'. + * + * + * + * A String value. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.StringLiteral#getValue Value}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getStringLiteral() + * @model + * @generated + */ +public interface StringLiteral extends Literal { + /** + * Returns the value of the 'Value' attribute. + * + *

+ * If the meaning of the 'Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #setValue(String) + * @see org.genivi.booleanexpr.FilterexprPackage#getStringLiteral_Value() + * @model unsettable="true" required="true" + * @generated + */ + String getValue(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.StringLiteral#getValue Value}' attribute. + * + * + * @param value the new value of the 'Value' attribute. + * @see #isSetValue() + * @see #unsetValue() + * @see #getValue() + * @generated + */ + void setValue(String value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.StringLiteral#getValue Value}' attribute. + * + * + * @see #isSetValue() + * @see #getValue() + * @see #setValue(String) + * @generated + */ + void unsetValue(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.StringLiteral#getValue Value}' attribute is set. + * + * + * @return whether the value of the 'Value' attribute is set. + * @see #unsetValue() + * @see #getValue() + * @see #setValue(String) + * @generated + */ + boolean isSetValue(); + +} // StringLiteral diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SubClassPredicate.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SubClassPredicate.java new file mode 100755 index 0000000..7e4e65f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/SubClassPredicate.java @@ -0,0 +1,141 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'Sub Class Predicate'. + * + * + * + * This predicate is used to evaluate an expression on a subclass of the current class. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression Sub Class Expression}
  • + *
  • {@link org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute Sub Class Attribute}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getSubClassPredicate() + * @model + * @generated + */ +public interface SubClassPredicate extends Predicate { + /** + * Returns the value of the 'Sub Class Expression' containment reference. + * + *

+ * If the meaning of the 'Sub Class Expression' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Sub Class Expression' containment reference. + * @see #isSetSubClassExpression() + * @see #unsetSubClassExpression() + * @see #setSubClassExpression(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getSubClassPredicate_SubClassExpression() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + BooleanExpression getSubClassExpression(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression Sub Class Expression}' containment reference. + * + * + * @param value the new value of the 'Sub Class Expression' containment reference. + * @see #isSetSubClassExpression() + * @see #unsetSubClassExpression() + * @see #getSubClassExpression() + * @generated + */ + void setSubClassExpression(BooleanExpression value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression Sub Class Expression}' containment reference. + * + * + * @see #isSetSubClassExpression() + * @see #getSubClassExpression() + * @see #setSubClassExpression(BooleanExpression) + * @generated + */ + void unsetSubClassExpression(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassExpression Sub Class Expression}' containment reference is set. + * + * + * @return whether the value of the 'Sub Class Expression' containment reference is set. + * @see #unsetSubClassExpression() + * @see #getSubClassExpression() + * @see #setSubClassExpression(BooleanExpression) + * @generated + */ + boolean isSetSubClassExpression(); + + /** + * Returns the value of the 'Sub Class Attribute' containment reference. + * + *

+ * If the meaning of the 'Sub Class Attribute' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Sub Class Attribute' containment reference. + * @see #isSetSubClassAttribute() + * @see #unsetSubClassAttribute() + * @see #setSubClassAttribute(ClassAttribute) + * @see org.genivi.booleanexpr.FilterexprPackage#getSubClassPredicate_SubClassAttribute() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + ClassAttribute getSubClassAttribute(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute Sub Class Attribute}' containment reference. + * + * + * @param value the new value of the 'Sub Class Attribute' containment reference. + * @see #isSetSubClassAttribute() + * @see #unsetSubClassAttribute() + * @see #getSubClassAttribute() + * @generated + */ + void setSubClassAttribute(ClassAttribute value); + + /** + * Unsets the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute Sub Class Attribute}' containment reference. + * + * + * @see #isSetSubClassAttribute() + * @see #getSubClassAttribute() + * @see #setSubClassAttribute(ClassAttribute) + * @generated + */ + void unsetSubClassAttribute(); + + /** + * Returns whether the value of the '{@link org.genivi.booleanexpr.SubClassPredicate#getSubClassAttribute Sub Class Attribute}' containment reference is set. + * + * + * @return whether the value of the 'Sub Class Attribute' containment reference is set. + * @see #unsetSubClassAttribute() + * @see #getSubClassAttribute() + * @see #setSubClassAttribute(ClassAttribute) + * @generated + */ + boolean isSetSubClassAttribute(); + +} // SubClassPredicate diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryExpression.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryExpression.java new file mode 100755 index 0000000..f8dd628 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryExpression.java @@ -0,0 +1,91 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + + +/** + * + * A representation of the model object 'unary Expression'. + * + * + * + * This is an expression of the form UnaryLogicalOperator 'expression', like: NOT 'expression'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.booleanexpr.UnaryExpression#getUnaryOperator Unary Operator}
  • + *
  • {@link org.genivi.booleanexpr.UnaryExpression#getExpression Expression}
  • + *
+ *

+ * + * @see org.genivi.booleanexpr.FilterexprPackage#getUnaryExpression() + * @model + * @generated + */ +public interface UnaryExpression extends BooleanExpression { + /** + * Returns the value of the 'Unary Operator' attribute. + * The default value is "NOT". + * The literals are from the enumeration {@link org.genivi.booleanexpr.UnaryLogicalOperator}. + * + *

+ * If the meaning of the 'Unary Operator' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Unary Operator' attribute. + * @see org.genivi.booleanexpr.UnaryLogicalOperator + * @see #setUnaryOperator(UnaryLogicalOperator) + * @see org.genivi.booleanexpr.FilterexprPackage#getUnaryExpression_UnaryOperator() + * @model default="NOT" required="true" + * @generated + */ + UnaryLogicalOperator getUnaryOperator(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.UnaryExpression#getUnaryOperator Unary Operator}' attribute. + * + * + * @param value the new value of the 'Unary Operator' attribute. + * @see org.genivi.booleanexpr.UnaryLogicalOperator + * @see #getUnaryOperator() + * @generated + */ + void setUnaryOperator(UnaryLogicalOperator value); + + /** + * Returns the value of the 'Expression' containment reference. + * + *

+ * If the meaning of the 'Expression' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expression' containment reference. + * @see #setExpression(BooleanExpression) + * @see org.genivi.booleanexpr.FilterexprPackage#getUnaryExpression_Expression() + * @model containment="true" required="true" + * @generated + */ + BooleanExpression getExpression(); + + /** + * Sets the value of the '{@link org.genivi.booleanexpr.UnaryExpression#getExpression Expression}' containment reference. + * + * + * @param value the new value of the 'Expression' containment reference. + * @see #getExpression() + * @generated + */ + void setExpression(BooleanExpression value); + +} // unaryExpression diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryLogicalOperator.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryLogicalOperator.java new file mode 100755 index 0000000..fc5b01a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/UnaryLogicalOperator.java @@ -0,0 +1,191 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Unary Logical Operator', + * and utility methods for working with them. + * + * + * This enumeration defines the operators for UnaryExpressions. + * + * @see org.genivi.booleanexpr.FilterexprPackage#getUnaryLogicalOperator() + * @model + * @generated + */ +public enum UnaryLogicalOperator implements Enumerator { + /** + * The 'NOT' literal object. + * + * + * @see #NOT_VALUE + * @generated + * @ordered + */ + NOT(0, "NOT", "NOT"); + + /** + * The 'NOT' literal value. + * + *

+ * If the meaning of 'NOT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NOT + * @model + * @generated + * @ordered + */ + public static final int NOT_VALUE = 0; + + /** + * An array of all the 'Unary Logical Operator' enumerators. + * + * + * @generated + */ + private static final UnaryLogicalOperator[] VALUES_ARRAY = + new UnaryLogicalOperator[] { + NOT, + }; + + /** + * A public read-only list of all the 'Unary Logical Operator' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Unary Logical Operator' literal with the specified literal value. + * + * + * @generated + */ + public static UnaryLogicalOperator get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + UnaryLogicalOperator result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Unary Logical Operator' literal with the specified name. + * + * + * @generated + */ + public static UnaryLogicalOperator getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + UnaryLogicalOperator result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Unary Logical Operator' literal with the specified integer value. + * + * + * @generated + */ + public static UnaryLogicalOperator get(int value) { + switch (value) { + case NOT_VALUE: return NOT; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private UnaryLogicalOperator(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //UnaryLogicalOperator diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanExpressionImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanExpressionImpl.java new file mode 100755 index 0000000..4069149 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanExpressionImpl.java @@ -0,0 +1,67 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.FilterexprPackage; + +/** + * + * An implementation of the model object 'Boolean Expression'. + * + *

+ *

+ * + * @generated + */ +public abstract class BooleanExpressionImpl extends EObjectImpl implements BooleanExpression { + /** + * + * + * @generated + */ + protected BooleanExpressionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.BOOLEAN_EXPRESSION; + } + + /** + * + * Actually there should be no implementation at all here. + * + * @generated NOT + */ + public boolean evaluate(Object object) { + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + throw new UnsupportedOperationException(); + } + +} //BooleanExpressionImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanLiteralImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanLiteralImpl.java new file mode 100755 index 0000000..8c3e672 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/BooleanLiteralImpl.java @@ -0,0 +1,204 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.booleanexpr.BooleanLiteral; +import org.genivi.booleanexpr.FilterexprPackage; + +/** + * + * An implementation of the model object 'Boolean Literal'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.BooleanLiteralImpl#isValue Value}
  • + *
+ *

+ * + * @generated + */ +public class BooleanLiteralImpl extends LiteralImpl implements BooleanLiteral { + /** + * The default value of the '{@link #isValue() Value}' attribute. + * + * + * @see #isValue() + * @generated + * @ordered + */ + protected static final boolean VALUE_EDEFAULT = false; + + /** + * The cached value of the '{@link #isValue() Value}' attribute. + * + * + * @see #isValue() + * @generated + * @ordered + */ + protected boolean value = VALUE_EDEFAULT; + + /** + * This is true if the Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean valueESet; + + /** + * + * + * @generated + */ + protected BooleanLiteralImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.BOOLEAN_LITERAL; + } + + /** + * + * + * @generated + */ + public boolean isValue() { + return value; + } + + /** + * + * + * @generated + */ + public void setValue(boolean newValue) { + boolean oldValue = value; + value = newValue; + boolean oldValueESet = valueESet; + valueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.BOOLEAN_LITERAL__VALUE, oldValue, value, !oldValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetValue() { + boolean oldValue = value; + boolean oldValueESet = valueESet; + value = VALUE_EDEFAULT; + valueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.BOOLEAN_LITERAL__VALUE, oldValue, VALUE_EDEFAULT, oldValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetValue() { + return valueESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.BOOLEAN_LITERAL__VALUE: + return isValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.BOOLEAN_LITERAL__VALUE: + setValue((Boolean)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.BOOLEAN_LITERAL__VALUE: + unsetValue(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.BOOLEAN_LITERAL__VALUE: + return isSetValue(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + if (valueESet) + result.append(value); + else + result.append(""); + + return result.toString(); + } + +} //BooleanLiteralImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ClassAttributeImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ClassAttributeImpl.java new file mode 100755 index 0000000..8844b49 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ClassAttributeImpl.java @@ -0,0 +1,587 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.common.util.Enumerator; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EStructuralFeature; + +import org.eclipse.emf.ecore.impl.EEnumImpl; +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.MetaOperator; +import org.genivi.booleanexpr.util.FilterExprUtil; + +/** + * + * An implementation of the model object 'Class Attribute'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.ClassAttributeImpl#getAttributeName Attribute Name}
  • + *
  • {@link org.genivi.booleanexpr.impl.ClassAttributeImpl#getMetaOperator Meta Operator}
  • + *
  • {@link org.genivi.booleanexpr.impl.ClassAttributeImpl#getIndex Index}
  • + *
+ *

+ * + * @generated + */ +public class ClassAttributeImpl extends EObjectImpl implements ClassAttribute { + /** + * The default value of the '{@link #getAttributeName() Attribute Name}' attribute. + * + * + * @see #getAttributeName() + * @generated + * @ordered + */ + protected static final String ATTRIBUTE_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getAttributeName() Attribute Name}' attribute. + * + * + * @see #getAttributeName() + * @generated + * @ordered + */ + protected String attributeName = ATTRIBUTE_NAME_EDEFAULT; + + /** + * This is true if the Attribute Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean attributeNameESet; + + /** + * The default value of the '{@link #getMetaOperator() Meta Operator}' attribute. + * + * + * @see #getMetaOperator() + * @generated + * @ordered + */ + protected static final MetaOperator META_OPERATOR_EDEFAULT = MetaOperator.SIZE; + + /** + * The cached value of the '{@link #getMetaOperator() Meta Operator}' attribute. + * + * + * @see #getMetaOperator() + * @generated + * @ordered + */ + protected MetaOperator metaOperator = META_OPERATOR_EDEFAULT; + + /** + * This is true if the Meta Operator attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean metaOperatorESet; + + /** + * The default value of the '{@link #getIndex() Index}' attribute. + * + * + * @see #getIndex() + * @generated + * @ordered + */ + protected static final int INDEX_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIndex() Index}' attribute. + * + * + * @see #getIndex() + * @generated + * @ordered + */ + protected int index = INDEX_EDEFAULT; + + /** + * This is true if the Index attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean indexESet; + + private final static Logger LOGGER = Logger.getLogger(ClassAttributeImpl.class.getName()); + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected ClassAttributeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.CLASS_ATTRIBUTE; + } + + /** + * + * + * @generated + */ + public String getAttributeName() { + return attributeName; + } + + /** + * + * + * @generated + */ + public void setAttributeName(String newAttributeName) { + String oldAttributeName = attributeName; + attributeName = newAttributeName; + boolean oldAttributeNameESet = attributeNameESet; + attributeNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME, oldAttributeName, attributeName, !oldAttributeNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetAttributeName() { + String oldAttributeName = attributeName; + boolean oldAttributeNameESet = attributeNameESet; + attributeName = ATTRIBUTE_NAME_EDEFAULT; + attributeNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME, oldAttributeName, ATTRIBUTE_NAME_EDEFAULT, oldAttributeNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetAttributeName() { + return attributeNameESet; + } + + /** + * + * + * @generated + */ + public MetaOperator getMetaOperator() { + return metaOperator; + } + + /** + * + * + * @generated + */ + public void setMetaOperator(MetaOperator newMetaOperator) { + MetaOperator oldMetaOperator = metaOperator; + metaOperator = newMetaOperator == null ? META_OPERATOR_EDEFAULT : newMetaOperator; + boolean oldMetaOperatorESet = metaOperatorESet; + metaOperatorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR, oldMetaOperator, metaOperator, !oldMetaOperatorESet)); + } + + /** + * + * + * @generated + */ + public void unsetMetaOperator() { + MetaOperator oldMetaOperator = metaOperator; + boolean oldMetaOperatorESet = metaOperatorESet; + metaOperator = META_OPERATOR_EDEFAULT; + metaOperatorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR, oldMetaOperator, META_OPERATOR_EDEFAULT, oldMetaOperatorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMetaOperator() { + return metaOperatorESet; + } + + /** + * + * + * @generated + */ + public int getIndex() { + return index; + } + + /** + * + * + * @generated + */ + public void setIndex(int newIndex) { + int oldIndex = index; + index = newIndex; + boolean oldIndexESet = indexESet; + indexESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.CLASS_ATTRIBUTE__INDEX, oldIndex, index, !oldIndexESet)); + } + + /** + * + * + * @generated + */ + public void unsetIndex() { + int oldIndex = index; + boolean oldIndexESet = indexESet; + index = INDEX_EDEFAULT; + indexESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.CLASS_ATTRIBUTE__INDEX, oldIndex, INDEX_EDEFAULT, oldIndexESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetIndex() { + return indexESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME: + return getAttributeName(); + case FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR: + return getMetaOperator(); + case FilterexprPackage.CLASS_ATTRIBUTE__INDEX: + return getIndex(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME: + setAttributeName((String)newValue); + return; + case FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR: + setMetaOperator((MetaOperator)newValue); + return; + case FilterexprPackage.CLASS_ATTRIBUTE__INDEX: + setIndex((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME: + unsetAttributeName(); + return; + case FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR: + unsetMetaOperator(); + return; + case FilterexprPackage.CLASS_ATTRIBUTE__INDEX: + unsetIndex(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.CLASS_ATTRIBUTE__ATTRIBUTE_NAME: + return isSetAttributeName(); + case FilterexprPackage.CLASS_ATTRIBUTE__META_OPERATOR: + return isSetMetaOperator(); + case FilterexprPackage.CLASS_ATTRIBUTE__INDEX: + return isSetIndex(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + if (attributeNameESet) { + result.append("@"); + result.append(attributeName); + + if (indexESet) { + result.append("["); + result.append(index); + result.append("]"); + } + + if (metaOperatorESet) { + result.append("^"); + result.append(FilterExprUtil.metaOperatorToString(metaOperator)); + } + } else { + result.append(""); + } + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean isSet(EObject object) { + LOGGER.info("Looking for attribute name: " + attributeName); + + boolean returnValue = false; + + EStructuralFeature eStructuralFeature = getEStructuralFeatureForAttributeName(object, attributeName); + + if (eStructuralFeature != null) { + + LOGGER.info("Feature found: eType = " + eStructuralFeature.getEType()); + returnValue = object.eIsSet(eStructuralFeature); + } else { + LOGGER.info("Feature NOT found"); + throw new IllegalArgumentException("The object doesn't have an attribute named: " + attributeName); + } + + LOGGER.info("<=" + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + public EList getListValue(Object object) { + LOGGER.info("=> " + toString()); + + EList returnValue = null; + EObject eObject = (EObject) object; + + EStructuralFeature eStructuralFeature = getEStructuralFeatureForAttributeName(eObject, attributeName); + + if (eStructuralFeature != null) { + + LOGGER.fine("Feature found: eType = " + eStructuralFeature.getEType()); + Object attributeValue = eObject.eGet(eStructuralFeature); + + if (attributeValue instanceof EList) { + returnValue = (EList) attributeValue; + } else { + throw new IllegalArgumentException("The object is not a list "); + } + } else { + LOGGER.info("Feature NOT found"); + throw new IllegalArgumentException("The object doesn't have an attribute named: " + attributeName); + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + public Object getValue(Object object) { + LOGGER.info("=> " + toString()); + + Object returnValue = null; + EObject eObject = (EObject) object; + boolean indexHandled = false; + + EStructuralFeature eStructuralFeature = getEStructuralFeatureForAttributeName(eObject, attributeName); + + if (eStructuralFeature != null) { + + LOGGER.info("Feature found: eType = " + eStructuralFeature.getEType()); + Object attributeObject = eObject.eGet(eStructuralFeature); + + if (attributeObject instanceof EList && indexESet) { + attributeObject = ((EList) attributeObject).get(index); + indexHandled = true; + } + + if (attributeObject instanceof EList) { + EList eListObject = (EList) attributeObject; + if (metaOperatorESet) { + switch (metaOperator) { + case SIZE: + returnValue = eListObject.size(); + break; + + default: + throw new IllegalArgumentException("Illegal meta operator: " + metaOperator); + } + } else { + throw new IllegalArgumentException("A list class attribute can only be used in combination with an index or a metaOperator."); + } + } else if (attributeObject instanceof EEnumImpl) { + LOGGER.info("EType is instance of EEnumImpl => Attribute is enum"); + + if (indexESet && !indexHandled) { + throw new IllegalArgumentException("An index can not be used on an enum."); + } + + if (metaOperatorESet) { + throw new IllegalArgumentException("A meta operator cannot be used on an enum."); + } + + Enumerator enumerator = (Enumerator) attributeObject; + returnValue = (Long) (long) enumerator.getValue(); +// } else if (eStructuralFeature.getEType().isInstance(Enumerator.class)) { + } else if (attributeObject instanceof Enumerator) { + LOGGER.info("EType isInstance is Enumerator => Attribute is enum"); + LOGGER.info("EObject = " + eObject); + LOGGER.info("eStructuralFeature = " + eStructuralFeature); + + if (indexESet && !indexHandled) { + throw new IllegalArgumentException("An index can not be used on an enum."); + } + + if (metaOperatorESet) { + throw new IllegalArgumentException("A meta operator cannot be used on an enum."); + } + + Enumerator enumerator = (Enumerator) attributeObject; + if (enumerator != null) { + returnValue = (Long) (long) enumerator.getValue(); + } + } else { + + if (indexESet && !indexHandled) { + throw new IllegalArgumentException("An index can only be used on a list."); + } + + if (metaOperatorESet) { + throw new IllegalArgumentException("A meta operator can only be used on a list."); + } + + returnValue = attributeObject; + } + } else { + LOGGER.info("Feature NOT found"); + throw new IllegalArgumentException("The object doesn't have an attribute named: " + attributeName); + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + public EAttribute getEStructuralFeatureForAttributeByName(EObject object, String attributeName) { + for (EAttribute eAttribute: object.eClass().getEAllAttributes()) { + if (eAttribute.getName().equals(attributeName)) { + return eAttribute; + } + } + + return null; + } + + /** + * + * + * @generated NOT + */ + public EStructuralFeature getEStructuralFeatureForAttributeName(EObject object, String attributeName) { + for (EStructuralFeature eStructuralFeature: object.eClass().getEAllStructuralFeatures()) { + if (eStructuralFeature.getName().equals(attributeName)) { + return eStructuralFeature; + } + } + + return null; + } + +} //ClassAttributeImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ComparisonPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ComparisonPredicateImpl.java new file mode 100755 index 0000000..b8cb7fa --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/ComparisonPredicateImpl.java @@ -0,0 +1,580 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.booleanexpr.BooleanLiteral; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.ComparisonOperator; +import org.genivi.booleanexpr.ComparisonPredicate; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.Literal; +import org.genivi.booleanexpr.SignedIntegerLiteral; +import org.genivi.booleanexpr.StringLiteral; +import org.genivi.booleanexpr.util.FilterExprUtil; + +/** + * + * An implementation of the model object 'Comparison Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.ComparisonPredicateImpl#getLiteral Literal}
  • + *
  • {@link org.genivi.booleanexpr.impl.ComparisonPredicateImpl#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.impl.ComparisonPredicateImpl#getComparisonOperator Comparison Operator}
  • + *
+ *

+ * + * @generated + */ +public class ComparisonPredicateImpl extends PredicateImpl implements ComparisonPredicate { + private final static Logger LOGGER = Logger.getLogger(ComparisonPredicateImpl.class.getName()); + + /** + * The cached value of the '{@link #getLiteral() Literal}' containment reference. + * + * + * @see #getLiteral() + * @generated + * @ordered + */ + protected Literal literal; + + /** + * The cached value of the '{@link #getAttribute() Attribute}' containment reference. + * + * + * @see #getAttribute() + * @generated + * @ordered + */ + protected ClassAttribute attribute; + + /** + * The default value of the '{@link #getComparisonOperator() Comparison Operator}' attribute. + * + * + * @see #getComparisonOperator() + * @generated + * @ordered + */ + protected static final ComparisonOperator COMPARISON_OPERATOR_EDEFAULT = ComparisonOperator.EQUAL; + + /** + * The cached value of the '{@link #getComparisonOperator() Comparison Operator}' attribute. + * + * + * @see #getComparisonOperator() + * @generated + * @ordered + */ + protected ComparisonOperator comparisonOperator = COMPARISON_OPERATOR_EDEFAULT; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected ComparisonPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.COMPARISON_PREDICATE; + } + + /** + * + * + * @generated + */ + public ComparisonOperator getComparisonOperator() { + return comparisonOperator; + } + + /** + * + * + * @generated + */ + public void setComparisonOperator(ComparisonOperator newComparisonOperator) { + ComparisonOperator oldComparisonOperator = comparisonOperator; + comparisonOperator = newComparisonOperator == null ? COMPARISON_OPERATOR_EDEFAULT : newComparisonOperator; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.COMPARISON_PREDICATE__COMPARISON_OPERATOR, oldComparisonOperator, comparisonOperator)); + } + + /** + * + * + * @generated + */ + public Literal getLiteral() { + return literal; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLiteral(Literal newLiteral, NotificationChain msgs) { + Literal oldLiteral = literal; + literal = newLiteral; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.COMPARISON_PREDICATE__LITERAL, oldLiteral, newLiteral); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLiteral(Literal newLiteral) { + if (newLiteral != literal) { + NotificationChain msgs = null; + if (literal != null) + msgs = ((InternalEObject)literal).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.COMPARISON_PREDICATE__LITERAL, null, msgs); + if (newLiteral != null) + msgs = ((InternalEObject)newLiteral).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.COMPARISON_PREDICATE__LITERAL, null, msgs); + msgs = basicSetLiteral(newLiteral, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.COMPARISON_PREDICATE__LITERAL, newLiteral, newLiteral)); + } + + /** + * + * + * @generated + */ + public ClassAttribute getAttribute() { + return attribute; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetAttribute(ClassAttribute newAttribute, NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = newAttribute; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE, oldAttribute, newAttribute); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setAttribute(ClassAttribute newAttribute) { + if (newAttribute != attribute) { + NotificationChain msgs = null; + if (attribute != null) + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE, null, msgs); + if (newAttribute != null) + msgs = ((InternalEObject)newAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicSetAttribute(newAttribute, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE, newAttribute, newAttribute)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.COMPARISON_PREDICATE__LITERAL: + return basicSetLiteral(null, msgs); + case FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE: + return basicSetAttribute(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.COMPARISON_PREDICATE__LITERAL: + return getLiteral(); + case FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE: + return getAttribute(); + case FilterexprPackage.COMPARISON_PREDICATE__COMPARISON_OPERATOR: + return getComparisonOperator(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.COMPARISON_PREDICATE__LITERAL: + setLiteral((Literal)newValue); + return; + case FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)newValue); + return; + case FilterexprPackage.COMPARISON_PREDICATE__COMPARISON_OPERATOR: + setComparisonOperator((ComparisonOperator)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.COMPARISON_PREDICATE__LITERAL: + setLiteral((Literal)null); + return; + case FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)null); + return; + case FilterexprPackage.COMPARISON_PREDICATE__COMPARISON_OPERATOR: + setComparisonOperator(COMPARISON_OPERATOR_EDEFAULT); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.COMPARISON_PREDICATE__LITERAL: + return literal != null; + case FilterexprPackage.COMPARISON_PREDICATE__ATTRIBUTE: + return attribute != null; + case FilterexprPackage.COMPARISON_PREDICATE__COMPARISON_OPERATOR: + return comparisonOperator != COMPARISON_OPERATOR_EDEFAULT; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // Attribute + if (attribute != null) { + result.append(attribute.toString()); + } else { + result.append(""); + } + result.append(' '); + + // ComparisonOperator + result.append(FilterExprUtil.comparisonOperatorToString(comparisonOperator)); + result.append(' '); + + // Literal + if (literal != null) { + result.append(literal.toString()); + } else { + result.append(""); + } + + return result.toString(); + } + + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + result.append(toString()); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + boolean returnValue = false; + Object attributeObjectValue = null; + if (attribute != null) { + attributeObjectValue = attribute.getValue(object); + } else { + attributeObjectValue = object; + } + + if (attributeObjectValue == null) { + returnValue = evaluateNull(); + } else if (attributeObjectValue instanceof Boolean) { + returnValue = evaluateBoolean(attributeObjectValue); + } else if (attributeObjectValue instanceof Integer) { + returnValue = evaluateInteger(attributeObjectValue); + } else if (attributeObjectValue instanceof Long) { + returnValue = evaluateInteger(attributeObjectValue); + } else if (attributeObjectValue instanceof String) { + returnValue = evaluateString(attributeObjectValue); + } else { + throw new IllegalArgumentException("Unsupported attribute type in ComparisonPredicate. Attribute value = " + attributeObjectValue); + } + + LOGGER.info("evaluate <= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateNull() { + LOGGER.info("=>"); + + Object literalValue = null; + if (literal instanceof BooleanLiteral) { + literalValue = ((BooleanLiteral) literal).isValue(); + } else if (literal instanceof SignedIntegerLiteral) { + literalValue = ((SignedIntegerLiteral) literal).getValue(); + } else if (literal instanceof StringLiteral) { + literalValue = ((StringLiteral) literal).getValue(); + } else { + throw new IllegalArgumentException("Unsupported literal type in ComparisonPredicate. literal = " + literal); + } + boolean returnValue = false; + + LOGGER.info("Applying: " + comparisonOperator + " on literalValue: " + literalValue); + switch (comparisonOperator) { + case EQUAL: + if (literalValue == null) { + returnValue = true; + } + break; + + case GREATER_OR_EQUAL_THAN: + break; + + case GREATER_THEN: + break; + + case LESS_OR_EQUAL_THAN: + break; + + case LESS_THAN: + break; + + case NOT_EQUAL: + if (literalValue != null) { + returnValue = true; + } + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateBoolean(Object attributeObjectValue) { + LOGGER.info("=>"); + + if (!(literal instanceof BooleanLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is Boolean, while literal is not a Boolean. Literal = " + literal); + } + + boolean attributeValue = (Boolean) attributeObjectValue; + boolean literalValue = ((BooleanLiteral) literal).isValue(); + boolean returnValue = false; + + switch (comparisonOperator) { + case EQUAL: + LOGGER.info("Applying EQUAL"); + returnValue = (attributeValue == literalValue); + break; + + case GREATER_OR_EQUAL_THAN: + case GREATER_THEN: + case LESS_OR_EQUAL_THAN: + case LESS_THAN: + throw new IllegalArgumentException("Illegal comparisonOperator in ComparisonPredicate. comparisonOperator = " + comparisonOperator); + + case NOT_EQUAL: + LOGGER.info("Applying NOT_EQUAL"); + returnValue = (attributeValue != literalValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateInteger(Object attributeObjectValue) { + LOGGER.info("=>"); + + if (!(literal instanceof SignedIntegerLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is Integer, while literal is not a Integer. Literal = " + literal); + } + + // TODO PRIO 2: Do we have to support null in expressions? I think so! + long attributeValue; + if (attributeObjectValue != null) { + if (attributeObjectValue instanceof Long) { + attributeValue = (Long) attributeObjectValue; + } else { + attributeValue = new Long(((Integer) attributeObjectValue).intValue()); + } + } else { + throw new IllegalArgumentException("attributeObjectValue is null, which is currently not allowed"); + } + + long literalValue = ((SignedIntegerLiteral) literal).getValue(); + boolean returnValue = false; + + LOGGER.fine("Applying: " + comparisonOperator + " on attributevalue: " + attributeValue + ", and literalValue: " + literalValue); + + switch (comparisonOperator) { + case EQUAL: + returnValue = (attributeValue == literalValue); + break; + + case GREATER_OR_EQUAL_THAN: + returnValue = (attributeValue >= literalValue); + break; + + case GREATER_THEN: + returnValue = (attributeValue > literalValue); + break; + + case LESS_OR_EQUAL_THAN: + returnValue = (attributeValue <= literalValue); + break; + + case LESS_THAN: + returnValue = (attributeValue < literalValue); + break; + + case NOT_EQUAL: + returnValue = (attributeValue != literalValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateString(Object attributeObjectValue) { + LOGGER.info("=>"); + + if (!(literal instanceof StringLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is String, while literal is not a String. Literal = " + literal); + } + + String attributeValue = (String) attributeObjectValue; // TODO PRIO 2: Do we have to support null in expressions? I think so! + String literalValue = ((StringLiteral) literal).getValue(); + boolean returnValue = false; + + LOGGER.info("Applying: " + comparisonOperator); + switch (comparisonOperator) { + case EQUAL: + returnValue = attributeValue.equals(literalValue); + break; + + case GREATER_OR_EQUAL_THAN: + case GREATER_THEN: + case LESS_OR_EQUAL_THAN: + case LESS_THAN: + throw new IllegalArgumentException("Illegal comparisonOperator in ComparisonPredicate. comparisonOperator = " + comparisonOperator); + + case NOT_EQUAL: + returnValue = !attributeValue.equals(literalValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } +} //ComparisonPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DownCastPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DownCastPredicateImpl.java new file mode 100755 index 0000000..e3b57da --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DownCastPredicateImpl.java @@ -0,0 +1,412 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.DownCastPredicate; +import org.genivi.booleanexpr.FilterexprPackage; + +/** + * + * An implementation of the model object 'Down Cast Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.DownCastPredicateImpl#getClassName Class Name}
  • + *
  • {@link org.genivi.booleanexpr.impl.DownCastPredicateImpl#getExpression Expression}
  • + *
+ *

+ * + * @generated + */ +public class DownCastPredicateImpl extends PredicateImpl implements DownCastPredicate { + private final static Logger LOGGER = Logger.getLogger(DownCastPredicateImpl.class.getName()); + private static final String NEW_LINE = System.getProperty("line.separator"); + + /** + * The default value of the '{@link #getClassName() Class Name}' attribute. + * + * + * @see #getClassName() + * @generated + * @ordered + */ + protected static final String CLASS_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getClassName() Class Name}' attribute. + * + * + * @see #getClassName() + * @generated + * @ordered + */ + protected String className = CLASS_NAME_EDEFAULT; + + /** + * This is true if the Class Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean classNameESet; + + /** + * The cached value of the '{@link #getExpression() Expression}' containment reference. + * + * + * @see #getExpression() + * @generated + * @ordered + */ + protected BooleanExpression expression; + + /** + * This is true if the Expression containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean expressionESet; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected DownCastPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.DOWN_CAST_PREDICATE; + } + + /** + * + * + * @generated + */ + public String getClassName() { + return className; + } + + /** + * + * + * @generated + */ + public void setClassName(String newClassName) { + String oldClassName = className; + className = newClassName; + boolean oldClassNameESet = classNameESet; + classNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME, oldClassName, className, !oldClassNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetClassName() { + String oldClassName = className; + boolean oldClassNameESet = classNameESet; + className = CLASS_NAME_EDEFAULT; + classNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME, oldClassName, CLASS_NAME_EDEFAULT, oldClassNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetClassName() { + return classNameESet; + } + + /** + * + * + * @generated + */ + public BooleanExpression getExpression() { + return expression; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetExpression(BooleanExpression newExpression, NotificationChain msgs) { + BooleanExpression oldExpression = expression; + expression = newExpression; + boolean oldExpressionESet = expressionESet; + expressionESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, oldExpression, newExpression, !oldExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setExpression(BooleanExpression newExpression) { + if (newExpression != expression) { + NotificationChain msgs = null; + if (expression != null) + msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, null, msgs); + if (newExpression != null) + msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, null, msgs); + msgs = basicSetExpression(newExpression, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldExpressionESet = expressionESet; + expressionESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, newExpression, newExpression, !oldExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetExpression(NotificationChain msgs) { + BooleanExpression oldExpression = expression; + expression = null; + boolean oldExpressionESet = expressionESet; + expressionESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, oldExpression, null, oldExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetExpression() { + if (expression != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, null, msgs); + msgs = basicUnsetExpression(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldExpressionESet = expressionESet; + expressionESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION, null, null, oldExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetExpression() { + return expressionESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION: + return basicUnsetExpression(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME: + return getClassName(); + case FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION: + return getExpression(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME: + setClassName((String)newValue); + return; + case FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION: + setExpression((BooleanExpression)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME: + unsetClassName(); + return; + case FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION: + unsetExpression(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.DOWN_CAST_PREDICATE__CLASS_NAME: + return isSetClassName(); + case FilterexprPackage.DOWN_CAST_PREDICATE__EXPRESSION: + return isSetExpression(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // 'DownCast to' class between '[' and ']' + result.append("["); + if (classNameESet) + result.append(className); + else + result.append(""); + result.append("]"); + + // Expression + result.append('('); + result.append(expression.toString()); + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + + // 'DownCast to' class between '[' and ']' + result.append("["); + if (classNameESet) + result.append(className); + else + result.append(""); + result.append("]"); + + // Expression + result.append(" ("); + result.append(NEW_LINE); + + indent += indentSize; + + result.append(expression.format(indent, indentSize)); + result.append(NEW_LINE); + + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + + result.append(indent); + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + boolean returnValue; + + returnValue = expression.evaluate(object); + + LOGGER.info("<= " + returnValue); + + return returnValue; + } +} //DownCastPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DyadicExpressionImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DyadicExpressionImpl.java new file mode 100755 index 0000000..b725313 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/DyadicExpressionImpl.java @@ -0,0 +1,593 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.DyadicExpression; +import org.genivi.booleanexpr.DyadicLogicalOperator; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.util.FilterExprUtil; + +/** + * + * An implementation of the model object 'Dyadic Expression'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.DyadicExpressionImpl#getLogicalOperator Logical Operator}
  • + *
  • {@link org.genivi.booleanexpr.impl.DyadicExpressionImpl#getLeftHandTerm Left Hand Term}
  • + *
  • {@link org.genivi.booleanexpr.impl.DyadicExpressionImpl#getRightHandTerm Right Hand Term}
  • + *
+ *

+ * + * @generated + */ +public class DyadicExpressionImpl extends BooleanExpressionImpl implements DyadicExpression { + private final static Logger LOGGER = Logger.getLogger(DyadicExpressionImpl.class.getName()); + private static final String NEW_LINE = System.getProperty("line.separator"); + + /** + * The default value of the '{@link #getLogicalOperator() Logical Operator}' attribute. + * + * + * @see #getLogicalOperator() + * @generated + * @ordered + */ + protected static final DyadicLogicalOperator LOGICAL_OPERATOR_EDEFAULT = DyadicLogicalOperator.AND; + + /** + * The cached value of the '{@link #getLogicalOperator() Logical Operator}' attribute. + * + * + * @see #getLogicalOperator() + * @generated + * @ordered + */ + protected DyadicLogicalOperator logicalOperator = LOGICAL_OPERATOR_EDEFAULT; + + /** + * This is true if the Logical Operator attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean logicalOperatorESet; + + /** + * The cached value of the '{@link #getLeftHandTerm() Left Hand Term}' containment reference. + * + * + * @see #getLeftHandTerm() + * @generated + * @ordered + */ + protected BooleanExpression leftHandTerm; + + /** + * This is true if the Left Hand Term containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean leftHandTermESet; + + /** + * The cached value of the '{@link #getRightHandTerm() Right Hand Term}' containment reference. + * + * + * @see #getRightHandTerm() + * @generated + * @ordered + */ + protected BooleanExpression rightHandTerm; + + /** + * This is true if the Right Hand Term containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean rightHandTermESet; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected DyadicExpressionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.DYADIC_EXPRESSION; + } + + /** + * + * + * @generated + */ + public DyadicLogicalOperator getLogicalOperator() { + return logicalOperator; + } + + /** + * + * + * @generated + */ + public void setLogicalOperator(DyadicLogicalOperator newLogicalOperator) { + DyadicLogicalOperator oldLogicalOperator = logicalOperator; + logicalOperator = newLogicalOperator == null ? LOGICAL_OPERATOR_EDEFAULT : newLogicalOperator; + boolean oldLogicalOperatorESet = logicalOperatorESet; + logicalOperatorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR, oldLogicalOperator, logicalOperator, !oldLogicalOperatorESet)); + } + + /** + * + * + * @generated + */ + public void unsetLogicalOperator() { + DyadicLogicalOperator oldLogicalOperator = logicalOperator; + boolean oldLogicalOperatorESet = logicalOperatorESet; + logicalOperator = LOGICAL_OPERATOR_EDEFAULT; + logicalOperatorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR, oldLogicalOperator, LOGICAL_OPERATOR_EDEFAULT, oldLogicalOperatorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLogicalOperator() { + return logicalOperatorESet; + } + + /** + * + * + * @generated + */ + public BooleanExpression getLeftHandTerm() { + return leftHandTerm; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLeftHandTerm(BooleanExpression newLeftHandTerm, NotificationChain msgs) { + BooleanExpression oldLeftHandTerm = leftHandTerm; + leftHandTerm = newLeftHandTerm; + boolean oldLeftHandTermESet = leftHandTermESet; + leftHandTermESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, oldLeftHandTerm, newLeftHandTerm, !oldLeftHandTermESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLeftHandTerm(BooleanExpression newLeftHandTerm) { + if (newLeftHandTerm != leftHandTerm) { + NotificationChain msgs = null; + if (leftHandTerm != null) + msgs = ((InternalEObject)leftHandTerm).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, null, msgs); + if (newLeftHandTerm != null) + msgs = ((InternalEObject)newLeftHandTerm).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, null, msgs); + msgs = basicSetLeftHandTerm(newLeftHandTerm, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLeftHandTermESet = leftHandTermESet; + leftHandTermESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, newLeftHandTerm, newLeftHandTerm, !oldLeftHandTermESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLeftHandTerm(NotificationChain msgs) { + BooleanExpression oldLeftHandTerm = leftHandTerm; + leftHandTerm = null; + boolean oldLeftHandTermESet = leftHandTermESet; + leftHandTermESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, oldLeftHandTerm, null, oldLeftHandTermESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLeftHandTerm() { + if (leftHandTerm != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)leftHandTerm).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, null, msgs); + msgs = basicUnsetLeftHandTerm(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLeftHandTermESet = leftHandTermESet; + leftHandTermESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM, null, null, oldLeftHandTermESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLeftHandTerm() { + return leftHandTermESet; + } + + /** + * + * + * @generated + */ + public BooleanExpression getRightHandTerm() { + return rightHandTerm; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetRightHandTerm(BooleanExpression newRightHandTerm, NotificationChain msgs) { + BooleanExpression oldRightHandTerm = rightHandTerm; + rightHandTerm = newRightHandTerm; + boolean oldRightHandTermESet = rightHandTermESet; + rightHandTermESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, oldRightHandTerm, newRightHandTerm, !oldRightHandTermESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setRightHandTerm(BooleanExpression newRightHandTerm) { + if (newRightHandTerm != rightHandTerm) { + NotificationChain msgs = null; + if (rightHandTerm != null) + msgs = ((InternalEObject)rightHandTerm).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, null, msgs); + if (newRightHandTerm != null) + msgs = ((InternalEObject)newRightHandTerm).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, null, msgs); + msgs = basicSetRightHandTerm(newRightHandTerm, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRightHandTermESet = rightHandTermESet; + rightHandTermESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, newRightHandTerm, newRightHandTerm, !oldRightHandTermESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetRightHandTerm(NotificationChain msgs) { + BooleanExpression oldRightHandTerm = rightHandTerm; + rightHandTerm = null; + boolean oldRightHandTermESet = rightHandTermESet; + rightHandTermESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, oldRightHandTerm, null, oldRightHandTermESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetRightHandTerm() { + if (rightHandTerm != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)rightHandTerm).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, null, msgs); + msgs = basicUnsetRightHandTerm(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRightHandTermESet = rightHandTermESet; + rightHandTermESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM, null, null, oldRightHandTermESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetRightHandTerm() { + return rightHandTermESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM: + return basicUnsetLeftHandTerm(msgs); + case FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM: + return basicUnsetRightHandTerm(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR: + return getLogicalOperator(); + case FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM: + return getLeftHandTerm(); + case FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM: + return getRightHandTerm(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR: + setLogicalOperator((DyadicLogicalOperator)newValue); + return; + case FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM: + setLeftHandTerm((BooleanExpression)newValue); + return; + case FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM: + setRightHandTerm((BooleanExpression)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR: + unsetLogicalOperator(); + return; + case FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM: + unsetLeftHandTerm(); + return; + case FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM: + unsetRightHandTerm(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.DYADIC_EXPRESSION__LOGICAL_OPERATOR: + return isSetLogicalOperator(); + case FilterexprPackage.DYADIC_EXPRESSION__LEFT_HAND_TERM: + return isSetLeftHandTerm(); + case FilterexprPackage.DYADIC_EXPRESSION__RIGHT_HAND_TERM: + return isSetRightHandTerm(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // Left hand Expression + result.append('('); + if (leftHandTerm != null) { + result.append(leftHandTerm.toString()); + } else { + result.append("null"); + } + result.append(") "); + + // DyadicLogicalOperator + if (logicalOperatorESet) + result.append(FilterExprUtil.dyadicLogicalOperatorToString(logicalOperator)); + else + result.append(""); + + // Right hand Expression + result.append(" ("); + if (rightHandTerm != null) { + result.append(rightHandTerm.toString()); + } else { + result.append("null"); + } + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + // Left hand Expression + result.append(indent); + result.append('('); + result.append(NEW_LINE); + + indent += indentSize; + + if (leftHandTerm != null) { + result.append(leftHandTerm.format(indent, indentSize)); + } else { + result.append("null"); + } + result.append(NEW_LINE); + + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + + result.append(indent); + result.append(") "); + + // DyadicLogicalOperator + if (logicalOperatorESet) + result.append(FilterExprUtil.dyadicLogicalOperatorToString(logicalOperator)); + else + result.append(""); + + // Right hand Expression + result.append(" ("); + result.append(NEW_LINE); + + indent += indentSize; + + if (rightHandTerm != null) { + result.append(rightHandTerm.format(indent, indentSize)); + } else { + result.append("null"); + } + result.append(NEW_LINE); + + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + + result.append(indent); + result.append(')'); + + return result.toString(); + } + + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + LOGGER.info("Going to evaluate left hand side"); + boolean result = false; + boolean leftHandResult = leftHandTerm.evaluate(object); + boolean rightHandResult; + + switch (logicalOperator) { + case AND: + LOGGER.info("Operator is AND"); + if (leftHandResult) { + LOGGER.info("Needed to evaluate right hand side"); + rightHandResult = rightHandTerm.evaluate(object); + result = leftHandResult && rightHandResult; + } + break; + + case OR: + LOGGER.info("Operator is OR"); + if (leftHandResult) { + result = true; + } else { + LOGGER.info("Needed to evaluate right hand side"); + rightHandResult = rightHandTerm.evaluate(object); + result = leftHandResult || rightHandResult; + } + } + + LOGGER.info("evaluate <= " + result); + return result; + } +} //DyadicExpressionImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprFactoryImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprFactoryImpl.java new file mode 100755 index 0000000..e9b00e9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprFactoryImpl.java @@ -0,0 +1,394 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.booleanexpr.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class FilterexprFactoryImpl extends EFactoryImpl implements FilterexprFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static FilterexprFactory init() { + try { + FilterexprFactory theFilterexprFactory = (FilterexprFactory)EPackage.Registry.INSTANCE.getEFactory(FilterexprPackage.eNS_URI); + if (theFilterexprFactory != null) { + return theFilterexprFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new FilterexprFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public FilterexprFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case FilterexprPackage.UNARY_EXPRESSION: return createUnaryExpression(); + case FilterexprPackage.DYADIC_EXPRESSION: return createDyadicExpression(); + case FilterexprPackage.COMPARISON_PREDICATE: return createComparisonPredicate(); + case FilterexprPackage.IN_PREDICATE: return createInPredicate(); + case FilterexprPackage.SIGNED_INTEGER_LITERAL: return createSignedIntegerLiteral(); + case FilterexprPackage.STRING_LITERAL: return createStringLiteral(); + case FilterexprPackage.BOOLEAN_LITERAL: return createBooleanLiteral(); + case FilterexprPackage.SUB_CLASS_PREDICATE: return createSubClassPredicate(); + case FilterexprPackage.CLASS_ATTRIBUTE: return createClassAttribute(); + case FilterexprPackage.DOWN_CAST_PREDICATE: return createDownCastPredicate(); + case FilterexprPackage.MULTIPLICITY_PREDICATE: return createMultiplicityPredicate(); + case FilterexprPackage.IS_SET_PREDICATE: return createIsSetPredicate(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case FilterexprPackage.DYADIC_LOGICAL_OPERATOR: + return createDyadicLogicalOperatorFromString(eDataType, initialValue); + case FilterexprPackage.UNARY_LOGICAL_OPERATOR: + return createUnaryLogicalOperatorFromString(eDataType, initialValue); + case FilterexprPackage.COMPARISON_OPERATOR: + return createComparisonOperatorFromString(eDataType, initialValue); + case FilterexprPackage.LIST_OPERATOR: + return createListOperatorFromString(eDataType, initialValue); + case FilterexprPackage.IN_OPERATOR: + return createInOperatorFromString(eDataType, initialValue); + case FilterexprPackage.META_OPERATOR: + return createMetaOperatorFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case FilterexprPackage.DYADIC_LOGICAL_OPERATOR: + return convertDyadicLogicalOperatorToString(eDataType, instanceValue); + case FilterexprPackage.UNARY_LOGICAL_OPERATOR: + return convertUnaryLogicalOperatorToString(eDataType, instanceValue); + case FilterexprPackage.COMPARISON_OPERATOR: + return convertComparisonOperatorToString(eDataType, instanceValue); + case FilterexprPackage.LIST_OPERATOR: + return convertListOperatorToString(eDataType, instanceValue); + case FilterexprPackage.IN_OPERATOR: + return convertInOperatorToString(eDataType, instanceValue); + case FilterexprPackage.META_OPERATOR: + return convertMetaOperatorToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public UnaryExpression createUnaryExpression() { + UnaryExpressionImpl unaryExpression = new UnaryExpressionImpl(); + return unaryExpression; + } + + /** + * + * + * @generated + */ + public DyadicExpression createDyadicExpression() { + DyadicExpressionImpl dyadicExpression = new DyadicExpressionImpl(); + return dyadicExpression; + } + + /** + * + * + * @generated + */ + public ComparisonPredicate createComparisonPredicate() { + ComparisonPredicateImpl comparisonPredicate = new ComparisonPredicateImpl(); + return comparisonPredicate; + } + + /** + * + * + * @generated + */ + public InPredicate createInPredicate() { + InPredicateImpl inPredicate = new InPredicateImpl(); + return inPredicate; + } + + /** + * + * + * @generated + */ + public SignedIntegerLiteral createSignedIntegerLiteral() { + SignedIntegerLiteralImpl signedIntegerLiteral = new SignedIntegerLiteralImpl(); + return signedIntegerLiteral; + } + + /** + * + * + * @generated + */ + public StringLiteral createStringLiteral() { + StringLiteralImpl stringLiteral = new StringLiteralImpl(); + return stringLiteral; + } + + /** + * + * + * @generated + */ + public BooleanLiteral createBooleanLiteral() { + BooleanLiteralImpl booleanLiteral = new BooleanLiteralImpl(); + return booleanLiteral; + } + + /** + * + * + * @generated + */ + public SubClassPredicate createSubClassPredicate() { + SubClassPredicateImpl subClassPredicate = new SubClassPredicateImpl(); + return subClassPredicate; + } + + /** + * + * + * @generated + */ + public ClassAttribute createClassAttribute() { + ClassAttributeImpl classAttribute = new ClassAttributeImpl(); + return classAttribute; + } + + /** + * + * + * @generated + */ + public DownCastPredicate createDownCastPredicate() { + DownCastPredicateImpl downCastPredicate = new DownCastPredicateImpl(); + return downCastPredicate; + } + + /** + * + * + * @generated + */ + public MultiplicityPredicate createMultiplicityPredicate() { + MultiplicityPredicateImpl multiplicityPredicate = new MultiplicityPredicateImpl(); + return multiplicityPredicate; + } + + /** + * + * + * @generated + */ + public IsSetPredicate createIsSetPredicate() { + IsSetPredicateImpl isSetPredicate = new IsSetPredicateImpl(); + return isSetPredicate; + } + + /** + * + * + * @generated + */ + public DyadicLogicalOperator createDyadicLogicalOperatorFromString(EDataType eDataType, String initialValue) { + DyadicLogicalOperator result = DyadicLogicalOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertDyadicLogicalOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public UnaryLogicalOperator createUnaryLogicalOperatorFromString(EDataType eDataType, String initialValue) { + UnaryLogicalOperator result = UnaryLogicalOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertUnaryLogicalOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ComparisonOperator createComparisonOperatorFromString(EDataType eDataType, String initialValue) { + ComparisonOperator result = ComparisonOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertComparisonOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ListOperator createListOperatorFromString(EDataType eDataType, String initialValue) { + ListOperator result = ListOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertListOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public InOperator createInOperatorFromString(EDataType eDataType, String initialValue) { + InOperator result = InOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertInOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public MetaOperator createMetaOperatorFromString(EDataType eDataType, String initialValue) { + MetaOperator result = MetaOperator.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertMetaOperatorToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public FilterexprPackage getFilterexprPackage() { + return (FilterexprPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static FilterexprPackage getPackage() { + return FilterexprPackage.eINSTANCE; + } + +} //FilterexprFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprPackageImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprPackageImpl.java new file mode 100755 index 0000000..3eee31f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/FilterexprPackageImpl.java @@ -0,0 +1,934 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EGenericType; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.BooleanLiteral; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.ComparisonOperator; +import org.genivi.booleanexpr.ComparisonPredicate; +import org.genivi.booleanexpr.DownCastPredicate; +import org.genivi.booleanexpr.DyadicExpression; +import org.genivi.booleanexpr.DyadicLogicalOperator; +import org.genivi.booleanexpr.FilterexprFactory; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.InOperator; +import org.genivi.booleanexpr.InPredicate; +import org.genivi.booleanexpr.IsSetPredicate; +import org.genivi.booleanexpr.ListOperator; +import org.genivi.booleanexpr.Literal; +import org.genivi.booleanexpr.MetaOperator; +import org.genivi.booleanexpr.MultiplicityPredicate; +import org.genivi.booleanexpr.Predicate; +import org.genivi.booleanexpr.SignedIntegerLiteral; +import org.genivi.booleanexpr.StringLiteral; +import org.genivi.booleanexpr.SubClassPredicate; +import org.genivi.booleanexpr.UnaryExpression; +import org.genivi.booleanexpr.UnaryLogicalOperator; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class FilterexprPackageImpl extends EPackageImpl implements FilterexprPackage { + /** + * + * + * @generated + */ + private EClass booleanExpressionEClass = null; + + /** + * + * + * @generated + */ + private EClass unaryExpressionEClass = null; + + /** + * + * + * @generated + */ + private EClass predicateEClass = null; + + /** + * + * + * @generated + */ + private EClass dyadicExpressionEClass = null; + + /** + * + * + * @generated + */ + private EClass comparisonPredicateEClass = null; + + /** + * + * + * @generated + */ + private EClass inPredicateEClass = null; + + /** + * + * + * @generated + */ + private EClass literalEClass = null; + + /** + * + * + * @generated + */ + private EClass signedIntegerLiteralEClass = null; + + /** + * + * + * @generated + */ + private EClass stringLiteralEClass = null; + + /** + * + * + * @generated + */ + private EClass booleanLiteralEClass = null; + + /** + * + * + * @generated + */ + private EClass subClassPredicateEClass = null; + + /** + * + * + * @generated + */ + private EClass classAttributeEClass = null; + + /** + * + * + * @generated + */ + private EClass downCastPredicateEClass = null; + + /** + * + * + * @generated + */ + private EClass multiplicityPredicateEClass = null; + + /** + * + * + * @generated + */ + private EClass isSetPredicateEClass = null; + + /** + * + * + * @generated + */ + private EEnum dyadicLogicalOperatorEEnum = null; + + /** + * + * + * @generated + */ + private EEnum unaryLogicalOperatorEEnum = null; + + /** + * + * + * @generated + */ + private EEnum comparisonOperatorEEnum = null; + + /** + * + * + * @generated + */ + private EEnum listOperatorEEnum = null; + + /** + * + * + * @generated + */ + private EEnum inOperatorEEnum = null; + + /** + * + * + * @generated + */ + private EEnum metaOperatorEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.booleanexpr.FilterexprPackage#eNS_URI + * @see #init() + * @generated + */ + private FilterexprPackageImpl() { + super(eNS_URI, FilterexprFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link FilterexprPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static FilterexprPackage init() { + if (isInited) return (FilterexprPackage)EPackage.Registry.INSTANCE.getEPackage(FilterexprPackage.eNS_URI); + + // Obtain or create and register package + FilterexprPackageImpl theFilterexprPackage = (FilterexprPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FilterexprPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FilterexprPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theFilterexprPackage.createPackageContents(); + + // Initialize created meta-data + theFilterexprPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theFilterexprPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(FilterexprPackage.eNS_URI, theFilterexprPackage); + return theFilterexprPackage; + } + + /** + * + * + * @generated + */ + public EClass getBooleanExpression() { + return booleanExpressionEClass; + } + + /** + * + * + * @generated + */ + public EClass getUnaryExpression() { + return unaryExpressionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getUnaryExpression_UnaryOperator() { + return (EAttribute)unaryExpressionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getUnaryExpression_Expression() { + return (EReference)unaryExpressionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getPredicate() { + return predicateEClass; + } + + /** + * + * + * @generated + */ + public EClass getDyadicExpression() { + return dyadicExpressionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getDyadicExpression_LogicalOperator() { + return (EAttribute)dyadicExpressionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getDyadicExpression_LeftHandTerm() { + return (EReference)dyadicExpressionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getDyadicExpression_RightHandTerm() { + return (EReference)dyadicExpressionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getComparisonPredicate() { + return comparisonPredicateEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getComparisonPredicate_ComparisonOperator() { + return (EAttribute)comparisonPredicateEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getComparisonPredicate_Literal() { + return (EReference)comparisonPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getComparisonPredicate_Attribute() { + return (EReference)comparisonPredicateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getInPredicate() { + return inPredicateEClass; + } + + /** + * + * + * @generated + */ + public EReference getInPredicate_Attribute() { + return (EReference)inPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getInPredicate_InOperator() { + return (EAttribute)inPredicateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getInPredicate_Literals() { + return (EReference)inPredicateEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getLiteral() { + return literalEClass; + } + + /** + * + * + * @generated + */ + public EClass getSignedIntegerLiteral() { + return signedIntegerLiteralEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getSignedIntegerLiteral_Value() { + return (EAttribute)signedIntegerLiteralEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getStringLiteral() { + return stringLiteralEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getStringLiteral_Value() { + return (EAttribute)stringLiteralEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getBooleanLiteral() { + return booleanLiteralEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getBooleanLiteral_Value() { + return (EAttribute)booleanLiteralEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getSubClassPredicate() { + return subClassPredicateEClass; + } + + /** + * + * + * @generated + */ + public EReference getSubClassPredicate_SubClassExpression() { + return (EReference)subClassPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getSubClassPredicate_SubClassAttribute() { + return (EReference)subClassPredicateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getClassAttribute() { + return classAttributeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getClassAttribute_AttributeName() { + return (EAttribute)classAttributeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getClassAttribute_MetaOperator() { + return (EAttribute)classAttributeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getClassAttribute_Index() { + return (EAttribute)classAttributeEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getDownCastPredicate() { + return downCastPredicateEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getDownCastPredicate_ClassName() { + return (EAttribute)downCastPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getDownCastPredicate_Expression() { + return (EReference)downCastPredicateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getMultiplicityPredicate() { + return multiplicityPredicateEClass; + } + + /** + * + * + * @generated + */ + public EReference getMultiplicityPredicate_Expression() { + return (EReference)multiplicityPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getMultiplicityPredicate_ListOperator() { + return (EAttribute)multiplicityPredicateEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getMultiplicityPredicate_Attribute() { + return (EReference)multiplicityPredicateEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getIsSetPredicate() { + return isSetPredicateEClass; + } + + /** + * + * + * @generated + */ + public EReference getIsSetPredicate_Attribute() { + return (EReference)isSetPredicateEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EEnum getDyadicLogicalOperator() { + return dyadicLogicalOperatorEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getUnaryLogicalOperator() { + return unaryLogicalOperatorEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getComparisonOperator() { + return comparisonOperatorEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getListOperator() { + return listOperatorEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getInOperator() { + return inOperatorEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getMetaOperator() { + return metaOperatorEEnum; + } + + /** + * + * + * @generated + */ + public FilterexprFactory getFilterexprFactory() { + return (FilterexprFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + booleanExpressionEClass = createEClass(BOOLEAN_EXPRESSION); + + unaryExpressionEClass = createEClass(UNARY_EXPRESSION); + createEAttribute(unaryExpressionEClass, UNARY_EXPRESSION__UNARY_OPERATOR); + createEReference(unaryExpressionEClass, UNARY_EXPRESSION__EXPRESSION); + + predicateEClass = createEClass(PREDICATE); + + dyadicExpressionEClass = createEClass(DYADIC_EXPRESSION); + createEAttribute(dyadicExpressionEClass, DYADIC_EXPRESSION__LOGICAL_OPERATOR); + createEReference(dyadicExpressionEClass, DYADIC_EXPRESSION__LEFT_HAND_TERM); + createEReference(dyadicExpressionEClass, DYADIC_EXPRESSION__RIGHT_HAND_TERM); + + comparisonPredicateEClass = createEClass(COMPARISON_PREDICATE); + createEReference(comparisonPredicateEClass, COMPARISON_PREDICATE__LITERAL); + createEReference(comparisonPredicateEClass, COMPARISON_PREDICATE__ATTRIBUTE); + createEAttribute(comparisonPredicateEClass, COMPARISON_PREDICATE__COMPARISON_OPERATOR); + + inPredicateEClass = createEClass(IN_PREDICATE); + createEReference(inPredicateEClass, IN_PREDICATE__ATTRIBUTE); + createEAttribute(inPredicateEClass, IN_PREDICATE__IN_OPERATOR); + createEReference(inPredicateEClass, IN_PREDICATE__LITERALS); + + literalEClass = createEClass(LITERAL); + + signedIntegerLiteralEClass = createEClass(SIGNED_INTEGER_LITERAL); + createEAttribute(signedIntegerLiteralEClass, SIGNED_INTEGER_LITERAL__VALUE); + + stringLiteralEClass = createEClass(STRING_LITERAL); + createEAttribute(stringLiteralEClass, STRING_LITERAL__VALUE); + + booleanLiteralEClass = createEClass(BOOLEAN_LITERAL); + createEAttribute(booleanLiteralEClass, BOOLEAN_LITERAL__VALUE); + + subClassPredicateEClass = createEClass(SUB_CLASS_PREDICATE); + createEReference(subClassPredicateEClass, SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION); + createEReference(subClassPredicateEClass, SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE); + + classAttributeEClass = createEClass(CLASS_ATTRIBUTE); + createEAttribute(classAttributeEClass, CLASS_ATTRIBUTE__ATTRIBUTE_NAME); + createEAttribute(classAttributeEClass, CLASS_ATTRIBUTE__META_OPERATOR); + createEAttribute(classAttributeEClass, CLASS_ATTRIBUTE__INDEX); + + downCastPredicateEClass = createEClass(DOWN_CAST_PREDICATE); + createEAttribute(downCastPredicateEClass, DOWN_CAST_PREDICATE__CLASS_NAME); + createEReference(downCastPredicateEClass, DOWN_CAST_PREDICATE__EXPRESSION); + + multiplicityPredicateEClass = createEClass(MULTIPLICITY_PREDICATE); + createEReference(multiplicityPredicateEClass, MULTIPLICITY_PREDICATE__EXPRESSION); + createEReference(multiplicityPredicateEClass, MULTIPLICITY_PREDICATE__ATTRIBUTE); + createEAttribute(multiplicityPredicateEClass, MULTIPLICITY_PREDICATE__LIST_OPERATOR); + + isSetPredicateEClass = createEClass(IS_SET_PREDICATE); + createEReference(isSetPredicateEClass, IS_SET_PREDICATE__ATTRIBUTE); + + // Create enums + dyadicLogicalOperatorEEnum = createEEnum(DYADIC_LOGICAL_OPERATOR); + unaryLogicalOperatorEEnum = createEEnum(UNARY_LOGICAL_OPERATOR); + comparisonOperatorEEnum = createEEnum(COMPARISON_OPERATOR); + listOperatorEEnum = createEEnum(LIST_OPERATOR); + inOperatorEEnum = createEEnum(IN_OPERATOR); + metaOperatorEEnum = createEEnum(META_OPERATOR); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + unaryExpressionEClass.getESuperTypes().add(this.getBooleanExpression()); + predicateEClass.getESuperTypes().add(this.getBooleanExpression()); + dyadicExpressionEClass.getESuperTypes().add(this.getBooleanExpression()); + comparisonPredicateEClass.getESuperTypes().add(this.getPredicate()); + inPredicateEClass.getESuperTypes().add(this.getPredicate()); + signedIntegerLiteralEClass.getESuperTypes().add(this.getLiteral()); + stringLiteralEClass.getESuperTypes().add(this.getLiteral()); + booleanLiteralEClass.getESuperTypes().add(this.getLiteral()); + subClassPredicateEClass.getESuperTypes().add(this.getPredicate()); + downCastPredicateEClass.getESuperTypes().add(this.getPredicate()); + multiplicityPredicateEClass.getESuperTypes().add(this.getPredicate()); + isSetPredicateEClass.getESuperTypes().add(this.getPredicate()); + + // Initialize classes and features; add operations and parameters + initEClass(booleanExpressionEClass, BooleanExpression.class, "BooleanExpression", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + EOperation op = addEOperation(booleanExpressionEClass, ecorePackage.getEBoolean(), "evaluate", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(booleanExpressionEClass, ecorePackage.getEString(), "format", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "indent", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "indentSize", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(unaryExpressionEClass, UnaryExpression.class, "UnaryExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getUnaryExpression_UnaryOperator(), this.getUnaryLogicalOperator(), "unaryOperator", "NOT", 1, 1, UnaryExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getUnaryExpression_Expression(), this.getBooleanExpression(), null, "expression", null, 1, 1, UnaryExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(predicateEClass, Predicate.class, "Predicate", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(dyadicExpressionEClass, DyadicExpression.class, "DyadicExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDyadicExpression_LogicalOperator(), this.getDyadicLogicalOperator(), "logicalOperator", "AND", 1, 1, DyadicExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDyadicExpression_LeftHandTerm(), this.getBooleanExpression(), null, "leftHandTerm", null, 1, 1, DyadicExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDyadicExpression_RightHandTerm(), this.getBooleanExpression(), null, "rightHandTerm", null, 1, 1, DyadicExpression.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(comparisonPredicateEClass, ComparisonPredicate.class, "ComparisonPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getComparisonPredicate_Literal(), this.getLiteral(), null, "literal", null, 1, 1, ComparisonPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getComparisonPredicate_Attribute(), this.getClassAttribute(), null, "attribute", null, 1, 1, ComparisonPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getComparisonPredicate_ComparisonOperator(), this.getComparisonOperator(), "comparisonOperator", null, 1, 1, ComparisonPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(inPredicateEClass, InPredicate.class, "InPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getInPredicate_Attribute(), this.getClassAttribute(), null, "attribute", null, 1, 1, InPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getInPredicate_InOperator(), this.getInOperator(), "inOperator", null, 1, 1, InPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getInPredicate_Literals(), this.getLiteral(), null, "literals", null, 0, -1, InPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(literalEClass, Literal.class, "Literal", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + initEClass(signedIntegerLiteralEClass, SignedIntegerLiteral.class, "SignedIntegerLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getSignedIntegerLiteral_Value(), ecorePackage.getELong(), "value", null, 1, 1, SignedIntegerLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(stringLiteralEClass, StringLiteral.class, "StringLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getStringLiteral_Value(), ecorePackage.getEString(), "value", null, 1, 1, StringLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(booleanLiteralEClass, BooleanLiteral.class, "BooleanLiteral", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getBooleanLiteral_Value(), ecorePackage.getEBoolean(), "value", null, 1, 1, BooleanLiteral.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(subClassPredicateEClass, SubClassPredicate.class, "SubClassPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getSubClassPredicate_SubClassExpression(), this.getBooleanExpression(), null, "subClassExpression", null, 1, 1, SubClassPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getSubClassPredicate_SubClassAttribute(), this.getClassAttribute(), null, "subClassAttribute", null, 1, 1, SubClassPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(classAttributeEClass, ClassAttribute.class, "ClassAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getClassAttribute_AttributeName(), ecorePackage.getEString(), "attributeName", null, 1, 1, ClassAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getClassAttribute_MetaOperator(), this.getMetaOperator(), "metaOperator", null, 0, 1, ClassAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getClassAttribute_Index(), ecorePackage.getEInt(), "index", null, 0, 1, ClassAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + op = addEOperation(classAttributeEClass, ecorePackage.getEBoolean(), "isSet", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(classAttributeEClass, null, "getListValue", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED); + EGenericType g1 = createEGenericType(ecorePackage.getEEList()); + EGenericType g2 = createEGenericType(); + g1.getETypeArguments().add(g2); + initEOperation(op, g1); + + op = addEOperation(classAttributeEClass, ecorePackage.getEJavaObject(), "getValue", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEJavaObject(), "object", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(downCastPredicateEClass, DownCastPredicate.class, "DownCastPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDownCastPredicate_ClassName(), ecorePackage.getEString(), "className", null, 1, 1, DownCastPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDownCastPredicate_Expression(), this.getBooleanExpression(), null, "expression", null, 1, 1, DownCastPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(multiplicityPredicateEClass, MultiplicityPredicate.class, "MultiplicityPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getMultiplicityPredicate_Expression(), this.getBooleanExpression(), null, "expression", null, 1, 1, MultiplicityPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getMultiplicityPredicate_Attribute(), this.getClassAttribute(), null, "attribute", null, 1, 1, MultiplicityPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getMultiplicityPredicate_ListOperator(), this.getListOperator(), "listOperator", null, 1, 1, MultiplicityPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(isSetPredicateEClass, IsSetPredicate.class, "IsSetPredicate", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getIsSetPredicate_Attribute(), this.getClassAttribute(), null, "attribute", null, 1, 1, IsSetPredicate.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(dyadicLogicalOperatorEEnum, DyadicLogicalOperator.class, "DyadicLogicalOperator"); + addEEnumLiteral(dyadicLogicalOperatorEEnum, DyadicLogicalOperator.AND); + addEEnumLiteral(dyadicLogicalOperatorEEnum, DyadicLogicalOperator.OR); + + initEEnum(unaryLogicalOperatorEEnum, UnaryLogicalOperator.class, "UnaryLogicalOperator"); + addEEnumLiteral(unaryLogicalOperatorEEnum, UnaryLogicalOperator.NOT); + + initEEnum(comparisonOperatorEEnum, ComparisonOperator.class, "ComparisonOperator"); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.EQUAL); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.NOT_EQUAL); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.GREATER_THEN); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.GREATER_OR_EQUAL_THAN); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.LESS_THAN); + addEEnumLiteral(comparisonOperatorEEnum, ComparisonOperator.LESS_OR_EQUAL_THAN); + + initEEnum(listOperatorEEnum, ListOperator.class, "ListOperator"); + addEEnumLiteral(listOperatorEEnum, ListOperator.ANY); + addEEnumLiteral(listOperatorEEnum, ListOperator.ALL); + addEEnumLiteral(listOperatorEEnum, ListOperator.NONE); + + initEEnum(inOperatorEEnum, InOperator.class, "InOperator"); + addEEnumLiteral(inOperatorEEnum, InOperator.IN); + addEEnumLiteral(inOperatorEEnum, InOperator.NOT_IN); + + initEEnum(metaOperatorEEnum, MetaOperator.class, "MetaOperator"); + addEEnumLiteral(metaOperatorEEnum, MetaOperator.SIZE); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //FilterexprPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/InPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/InPredicateImpl.java new file mode 100755 index 0000000..06bf100 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/InPredicateImpl.java @@ -0,0 +1,613 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.genivi.booleanexpr.BooleanLiteral; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.InOperator; +import org.genivi.booleanexpr.InPredicate; +import org.genivi.booleanexpr.Literal; +import org.genivi.booleanexpr.SignedIntegerLiteral; +import org.genivi.booleanexpr.StringLiteral; +import org.genivi.booleanexpr.util.FilterExprUtil; + + +/** + * + * An implementation of the model object 'In Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.InPredicateImpl#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.impl.InPredicateImpl#getInOperator In Operator}
  • + *
  • {@link org.genivi.booleanexpr.impl.InPredicateImpl#getLiterals Literals}
  • + *
+ *

+ * + * @generated + */ +public class InPredicateImpl extends PredicateImpl implements InPredicate { + private final static Logger LOGGER = Logger.getLogger(ComparisonPredicateImpl.class.getName()); + + /** + * The cached value of the '{@link #getAttribute() Attribute}' containment reference. + * + * + * @see #getAttribute() + * @generated + * @ordered + */ + protected ClassAttribute attribute; + /** + * This is true if the Attribute containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean attributeESet; + /** + * The default value of the '{@link #getInOperator() In Operator}' attribute. + * + * + * @see #getInOperator() + * @generated + * @ordered + */ + protected static final InOperator IN_OPERATOR_EDEFAULT = InOperator.IN; + /** + * The cached value of the '{@link #getInOperator() In Operator}' attribute. + * + * + * @see #getInOperator() + * @generated + * @ordered + */ + protected InOperator inOperator = IN_OPERATOR_EDEFAULT; + /** + * This is true if the In Operator attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean inOperatorESet; + /** + * The cached value of the '{@link #getLiterals() Literals}' containment reference list. + * + * + * @see #getLiterals() + * @generated + * @ordered + */ + protected EList literals; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected InPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.IN_PREDICATE; + } + + /** + * + * + * @generated + */ + public ClassAttribute getAttribute() { + return attribute; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetAttribute(ClassAttribute newAttribute, NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = newAttribute; + boolean oldAttributeESet = attributeESet; + attributeESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.IN_PREDICATE__ATTRIBUTE, oldAttribute, newAttribute, !oldAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setAttribute(ClassAttribute newAttribute) { + if (newAttribute != attribute) { + NotificationChain msgs = null; + if (attribute != null) + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.IN_PREDICATE__ATTRIBUTE, null, msgs); + if (newAttribute != null) + msgs = ((InternalEObject)newAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.IN_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicSetAttribute(newAttribute, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAttributeESet = attributeESet; + attributeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.IN_PREDICATE__ATTRIBUTE, newAttribute, newAttribute, !oldAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetAttribute(NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = null; + boolean oldAttributeESet = attributeESet; + attributeESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.IN_PREDICATE__ATTRIBUTE, oldAttribute, null, oldAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetAttribute() { + if (attribute != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.IN_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicUnsetAttribute(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAttributeESet = attributeESet; + attributeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.IN_PREDICATE__ATTRIBUTE, null, null, oldAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetAttribute() { + return attributeESet; + } + + /** + * + * + * @generated + */ + public InOperator getInOperator() { + return inOperator; + } + + /** + * + * + * @generated + */ + public void setInOperator(InOperator newInOperator) { + InOperator oldInOperator = inOperator; + inOperator = newInOperator == null ? IN_OPERATOR_EDEFAULT : newInOperator; + boolean oldInOperatorESet = inOperatorESet; + inOperatorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.IN_PREDICATE__IN_OPERATOR, oldInOperator, inOperator, !oldInOperatorESet)); + } + + /** + * + * + * @generated + */ + public void unsetInOperator() { + InOperator oldInOperator = inOperator; + boolean oldInOperatorESet = inOperatorESet; + inOperator = IN_OPERATOR_EDEFAULT; + inOperatorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.IN_PREDICATE__IN_OPERATOR, oldInOperator, IN_OPERATOR_EDEFAULT, oldInOperatorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetInOperator() { + return inOperatorESet; + } + + /** + * + * + * @generated + */ + public EList getLiterals() { + if (literals == null) { + literals = new EObjectContainmentEList.Unsettable(Literal.class, this, FilterexprPackage.IN_PREDICATE__LITERALS); + } + return literals; + } + + /** + * + * + * @generated + */ + public void unsetLiterals() { + if (literals != null) ((InternalEList.Unsettable)literals).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetLiterals() { + return literals != null && ((InternalEList.Unsettable)literals).isSet(); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.IN_PREDICATE__ATTRIBUTE: + return basicUnsetAttribute(msgs); + case FilterexprPackage.IN_PREDICATE__LITERALS: + return ((InternalEList)getLiterals()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.IN_PREDICATE__ATTRIBUTE: + return getAttribute(); + case FilterexprPackage.IN_PREDICATE__IN_OPERATOR: + return getInOperator(); + case FilterexprPackage.IN_PREDICATE__LITERALS: + return getLiterals(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.IN_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)newValue); + return; + case FilterexprPackage.IN_PREDICATE__IN_OPERATOR: + setInOperator((InOperator)newValue); + return; + case FilterexprPackage.IN_PREDICATE__LITERALS: + getLiterals().clear(); + getLiterals().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.IN_PREDICATE__ATTRIBUTE: + unsetAttribute(); + return; + case FilterexprPackage.IN_PREDICATE__IN_OPERATOR: + unsetInOperator(); + return; + case FilterexprPackage.IN_PREDICATE__LITERALS: + unsetLiterals(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.IN_PREDICATE__ATTRIBUTE: + return isSetAttribute(); + case FilterexprPackage.IN_PREDICATE__IN_OPERATOR: + return isSetInOperator(); + case FilterexprPackage.IN_PREDICATE__LITERALS: + return isSetLiterals(); + } + return super.eIsSet(featureID); + } + + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + if (attribute != null) { + result.append(attribute.toString()); + } else { + result.append("@"); + } + result.append(' '); + result.append(FilterExprUtil.inOperatorToString(inOperator)); + result.append(" ["); + boolean first = true; + for (Literal literal: literals) { + if (first) { + first = false; + } else { + result.append(", "); + } + result.append(literal.toString()); + } + result.append("]"); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + boolean returnValue = false; + Object attributeObjectValue = null; + if (object instanceof EObject) { + attributeObjectValue = attribute.getValue((EObject) object); + } else { + attributeObjectValue = object; + } + if (attributeObjectValue == null) { + returnValue = evaluateNull(); + } else if (attributeObjectValue instanceof Boolean) { + returnValue = evaluateBoolean(attributeObjectValue); + } else if (attributeObjectValue instanceof Integer) { + returnValue = evaluateInteger(attributeObjectValue); + } else if (attributeObjectValue instanceof Long) { + returnValue = evaluateInteger(attributeObjectValue); + } else if (attributeObjectValue instanceof String) { + returnValue = evaluateString(attributeObjectValue); + } else { + throw new IllegalArgumentException("Unsupported attribute type in InPredicate. Attribute value = " + attributeObjectValue); + } + + LOGGER.info("evaluate <= " + returnValue); + + return returnValue; + } + + + /** + * + * + * @generated NOT + */ + private boolean evaluateNull() { + LOGGER.info("=>"); + + boolean returnValue = false; + + switch (inOperator) { + + case NOT_IN: + returnValue = true; + break; + + default: + break; // No action. + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateBoolean(Object attributeObjectValue) { + LOGGER.info("=>"); + boolean attributeValue = (Boolean) attributeObjectValue; + List literalValues = new ArrayList(); + + for (Literal literal: literals) { + if (!(literal instanceof BooleanLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is Boolean, while literal is not a Boolean. Literal = " + literal); + } + + boolean literalValue = ((BooleanLiteral) literal).isValue(); + literalValues.add(literalValue); + } + + boolean returnValue = false; + + switch (inOperator) { + case IN: + LOGGER.info("Applying IN"); + returnValue = literalValues.contains(attributeValue); + break; + + case NOT_IN: + LOGGER.info("Applying NOT_IN"); + returnValue = !literalValues.contains(attributeValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + + /** + * + * + * @generated NOT + */ + private boolean evaluateInteger(Object attributeObjectValue) { + LOGGER.info("=>"); + Long attributeValue = null; + if (attributeObjectValue != null) { + if (attributeObjectValue instanceof Long) { + attributeValue = (Long) attributeObjectValue; + } else { + attributeValue = new Long(((Integer) attributeObjectValue).intValue()); + } + } + List literalValues = new ArrayList(); + + for (Literal literal: literals) { + if (!(literal instanceof SignedIntegerLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is Integer, while literal is not a Integer. Literal = " + literal); + } + + Long literalValue = ((SignedIntegerLiteral) literal).getValue(); + literalValues.add(literalValue); + } + + boolean returnValue = false; + + switch (inOperator) { + case IN: + LOGGER.info("Applying IN"); + returnValue = literalValues.contains(attributeValue); + break; + + case NOT_IN: + LOGGER.info("Applying NOT_IN"); + returnValue = !literalValues.contains(attributeValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateString(Object attributeObjectValue) { + LOGGER.info("=>"); + String attributeValue = (String) attributeObjectValue; + List literalValues = new ArrayList(); + + for (Literal literal: literals) { + if (!(literal instanceof StringLiteral)) { + throw new IllegalArgumentException("Incompatible types in ComparisonPredicate. Attribute value is String, while literal is not a String. Literal = " + literal); + } + + String literalValue = ((StringLiteral) literal).getValue(); + literalValues.add(literalValue); + } + + boolean returnValue = false; + + switch (inOperator) { + case IN: + LOGGER.info("Applying IN"); + returnValue = literalValues.contains(attributeValue); + break; + + case NOT_IN: + LOGGER.info("Applying NOT_IN"); + returnValue = !literalValues.contains(attributeValue); + break; + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + +} //InPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/IsSetPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/IsSetPredicateImpl.java new file mode 100755 index 0000000..6c25c89 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/IsSetPredicateImpl.java @@ -0,0 +1,245 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.IsSetPredicate; + +/** + * + * An implementation of the model object 'Is Set Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.IsSetPredicateImpl#getAttribute Attribute}
  • + *
+ *

+ * + * @generated + */ +public class IsSetPredicateImpl extends PredicateImpl implements IsSetPredicate { + private final static Logger LOGGER = Logger.getLogger(IsSetPredicateImpl.class.getName()); + + /** + * The cached value of the '{@link #getAttribute() Attribute}' containment reference. + * + * + * @see #getAttribute() + * @generated + * @ordered + */ + protected ClassAttribute attribute; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected IsSetPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.IS_SET_PREDICATE; + } + + /** + * + * + * @generated + */ + public ClassAttribute getAttribute() { + return attribute; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetAttribute(ClassAttribute newAttribute, NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = newAttribute; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE, oldAttribute, newAttribute); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setAttribute(ClassAttribute newAttribute) { + if (newAttribute != attribute) { + NotificationChain msgs = null; + if (attribute != null) + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE, null, msgs); + if (newAttribute != null) + msgs = ((InternalEObject)newAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicSetAttribute(newAttribute, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE, newAttribute, newAttribute)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE: + return basicSetAttribute(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE: + return getAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.IS_SET_PREDICATE__ATTRIBUTE: + return attribute != null; + } + return super.eIsSet(featureID); + } + + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // isSet operator + result.append("isSet "); + + // ClassAttribute + if (attribute != null) { + result.append(attribute.toString()); + } else { + result.append(""); + } + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + result.append(toString()); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + boolean returnValue = false; + if (object instanceof EObject) { + returnValue = attribute.isSet((EObject) object); + } else { + throw new IllegalArgumentException("Unsupported attribute in IsSetPredicate. Attribute = " + object); + } + + LOGGER.info("evaluate <= " + returnValue); + + return returnValue; + } +} //IsSetPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/LiteralImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/LiteralImpl.java new file mode 100755 index 0000000..68b46a9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/LiteralImpl.java @@ -0,0 +1,57 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.Literal; + +/** + * + * An implementation of the model object 'Literal'. + * + *

+ *

+ * + * @generated + */ +public abstract class LiteralImpl extends EObjectImpl implements Literal { + /** + * + * + * @generated + */ + protected LiteralImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.LITERAL; + } + + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + return toString(); + } +} //LiteralImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/MultiplicityPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/MultiplicityPredicateImpl.java new file mode 100755 index 0000000..843f1d7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/MultiplicityPredicateImpl.java @@ -0,0 +1,638 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.ListOperator; +import org.genivi.booleanexpr.MultiplicityPredicate; +import org.genivi.booleanexpr.util.FilterExprUtil; + +/** + * + * An implementation of the model object 'Multiplicity Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.MultiplicityPredicateImpl#getExpression Expression}
  • + *
  • {@link org.genivi.booleanexpr.impl.MultiplicityPredicateImpl#getAttribute Attribute}
  • + *
  • {@link org.genivi.booleanexpr.impl.MultiplicityPredicateImpl#getListOperator List Operator}
  • + *
+ *

+ * + * @generated + */ +public class MultiplicityPredicateImpl extends PredicateImpl implements MultiplicityPredicate { + private final static Logger LOGGER = Logger.getLogger(SubClassPredicateImpl.class.getName()); + private static final String NEW_LINE = System.getProperty("line.separator"); + + /** + * The cached value of the '{@link #getExpression() Expression}' containment reference. + * + * + * @see #getExpression() + * @generated + * @ordered + */ + protected BooleanExpression expression; + + /** + * This is true if the Expression containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean expressionESet; + + /** + * The cached value of the '{@link #getAttribute() Attribute}' containment reference. + * + * + * @see #getAttribute() + * @generated + * @ordered + */ + protected ClassAttribute attribute; + + /** + * This is true if the Attribute containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean attributeESet; + + /** + * The default value of the '{@link #getListOperator() List Operator}' attribute. + * + * + * @see #getListOperator() + * @generated + * @ordered + */ + protected static final ListOperator LIST_OPERATOR_EDEFAULT = ListOperator.ANY; + + /** + * The cached value of the '{@link #getListOperator() List Operator}' attribute. + * + * + * @see #getListOperator() + * @generated + * @ordered + */ + protected ListOperator listOperator = LIST_OPERATOR_EDEFAULT; + + /** + * This is true if the List Operator attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean listOperatorESet; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + /** + * + * + * @generated + */ + protected MultiplicityPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.MULTIPLICITY_PREDICATE; + } + + /** + * + * + * @generated + */ + public BooleanExpression getExpression() { + return expression; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetExpression(BooleanExpression newExpression, NotificationChain msgs) { + BooleanExpression oldExpression = expression; + expression = newExpression; + boolean oldExpressionESet = expressionESet; + expressionESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, oldExpression, newExpression, !oldExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setExpression(BooleanExpression newExpression) { + if (newExpression != expression) { + NotificationChain msgs = null; + if (expression != null) + msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, null, msgs); + if (newExpression != null) + msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, null, msgs); + msgs = basicSetExpression(newExpression, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldExpressionESet = expressionESet; + expressionESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, newExpression, newExpression, !oldExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetExpression(NotificationChain msgs) { + BooleanExpression oldExpression = expression; + expression = null; + boolean oldExpressionESet = expressionESet; + expressionESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, oldExpression, null, oldExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetExpression() { + if (expression != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, null, msgs); + msgs = basicUnsetExpression(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldExpressionESet = expressionESet; + expressionESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION, null, null, oldExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetExpression() { + return expressionESet; + } + + /** + * + * + * @generated + */ + public ListOperator getListOperator() { + return listOperator; + } + + /** + * + * + * @generated + */ + public void setListOperator(ListOperator newListOperator) { + ListOperator oldListOperator = listOperator; + listOperator = newListOperator == null ? LIST_OPERATOR_EDEFAULT : newListOperator; + boolean oldListOperatorESet = listOperatorESet; + listOperatorESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR, oldListOperator, listOperator, !oldListOperatorESet)); + } + + /** + * + * + * @generated + */ + public void unsetListOperator() { + ListOperator oldListOperator = listOperator; + boolean oldListOperatorESet = listOperatorESet; + listOperator = LIST_OPERATOR_EDEFAULT; + listOperatorESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR, oldListOperator, LIST_OPERATOR_EDEFAULT, oldListOperatorESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetListOperator() { + return listOperatorESet; + } + + /** + * + * + * @generated + */ + public ClassAttribute getAttribute() { + return attribute; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetAttribute(ClassAttribute newAttribute, NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = newAttribute; + boolean oldAttributeESet = attributeESet; + attributeESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, oldAttribute, newAttribute, !oldAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setAttribute(ClassAttribute newAttribute) { + if (newAttribute != attribute) { + NotificationChain msgs = null; + if (attribute != null) + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, null, msgs); + if (newAttribute != null) + msgs = ((InternalEObject)newAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicSetAttribute(newAttribute, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAttributeESet = attributeESet; + attributeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, newAttribute, newAttribute, !oldAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetAttribute(NotificationChain msgs) { + ClassAttribute oldAttribute = attribute; + attribute = null; + boolean oldAttributeESet = attributeESet; + attributeESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, oldAttribute, null, oldAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetAttribute() { + if (attribute != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)attribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, null, msgs); + msgs = basicUnsetAttribute(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAttributeESet = attributeESet; + attributeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE, null, null, oldAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetAttribute() { + return attributeESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION: + return basicUnsetExpression(msgs); + case FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE: + return basicUnsetAttribute(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION: + return getExpression(); + case FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE: + return getAttribute(); + case FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR: + return getListOperator(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION: + setExpression((BooleanExpression)newValue); + return; + case FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE: + setAttribute((ClassAttribute)newValue); + return; + case FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR: + setListOperator((ListOperator)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION: + unsetExpression(); + return; + case FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE: + unsetAttribute(); + return; + case FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR: + unsetListOperator(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.MULTIPLICITY_PREDICATE__EXPRESSION: + return isSetExpression(); + case FilterexprPackage.MULTIPLICITY_PREDICATE__ATTRIBUTE: + return isSetAttribute(); + case FilterexprPackage.MULTIPLICITY_PREDICATE__LIST_OPERATOR: + return isSetListOperator(); + } + return super.eIsSet(featureID); + } + + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // ListOperator + if (listOperatorESet) + result.append(FilterExprUtil.listOperatorToString(listOperator)); + else + result.append(""); + + // ClassAttribute + result.append(' '); + if (attribute != null) { + result.append(attribute.toString()); + } else { + result.append(""); + } + + // Expression + result.append(" ("); + result.append(expression.toString()); + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + // ListOperator + if (listOperatorESet) + result.append(FilterExprUtil.listOperatorToString(listOperator)); + else + result.append(""); + + // ClassAttribute + result.append(' '); + if (attribute != null) { + result.append(attribute.toString()); + } else { + result.append(""); + } + + // Expression + result.append(" ("); + result.append(NEW_LINE); + + indent += indentSize; + + result.append(expression.format(indent, indentSize)); + result.append(NEW_LINE); + + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + + result.append(indent); + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + boolean returnValue = false; + + Object attributeObject = attribute.getListValue((EObject) object); + + // subClassObject can be + // a simple object, e.g. Integer + // a list of simple objects + // a subClass + // a list of subClasses. + + if (attributeObject instanceof EList) { + LOGGER.fine("EList, so many"); + @SuppressWarnings("unchecked") + EList eObjects = (EList) attributeObject; + + switch (listOperator) { + case ALL: + returnValue = evaluateForAllListOperator(eObjects); + break; + + case ANY: + returnValue = evaluateForAnyListOperator(eObjects); + break; + + case NONE: + returnValue = !evaluateForAnyListOperator(eObjects); + break; + + default: + throw new IllegalArgumentException("Operator not supported: " + listOperator); + } + } else { + LOGGER.severe("No EList, so single subclass object"); + throw new IllegalArgumentException("Attribute \'" + attribute.getAttributeName() + "\' is not a list."); + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateForAllListOperator(EList eObjects) { + LOGGER.info("=>"); + + boolean returnValue = true; + + for (EObject eObject: eObjects) { + boolean result = expression.evaluate(eObject); + if (result == false) { + returnValue = false; + break; + } + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + /** + * + * + * @generated NOT + */ + private boolean evaluateForAnyListOperator(EList eObjects) { + LOGGER.info("=>"); + + boolean returnValue = false; + + for (Object eObject: eObjects) { + LOGGER.info("Handling eObject in for loop"); + boolean result = expression.evaluate(eObject); + if (result == true) { + returnValue = true; + break; + } + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } +} //MultiplicityPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/PredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/PredicateImpl.java new file mode 100755 index 0000000..c8ed172 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/PredicateImpl.java @@ -0,0 +1,60 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.ecore.EClass; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.Predicate; + +/** + * + * An implementation of the model object 'Predicate'. + * + *

+ *

+ * + * @generated + */ +public abstract class PredicateImpl extends BooleanExpressionImpl implements Predicate { + + /** + * + * + * @generated + */ + protected PredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.PREDICATE; + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + result.append(toString()); + + return result.toString(); + } + +} //PredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SignedIntegerLiteralImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SignedIntegerLiteralImpl.java new file mode 100755 index 0000000..7b6577b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SignedIntegerLiteralImpl.java @@ -0,0 +1,204 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.SignedIntegerLiteral; + +/** + * + * An implementation of the model object 'Signed Integer Literal'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.SignedIntegerLiteralImpl#getValue Value}
  • + *
+ *

+ * + * @generated + */ +public class SignedIntegerLiteralImpl extends LiteralImpl implements SignedIntegerLiteral { + /** + * The default value of the '{@link #getValue() Value}' attribute. + * + * + * @see #getValue() + * @generated + * @ordered + */ + protected static final long VALUE_EDEFAULT = 0L; + + /** + * The cached value of the '{@link #getValue() Value}' attribute. + * + * + * @see #getValue() + * @generated + * @ordered + */ + protected long value = VALUE_EDEFAULT; + + /** + * This is true if the Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean valueESet; + + /** + * + * + * @generated + */ + protected SignedIntegerLiteralImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.SIGNED_INTEGER_LITERAL; + } + + /** + * + * + * @generated + */ + public long getValue() { + return value; + } + + /** + * + * + * @generated + */ + public void setValue(long newValue) { + long oldValue = value; + value = newValue; + boolean oldValueESet = valueESet; + valueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE, oldValue, value, !oldValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetValue() { + long oldValue = value; + boolean oldValueESet = valueESet; + value = VALUE_EDEFAULT; + valueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE, oldValue, VALUE_EDEFAULT, oldValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetValue() { + return valueESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE: + setValue((Long)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE: + unsetValue(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.SIGNED_INTEGER_LITERAL__VALUE: + return isSetValue(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + if (valueESet) + result.append(value); + else + result.append(""); + + return result.toString(); + } + +} //SignedIntegerLiteralImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/StringLiteralImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/StringLiteralImpl.java new file mode 100755 index 0000000..7d7c626 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/StringLiteralImpl.java @@ -0,0 +1,207 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.StringLiteral; + +/** + * + * An implementation of the model object 'String Literal'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.StringLiteralImpl#getValue Value}
  • + *
+ *

+ * + * @generated + */ +public class StringLiteralImpl extends LiteralImpl implements StringLiteral { + /** + * The default value of the '{@link #getValue() Value}' attribute. + * + * + * @see #getValue() + * @generated + * @ordered + */ + protected static final String VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getValue() Value}' attribute. + * + * + * @see #getValue() + * @generated + * @ordered + */ + protected String value = VALUE_EDEFAULT; + + /** + * This is true if the Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean valueESet; + + /** + * + * + * @generated + */ + protected StringLiteralImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.STRING_LITERAL; + } + + /** + * + * + * @generated + */ + public String getValue() { + return value; + } + + /** + * + * + * @generated + */ + public void setValue(String newValue) { + String oldValue = value; + value = newValue; + boolean oldValueESet = valueESet; + valueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.STRING_LITERAL__VALUE, oldValue, value, !oldValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetValue() { + String oldValue = value; + boolean oldValueESet = valueESet; + value = VALUE_EDEFAULT; + valueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.STRING_LITERAL__VALUE, oldValue, VALUE_EDEFAULT, oldValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetValue() { + return valueESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.STRING_LITERAL__VALUE: + return getValue(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.STRING_LITERAL__VALUE: + setValue((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.STRING_LITERAL__VALUE: + unsetValue(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.STRING_LITERAL__VALUE: + return isSetValue(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + if (valueESet) { + result.append("\""); + result.append(value); + result.append("\""); + } else { + result.append(""); + } + + return result.toString(); + } + +} //StringLiteralImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SubClassPredicateImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SubClassPredicateImpl.java new file mode 100755 index 0000000..359ce51 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/SubClassPredicateImpl.java @@ -0,0 +1,462 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.SubClassPredicate; + +/** + * + * An implementation of the model object 'Sub Class Predicate'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.SubClassPredicateImpl#getSubClassExpression Sub Class Expression}
  • + *
  • {@link org.genivi.booleanexpr.impl.SubClassPredicateImpl#getSubClassAttribute Sub Class Attribute}
  • + *
+ *

+ * + * @generated + */ +public class SubClassPredicateImpl extends PredicateImpl implements SubClassPredicate { + private final static Logger LOGGER = Logger.getLogger(SubClassPredicateImpl.class.getName()); + private static final String NEW_LINE = System.getProperty("line.separator"); + + /** + * The cached value of the '{@link #getSubClassExpression() Sub Class Expression}' containment reference. + * + * + * @see #getSubClassExpression() + * @generated + * @ordered + */ + protected BooleanExpression subClassExpression; + + /** + * This is true if the Sub Class Expression containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean subClassExpressionESet; + + /** + * The cached value of the '{@link #getSubClassAttribute() Sub Class Attribute}' containment reference. + * + * + * @see #getSubClassAttribute() + * @generated + * @ordered + */ + protected ClassAttribute subClassAttribute; + + /** + * This is true if the Sub Class Attribute containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean subClassAttributeESet; + + /** + * + * + * @generated + */ + protected SubClassPredicateImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.SUB_CLASS_PREDICATE; + } + + /** + * + * + * @generated + */ + public BooleanExpression getSubClassExpression() { + return subClassExpression; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetSubClassExpression(BooleanExpression newSubClassExpression, NotificationChain msgs) { + BooleanExpression oldSubClassExpression = subClassExpression; + subClassExpression = newSubClassExpression; + boolean oldSubClassExpressionESet = subClassExpressionESet; + subClassExpressionESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, oldSubClassExpression, newSubClassExpression, !oldSubClassExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setSubClassExpression(BooleanExpression newSubClassExpression) { + if (newSubClassExpression != subClassExpression) { + NotificationChain msgs = null; + if (subClassExpression != null) + msgs = ((InternalEObject)subClassExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, null, msgs); + if (newSubClassExpression != null) + msgs = ((InternalEObject)newSubClassExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, null, msgs); + msgs = basicSetSubClassExpression(newSubClassExpression, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSubClassExpressionESet = subClassExpressionESet; + subClassExpressionESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, newSubClassExpression, newSubClassExpression, !oldSubClassExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetSubClassExpression(NotificationChain msgs) { + BooleanExpression oldSubClassExpression = subClassExpression; + subClassExpression = null; + boolean oldSubClassExpressionESet = subClassExpressionESet; + subClassExpressionESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, oldSubClassExpression, null, oldSubClassExpressionESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetSubClassExpression() { + if (subClassExpression != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)subClassExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, null, msgs); + msgs = basicUnsetSubClassExpression(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSubClassExpressionESet = subClassExpressionESet; + subClassExpressionESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION, null, null, oldSubClassExpressionESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetSubClassExpression() { + return subClassExpressionESet; + } + + /** + * + * + * @generated + */ + public ClassAttribute getSubClassAttribute() { + return subClassAttribute; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetSubClassAttribute(ClassAttribute newSubClassAttribute, NotificationChain msgs) { + ClassAttribute oldSubClassAttribute = subClassAttribute; + subClassAttribute = newSubClassAttribute; + boolean oldSubClassAttributeESet = subClassAttributeESet; + subClassAttributeESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, oldSubClassAttribute, newSubClassAttribute, !oldSubClassAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setSubClassAttribute(ClassAttribute newSubClassAttribute) { + if (newSubClassAttribute != subClassAttribute) { + NotificationChain msgs = null; + if (subClassAttribute != null) + msgs = ((InternalEObject)subClassAttribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, null, msgs); + if (newSubClassAttribute != null) + msgs = ((InternalEObject)newSubClassAttribute).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, null, msgs); + msgs = basicSetSubClassAttribute(newSubClassAttribute, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSubClassAttributeESet = subClassAttributeESet; + subClassAttributeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, newSubClassAttribute, newSubClassAttribute, !oldSubClassAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetSubClassAttribute(NotificationChain msgs) { + ClassAttribute oldSubClassAttribute = subClassAttribute; + subClassAttribute = null; + boolean oldSubClassAttributeESet = subClassAttributeESet; + subClassAttributeESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, oldSubClassAttribute, null, oldSubClassAttributeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetSubClassAttribute() { + if (subClassAttribute != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)subClassAttribute).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, null, msgs); + msgs = basicUnsetSubClassAttribute(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSubClassAttributeESet = subClassAttributeESet; + subClassAttributeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE, null, null, oldSubClassAttributeESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetSubClassAttribute() { + return subClassAttributeESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION: + return basicUnsetSubClassExpression(msgs); + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE: + return basicUnsetSubClassAttribute(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION: + return getSubClassExpression(); + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE: + return getSubClassAttribute(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION: + setSubClassExpression((BooleanExpression)newValue); + return; + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE: + setSubClassAttribute((ClassAttribute)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION: + unsetSubClassExpression(); + return; + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE: + unsetSubClassAttribute(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_EXPRESSION: + return isSetSubClassExpression(); + case FilterexprPackage.SUB_CLASS_PREDICATE__SUB_CLASS_ATTRIBUTE: + return isSetSubClassAttribute(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + + // ClassAttribute + if (subClassAttribute != null) { + result.append(subClassAttribute.toString()); + } else { + result.append("@"); + } + + // Expression + result.append(" ("); + result.append(subClassExpression.toString()); + result.append(')'); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + + result.append(indent); + + // ClassAttribute + if (subClassAttribute != null) { + result.append(subClassAttribute.toString()); + } else { + result.append("@"); + } + + // Expression + result.append(" ("); + result.append(NEW_LINE); + + indent += indentSize; + + result.append(subClassExpression.format(indent, indentSize)); + result.append(NEW_LINE); + + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + + result.append(indent); + result.append(')'); + result.append(NEW_LINE); + + return result.toString(); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + String subClassAttributeName = ""; + if (subClassAttribute != null) { + subClassAttributeName =subClassAttribute.getAttributeName(); + } + LOGGER.info("=> attributeName = " + subClassAttributeName); + + boolean returnValue = false; + + Object subClassObject; + if (subClassAttribute != null) { + subClassObject = subClassAttribute.getValue((EObject) object); + } else { + subClassObject = object; // TODO throw exception + } + + returnValue = subClassExpression.evaluate(subClassObject); + + LOGGER.info("<= " + returnValue); + + return returnValue; + } +} //SubClassPredicateImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/UnaryExpressionImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/UnaryExpressionImpl.java new file mode 100755 index 0000000..ef2fd3f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/impl/UnaryExpressionImpl.java @@ -0,0 +1,306 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.impl; + +import java.util.logging.Logger; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.FilterexprPackage; +import org.genivi.booleanexpr.UnaryExpression; +import org.genivi.booleanexpr.UnaryLogicalOperator; +import org.genivi.booleanexpr.util.FilterExprUtil; + +/** + * + * An implementation of the model object 'unary Expression'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.booleanexpr.impl.UnaryExpressionImpl#getUnaryOperator Unary Operator}
  • + *
  • {@link org.genivi.booleanexpr.impl.UnaryExpressionImpl#getExpression Expression}
  • + *
+ *

+ * + * @generated + */ +public class UnaryExpressionImpl extends BooleanExpressionImpl implements UnaryExpression { + private final static Logger LOGGER = Logger.getLogger(UnaryExpressionImpl.class.getName()); + private static final String NEW_LINE = System.getProperty("line.separator"); + + /** + * The default value of the '{@link #getUnaryOperator() Unary Operator}' attribute. + * + * + * @see #getUnaryOperator() + * @generated + * @ordered + */ + protected static final UnaryLogicalOperator UNARY_OPERATOR_EDEFAULT = UnaryLogicalOperator.NOT; + + /** + * The cached value of the '{@link #getUnaryOperator() Unary Operator}' attribute. + * + * + * @see #getUnaryOperator() + * @generated + * @ordered + */ + protected UnaryLogicalOperator unaryOperator = UNARY_OPERATOR_EDEFAULT; + + /** + * The cached value of the '{@link #getExpression() Expression}' containment reference. + * + * + * @see #getExpression() + * @generated + * @ordered + */ + protected BooleanExpression expression; + + /** + * + * + * @generated + */ + protected UnaryExpressionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FilterexprPackage.Literals.UNARY_EXPRESSION; + } + + /** + * + * + * @generated + */ + public UnaryLogicalOperator getUnaryOperator() { + return unaryOperator; + } + + /** + * + * + * @generated + */ + public void setUnaryOperator(UnaryLogicalOperator newUnaryOperator) { + UnaryLogicalOperator oldUnaryOperator = unaryOperator; + unaryOperator = newUnaryOperator == null ? UNARY_OPERATOR_EDEFAULT : newUnaryOperator; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.UNARY_EXPRESSION__UNARY_OPERATOR, oldUnaryOperator, unaryOperator)); + } + + /** + * + * + * @generated + */ + public BooleanExpression getExpression() { + return expression; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetExpression(BooleanExpression newExpression, NotificationChain msgs) { + BooleanExpression oldExpression = expression; + expression = newExpression; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FilterexprPackage.UNARY_EXPRESSION__EXPRESSION, oldExpression, newExpression); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setExpression(BooleanExpression newExpression) { + if (newExpression != expression) { + NotificationChain msgs = null; + if (expression != null) + msgs = ((InternalEObject)expression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.UNARY_EXPRESSION__EXPRESSION, null, msgs); + if (newExpression != null) + msgs = ((InternalEObject)newExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FilterexprPackage.UNARY_EXPRESSION__EXPRESSION, null, msgs); + msgs = basicSetExpression(newExpression, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FilterexprPackage.UNARY_EXPRESSION__EXPRESSION, newExpression, newExpression)); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FilterexprPackage.UNARY_EXPRESSION__EXPRESSION: + return basicSetExpression(null, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FilterexprPackage.UNARY_EXPRESSION__UNARY_OPERATOR: + return getUnaryOperator(); + case FilterexprPackage.UNARY_EXPRESSION__EXPRESSION: + return getExpression(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FilterexprPackage.UNARY_EXPRESSION__UNARY_OPERATOR: + setUnaryOperator((UnaryLogicalOperator)newValue); + return; + case FilterexprPackage.UNARY_EXPRESSION__EXPRESSION: + setExpression((BooleanExpression)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FilterexprPackage.UNARY_EXPRESSION__UNARY_OPERATOR: + setUnaryOperator(UNARY_OPERATOR_EDEFAULT); + return; + case FilterexprPackage.UNARY_EXPRESSION__EXPRESSION: + setExpression((BooleanExpression)null); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FilterexprPackage.UNARY_EXPRESSION__UNARY_OPERATOR: + return unaryOperator != UNARY_OPERATOR_EDEFAULT; + case FilterexprPackage.UNARY_EXPRESSION__EXPRESSION: + return expression != null; + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated NOT + */ + public boolean evaluate(Object object) { + LOGGER.info("evaluate => " + toString()); + + LOGGER.info("Going to evaluate expression."); + boolean result = expression.evaluate(object); + + switch (unaryOperator) { + case NOT: + LOGGER.fine("applying unary operator NOT."); + result = !result; + break; + } + + LOGGER.info("evaluate <= " + result); + return result; + } + + + /** + * + * + * @generated NOT + */ + @Override + public String toString() { + StringBuffer result = new StringBuffer(); + result.append(FilterExprUtil.unaryLogicalOperatorToString(unaryOperator)); + result.append(" ("); + + result.append(expression.toString()); + result.append(")"); + + return result.toString(); + } + + + /** + * + * + * @generated NOT + */ + public String format(String indent, String indentSize) { + StringBuffer result = new StringBuffer(); + result.append(indent); + result.append(FilterExprUtil.unaryLogicalOperatorToString(unaryOperator)); + result.append(" ("); + result.append(NEW_LINE); + + indent += indentSize; + + result.append(expression.format(indent, indentSize)); + indent = indent.substring(0, indent.lastIndexOf(indentSize)); + result.append(NEW_LINE); + + result.append(indent); + result.append(")"); + result.append(NEW_LINE); + + return result.toString(); + } +} //unaryExpressionImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterExprUtil.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterExprUtil.java new file mode 100755 index 0000000..0702f72 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterExprUtil.java @@ -0,0 +1,714 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.util; + +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.BooleanLiteral; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.ComparisonOperator; +import org.genivi.booleanexpr.ComparisonPredicate; +import org.genivi.booleanexpr.DownCastPredicate; +import org.genivi.booleanexpr.DyadicExpression; +import org.genivi.booleanexpr.DyadicLogicalOperator; +import org.genivi.booleanexpr.FilterexprFactory; +import org.genivi.booleanexpr.InOperator; +import org.genivi.booleanexpr.InPredicate; +import org.genivi.booleanexpr.IsSetPredicate; +import org.genivi.booleanexpr.ListOperator; +import org.genivi.booleanexpr.Literal; +import org.genivi.booleanexpr.MetaOperator; +import org.genivi.booleanexpr.MultiplicityPredicate; +import org.genivi.booleanexpr.SignedIntegerLiteral; +import org.genivi.booleanexpr.StringLiteral; +import org.genivi.booleanexpr.SubClassPredicate; +import org.genivi.booleanexpr.UnaryExpression; +import org.genivi.booleanexpr.UnaryLogicalOperator; + + +public class FilterExprUtil { + private final static Logger LOGGER = Logger.getLogger(FilterExprUtil.class.getName()); + private final static FilterexprFactory FILTER_EXPR_FACTORY = FilterexprFactory.eINSTANCE; + private static Map comparisonOperatorToString = new HashMap<>(); + private static Map stringToComparisonOperator = new HashMap<>(); + private static Map listOperatorToString = new HashMap<>(); + private static Map stringToListOperator = new HashMap<>(); + private static Map unaryLogicalOperatorToString = new HashMap<>(); + private static Map stringToUnaryLogicalOperator = new HashMap<>(); + private static Map dyadicLogicalOperatorToString = new HashMap<>(); + private static Map stringToDyadicLogicalOperator = new HashMap<>(); + private static Map metaOperatorToString = new HashMap<>(); + private static Map stringToMetaOperator = new HashMap<>(); + private static Map inOperatorToString = new HashMap<>(); + private static Map stringToInOperator = new HashMap<>(); + + static { + LOGGER.setLevel(Level.SEVERE); + + comparisonOperatorToString.put(ComparisonOperator.EQUAL, "=="); + comparisonOperatorToString.put(ComparisonOperator.NOT_EQUAL, "!="); + comparisonOperatorToString.put(ComparisonOperator.GREATER_THEN, ">"); + comparisonOperatorToString.put(ComparisonOperator.GREATER_OR_EQUAL_THAN, ">="); + comparisonOperatorToString.put(ComparisonOperator.LESS_THAN, "<"); + comparisonOperatorToString.put(ComparisonOperator.LESS_OR_EQUAL_THAN, "<="); + + stringToComparisonOperator.put("==", ComparisonOperator.EQUAL); + stringToComparisonOperator.put("!=", ComparisonOperator.NOT_EQUAL); + stringToComparisonOperator.put(">", ComparisonOperator.GREATER_THEN); + stringToComparisonOperator.put(">=", ComparisonOperator.GREATER_OR_EQUAL_THAN); + stringToComparisonOperator.put("<", ComparisonOperator.LESS_THAN); + stringToComparisonOperator.put("<=", ComparisonOperator.LESS_OR_EQUAL_THAN); + + listOperatorToString.put(ListOperator.ANY, "any"); + listOperatorToString.put(ListOperator.ALL, "all"); + listOperatorToString.put(ListOperator.NONE, "none"); + + stringToListOperator.put("any", ListOperator.ANY); + stringToListOperator.put("all", ListOperator.ALL); + stringToListOperator.put("none", ListOperator.NONE); + + unaryLogicalOperatorToString.put(UnaryLogicalOperator.NOT, "not"); + + stringToUnaryLogicalOperator.put("not", UnaryLogicalOperator.NOT); + + dyadicLogicalOperatorToString.put(DyadicLogicalOperator.AND, "and"); + dyadicLogicalOperatorToString.put(DyadicLogicalOperator.OR, "or"); + + stringToDyadicLogicalOperator.put("and", DyadicLogicalOperator.AND); + stringToDyadicLogicalOperator.put("or", DyadicLogicalOperator.OR); + + metaOperatorToString.put(MetaOperator.SIZE, "size"); + stringToMetaOperator.put("size", MetaOperator.SIZE); + + inOperatorToString.put(InOperator.IN, "in"); + inOperatorToString.put(InOperator.NOT_IN, "not-in"); + + stringToInOperator.put("in", InOperator.IN); + stringToInOperator.put("not-in", InOperator.NOT_IN); + } + + public static BooleanExpression parseFilterExpression(String expressionString) { + LOGGER.info("=> " + expressionString); + BooleanExpression booleanExpression = null; + + expressionString = expressionString.trim(); + if (!expressionString.isEmpty()) { + + if (booleanExpression == null) { + try { + booleanExpression = parseComparisonPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not ComparisonPredicate, continue ... (" + e.getMessage() + ")"); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseDownCastPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not DownCastPredicate, continue ... (" + e.getMessage() + ")"); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseDyadicExpression(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not DyadicExpression, continue ..."); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseIsSetPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not IsSetPredicate, continue ..."); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseMultiplicityPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not MultiplicityPredicate, continue ..."); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseSubClassPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not SubClassPredicate, continue ..."); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseUnaryExpression(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not UnaryExpression, continue ..."); + } + } + + if (booleanExpression == null) { + try { + booleanExpression = parseInPredicate(expressionString); + } catch (IllegalArgumentException e) { + LOGGER.info("expression is not InPredicate, continue ..."); + } + } + + if (booleanExpression == null) { + throw new IllegalArgumentException("Wrong expression format: " + expressionString); + } + } + + LOGGER.info("<= " + booleanExpression); + return booleanExpression; + + } + + public static BooleanExpression parseUnaryExpression(String expressionString) { + LOGGER.info("=> " + expressionString); + UnaryExpression unaryExpression = FILTER_EXPR_FACTORY.createUnaryExpression(); + + expressionString = expressionString.trim(); + + // UnaryLogicalOperator + int spaceAfterOperatorIndex = expressionString.indexOf(" "); + if (spaceAfterOperatorIndex == -1) { + throw new IllegalArgumentException("Cannot find operator: " + expressionString); + } + String operatorString = expressionString.substring(0, spaceAfterOperatorIndex); + UnaryLogicalOperator operator = parseUnaryLogicalOperator(operatorString); + unaryExpression.setUnaryOperator(operator); + + // Followed by expression between braces + expressionString = expressionString.substring(spaceAfterOperatorIndex); + expressionString = expressionString.trim(); + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("Term not starting with '(': " + expressionString); + } + int matchingClosingParenthesisIndex = findMatchingClosingParenthesis(expressionString); + if (matchingClosingParenthesisIndex == -1) { + throw new IllegalArgumentException("No matching parenthesis in term: " + expressionString); + } + String termString = expressionString.substring(1, matchingClosingParenthesisIndex); + BooleanExpression filterExpression = parseFilterExpression(termString); + unaryExpression.setExpression(filterExpression); + + return unaryExpression; + } + + public static DyadicExpression parseDyadicExpression(String expressionString) { + LOGGER.info("=> " + expressionString); + DyadicExpression dyadicExpression = FILTER_EXPR_FACTORY.createDyadicExpression(); + + expressionString = expressionString.trim(); + + // Left hand Expression + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("Left hand term not starting with '(': " + expressionString); + } + int matchingClosingParenthesisIndex = findMatchingClosingParenthesis(expressionString); + if (matchingClosingParenthesisIndex == -1) { + throw new IllegalArgumentException("No matching parenthesis in left hand term: " + expressionString); + } + String termString = expressionString.substring(1, matchingClosingParenthesisIndex); + BooleanExpression filterExpression = parseFilterExpression(termString); + dyadicExpression.setLeftHandTerm(filterExpression); + + expressionString = expressionString.substring(matchingClosingParenthesisIndex + 1); + + // DyadicLogicalOperator + expressionString = expressionString.trim(); + int spaceAfterOperatorIndex = expressionString.indexOf(" "); + if (spaceAfterOperatorIndex == -1) { + throw new IllegalArgumentException("Cannot find operator: " + expressionString); + } + String operatorString = expressionString.substring(0, spaceAfterOperatorIndex); + DyadicLogicalOperator operator = parseDyadicLogicalOperator(operatorString); + dyadicExpression.setLogicalOperator(operator); + + expressionString = expressionString.substring(spaceAfterOperatorIndex); + expressionString = expressionString.trim(); + + // Right hand Expression + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("Right hand term not starting with '(': " + expressionString); + } + matchingClosingParenthesisIndex = findMatchingClosingParenthesis(expressionString); + if (matchingClosingParenthesisIndex == -1) { + throw new IllegalArgumentException("No matching parenthesis in right hand term: " + expressionString); + } + termString = expressionString.substring(1, matchingClosingParenthesisIndex); + filterExpression = parseFilterExpression(termString); + dyadicExpression.setRightHandTerm(filterExpression); + + return dyadicExpression; + } + + private static int findMatchingClosingParenthesis(String expressionString) { + int bracesToMatch = 0; + int matchIndex = -1; + + for (int i = 0; i < expressionString.length(); i++) { + char c = expressionString.charAt(i); + if (c == '(') { + bracesToMatch++; + } else if (c == ')') { + bracesToMatch--; + if (bracesToMatch == 0) { + matchIndex = i; + break; + } + } + } + + return matchIndex; + } + + public static ComparisonPredicate parseComparisonPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + ComparisonPredicate comparisonPredicate = FILTER_EXPR_FACTORY.createComparisonPredicate(); + + expressionString = expressionString.trim(); + + StringTokenizer tokens = new StringTokenizer(expressionString, " "); + if (tokens.countTokens() != 3) { + throw new IllegalArgumentException("wrong number of tokens in comparison predicate: " + expressionString); + } + + // Attribute + ClassAttribute attribute = parseClassAttribute(tokens.nextToken()); + comparisonPredicate.setAttribute(attribute); + + // ComparisonOperator + ComparisonOperator comparisonOperator = parseComparisonOperator(tokens.nextToken()); + comparisonPredicate.setComparisonOperator(comparisonOperator); + + // Literal + Literal literal = parseLiteral(tokens.nextToken()); + comparisonPredicate.setLiteral(literal); + + LOGGER.info("<= " + comparisonPredicate); + return comparisonPredicate; + } + + public static DownCastPredicate parseDownCastPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + DownCastPredicate downCastPredicate = FILTER_EXPR_FACTORY.createDownCastPredicate(); + + expressionString = expressionString.trim(); + + // 'DownCast to' class between '[' and ']' + if (!expressionString.startsWith("[")) { + throw new IllegalArgumentException("DownCastPredicate not starting with '[': " + expressionString); + } + + int closingBracketIndex = expressionString.indexOf("]"); + if (closingBracketIndex == -1) { + throw new IllegalArgumentException("DownCastPredicate is missing ']': " + expressionString); + } + + String className = expressionString.substring(1, closingBracketIndex); + downCastPredicate.setClassName(className); + + expressionString = expressionString.substring(closingBracketIndex + 1); + expressionString = expressionString.trim(); + + // Expression + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("DownCastPredicate is missing '(': " + expressionString); + } + + if (!expressionString.endsWith(")")) { + throw new IllegalArgumentException("DownCastPredicate is missing ')': " + expressionString); + } + + expressionString = expressionString.substring(1, expressionString.length() - 1); + BooleanExpression filterExpression = parseFilterExpression(expressionString); + downCastPredicate.setExpression(filterExpression); + + LOGGER.info("<= " + downCastPredicate); + return downCastPredicate; + } + + + public static IsSetPredicate parseIsSetPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + IsSetPredicate isSetPredicate = FILTER_EXPR_FACTORY.createIsSetPredicate(); + + expressionString = expressionString.trim(); + + // isSet operator + if (!expressionString.startsWith("isSet")) { + LOGGER.info("Not starting with isSet"); + throw new IllegalArgumentException("IsSetPredicate not starting with 'isSet': " + expressionString); + } + LOGGER.info("Starting with isSet: " + expressionString); + expressionString = expressionString.substring(5); + expressionString = expressionString.trim(); + + // Expression +// if (!expressionString.startsWith("(")) { +// LOGGER.info("Not opening brace"); +// throw new IllegalArgumentException("IsSetPredicate is missing '(': " + expressionString); +// } +// if (!expressionString.endsWith(")")) { +// LOGGER.info("Not closing brace"); +// throw new IllegalArgumentException("IsSetPredicate is missing ')': " + expressionString); +// } + +// String className = expressionString.substring(1, expressionString.length() - 1); +// ClassAttribute classAttribute = parseClassAttribute(className); + + // ClassAttribute + ClassAttribute classAttribute = parseClassAttribute(expressionString); + isSetPredicate.setAttribute(classAttribute); + + LOGGER.info("<= " + isSetPredicate); + return isSetPredicate; + } + + public static MultiplicityPredicate parseMultiplicityPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + MultiplicityPredicate multiplicityPredicate = FILTER_EXPR_FACTORY.createMultiplicityPredicate(); + + expressionString = expressionString.trim(); + + // ListOperator + int spaceAfterOperator = expressionString.indexOf(" "); + if (spaceAfterOperator == -1) { + throw new IllegalArgumentException("No operator found: " + expressionString); + } + String operatorString = expressionString.substring(0, spaceAfterOperator); + ListOperator listOperator = parseListOperator(operatorString); + multiplicityPredicate.setListOperator(listOperator); + + + expressionString = expressionString.substring(spaceAfterOperator); + expressionString = expressionString.trim(); + + // ClassAttribute + int spaceAfterAttribute = expressionString.indexOf(" "); + String attributeString = expressionString.substring(0, spaceAfterAttribute); + ClassAttribute classAttribute = parseClassAttribute(attributeString); + multiplicityPredicate.setAttribute(classAttribute); + + expressionString = expressionString.substring(spaceAfterAttribute); + expressionString = expressionString.trim(); + + // Expression + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("'(' expected: " + expressionString); + } + if (!expressionString.endsWith(")")) { + throw new IllegalArgumentException("')' expected: " + expressionString); + } + + expressionString = expressionString.substring(1, expressionString.length() - 1); + BooleanExpression filterExpression = parseFilterExpression(expressionString); + multiplicityPredicate.setExpression(filterExpression); + + LOGGER.info("<= " + multiplicityPredicate); + return multiplicityPredicate; + } + + public static SubClassPredicate parseSubClassPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + SubClassPredicate subClassPredicate = FILTER_EXPR_FACTORY.createSubClassPredicate(); + + expressionString = expressionString.trim(); + + // ClassAttribute + int spaceAfterAttribute = expressionString.indexOf(" "); + if (spaceAfterAttribute == -1) { + throw new IllegalArgumentException("No attribute found: " + expressionString); + } + String attributeString = expressionString.substring(0, spaceAfterAttribute); + if (attributeString.equals("@")) { + subClassPredicate.setSubClassAttribute(null); + } else { + ClassAttribute classAttribute = parseClassAttribute(attributeString); + subClassPredicate.setSubClassAttribute(classAttribute); + } + + expressionString = expressionString.substring(spaceAfterAttribute); + expressionString = expressionString.trim(); + + // Expression + if (!expressionString.startsWith("(")) { + throw new IllegalArgumentException("'(' expected: " + expressionString); + } + if (!expressionString.endsWith(")")) { + throw new IllegalArgumentException("')' expected: " + expressionString); + } + + expressionString = expressionString.substring(1, expressionString.length() - 1); + BooleanExpression filterExpression = parseFilterExpression(expressionString); + subClassPredicate.setSubClassExpression(filterExpression); + + LOGGER.info("<= " + subClassPredicate); + return subClassPredicate; + } + + public static InPredicate parseInPredicate(String expressionString) { + LOGGER.info("=> " + expressionString); + InPredicate inPredicate = FILTER_EXPR_FACTORY.createInPredicate(); + + expressionString = expressionString.trim(); + + + // Attribute - text before the first space character + int index = expressionString.indexOf(" "); + if (index == -1) { + throw new IllegalArgumentException("no space after class attribute found: " + expressionString); + } + String token = expressionString.substring(0, index); + ClassAttribute attribute = parseClassAttribute(token); + inPredicate.setAttribute(attribute); + + // in operator - text before the next space + String remainingExpressioString = expressionString.substring(index).trim(); + index = remainingExpressioString.indexOf(" "); + if (index == -1) { + throw new IllegalArgumentException("no space after in operator found: " + remainingExpressioString); + } + token = remainingExpressioString.substring(0, index); + InOperator inOperator = parseInOperator(token); + inPredicate.setInOperator(inOperator); + + // Set of Literals + remainingExpressioString = remainingExpressioString.substring(index).trim(); + if (remainingExpressioString.startsWith("[") && + remainingExpressioString.endsWith("]")) { + // TODO This simple implementation doesn't handle comma's in string literals. + remainingExpressioString = remainingExpressioString.substring(1, remainingExpressioString.length() - 1); + StringTokenizer tokens = new StringTokenizer(remainingExpressioString, ","); + while (tokens.hasMoreElements()) { + Literal literal = parseLiteral(tokens.nextToken()); + inPredicate.getLiterals().add(literal); + } + } else { + throw new IllegalArgumentException("no brackets around literals found: " + remainingExpressioString); + } + + LOGGER.info("<= " + inPredicate); + return inPredicate; + } + + public static ClassAttribute parseClassAttribute(String expressionString) { + LOGGER.info("=> " + expressionString); + + expressionString = expressionString.trim(); + if (!expressionString.startsWith("@")) { + throw new IllegalArgumentException("Class attribute is not starting with @:" + expressionString); + } + expressionString = expressionString.substring(1); + + // Handle 'empty' attribute + if (expressionString.length() == 0) { + return null; + } + + ClassAttribute classAttribute = FILTER_EXPR_FACTORY.createClassAttribute(); + + // Handle optional meta operator + int metaOperatorSeparatorIndex = expressionString.indexOf("^"); + if (metaOperatorSeparatorIndex != -1) { + String metaOperatorString = expressionString.substring(metaOperatorSeparatorIndex + 1); + MetaOperator metaOperator = stringToMetaOperator.get(metaOperatorString); + if (metaOperator == null) { + LOGGER.severe("Unknown meta operator: " + metaOperatorString); + throw new IllegalArgumentException("Unknown meta operator: " + metaOperatorString); + } + classAttribute.setMetaOperator(metaOperator); + + expressionString = expressionString.substring(0, metaOperatorSeparatorIndex); + } + + // Handle optional index + int openBracketIndex = expressionString.indexOf("["); + if (openBracketIndex != -1) { + int closeBracketIndex = expressionString.indexOf("]"); + if (closeBracketIndex == -1) { + throw new IllegalArgumentException("No matching \']\' found."); + } + String indexString = expressionString.substring(openBracketIndex + 1, closeBracketIndex); + indexString = indexString.trim(); + int index = Integer.valueOf(indexString); + classAttribute.setIndex(index); + + expressionString = expressionString.substring(0, openBracketIndex); + } + + char firstChar = expressionString.charAt(0); + if (!Character.isLetter(firstChar)) { + throw new IllegalArgumentException("Attribute name is not starting with a letter: " + expressionString); + } + classAttribute.setAttributeName(expressionString); + + LOGGER.info("<= " + classAttribute); + return classAttribute; + } + + public static Literal parseLiteral(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + Literal literal; + + char firstChar = expressionString.charAt(0); + if (firstChar == '+' || firstChar == '-' || + (firstChar >= '0' && firstChar <= '9')) { + literal = parseSignedIntegerLiteral(expressionString); + } else if (firstChar == '\"') { + literal = parseStringLiteral(expressionString); + } else if (expressionString.equals("true") || expressionString.equals("false")) { + literal = parseBooleanLiteral(expressionString); + } else { + throw new IllegalArgumentException(expressionString); + } + + LOGGER.info("<= " + literal); + return literal; + } + + public static BooleanLiteral parseBooleanLiteral(String expressionString) { + LOGGER.info("=> " + expressionString); + BooleanLiteral booleanLiteral = FILTER_EXPR_FACTORY.createBooleanLiteral(); + + expressionString = expressionString.trim(); + if (expressionString.equals("true")) { + booleanLiteral.setValue(true); + } else if (expressionString.equals("false")) { + booleanLiteral.setValue(false); + } else { + throw new IllegalArgumentException(expressionString); + } + + LOGGER.info("<= " + booleanLiteral); + return booleanLiteral; + } + + public static SignedIntegerLiteral parseSignedIntegerLiteral(String expressionString) { + LOGGER.info("=> " + expressionString); + SignedIntegerLiteral signedIntegerLiteral = FILTER_EXPR_FACTORY.createSignedIntegerLiteral(); + + expressionString = expressionString.trim(); + signedIntegerLiteral.setValue(Long.parseLong(expressionString)); + + LOGGER.info("<= " + signedIntegerLiteral); + return signedIntegerLiteral; + } + + public static StringLiteral parseStringLiteral(String expressionString) { + LOGGER.info("=> " + expressionString); + StringLiteral stringLiteral = FILTER_EXPR_FACTORY.createStringLiteral(); + + expressionString = expressionString.trim(); + if (!expressionString.startsWith("\"")) { + throw new IllegalArgumentException("String not starting with quotes: " + expressionString); + } + if (!expressionString.endsWith("\"")) { + throw new IllegalArgumentException("String not ending with quotes: " + expressionString); + } + + String value = expressionString.substring(1, expressionString.length() - 1); + stringLiteral.setValue(value); + + LOGGER.info("<= " + stringLiteral); + return stringLiteral; + } + + public static ComparisonOperator parseComparisonOperator(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + ComparisonOperator comparisonOperator = stringToComparisonOperator.get(expressionString); + + LOGGER.info("<= " + comparisonOperator); + return comparisonOperator; + } + + public static String comparisonOperatorToString(ComparisonOperator comparisonOperator) { + return comparisonOperatorToString.get(comparisonOperator); + } + + public static UnaryLogicalOperator parseUnaryLogicalOperator(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + UnaryLogicalOperator unaryLogicalOperator = stringToUnaryLogicalOperator.get(expressionString); + + LOGGER.info("<= " + unaryLogicalOperator); + return unaryLogicalOperator; + } + + public static String unaryLogicalOperatorToString(UnaryLogicalOperator unaryLogicalOperator) { + return unaryLogicalOperatorToString.get(unaryLogicalOperator); + } + + public static DyadicLogicalOperator parseDyadicLogicalOperator(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + DyadicLogicalOperator dyadicLogicalOperator = stringToDyadicLogicalOperator.get(expressionString); + + LOGGER.info("<= " + dyadicLogicalOperator); + return dyadicLogicalOperator; + } + + public static String dyadicLogicalOperatorToString(DyadicLogicalOperator dyadicLogicalOperator) { + return dyadicLogicalOperatorToString.get(dyadicLogicalOperator); + } + + public static ListOperator parseListOperator(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + if (!expressionString.startsWith("#")) { + throw new IllegalArgumentException("List operator not starting with '#': " + expressionString); + } + expressionString = expressionString.substring(1); + ListOperator listOperator = stringToListOperator.get(expressionString); + + LOGGER.info("<= " + listOperator); + return listOperator; + } + + public static String listOperatorToString(ListOperator listOperator) { + return "#" + listOperatorToString.get(listOperator); + } + + public static String metaOperatorToString(MetaOperator metaOperator) { + return metaOperatorToString.get(metaOperator); + } + + public static InOperator parseInOperator(String expressionString) { + LOGGER.info("=> " + expressionString); + expressionString = expressionString.trim(); + + InOperator inOperator = stringToInOperator.get(expressionString); + + LOGGER.info("<= " + inOperator); + return inOperator; + } + + public static String inOperatorToString(InOperator inOperator) { + return inOperatorToString.get(inOperator); + } +} diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprAdapterFactory.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprAdapterFactory.java new file mode 100755 index 0000000..43b5594 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprAdapterFactory.java @@ -0,0 +1,379 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.booleanexpr.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.booleanexpr.FilterexprPackage + * @generated + */ +public class FilterexprAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static FilterexprPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public FilterexprAdapterFactory() { + if (modelPackage == null) { + modelPackage = FilterexprPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected FilterexprSwitch modelSwitch = + new FilterexprSwitch() { + @Override + public Adapter caseBooleanExpression(BooleanExpression object) { + return createBooleanExpressionAdapter(); + } + @Override + public Adapter caseUnaryExpression(UnaryExpression object) { + return createUnaryExpressionAdapter(); + } + @Override + public Adapter casePredicate(Predicate object) { + return createPredicateAdapter(); + } + @Override + public Adapter caseDyadicExpression(DyadicExpression object) { + return createDyadicExpressionAdapter(); + } + @Override + public Adapter caseComparisonPredicate(ComparisonPredicate object) { + return createComparisonPredicateAdapter(); + } + @Override + public Adapter caseInPredicate(InPredicate object) { + return createInPredicateAdapter(); + } + @Override + public Adapter caseLiteral(Literal object) { + return createLiteralAdapter(); + } + @Override + public Adapter caseSignedIntegerLiteral(SignedIntegerLiteral object) { + return createSignedIntegerLiteralAdapter(); + } + @Override + public Adapter caseStringLiteral(StringLiteral object) { + return createStringLiteralAdapter(); + } + @Override + public Adapter caseBooleanLiteral(BooleanLiteral object) { + return createBooleanLiteralAdapter(); + } + @Override + public Adapter caseSubClassPredicate(SubClassPredicate object) { + return createSubClassPredicateAdapter(); + } + @Override + public Adapter caseClassAttribute(ClassAttribute object) { + return createClassAttributeAdapter(); + } + @Override + public Adapter caseDownCastPredicate(DownCastPredicate object) { + return createDownCastPredicateAdapter(); + } + @Override + public Adapter caseMultiplicityPredicate(MultiplicityPredicate object) { + return createMultiplicityPredicateAdapter(); + } + @Override + public Adapter caseIsSetPredicate(IsSetPredicate object) { + return createIsSetPredicateAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.BooleanExpression Boolean Expression}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.BooleanExpression + * @generated + */ + public Adapter createBooleanExpressionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.UnaryExpression Unary Expression}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.UnaryExpression + * @generated + */ + public Adapter createUnaryExpressionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.Predicate Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.Predicate + * @generated + */ + public Adapter createPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.DyadicExpression Dyadic Expression}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.DyadicExpression + * @generated + */ + public Adapter createDyadicExpressionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.ComparisonPredicate Comparison Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.ComparisonPredicate + * @generated + */ + public Adapter createComparisonPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.InPredicate In Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.InPredicate + * @generated + */ + public Adapter createInPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.Literal Literal}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.Literal + * @generated + */ + public Adapter createLiteralAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.SignedIntegerLiteral Signed Integer Literal}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.SignedIntegerLiteral + * @generated + */ + public Adapter createSignedIntegerLiteralAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.StringLiteral String Literal}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.StringLiteral + * @generated + */ + public Adapter createStringLiteralAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.BooleanLiteral Boolean Literal}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.BooleanLiteral + * @generated + */ + public Adapter createBooleanLiteralAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.SubClassPredicate Sub Class Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.SubClassPredicate + * @generated + */ + public Adapter createSubClassPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.ClassAttribute Class Attribute}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.ClassAttribute + * @generated + */ + public Adapter createClassAttributeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.DownCastPredicate Down Cast Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.DownCastPredicate + * @generated + */ + public Adapter createDownCastPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.MultiplicityPredicate Multiplicity Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.MultiplicityPredicate + * @generated + */ + public Adapter createMultiplicityPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.booleanexpr.IsSetPredicate Is Set Predicate}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.booleanexpr.IsSetPredicate + * @generated + */ + public Adapter createIsSetPredicateAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //FilterexprAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprSwitch.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprSwitch.java new file mode 100755 index 0000000..8db9edd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/main/java/org/genivi/booleanexpr/util/FilterexprSwitch.java @@ -0,0 +1,429 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.booleanexpr.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.booleanexpr.FilterexprPackage + * @generated + */ +public class FilterexprSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static FilterexprPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public FilterexprSwitch() { + if (modelPackage == null) { + modelPackage = FilterexprPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case FilterexprPackage.BOOLEAN_EXPRESSION: { + BooleanExpression booleanExpression = (BooleanExpression)theEObject; + T result = caseBooleanExpression(booleanExpression); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.UNARY_EXPRESSION: { + UnaryExpression unaryExpression = (UnaryExpression)theEObject; + T result = caseUnaryExpression(unaryExpression); + if (result == null) result = caseBooleanExpression(unaryExpression); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.PREDICATE: { + Predicate predicate = (Predicate)theEObject; + T result = casePredicate(predicate); + if (result == null) result = caseBooleanExpression(predicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.DYADIC_EXPRESSION: { + DyadicExpression dyadicExpression = (DyadicExpression)theEObject; + T result = caseDyadicExpression(dyadicExpression); + if (result == null) result = caseBooleanExpression(dyadicExpression); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.COMPARISON_PREDICATE: { + ComparisonPredicate comparisonPredicate = (ComparisonPredicate)theEObject; + T result = caseComparisonPredicate(comparisonPredicate); + if (result == null) result = casePredicate(comparisonPredicate); + if (result == null) result = caseBooleanExpression(comparisonPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.IN_PREDICATE: { + InPredicate inPredicate = (InPredicate)theEObject; + T result = caseInPredicate(inPredicate); + if (result == null) result = casePredicate(inPredicate); + if (result == null) result = caseBooleanExpression(inPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.LITERAL: { + Literal literal = (Literal)theEObject; + T result = caseLiteral(literal); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.SIGNED_INTEGER_LITERAL: { + SignedIntegerLiteral signedIntegerLiteral = (SignedIntegerLiteral)theEObject; + T result = caseSignedIntegerLiteral(signedIntegerLiteral); + if (result == null) result = caseLiteral(signedIntegerLiteral); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.STRING_LITERAL: { + StringLiteral stringLiteral = (StringLiteral)theEObject; + T result = caseStringLiteral(stringLiteral); + if (result == null) result = caseLiteral(stringLiteral); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.BOOLEAN_LITERAL: { + BooleanLiteral booleanLiteral = (BooleanLiteral)theEObject; + T result = caseBooleanLiteral(booleanLiteral); + if (result == null) result = caseLiteral(booleanLiteral); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.SUB_CLASS_PREDICATE: { + SubClassPredicate subClassPredicate = (SubClassPredicate)theEObject; + T result = caseSubClassPredicate(subClassPredicate); + if (result == null) result = casePredicate(subClassPredicate); + if (result == null) result = caseBooleanExpression(subClassPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.CLASS_ATTRIBUTE: { + ClassAttribute classAttribute = (ClassAttribute)theEObject; + T result = caseClassAttribute(classAttribute); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.DOWN_CAST_PREDICATE: { + DownCastPredicate downCastPredicate = (DownCastPredicate)theEObject; + T result = caseDownCastPredicate(downCastPredicate); + if (result == null) result = casePredicate(downCastPredicate); + if (result == null) result = caseBooleanExpression(downCastPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.MULTIPLICITY_PREDICATE: { + MultiplicityPredicate multiplicityPredicate = (MultiplicityPredicate)theEObject; + T result = caseMultiplicityPredicate(multiplicityPredicate); + if (result == null) result = casePredicate(multiplicityPredicate); + if (result == null) result = caseBooleanExpression(multiplicityPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FilterexprPackage.IS_SET_PREDICATE: { + IsSetPredicate isSetPredicate = (IsSetPredicate)theEObject; + T result = caseIsSetPredicate(isSetPredicate); + if (result == null) result = casePredicate(isSetPredicate); + if (result == null) result = caseBooleanExpression(isSetPredicate); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Boolean Expression'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Boolean Expression'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseBooleanExpression(BooleanExpression object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Unary Expression'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Unary Expression'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseUnaryExpression(UnaryExpression object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePredicate(Predicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Dyadic Expression'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Dyadic Expression'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDyadicExpression(DyadicExpression object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Comparison Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Comparison Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseComparisonPredicate(ComparisonPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'In Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'In Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseInPredicate(InPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Literal'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Literal'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLiteral(Literal object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Signed Integer Literal'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Signed Integer Literal'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSignedIntegerLiteral(SignedIntegerLiteral object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'String Literal'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'String Literal'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseStringLiteral(StringLiteral object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Boolean Literal'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Boolean Literal'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseBooleanLiteral(BooleanLiteral object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Sub Class Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Sub Class Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseSubClassPredicate(SubClassPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Class Attribute'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Class Attribute'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseClassAttribute(ClassAttribute object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Down Cast Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Down Cast Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDownCastPredicate(DownCastPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Multiplicity Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Multiplicity Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseMultiplicityPredicate(MultiplicityPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Is Set Predicate'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Is Set Predicate'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIsSetPredicate(IsSetPredicate object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //FilterexprSwitch diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/booleanexpr/BooleanExprTests.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/booleanexpr/BooleanExprTests.java new file mode 100755 index 0000000..60ca14d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/booleanexpr/BooleanExprTests.java @@ -0,0 +1,439 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.booleanexpr; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.genivi.booleanexpr.util.FilterExprUtil; +import org.genivi.family.Address; +import org.genivi.family.Family; +import org.genivi.family.FamilyFactory; +import org.genivi.family.Person; +import org.genivi.family.Sexe; +import org.genivi.family.WealthyFamily; +import org.genivi.trafficinfo.demo.logging.EclipseConsoleFormatter; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * About the tests: + * - Literals and attributes are implicitly tested in predicate tests + */ +public class BooleanExprTests { + private final static Logger LOGGER = Logger.getLogger(BooleanExprTests.class.getName()); + private static final FamilyFactory FAMILY_FACTORY = FamilyFactory.eINSTANCE; + + private static final String FAMILY_SURNAME = "Smith"; + private static final int FAMILY_NUMBER_OF_PETS = 2; + private static final boolean FAMILY_HAS_SWIMMINGPOOL = false; + private static final String FAMILY_PERSON_1_FIRSTNAME = "Jim"; + private static final Sexe FAMILY_PERSON_1_SEXE = Sexe.MALE; + private static final String FAMILY_PERSON_2_FIRSTNAME = "John"; + private static final Sexe FAMILY_PERSON_2_SEXE = Sexe.MALE; + private static final String FAMILY_ADDRESS_STREET = "PacificHwy"; + private static final String[] FAMILY_FAVORITE_HOLIDAY_DESTINATIONS = { + "Egypt", "Austria" + }; + + private static final String WEALTHY_FAMILY_SURNAME = "Slim"; + private static final boolean WEALTHY_FAMILY_HAS_SWIMMINGPOOL = true; + private static final int WEALTHY_FAMILY_FORBES_RANKING = 1; + + private static Family family; + private static Family wealthyFamily; + private final static Level logLevel = Level.SEVERE; + + @BeforeClass + public static void setUp() { + logSetup(); + + family = createFamily(); + wealthyFamily = createWealthyFamily(); + LOGGER.info("family = " + family); + } + + @Test + public void testUnaryExpression() { + String expressionString; + BooleanExpression expression; + + expressionString = "not (@surname != \"" + FAMILY_SURNAME + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "not (@surname != \"Adams\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + } + + @Test + public void testDyadicExpression() { + String expressionString; + BooleanExpression expression; + + expressionString = "(@surname == \"" + FAMILY_SURNAME + "\") and (@numberOfPets == " + FAMILY_NUMBER_OF_PETS + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "(@surname != \"" + FAMILY_SURNAME + "\") and (@numberOfPets == " + FAMILY_NUMBER_OF_PETS + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "(@surname != \"" + FAMILY_SURNAME + "\") or (@numberOfPets == " + FAMILY_NUMBER_OF_PETS + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + } + + @Test + public void testComparisonPredicate() { + String expressionString; + BooleanExpression expression; + + // Test all supported operations for type String (only EQUAL, NOT_EQUAL) + expressionString = "@surname == \"" + FAMILY_SURNAME + "\""; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + + expressionString = "@surname == \"Adams\""; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@surname != \"" + FAMILY_SURNAME + "\""; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@surname != \"Adams\""; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + // Test all supported operations for type Integer (all operations) + expressionString = "@numberOfPets == " + FAMILY_NUMBER_OF_PETS; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets == " + 99; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets != " + 99; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets != " + FAMILY_NUMBER_OF_PETS; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets > " + -1; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets > " + FAMILY_NUMBER_OF_PETS; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets >= " + -1; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets >= " + (FAMILY_NUMBER_OF_PETS + 1); + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets < " + 1000; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets < " + FAMILY_NUMBER_OF_PETS; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets <= " + FAMILY_NUMBER_OF_PETS; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets <= " + (FAMILY_NUMBER_OF_PETS - 1); + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + // Test all supported operations for type boolean (only EQUAL, NOT_EQUAL) + expressionString = "@hasASwimmingPool == " + FAMILY_HAS_SWIMMINGPOOL; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@hasASwimmingPool == " + !FAMILY_HAS_SWIMMINGPOOL; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@hasASwimmingPool != " + !FAMILY_HAS_SWIMMINGPOOL; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@hasASwimmingPool != " + FAMILY_HAS_SWIMMINGPOOL; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + } + + @Test + public void testSubClassPredicate() { + String expressionString; + BooleanExpression expression; + + expressionString = "@address (@street == \"" + FAMILY_ADDRESS_STREET + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@address (@street != \"" + FAMILY_ADDRESS_STREET + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + } + + @Test + public void testDownCastPredicate() { + String expressionString; + BooleanExpression expression; + + expressionString = "[@WealthyFamily](@forbesRanking < 100)"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(wealthyFamily)); + + + expressionString = "[@WealthyFamily](@forbesRanking != 1)"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(wealthyFamily)); + } + + @Test + public void testIsSetPredicate() { + String expressionString; + BooleanExpression expression; + + expressionString = "isSet @numberOfPets"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + assertFalse("Wrong evaluation result", expression.evaluate(wealthyFamily)); + } + + @Test + public void testInPredicate() { + String expressionString; + BooleanExpression expression; + + expressionString = "@surname in [\"Dummy\", \"Smith\", \"Dummy2\"]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@surname in [\"Dummy\", \"Dummy3\", \"Dummy2\"]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@surname not-in [\"Dummy\", \"Smith\", \"Dummy2\"]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@surname not-in [\"Dummy\", \"Dummy3\", \"Dummy2\"]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets in [2, 3, 4]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets in [4, 3, 2]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets in [4, 3, 12]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets not-in [2, 3, 4]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets not-in [4, 3, 2]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@numberOfPets not-in [4, 3, 12]"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + } + + @Test + public void testMultiplicityPredicate() { + String expressionString; + BooleanExpression expression; + + // ANY + expressionString = "#any @members (@firstName == \"" + FAMILY_PERSON_1_FIRSTNAME + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "#any @members (@firstName == \"Susan\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "#any @favoriteHolidayDestinations (@ in [\"Netherlands\", \"Egypt\"])"; + System.out.println(expressionString); + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + // ALL + expressionString = "#all @members (@sexe == " + Sexe.MALE.getValue() + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "#all @members (@firstName == \"" + FAMILY_PERSON_1_FIRSTNAME + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + // NONE + expressionString = "#none @members (@sexe == " + Sexe.FEMALE.getValue() + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "#none @members (@sexe == " + Sexe.MALE.getValue() + ")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + // MetaOperator + expressionString = "@members^size == 2"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@members^size == 4"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + + // index + expressionString = "@members[1] (@firstName == \"" + FAMILY_PERSON_2_FIRSTNAME + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertTrue("Wrong evaluation result", expression.evaluate(family)); + + expressionString = "@members[0] (@firstName == \"" + FAMILY_PERSON_2_FIRSTNAME + "\")"; + expression = FilterExprUtil.parseFilterExpression(expressionString); + assertEquals("Error in expression translation", expressionString, expression.toString()); + assertFalse("Wrong evaluation result", expression.evaluate(family)); + } + + private static void logSetup() { + // Create Logger + Logger logger = Logger.getLogger(""); + logger.setLevel(logLevel); + + Handler consoleHandler = null; + for (Handler handler: logger.getHandlers()) { + if (handler.getClass().getName().equals("java.util.logging.ConsoleHandler")) { + consoleHandler = handler; + break; + } + } + consoleHandler.setFormatter(new EclipseConsoleFormatter()); + consoleHandler.setLevel(Level.INFO); + } + + private static Family createFamily() { + Family family = FAMILY_FACTORY.createFamily(); + + family.setSurname(FAMILY_SURNAME); + family.setNumberOfPets(FAMILY_NUMBER_OF_PETS); + family.setHasASwimmingPool(FAMILY_HAS_SWIMMINGPOOL); + + Person person; + + person = FAMILY_FACTORY.createPerson(); + person.setFirstName(FAMILY_PERSON_1_FIRSTNAME); + person.setSexe(FAMILY_PERSON_1_SEXE); + family.getMembers().add(person); + + person = FAMILY_FACTORY.createPerson(); + person.setFirstName(FAMILY_PERSON_2_FIRSTNAME); + person.setSexe(FAMILY_PERSON_2_SEXE); + family.getMembers().add(person); + + Address address = FAMILY_FACTORY.createAddress(); + address.setStreet(FAMILY_ADDRESS_STREET); + family.setAddress(address); + + for (String destination: FAMILY_FAVORITE_HOLIDAY_DESTINATIONS) { + family.getFavoriteHolidayDestinations().add(destination); + } + + return family; + } + + private static Family createWealthyFamily() { + WealthyFamily family = FAMILY_FACTORY.createWealthyFamily(); + + family.setSurname(WEALTHY_FAMILY_SURNAME); + family.setHasASwimmingPool(WEALTHY_FAMILY_HAS_SWIMMINGPOOL); + family.setForbesRanking(WEALTHY_FAMILY_FORBES_RANKING); + + return family; + } +} diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Address.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Address.java new file mode 100755 index 0000000..e004ca8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Address.java @@ -0,0 +1,84 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Address'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.family.Address#getStreet Street}
  • + *
+ *

+ * + * @see org.genivi.family.FamilyPackage#getAddress() + * @model + * @generated + */ +public interface Address extends EObject { + /** + * Returns the value of the 'Street' attribute. + * + *

+ * If the meaning of the 'Street' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Street' attribute. + * @see #isSetStreet() + * @see #unsetStreet() + * @see #setStreet(String) + * @see org.genivi.family.FamilyPackage#getAddress_Street() + * @model unsettable="true" + * @generated + */ + String getStreet(); + + /** + * Sets the value of the '{@link org.genivi.family.Address#getStreet Street}' attribute. + * + * + * @param value the new value of the 'Street' attribute. + * @see #isSetStreet() + * @see #unsetStreet() + * @see #getStreet() + * @generated + */ + void setStreet(String value); + + /** + * Unsets the value of the '{@link org.genivi.family.Address#getStreet Street}' attribute. + * + * + * @see #isSetStreet() + * @see #getStreet() + * @see #setStreet(String) + * @generated + */ + void unsetStreet(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Address#getStreet Street}' attribute is set. + * + * + * @return whether the value of the 'Street' attribute is set. + * @see #unsetStreet() + * @see #getStreet() + * @see #setStreet(String) + * @generated + */ + boolean isSetStreet(); + +} // Address diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Car.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Car.java new file mode 100755 index 0000000..09c82fc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Car.java @@ -0,0 +1,84 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Car'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.family.Car#getNumberOfSeats Number Of Seats}
  • + *
+ *

+ * + * @see org.genivi.family.FamilyPackage#getCar() + * @model + * @generated + */ +public interface Car extends EObject { + /** + * Returns the value of the 'Number Of Seats' attribute. + * + *

+ * If the meaning of the 'Number Of Seats' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Number Of Seats' attribute. + * @see #isSetNumberOfSeats() + * @see #unsetNumberOfSeats() + * @see #setNumberOfSeats(Integer) + * @see org.genivi.family.FamilyPackage#getCar_NumberOfSeats() + * @model unsettable="true" + * @generated + */ + Integer getNumberOfSeats(); + + /** + * Sets the value of the '{@link org.genivi.family.Car#getNumberOfSeats Number Of Seats}' attribute. + * + * + * @param value the new value of the 'Number Of Seats' attribute. + * @see #isSetNumberOfSeats() + * @see #unsetNumberOfSeats() + * @see #getNumberOfSeats() + * @generated + */ + void setNumberOfSeats(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.family.Car#getNumberOfSeats Number Of Seats}' attribute. + * + * + * @see #isSetNumberOfSeats() + * @see #getNumberOfSeats() + * @see #setNumberOfSeats(Integer) + * @generated + */ + void unsetNumberOfSeats(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Car#getNumberOfSeats Number Of Seats}' attribute is set. + * + * + * @return whether the value of the 'Number Of Seats' attribute is set. + * @see #unsetNumberOfSeats() + * @see #getNumberOfSeats() + * @see #setNumberOfSeats(Integer) + * @generated + */ + boolean isSetNumberOfSeats(); + +} // Car diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Family.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Family.java new file mode 100755 index 0000000..021fdcc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Family.java @@ -0,0 +1,282 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Family'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.family.Family#getMembers Members}
  • + *
  • {@link org.genivi.family.Family#getSurname Surname}
  • + *
  • {@link org.genivi.family.Family#getNumberOfPets Number Of Pets}
  • + *
  • {@link org.genivi.family.Family#isHasASwimmingPool Has ASwimming Pool}
  • + *
  • {@link org.genivi.family.Family#getAddress Address}
  • + *
  • {@link org.genivi.family.Family#getFavoriteHolidayDestinations Favorite Holiday Destinations}
  • + *
+ *

+ * + * @see org.genivi.family.FamilyPackage#getFamily() + * @model + * @generated + */ +public interface Family extends EObject { + /** + * Returns the value of the 'Members' containment reference list. + * The list contents are of type {@link org.genivi.family.Person}. + * + *

+ * If the meaning of the 'Members' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Members' containment reference list. + * @see org.genivi.family.FamilyPackage#getFamily_Members() + * @model containment="true" required="true" + * @generated + */ + EList getMembers(); + + /** + * Returns the value of the 'Surname' attribute. + * + *

+ * If the meaning of the 'Surname' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Surname' attribute. + * @see #isSetSurname() + * @see #unsetSurname() + * @see #setSurname(String) + * @see org.genivi.family.FamilyPackage#getFamily_Surname() + * @model unsettable="true" required="true" + * @generated + */ + String getSurname(); + + /** + * Sets the value of the '{@link org.genivi.family.Family#getSurname Surname}' attribute. + * + * + * @param value the new value of the 'Surname' attribute. + * @see #isSetSurname() + * @see #unsetSurname() + * @see #getSurname() + * @generated + */ + void setSurname(String value); + + /** + * Unsets the value of the '{@link org.genivi.family.Family#getSurname Surname}' attribute. + * + * + * @see #isSetSurname() + * @see #getSurname() + * @see #setSurname(String) + * @generated + */ + void unsetSurname(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Family#getSurname Surname}' attribute is set. + * + * + * @return whether the value of the 'Surname' attribute is set. + * @see #unsetSurname() + * @see #getSurname() + * @see #setSurname(String) + * @generated + */ + boolean isSetSurname(); + + /** + * Returns the value of the 'Number Of Pets' attribute. + * + *

+ * If the meaning of the 'Number Of Pets' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Number Of Pets' attribute. + * @see #isSetNumberOfPets() + * @see #unsetNumberOfPets() + * @see #setNumberOfPets(int) + * @see org.genivi.family.FamilyPackage#getFamily_NumberOfPets() + * @model unsettable="true" + * @generated + */ + int getNumberOfPets(); + + /** + * Sets the value of the '{@link org.genivi.family.Family#getNumberOfPets Number Of Pets}' attribute. + * + * + * @param value the new value of the 'Number Of Pets' attribute. + * @see #isSetNumberOfPets() + * @see #unsetNumberOfPets() + * @see #getNumberOfPets() + * @generated + */ + void setNumberOfPets(int value); + + /** + * Unsets the value of the '{@link org.genivi.family.Family#getNumberOfPets Number Of Pets}' attribute. + * + * + * @see #isSetNumberOfPets() + * @see #getNumberOfPets() + * @see #setNumberOfPets(int) + * @generated + */ + void unsetNumberOfPets(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Family#getNumberOfPets Number Of Pets}' attribute is set. + * + * + * @return whether the value of the 'Number Of Pets' attribute is set. + * @see #unsetNumberOfPets() + * @see #getNumberOfPets() + * @see #setNumberOfPets(int) + * @generated + */ + boolean isSetNumberOfPets(); + + /** + * Returns the value of the 'Has ASwimming Pool' attribute. + * + *

+ * If the meaning of the 'Has ASwimming Pool' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Has ASwimming Pool' attribute. + * @see #isSetHasASwimmingPool() + * @see #unsetHasASwimmingPool() + * @see #setHasASwimmingPool(boolean) + * @see org.genivi.family.FamilyPackage#getFamily_HasASwimmingPool() + * @model unsettable="true" + * @generated + */ + boolean isHasASwimmingPool(); + + /** + * Sets the value of the '{@link org.genivi.family.Family#isHasASwimmingPool Has ASwimming Pool}' attribute. + * + * + * @param value the new value of the 'Has ASwimming Pool' attribute. + * @see #isSetHasASwimmingPool() + * @see #unsetHasASwimmingPool() + * @see #isHasASwimmingPool() + * @generated + */ + void setHasASwimmingPool(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.family.Family#isHasASwimmingPool Has ASwimming Pool}' attribute. + * + * + * @see #isSetHasASwimmingPool() + * @see #isHasASwimmingPool() + * @see #setHasASwimmingPool(boolean) + * @generated + */ + void unsetHasASwimmingPool(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Family#isHasASwimmingPool Has ASwimming Pool}' attribute is set. + * + * + * @return whether the value of the 'Has ASwimming Pool' attribute is set. + * @see #unsetHasASwimmingPool() + * @see #isHasASwimmingPool() + * @see #setHasASwimmingPool(boolean) + * @generated + */ + boolean isSetHasASwimmingPool(); + + /** + * Returns the value of the 'Address' containment reference. + * + *

+ * If the meaning of the 'Address' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Address' containment reference. + * @see #isSetAddress() + * @see #unsetAddress() + * @see #setAddress(Address) + * @see org.genivi.family.FamilyPackage#getFamily_Address() + * @model containment="true" unsettable="true" + * @generated + */ + Address getAddress(); + + /** + * Sets the value of the '{@link org.genivi.family.Family#getAddress Address}' containment reference. + * + * + * @param value the new value of the 'Address' containment reference. + * @see #isSetAddress() + * @see #unsetAddress() + * @see #getAddress() + * @generated + */ + void setAddress(Address value); + + /** + * Unsets the value of the '{@link org.genivi.family.Family#getAddress Address}' containment reference. + * + * + * @see #isSetAddress() + * @see #getAddress() + * @see #setAddress(Address) + * @generated + */ + void unsetAddress(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Family#getAddress Address}' containment reference is set. + * + * + * @return whether the value of the 'Address' containment reference is set. + * @see #unsetAddress() + * @see #getAddress() + * @see #setAddress(Address) + * @generated + */ + boolean isSetAddress(); + + /** + * Returns the value of the 'Favorite Holiday Destinations' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Favorite Holiday Destinations' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Favorite Holiday Destinations' attribute list. + * @see org.genivi.family.FamilyPackage#getFamily_FavoriteHolidayDestinations() + * @model + * @generated + */ + EList getFavoriteHolidayDestinations(); + +} // Family diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyFactory.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyFactory.java new file mode 100755 index 0000000..4208ede --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyFactory.java @@ -0,0 +1,85 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.family.FamilyPackage + * @generated + */ +public interface FamilyFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + FamilyFactory eINSTANCE = org.genivi.family.impl.FamilyFactoryImpl.init(); + + /** + * Returns a new object of class 'Family'. + * + * + * @return a new object of class 'Family'. + * @generated + */ + Family createFamily(); + + /** + * Returns a new object of class 'Person'. + * + * + * @return a new object of class 'Person'. + * @generated + */ + Person createPerson(); + + /** + * Returns a new object of class 'Car'. + * + * + * @return a new object of class 'Car'. + * @generated + */ + Car createCar(); + + /** + * Returns a new object of class 'Address'. + * + * + * @return a new object of class 'Address'. + * @generated + */ + Address createAddress(); + + /** + * Returns a new object of class 'Wealthy Family'. + * + * + * @return a new object of class 'Wealthy Family'. + * @generated + */ + WealthyFamily createWealthyFamily(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + FamilyPackage getFamilyPackage(); + +} //FamilyFactory diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyPackage.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyPackage.java new file mode 100755 index 0000000..05b8d31 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/FamilyPackage.java @@ -0,0 +1,707 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.family.FamilyFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface FamilyPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "family"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.family"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "family"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + FamilyPackage eINSTANCE = org.genivi.family.impl.FamilyPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.family.impl.FamilyImpl Family}' class. + * + * + * @see org.genivi.family.impl.FamilyImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getFamily() + * @generated + */ + int FAMILY = 0; + + /** + * The feature id for the 'Members' containment reference list. + * + * + * @generated + * @ordered + */ + int FAMILY__MEMBERS = 0; + + /** + * The feature id for the 'Surname' attribute. + * + * + * @generated + * @ordered + */ + int FAMILY__SURNAME = 1; + + /** + * The feature id for the 'Number Of Pets' attribute. + * + * + * @generated + * @ordered + */ + int FAMILY__NUMBER_OF_PETS = 2; + + /** + * The feature id for the 'Has ASwimming Pool' attribute. + * + * + * @generated + * @ordered + */ + int FAMILY__HAS_ASWIMMING_POOL = 3; + + /** + * The feature id for the 'Address' containment reference. + * + * + * @generated + * @ordered + */ + int FAMILY__ADDRESS = 4; + + /** + * The feature id for the 'Favorite Holiday Destinations' attribute list. + * + * + * @generated + * @ordered + */ + int FAMILY__FAVORITE_HOLIDAY_DESTINATIONS = 5; + + /** + * The number of structural features of the 'Family' class. + * + * + * @generated + * @ordered + */ + int FAMILY_FEATURE_COUNT = 6; + + /** + * The meta object id for the '{@link org.genivi.family.impl.PersonImpl Person}' class. + * + * + * @see org.genivi.family.impl.PersonImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getPerson() + * @generated + */ + int PERSON = 1; + + /** + * The feature id for the 'First Name' attribute. + * + * + * @generated + * @ordered + */ + int PERSON__FIRST_NAME = 0; + + /** + * The feature id for the 'Sexe' attribute. + * + * + * @generated + * @ordered + */ + int PERSON__SEXE = 1; + + /** + * The feature id for the 'Owned Cars' containment reference list. + * + * + * @generated + * @ordered + */ + int PERSON__OWNED_CARS = 2; + + /** + * The number of structural features of the 'Person' class. + * + * + * @generated + * @ordered + */ + int PERSON_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.genivi.family.impl.CarImpl Car}' class. + * + * + * @see org.genivi.family.impl.CarImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getCar() + * @generated + */ + int CAR = 2; + + /** + * The feature id for the 'Number Of Seats' attribute. + * + * + * @generated + * @ordered + */ + int CAR__NUMBER_OF_SEATS = 0; + + /** + * The number of structural features of the 'Car' class. + * + * + * @generated + * @ordered + */ + int CAR_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.genivi.family.impl.AddressImpl Address}' class. + * + * + * @see org.genivi.family.impl.AddressImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getAddress() + * @generated + */ + int ADDRESS = 3; + + /** + * The feature id for the 'Street' attribute. + * + * + * @generated + * @ordered + */ + int ADDRESS__STREET = 0; + + /** + * The number of structural features of the 'Address' class. + * + * + * @generated + * @ordered + */ + int ADDRESS_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.genivi.family.impl.WealthyFamilyImpl Wealthy Family}' class. + * + * + * @see org.genivi.family.impl.WealthyFamilyImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getWealthyFamily() + * @generated + */ + int WEALTHY_FAMILY = 4; + + /** + * The feature id for the 'Members' containment reference list. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__MEMBERS = FAMILY__MEMBERS; + + /** + * The feature id for the 'Surname' attribute. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__SURNAME = FAMILY__SURNAME; + + /** + * The feature id for the 'Number Of Pets' attribute. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__NUMBER_OF_PETS = FAMILY__NUMBER_OF_PETS; + + /** + * The feature id for the 'Has ASwimming Pool' attribute. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__HAS_ASWIMMING_POOL = FAMILY__HAS_ASWIMMING_POOL; + + /** + * The feature id for the 'Address' containment reference. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__ADDRESS = FAMILY__ADDRESS; + + /** + * The feature id for the 'Favorite Holiday Destinations' attribute list. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__FAVORITE_HOLIDAY_DESTINATIONS = FAMILY__FAVORITE_HOLIDAY_DESTINATIONS; + + /** + * The feature id for the 'Forbes Ranking' attribute. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY__FORBES_RANKING = FAMILY_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Wealthy Family' class. + * + * + * @generated + * @ordered + */ + int WEALTHY_FAMILY_FEATURE_COUNT = FAMILY_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.family.Sexe Sexe}' enum. + * + * + * @see org.genivi.family.Sexe + * @see org.genivi.family.impl.FamilyPackageImpl#getSexe() + * @generated + */ + int SEXE = 5; + + + /** + * Returns the meta object for class '{@link org.genivi.family.Family Family}'. + * + * + * @return the meta object for class 'Family'. + * @see org.genivi.family.Family + * @generated + */ + EClass getFamily(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.family.Family#getMembers Members}'. + * + * + * @return the meta object for the containment reference list 'Members'. + * @see org.genivi.family.Family#getMembers() + * @see #getFamily() + * @generated + */ + EReference getFamily_Members(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Family#getSurname Surname}'. + * + * + * @return the meta object for the attribute 'Surname'. + * @see org.genivi.family.Family#getSurname() + * @see #getFamily() + * @generated + */ + EAttribute getFamily_Surname(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Family#getNumberOfPets Number Of Pets}'. + * + * + * @return the meta object for the attribute 'Number Of Pets'. + * @see org.genivi.family.Family#getNumberOfPets() + * @see #getFamily() + * @generated + */ + EAttribute getFamily_NumberOfPets(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Family#isHasASwimmingPool Has ASwimming Pool}'. + * + * + * @return the meta object for the attribute 'Has ASwimming Pool'. + * @see org.genivi.family.Family#isHasASwimmingPool() + * @see #getFamily() + * @generated + */ + EAttribute getFamily_HasASwimmingPool(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.family.Family#getAddress Address}'. + * + * + * @return the meta object for the containment reference 'Address'. + * @see org.genivi.family.Family#getAddress() + * @see #getFamily() + * @generated + */ + EReference getFamily_Address(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.family.Family#getFavoriteHolidayDestinations Favorite Holiday Destinations}'. + * + * + * @return the meta object for the attribute list 'Favorite Holiday Destinations'. + * @see org.genivi.family.Family#getFavoriteHolidayDestinations() + * @see #getFamily() + * @generated + */ + EAttribute getFamily_FavoriteHolidayDestinations(); + + /** + * Returns the meta object for class '{@link org.genivi.family.Person Person}'. + * + * + * @return the meta object for class 'Person'. + * @see org.genivi.family.Person + * @generated + */ + EClass getPerson(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Person#getFirstName First Name}'. + * + * + * @return the meta object for the attribute 'First Name'. + * @see org.genivi.family.Person#getFirstName() + * @see #getPerson() + * @generated + */ + EAttribute getPerson_FirstName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Person#getSexe Sexe}'. + * + * + * @return the meta object for the attribute 'Sexe'. + * @see org.genivi.family.Person#getSexe() + * @see #getPerson() + * @generated + */ + EAttribute getPerson_Sexe(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.family.Person#getOwnedCars Owned Cars}'. + * + * + * @return the meta object for the containment reference list 'Owned Cars'. + * @see org.genivi.family.Person#getOwnedCars() + * @see #getPerson() + * @generated + */ + EReference getPerson_OwnedCars(); + + /** + * Returns the meta object for class '{@link org.genivi.family.Car Car}'. + * + * + * @return the meta object for class 'Car'. + * @see org.genivi.family.Car + * @generated + */ + EClass getCar(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Car#getNumberOfSeats Number Of Seats}'. + * + * + * @return the meta object for the attribute 'Number Of Seats'. + * @see org.genivi.family.Car#getNumberOfSeats() + * @see #getCar() + * @generated + */ + EAttribute getCar_NumberOfSeats(); + + /** + * Returns the meta object for class '{@link org.genivi.family.Address Address}'. + * + * + * @return the meta object for class 'Address'. + * @see org.genivi.family.Address + * @generated + */ + EClass getAddress(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.Address#getStreet Street}'. + * + * + * @return the meta object for the attribute 'Street'. + * @see org.genivi.family.Address#getStreet() + * @see #getAddress() + * @generated + */ + EAttribute getAddress_Street(); + + /** + * Returns the meta object for class '{@link org.genivi.family.WealthyFamily Wealthy Family}'. + * + * + * @return the meta object for class 'Wealthy Family'. + * @see org.genivi.family.WealthyFamily + * @generated + */ + EClass getWealthyFamily(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.family.WealthyFamily#getForbesRanking Forbes Ranking}'. + * + * + * @return the meta object for the attribute 'Forbes Ranking'. + * @see org.genivi.family.WealthyFamily#getForbesRanking() + * @see #getWealthyFamily() + * @generated + */ + EAttribute getWealthyFamily_ForbesRanking(); + + /** + * Returns the meta object for enum '{@link org.genivi.family.Sexe Sexe}'. + * + * + * @return the meta object for enum 'Sexe'. + * @see org.genivi.family.Sexe + * @generated + */ + EEnum getSexe(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + FamilyFactory getFamilyFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.family.impl.FamilyImpl Family}' class. + * + * + * @see org.genivi.family.impl.FamilyImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getFamily() + * @generated + */ + EClass FAMILY = eINSTANCE.getFamily(); + + /** + * The meta object literal for the 'Members' containment reference list feature. + * + * + * @generated + */ + EReference FAMILY__MEMBERS = eINSTANCE.getFamily_Members(); + + /** + * The meta object literal for the 'Surname' attribute feature. + * + * + * @generated + */ + EAttribute FAMILY__SURNAME = eINSTANCE.getFamily_Surname(); + + /** + * The meta object literal for the 'Number Of Pets' attribute feature. + * + * + * @generated + */ + EAttribute FAMILY__NUMBER_OF_PETS = eINSTANCE.getFamily_NumberOfPets(); + + /** + * The meta object literal for the 'Has ASwimming Pool' attribute feature. + * + * + * @generated + */ + EAttribute FAMILY__HAS_ASWIMMING_POOL = eINSTANCE.getFamily_HasASwimmingPool(); + + /** + * The meta object literal for the 'Address' containment reference feature. + * + * + * @generated + */ + EReference FAMILY__ADDRESS = eINSTANCE.getFamily_Address(); + + /** + * The meta object literal for the 'Favorite Holiday Destinations' attribute list feature. + * + * + * @generated + */ + EAttribute FAMILY__FAVORITE_HOLIDAY_DESTINATIONS = eINSTANCE.getFamily_FavoriteHolidayDestinations(); + + /** + * The meta object literal for the '{@link org.genivi.family.impl.PersonImpl Person}' class. + * + * + * @see org.genivi.family.impl.PersonImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getPerson() + * @generated + */ + EClass PERSON = eINSTANCE.getPerson(); + + /** + * The meta object literal for the 'First Name' attribute feature. + * + * + * @generated + */ + EAttribute PERSON__FIRST_NAME = eINSTANCE.getPerson_FirstName(); + + /** + * The meta object literal for the 'Sexe' attribute feature. + * + * + * @generated + */ + EAttribute PERSON__SEXE = eINSTANCE.getPerson_Sexe(); + + /** + * The meta object literal for the 'Owned Cars' containment reference list feature. + * + * + * @generated + */ + EReference PERSON__OWNED_CARS = eINSTANCE.getPerson_OwnedCars(); + + /** + * The meta object literal for the '{@link org.genivi.family.impl.CarImpl Car}' class. + * + * + * @see org.genivi.family.impl.CarImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getCar() + * @generated + */ + EClass CAR = eINSTANCE.getCar(); + + /** + * The meta object literal for the 'Number Of Seats' attribute feature. + * + * + * @generated + */ + EAttribute CAR__NUMBER_OF_SEATS = eINSTANCE.getCar_NumberOfSeats(); + + /** + * The meta object literal for the '{@link org.genivi.family.impl.AddressImpl Address}' class. + * + * + * @see org.genivi.family.impl.AddressImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getAddress() + * @generated + */ + EClass ADDRESS = eINSTANCE.getAddress(); + + /** + * The meta object literal for the 'Street' attribute feature. + * + * + * @generated + */ + EAttribute ADDRESS__STREET = eINSTANCE.getAddress_Street(); + + /** + * The meta object literal for the '{@link org.genivi.family.impl.WealthyFamilyImpl Wealthy Family}' class. + * + * + * @see org.genivi.family.impl.WealthyFamilyImpl + * @see org.genivi.family.impl.FamilyPackageImpl#getWealthyFamily() + * @generated + */ + EClass WEALTHY_FAMILY = eINSTANCE.getWealthyFamily(); + + /** + * The meta object literal for the 'Forbes Ranking' attribute feature. + * + * + * @generated + */ + EAttribute WEALTHY_FAMILY__FORBES_RANKING = eINSTANCE.getWealthyFamily_ForbesRanking(); + + /** + * The meta object literal for the '{@link org.genivi.family.Sexe Sexe}' enum. + * + * + * @see org.genivi.family.Sexe + * @see org.genivi.family.impl.FamilyPackageImpl#getSexe() + * @generated + */ + EEnum SEXE = eINSTANCE.getSexe(); + + } + +} //FamilyPackage diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Person.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Person.java new file mode 100755 index 0000000..73cd952 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Person.java @@ -0,0 +1,160 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Person'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.family.Person#getFirstName First Name}
  • + *
  • {@link org.genivi.family.Person#getSexe Sexe}
  • + *
  • {@link org.genivi.family.Person#getOwnedCars Owned Cars}
  • + *
+ *

+ * + * @see org.genivi.family.FamilyPackage#getPerson() + * @model + * @generated + */ +public interface Person extends EObject { + /** + * Returns the value of the 'First Name' attribute. + * + *

+ * If the meaning of the 'First Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'First Name' attribute. + * @see #isSetFirstName() + * @see #unsetFirstName() + * @see #setFirstName(String) + * @see org.genivi.family.FamilyPackage#getPerson_FirstName() + * @model unsettable="true" required="true" + * @generated + */ + String getFirstName(); + + /** + * Sets the value of the '{@link org.genivi.family.Person#getFirstName First Name}' attribute. + * + * + * @param value the new value of the 'First Name' attribute. + * @see #isSetFirstName() + * @see #unsetFirstName() + * @see #getFirstName() + * @generated + */ + void setFirstName(String value); + + /** + * Unsets the value of the '{@link org.genivi.family.Person#getFirstName First Name}' attribute. + * + * + * @see #isSetFirstName() + * @see #getFirstName() + * @see #setFirstName(String) + * @generated + */ + void unsetFirstName(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Person#getFirstName First Name}' attribute is set. + * + * + * @return whether the value of the 'First Name' attribute is set. + * @see #unsetFirstName() + * @see #getFirstName() + * @see #setFirstName(String) + * @generated + */ + boolean isSetFirstName(); + + /** + * Returns the value of the 'Sexe' attribute. + * The literals are from the enumeration {@link org.genivi.family.Sexe}. + * + *

+ * If the meaning of the 'Sexe' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Sexe' attribute. + * @see org.genivi.family.Sexe + * @see #isSetSexe() + * @see #unsetSexe() + * @see #setSexe(Sexe) + * @see org.genivi.family.FamilyPackage#getPerson_Sexe() + * @model unsettable="true" required="true" + * @generated + */ + Sexe getSexe(); + + /** + * Sets the value of the '{@link org.genivi.family.Person#getSexe Sexe}' attribute. + * + * + * @param value the new value of the 'Sexe' attribute. + * @see org.genivi.family.Sexe + * @see #isSetSexe() + * @see #unsetSexe() + * @see #getSexe() + * @generated + */ + void setSexe(Sexe value); + + /** + * Unsets the value of the '{@link org.genivi.family.Person#getSexe Sexe}' attribute. + * + * + * @see #isSetSexe() + * @see #getSexe() + * @see #setSexe(Sexe) + * @generated + */ + void unsetSexe(); + + /** + * Returns whether the value of the '{@link org.genivi.family.Person#getSexe Sexe}' attribute is set. + * + * + * @return whether the value of the 'Sexe' attribute is set. + * @see #unsetSexe() + * @see #getSexe() + * @see #setSexe(Sexe) + * @generated + */ + boolean isSetSexe(); + + /** + * Returns the value of the 'Owned Cars' containment reference list. + * The list contents are of type {@link org.genivi.family.Car}. + * + *

+ * If the meaning of the 'Owned Cars' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Owned Cars' containment reference list. + * @see org.genivi.family.FamilyPackage#getPerson_OwnedCars() + * @model containment="true" + * @generated + */ + EList getOwnedCars(); + +} // Person diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Sexe.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Sexe.java new file mode 100755 index 0000000..299eb4e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/Sexe.java @@ -0,0 +1,215 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Sexe', + * and utility methods for working with them. + * + * @see org.genivi.family.FamilyPackage#getSexe() + * @model + * @generated + */ +public enum Sexe implements Enumerator { + /** + * The 'MALE' literal object. + * + * + * @see #MALE_VALUE + * @generated + * @ordered + */ + MALE(0, "MALE", "MALE"), + + /** + * The 'FEMALE' literal object. + * + * + * @see #FEMALE_VALUE + * @generated + * @ordered + */ + FEMALE(1, "FEMALE", "FEMALE"); + + /** + * The 'MALE' literal value. + * + *

+ * If the meaning of 'MALE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MALE + * @model + * @generated + * @ordered + */ + public static final int MALE_VALUE = 0; + + /** + * The 'FEMALE' literal value. + * + *

+ * If the meaning of 'FEMALE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FEMALE + * @model + * @generated + * @ordered + */ + public static final int FEMALE_VALUE = 1; + + /** + * An array of all the 'Sexe' enumerators. + * + * + * @generated + */ + private static final Sexe[] VALUES_ARRAY = + new Sexe[] { + MALE, + FEMALE, + }; + + /** + * A public read-only list of all the 'Sexe' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Sexe' literal with the specified literal value. + * + * + * @generated + */ + public static Sexe get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Sexe result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Sexe' literal with the specified name. + * + * + * @generated + */ + public static Sexe getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Sexe result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Sexe' literal with the specified integer value. + * + * + * @generated + */ + public static Sexe get(int value) { + switch (value) { + case MALE_VALUE: return MALE; + case FEMALE_VALUE: return FEMALE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Sexe(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Sexe diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/WealthyFamily.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/WealthyFamily.java new file mode 100755 index 0000000..7b5ed67 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/WealthyFamily.java @@ -0,0 +1,83 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family; + + +/** + * + * A representation of the model object 'Wealthy Family'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.family.WealthyFamily#getForbesRanking Forbes Ranking}
  • + *
+ *

+ * + * @see org.genivi.family.FamilyPackage#getWealthyFamily() + * @model + * @generated + */ +public interface WealthyFamily extends Family { + /** + * Returns the value of the 'Forbes Ranking' attribute. + * + *

+ * If the meaning of the 'Forbes Ranking' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Forbes Ranking' attribute. + * @see #isSetForbesRanking() + * @see #unsetForbesRanking() + * @see #setForbesRanking(int) + * @see org.genivi.family.FamilyPackage#getWealthyFamily_ForbesRanking() + * @model unsettable="true" + * @generated + */ + int getForbesRanking(); + + /** + * Sets the value of the '{@link org.genivi.family.WealthyFamily#getForbesRanking Forbes Ranking}' attribute. + * + * + * @param value the new value of the 'Forbes Ranking' attribute. + * @see #isSetForbesRanking() + * @see #unsetForbesRanking() + * @see #getForbesRanking() + * @generated + */ + void setForbesRanking(int value); + + /** + * Unsets the value of the '{@link org.genivi.family.WealthyFamily#getForbesRanking Forbes Ranking}' attribute. + * + * + * @see #isSetForbesRanking() + * @see #getForbesRanking() + * @see #setForbesRanking(int) + * @generated + */ + void unsetForbesRanking(); + + /** + * Returns whether the value of the '{@link org.genivi.family.WealthyFamily#getForbesRanking Forbes Ranking}' attribute is set. + * + * + * @return whether the value of the 'Forbes Ranking' attribute is set. + * @see #unsetForbesRanking() + * @see #getForbesRanking() + * @see #setForbesRanking(int) + * @generated + */ + boolean isSetForbesRanking(); + +} // WealthyFamily diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/AddressImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/AddressImpl.java new file mode 100755 index 0000000..8b1e40e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/AddressImpl.java @@ -0,0 +1,204 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.family.Address; +import org.genivi.family.FamilyPackage; + +/** + * + * An implementation of the model object 'Address'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.family.impl.AddressImpl#getStreet Street}
  • + *
+ *

+ * + * @generated + */ +public class AddressImpl extends EObjectImpl implements Address { + /** + * The default value of the '{@link #getStreet() Street}' attribute. + * + * + * @see #getStreet() + * @generated + * @ordered + */ + protected static final String STREET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStreet() Street}' attribute. + * + * + * @see #getStreet() + * @generated + * @ordered + */ + protected String street = STREET_EDEFAULT; + + /** + * This is true if the Street attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean streetESet; + + /** + * + * + * @generated + */ + protected AddressImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FamilyPackage.Literals.ADDRESS; + } + + /** + * + * + * @generated + */ + public String getStreet() { + return street; + } + + /** + * + * + * @generated + */ + public void setStreet(String newStreet) { + String oldStreet = street; + street = newStreet; + boolean oldStreetESet = streetESet; + streetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.ADDRESS__STREET, oldStreet, street, !oldStreetESet)); + } + + /** + * + * + * @generated + */ + public void unsetStreet() { + String oldStreet = street; + boolean oldStreetESet = streetESet; + street = STREET_EDEFAULT; + streetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.ADDRESS__STREET, oldStreet, STREET_EDEFAULT, oldStreetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetStreet() { + return streetESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FamilyPackage.ADDRESS__STREET: + return getStreet(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FamilyPackage.ADDRESS__STREET: + setStreet((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FamilyPackage.ADDRESS__STREET: + unsetStreet(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FamilyPackage.ADDRESS__STREET: + return isSetStreet(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (street: "); + if (streetESet) result.append(street); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //AddressImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/CarImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/CarImpl.java new file mode 100755 index 0000000..c465489 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/CarImpl.java @@ -0,0 +1,204 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.family.Car; +import org.genivi.family.FamilyPackage; + +/** + * + * An implementation of the model object 'Car'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.family.impl.CarImpl#getNumberOfSeats Number Of Seats}
  • + *
+ *

+ * + * @generated + */ +public class CarImpl extends EObjectImpl implements Car { + /** + * The default value of the '{@link #getNumberOfSeats() Number Of Seats}' attribute. + * + * + * @see #getNumberOfSeats() + * @generated + * @ordered + */ + protected static final Integer NUMBER_OF_SEATS_EDEFAULT = null; + + /** + * The cached value of the '{@link #getNumberOfSeats() Number Of Seats}' attribute. + * + * + * @see #getNumberOfSeats() + * @generated + * @ordered + */ + protected Integer numberOfSeats = NUMBER_OF_SEATS_EDEFAULT; + + /** + * This is true if the Number Of Seats attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean numberOfSeatsESet; + + /** + * + * + * @generated + */ + protected CarImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FamilyPackage.Literals.CAR; + } + + /** + * + * + * @generated + */ + public Integer getNumberOfSeats() { + return numberOfSeats; + } + + /** + * + * + * @generated + */ + public void setNumberOfSeats(Integer newNumberOfSeats) { + Integer oldNumberOfSeats = numberOfSeats; + numberOfSeats = newNumberOfSeats; + boolean oldNumberOfSeatsESet = numberOfSeatsESet; + numberOfSeatsESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.CAR__NUMBER_OF_SEATS, oldNumberOfSeats, numberOfSeats, !oldNumberOfSeatsESet)); + } + + /** + * + * + * @generated + */ + public void unsetNumberOfSeats() { + Integer oldNumberOfSeats = numberOfSeats; + boolean oldNumberOfSeatsESet = numberOfSeatsESet; + numberOfSeats = NUMBER_OF_SEATS_EDEFAULT; + numberOfSeatsESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.CAR__NUMBER_OF_SEATS, oldNumberOfSeats, NUMBER_OF_SEATS_EDEFAULT, oldNumberOfSeatsESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNumberOfSeats() { + return numberOfSeatsESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FamilyPackage.CAR__NUMBER_OF_SEATS: + return getNumberOfSeats(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FamilyPackage.CAR__NUMBER_OF_SEATS: + setNumberOfSeats((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FamilyPackage.CAR__NUMBER_OF_SEATS: + unsetNumberOfSeats(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FamilyPackage.CAR__NUMBER_OF_SEATS: + return isSetNumberOfSeats(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (numberOfSeats: "); + if (numberOfSeatsESet) result.append(numberOfSeats); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //CarImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyFactoryImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyFactoryImpl.java new file mode 100755 index 0000000..a6ec37d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyFactoryImpl.java @@ -0,0 +1,197 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.family.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class FamilyFactoryImpl extends EFactoryImpl implements FamilyFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static FamilyFactory init() { + try { + FamilyFactory theFamilyFactory = (FamilyFactory)EPackage.Registry.INSTANCE.getEFactory(FamilyPackage.eNS_URI); + if (theFamilyFactory != null) { + return theFamilyFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new FamilyFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public FamilyFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case FamilyPackage.FAMILY: return createFamily(); + case FamilyPackage.PERSON: return createPerson(); + case FamilyPackage.CAR: return createCar(); + case FamilyPackage.ADDRESS: return createAddress(); + case FamilyPackage.WEALTHY_FAMILY: return createWealthyFamily(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case FamilyPackage.SEXE: + return createSexeFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case FamilyPackage.SEXE: + return convertSexeToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public Family createFamily() { + FamilyImpl family = new FamilyImpl(); + return family; + } + + /** + * + * + * @generated + */ + public Person createPerson() { + PersonImpl person = new PersonImpl(); + return person; + } + + /** + * + * + * @generated + */ + public Car createCar() { + CarImpl car = new CarImpl(); + return car; + } + + /** + * + * + * @generated + */ + public Address createAddress() { + AddressImpl address = new AddressImpl(); + return address; + } + + /** + * + * + * @generated + */ + public WealthyFamily createWealthyFamily() { + WealthyFamilyImpl wealthyFamily = new WealthyFamilyImpl(); + return wealthyFamily; + } + + /** + * + * + * @generated + */ + public Sexe createSexeFromString(EDataType eDataType, String initialValue) { + Sexe result = Sexe.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertSexeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public FamilyPackage getFamilyPackage() { + return (FamilyPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static FamilyPackage getPackage() { + return FamilyPackage.eINSTANCE; + } + +} //FamilyFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyImpl.java new file mode 100755 index 0000000..c1b027c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyImpl.java @@ -0,0 +1,604 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.family.Address; +import org.genivi.family.Family; +import org.genivi.family.FamilyPackage; +import org.genivi.family.Person; + +/** + * + * An implementation of the model object 'Family'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.family.impl.FamilyImpl#getMembers Members}
  • + *
  • {@link org.genivi.family.impl.FamilyImpl#getSurname Surname}
  • + *
  • {@link org.genivi.family.impl.FamilyImpl#getNumberOfPets Number Of Pets}
  • + *
  • {@link org.genivi.family.impl.FamilyImpl#isHasASwimmingPool Has ASwimming Pool}
  • + *
  • {@link org.genivi.family.impl.FamilyImpl#getAddress Address}
  • + *
  • {@link org.genivi.family.impl.FamilyImpl#getFavoriteHolidayDestinations Favorite Holiday Destinations}
  • + *
+ *

+ * + * @generated + */ +public class FamilyImpl extends EObjectImpl implements Family { + /** + * The cached value of the '{@link #getMembers() Members}' containment reference list. + * + * + * @see #getMembers() + * @generated + * @ordered + */ + protected EList members; + + /** + * The default value of the '{@link #getSurname() Surname}' attribute. + * + * + * @see #getSurname() + * @generated + * @ordered + */ + protected static final String SURNAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSurname() Surname}' attribute. + * + * + * @see #getSurname() + * @generated + * @ordered + */ + protected String surname = SURNAME_EDEFAULT; + + /** + * This is true if the Surname attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean surnameESet; + + /** + * The default value of the '{@link #getNumberOfPets() Number Of Pets}' attribute. + * + * + * @see #getNumberOfPets() + * @generated + * @ordered + */ + protected static final int NUMBER_OF_PETS_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getNumberOfPets() Number Of Pets}' attribute. + * + * + * @see #getNumberOfPets() + * @generated + * @ordered + */ + protected int numberOfPets = NUMBER_OF_PETS_EDEFAULT; + + /** + * This is true if the Number Of Pets attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean numberOfPetsESet; + + /** + * The default value of the '{@link #isHasASwimmingPool() Has ASwimming Pool}' attribute. + * + * + * @see #isHasASwimmingPool() + * @generated + * @ordered + */ + protected static final boolean HAS_ASWIMMING_POOL_EDEFAULT = false; + + /** + * The cached value of the '{@link #isHasASwimmingPool() Has ASwimming Pool}' attribute. + * + * + * @see #isHasASwimmingPool() + * @generated + * @ordered + */ + protected boolean hasASwimmingPool = HAS_ASWIMMING_POOL_EDEFAULT; + + /** + * This is true if the Has ASwimming Pool attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean hasASwimmingPoolESet; + + /** + * The cached value of the '{@link #getAddress() Address}' containment reference. + * + * + * @see #getAddress() + * @generated + * @ordered + */ + protected Address address; + + /** + * This is true if the Address containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean addressESet; + + /** + * The cached value of the '{@link #getFavoriteHolidayDestinations() Favorite Holiday Destinations}' attribute list. + * + * + * @see #getFavoriteHolidayDestinations() + * @generated + * @ordered + */ + protected EList favoriteHolidayDestinations; + + /** + * + * + * @generated + */ + protected FamilyImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FamilyPackage.Literals.FAMILY; + } + + /** + * + * + * @generated + */ + public EList getMembers() { + if (members == null) { + members = new EObjectContainmentEList(Person.class, this, FamilyPackage.FAMILY__MEMBERS); + } + return members; + } + + /** + * + * + * @generated + */ + public String getSurname() { + return surname; + } + + /** + * + * + * @generated + */ + public void setSurname(String newSurname) { + String oldSurname = surname; + surname = newSurname; + boolean oldSurnameESet = surnameESet; + surnameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.FAMILY__SURNAME, oldSurname, surname, !oldSurnameESet)); + } + + /** + * + * + * @generated + */ + public void unsetSurname() { + String oldSurname = surname; + boolean oldSurnameESet = surnameESet; + surname = SURNAME_EDEFAULT; + surnameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.FAMILY__SURNAME, oldSurname, SURNAME_EDEFAULT, oldSurnameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSurname() { + return surnameESet; + } + + /** + * + * + * @generated + */ + public int getNumberOfPets() { + return numberOfPets; + } + + /** + * + * + * @generated + */ + public void setNumberOfPets(int newNumberOfPets) { + int oldNumberOfPets = numberOfPets; + numberOfPets = newNumberOfPets; + boolean oldNumberOfPetsESet = numberOfPetsESet; + numberOfPetsESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.FAMILY__NUMBER_OF_PETS, oldNumberOfPets, numberOfPets, !oldNumberOfPetsESet)); + } + + /** + * + * + * @generated + */ + public void unsetNumberOfPets() { + int oldNumberOfPets = numberOfPets; + boolean oldNumberOfPetsESet = numberOfPetsESet; + numberOfPets = NUMBER_OF_PETS_EDEFAULT; + numberOfPetsESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.FAMILY__NUMBER_OF_PETS, oldNumberOfPets, NUMBER_OF_PETS_EDEFAULT, oldNumberOfPetsESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNumberOfPets() { + return numberOfPetsESet; + } + + /** + * + * + * @generated + */ + public boolean isHasASwimmingPool() { + return hasASwimmingPool; + } + + /** + * + * + * @generated + */ + public void setHasASwimmingPool(boolean newHasASwimmingPool) { + boolean oldHasASwimmingPool = hasASwimmingPool; + hasASwimmingPool = newHasASwimmingPool; + boolean oldHasASwimmingPoolESet = hasASwimmingPoolESet; + hasASwimmingPoolESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.FAMILY__HAS_ASWIMMING_POOL, oldHasASwimmingPool, hasASwimmingPool, !oldHasASwimmingPoolESet)); + } + + /** + * + * + * @generated + */ + public void unsetHasASwimmingPool() { + boolean oldHasASwimmingPool = hasASwimmingPool; + boolean oldHasASwimmingPoolESet = hasASwimmingPoolESet; + hasASwimmingPool = HAS_ASWIMMING_POOL_EDEFAULT; + hasASwimmingPoolESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.FAMILY__HAS_ASWIMMING_POOL, oldHasASwimmingPool, HAS_ASWIMMING_POOL_EDEFAULT, oldHasASwimmingPoolESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetHasASwimmingPool() { + return hasASwimmingPoolESet; + } + + /** + * + * + * @generated + */ + public Address getAddress() { + return address; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetAddress(Address newAddress, NotificationChain msgs) { + Address oldAddress = address; + address = newAddress; + boolean oldAddressESet = addressESet; + addressESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FamilyPackage.FAMILY__ADDRESS, oldAddress, newAddress, !oldAddressESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setAddress(Address newAddress) { + if (newAddress != address) { + NotificationChain msgs = null; + if (address != null) + msgs = ((InternalEObject)address).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FamilyPackage.FAMILY__ADDRESS, null, msgs); + if (newAddress != null) + msgs = ((InternalEObject)newAddress).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FamilyPackage.FAMILY__ADDRESS, null, msgs); + msgs = basicSetAddress(newAddress, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAddressESet = addressESet; + addressESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.FAMILY__ADDRESS, newAddress, newAddress, !oldAddressESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetAddress(NotificationChain msgs) { + Address oldAddress = address; + address = null; + boolean oldAddressESet = addressESet; + addressESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, FamilyPackage.FAMILY__ADDRESS, oldAddress, null, oldAddressESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetAddress() { + if (address != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)address).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FamilyPackage.FAMILY__ADDRESS, null, msgs); + msgs = basicUnsetAddress(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldAddressESet = addressESet; + addressESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.FAMILY__ADDRESS, null, null, oldAddressESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetAddress() { + return addressESet; + } + + /** + * + * + * @generated + */ + public EList getFavoriteHolidayDestinations() { + if (favoriteHolidayDestinations == null) { + favoriteHolidayDestinations = new EDataTypeUniqueEList(String.class, this, FamilyPackage.FAMILY__FAVORITE_HOLIDAY_DESTINATIONS); + } + return favoriteHolidayDestinations; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FamilyPackage.FAMILY__MEMBERS: + return ((InternalEList)getMembers()).basicRemove(otherEnd, msgs); + case FamilyPackage.FAMILY__ADDRESS: + return basicUnsetAddress(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FamilyPackage.FAMILY__MEMBERS: + return getMembers(); + case FamilyPackage.FAMILY__SURNAME: + return getSurname(); + case FamilyPackage.FAMILY__NUMBER_OF_PETS: + return getNumberOfPets(); + case FamilyPackage.FAMILY__HAS_ASWIMMING_POOL: + return isHasASwimmingPool(); + case FamilyPackage.FAMILY__ADDRESS: + return getAddress(); + case FamilyPackage.FAMILY__FAVORITE_HOLIDAY_DESTINATIONS: + return getFavoriteHolidayDestinations(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FamilyPackage.FAMILY__MEMBERS: + getMembers().clear(); + getMembers().addAll((Collection)newValue); + return; + case FamilyPackage.FAMILY__SURNAME: + setSurname((String)newValue); + return; + case FamilyPackage.FAMILY__NUMBER_OF_PETS: + setNumberOfPets((Integer)newValue); + return; + case FamilyPackage.FAMILY__HAS_ASWIMMING_POOL: + setHasASwimmingPool((Boolean)newValue); + return; + case FamilyPackage.FAMILY__ADDRESS: + setAddress((Address)newValue); + return; + case FamilyPackage.FAMILY__FAVORITE_HOLIDAY_DESTINATIONS: + getFavoriteHolidayDestinations().clear(); + getFavoriteHolidayDestinations().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FamilyPackage.FAMILY__MEMBERS: + getMembers().clear(); + return; + case FamilyPackage.FAMILY__SURNAME: + unsetSurname(); + return; + case FamilyPackage.FAMILY__NUMBER_OF_PETS: + unsetNumberOfPets(); + return; + case FamilyPackage.FAMILY__HAS_ASWIMMING_POOL: + unsetHasASwimmingPool(); + return; + case FamilyPackage.FAMILY__ADDRESS: + unsetAddress(); + return; + case FamilyPackage.FAMILY__FAVORITE_HOLIDAY_DESTINATIONS: + getFavoriteHolidayDestinations().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FamilyPackage.FAMILY__MEMBERS: + return members != null && !members.isEmpty(); + case FamilyPackage.FAMILY__SURNAME: + return isSetSurname(); + case FamilyPackage.FAMILY__NUMBER_OF_PETS: + return isSetNumberOfPets(); + case FamilyPackage.FAMILY__HAS_ASWIMMING_POOL: + return isSetHasASwimmingPool(); + case FamilyPackage.FAMILY__ADDRESS: + return isSetAddress(); + case FamilyPackage.FAMILY__FAVORITE_HOLIDAY_DESTINATIONS: + return favoriteHolidayDestinations != null && !favoriteHolidayDestinations.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (surname: "); + if (surnameESet) result.append(surname); else result.append(""); + result.append(", numberOfPets: "); + if (numberOfPetsESet) result.append(numberOfPets); else result.append(""); + result.append(", hasASwimmingPool: "); + if (hasASwimmingPoolESet) result.append(hasASwimmingPool); else result.append(""); + result.append(", favoriteHolidayDestinations: "); + result.append(favoriteHolidayDestinations); + result.append(')'); + return result.toString(); + } + +} //FamilyImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyPackageImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyPackageImpl.java new file mode 100755 index 0000000..41cd05e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/FamilyPackageImpl.java @@ -0,0 +1,437 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.family.Address; +import org.genivi.family.Car; +import org.genivi.family.Family; +import org.genivi.family.FamilyFactory; +import org.genivi.family.FamilyPackage; +import org.genivi.family.Person; +import org.genivi.family.Sexe; +import org.genivi.family.WealthyFamily; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class FamilyPackageImpl extends EPackageImpl implements FamilyPackage { + /** + * + * + * @generated + */ + private EClass familyEClass = null; + + /** + * + * + * @generated + */ + private EClass personEClass = null; + + /** + * + * + * @generated + */ + private EClass carEClass = null; + + /** + * + * + * @generated + */ + private EClass addressEClass = null; + + /** + * + * + * @generated + */ + private EClass wealthyFamilyEClass = null; + + /** + * + * + * @generated + */ + private EEnum sexeEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.family.FamilyPackage#eNS_URI + * @see #init() + * @generated + */ + private FamilyPackageImpl() { + super(eNS_URI, FamilyFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link FamilyPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static FamilyPackage init() { + if (isInited) return (FamilyPackage)EPackage.Registry.INSTANCE.getEPackage(FamilyPackage.eNS_URI); + + // Obtain or create and register package + FamilyPackageImpl theFamilyPackage = (FamilyPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FamilyPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FamilyPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theFamilyPackage.createPackageContents(); + + // Initialize created meta-data + theFamilyPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theFamilyPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(FamilyPackage.eNS_URI, theFamilyPackage); + return theFamilyPackage; + } + + /** + * + * + * @generated + */ + public EClass getFamily() { + return familyEClass; + } + + /** + * + * + * @generated + */ + public EReference getFamily_Members() { + return (EReference)familyEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getFamily_Surname() { + return (EAttribute)familyEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getFamily_NumberOfPets() { + return (EAttribute)familyEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getFamily_HasASwimmingPool() { + return (EAttribute)familyEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getFamily_Address() { + return (EReference)familyEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getFamily_FavoriteHolidayDestinations() { + return (EAttribute)familyEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EClass getPerson() { + return personEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getPerson_FirstName() { + return (EAttribute)personEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getPerson_Sexe() { + return (EAttribute)personEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getPerson_OwnedCars() { + return (EReference)personEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getCar() { + return carEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getCar_NumberOfSeats() { + return (EAttribute)carEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getAddress() { + return addressEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getAddress_Street() { + return (EAttribute)addressEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getWealthyFamily() { + return wealthyFamilyEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getWealthyFamily_ForbesRanking() { + return (EAttribute)wealthyFamilyEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EEnum getSexe() { + return sexeEEnum; + } + + /** + * + * + * @generated + */ + public FamilyFactory getFamilyFactory() { + return (FamilyFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + familyEClass = createEClass(FAMILY); + createEReference(familyEClass, FAMILY__MEMBERS); + createEAttribute(familyEClass, FAMILY__SURNAME); + createEAttribute(familyEClass, FAMILY__NUMBER_OF_PETS); + createEAttribute(familyEClass, FAMILY__HAS_ASWIMMING_POOL); + createEReference(familyEClass, FAMILY__ADDRESS); + createEAttribute(familyEClass, FAMILY__FAVORITE_HOLIDAY_DESTINATIONS); + + personEClass = createEClass(PERSON); + createEAttribute(personEClass, PERSON__FIRST_NAME); + createEAttribute(personEClass, PERSON__SEXE); + createEReference(personEClass, PERSON__OWNED_CARS); + + carEClass = createEClass(CAR); + createEAttribute(carEClass, CAR__NUMBER_OF_SEATS); + + addressEClass = createEClass(ADDRESS); + createEAttribute(addressEClass, ADDRESS__STREET); + + wealthyFamilyEClass = createEClass(WEALTHY_FAMILY); + createEAttribute(wealthyFamilyEClass, WEALTHY_FAMILY__FORBES_RANKING); + + // Create enums + sexeEEnum = createEEnum(SEXE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + wealthyFamilyEClass.getESuperTypes().add(this.getFamily()); + + // Initialize classes and features; add operations and parameters + initEClass(familyEClass, Family.class, "Family", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getFamily_Members(), this.getPerson(), null, "members", null, 1, -1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFamily_Surname(), ecorePackage.getEString(), "surname", null, 1, 1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFamily_NumberOfPets(), ecorePackage.getEInt(), "numberOfPets", null, 0, 1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFamily_HasASwimmingPool(), ecorePackage.getEBoolean(), "hasASwimmingPool", null, 0, 1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getFamily_Address(), this.getAddress(), null, "address", null, 0, 1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFamily_FavoriteHolidayDestinations(), ecorePackage.getEString(), "favoriteHolidayDestinations", null, 0, -1, Family.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(personEClass, Person.class, "Person", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getPerson_FirstName(), ecorePackage.getEString(), "firstName", null, 1, 1, Person.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getPerson_Sexe(), this.getSexe(), "sexe", null, 1, 1, Person.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getPerson_OwnedCars(), this.getCar(), null, "ownedCars", null, 0, -1, Person.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(carEClass, Car.class, "Car", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCar_NumberOfSeats(), ecorePackage.getEIntegerObject(), "numberOfSeats", null, 0, 1, Car.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(addressEClass, Address.class, "Address", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getAddress_Street(), ecorePackage.getEString(), "street", null, 0, 1, Address.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(wealthyFamilyEClass, WealthyFamily.class, "WealthyFamily", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getWealthyFamily_ForbesRanking(), ecorePackage.getEInt(), "forbesRanking", null, 0, 1, WealthyFamily.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(sexeEEnum, Sexe.class, "Sexe"); + addEEnumLiteral(sexeEEnum, Sexe.MALE); + addEEnumLiteral(sexeEEnum, Sexe.FEMALE); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //FamilyPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/PersonImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/PersonImpl.java new file mode 100755 index 0000000..66002c6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/PersonImpl.java @@ -0,0 +1,352 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.family.Car; +import org.genivi.family.FamilyPackage; +import org.genivi.family.Person; +import org.genivi.family.Sexe; + +/** + * + * An implementation of the model object 'Person'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.family.impl.PersonImpl#getFirstName First Name}
  • + *
  • {@link org.genivi.family.impl.PersonImpl#getSexe Sexe}
  • + *
  • {@link org.genivi.family.impl.PersonImpl#getOwnedCars Owned Cars}
  • + *
+ *

+ * + * @generated + */ +public class PersonImpl extends EObjectImpl implements Person { + /** + * The default value of the '{@link #getFirstName() First Name}' attribute. + * + * + * @see #getFirstName() + * @generated + * @ordered + */ + protected static final String FIRST_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFirstName() First Name}' attribute. + * + * + * @see #getFirstName() + * @generated + * @ordered + */ + protected String firstName = FIRST_NAME_EDEFAULT; + + /** + * This is true if the First Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean firstNameESet; + + /** + * The default value of the '{@link #getSexe() Sexe}' attribute. + * + * + * @see #getSexe() + * @generated + * @ordered + */ + protected static final Sexe SEXE_EDEFAULT = Sexe.MALE; + + /** + * The cached value of the '{@link #getSexe() Sexe}' attribute. + * + * + * @see #getSexe() + * @generated + * @ordered + */ + protected Sexe sexe = SEXE_EDEFAULT; + + /** + * This is true if the Sexe attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean sexeESet; + + /** + * The cached value of the '{@link #getOwnedCars() Owned Cars}' containment reference list. + * + * + * @see #getOwnedCars() + * @generated + * @ordered + */ + protected EList ownedCars; + + /** + * + * + * @generated + */ + protected PersonImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FamilyPackage.Literals.PERSON; + } + + /** + * + * + * @generated + */ + public String getFirstName() { + return firstName; + } + + /** + * + * + * @generated + */ + public void setFirstName(String newFirstName) { + String oldFirstName = firstName; + firstName = newFirstName; + boolean oldFirstNameESet = firstNameESet; + firstNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.PERSON__FIRST_NAME, oldFirstName, firstName, !oldFirstNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetFirstName() { + String oldFirstName = firstName; + boolean oldFirstNameESet = firstNameESet; + firstName = FIRST_NAME_EDEFAULT; + firstNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.PERSON__FIRST_NAME, oldFirstName, FIRST_NAME_EDEFAULT, oldFirstNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetFirstName() { + return firstNameESet; + } + + /** + * + * + * @generated + */ + public Sexe getSexe() { + return sexe; + } + + /** + * + * + * @generated + */ + public void setSexe(Sexe newSexe) { + Sexe oldSexe = sexe; + sexe = newSexe == null ? SEXE_EDEFAULT : newSexe; + boolean oldSexeESet = sexeESet; + sexeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.PERSON__SEXE, oldSexe, sexe, !oldSexeESet)); + } + + /** + * + * + * @generated + */ + public void unsetSexe() { + Sexe oldSexe = sexe; + boolean oldSexeESet = sexeESet; + sexe = SEXE_EDEFAULT; + sexeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.PERSON__SEXE, oldSexe, SEXE_EDEFAULT, oldSexeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSexe() { + return sexeESet; + } + + /** + * + * + * @generated + */ + public EList getOwnedCars() { + if (ownedCars == null) { + ownedCars = new EObjectContainmentEList(Car.class, this, FamilyPackage.PERSON__OWNED_CARS); + } + return ownedCars; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case FamilyPackage.PERSON__OWNED_CARS: + return ((InternalEList)getOwnedCars()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FamilyPackage.PERSON__FIRST_NAME: + return getFirstName(); + case FamilyPackage.PERSON__SEXE: + return getSexe(); + case FamilyPackage.PERSON__OWNED_CARS: + return getOwnedCars(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FamilyPackage.PERSON__FIRST_NAME: + setFirstName((String)newValue); + return; + case FamilyPackage.PERSON__SEXE: + setSexe((Sexe)newValue); + return; + case FamilyPackage.PERSON__OWNED_CARS: + getOwnedCars().clear(); + getOwnedCars().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FamilyPackage.PERSON__FIRST_NAME: + unsetFirstName(); + return; + case FamilyPackage.PERSON__SEXE: + unsetSexe(); + return; + case FamilyPackage.PERSON__OWNED_CARS: + getOwnedCars().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FamilyPackage.PERSON__FIRST_NAME: + return isSetFirstName(); + case FamilyPackage.PERSON__SEXE: + return isSetSexe(); + case FamilyPackage.PERSON__OWNED_CARS: + return ownedCars != null && !ownedCars.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (firstName: "); + if (firstNameESet) result.append(firstName); else result.append(""); + result.append(", sexe: "); + if (sexeESet) result.append(sexe); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //PersonImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/WealthyFamilyImpl.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/WealthyFamilyImpl.java new file mode 100755 index 0000000..5bbb0ef --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/impl/WealthyFamilyImpl.java @@ -0,0 +1,200 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.family.FamilyPackage; +import org.genivi.family.WealthyFamily; + +/** + * + * An implementation of the model object 'Wealthy Family'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.family.impl.WealthyFamilyImpl#getForbesRanking Forbes Ranking}
  • + *
+ *

+ * + * @generated + */ +public class WealthyFamilyImpl extends FamilyImpl implements WealthyFamily { + /** + * The default value of the '{@link #getForbesRanking() Forbes Ranking}' attribute. + * + * + * @see #getForbesRanking() + * @generated + * @ordered + */ + protected static final int FORBES_RANKING_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getForbesRanking() Forbes Ranking}' attribute. + * + * + * @see #getForbesRanking() + * @generated + * @ordered + */ + protected int forbesRanking = FORBES_RANKING_EDEFAULT; + + /** + * This is true if the Forbes Ranking attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean forbesRankingESet; + + /** + * + * + * @generated + */ + protected WealthyFamilyImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return FamilyPackage.Literals.WEALTHY_FAMILY; + } + + /** + * + * + * @generated + */ + public int getForbesRanking() { + return forbesRanking; + } + + /** + * + * + * @generated + */ + public void setForbesRanking(int newForbesRanking) { + int oldForbesRanking = forbesRanking; + forbesRanking = newForbesRanking; + boolean oldForbesRankingESet = forbesRankingESet; + forbesRankingESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING, oldForbesRanking, forbesRanking, !oldForbesRankingESet)); + } + + /** + * + * + * @generated + */ + public void unsetForbesRanking() { + int oldForbesRanking = forbesRanking; + boolean oldForbesRankingESet = forbesRankingESet; + forbesRanking = FORBES_RANKING_EDEFAULT; + forbesRankingESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING, oldForbesRanking, FORBES_RANKING_EDEFAULT, oldForbesRankingESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetForbesRanking() { + return forbesRankingESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING: + return getForbesRanking(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING: + setForbesRanking((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING: + unsetForbesRanking(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case FamilyPackage.WEALTHY_FAMILY__FORBES_RANKING: + return isSetForbesRanking(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (forbesRanking: "); + if (forbesRankingESet) result.append(forbesRanking); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //WealthyFamilyImpl diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilyAdapterFactory.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilyAdapterFactory.java new file mode 100755 index 0000000..be65e1f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilyAdapterFactory.java @@ -0,0 +1,199 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.family.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.family.FamilyPackage + * @generated + */ +public class FamilyAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static FamilyPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public FamilyAdapterFactory() { + if (modelPackage == null) { + modelPackage = FamilyPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected FamilySwitch modelSwitch = + new FamilySwitch() { + @Override + public Adapter caseFamily(Family object) { + return createFamilyAdapter(); + } + @Override + public Adapter casePerson(Person object) { + return createPersonAdapter(); + } + @Override + public Adapter caseCar(Car object) { + return createCarAdapter(); + } + @Override + public Adapter caseAddress(Address object) { + return createAddressAdapter(); + } + @Override + public Adapter caseWealthyFamily(WealthyFamily object) { + return createWealthyFamilyAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.family.Family Family}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.family.Family + * @generated + */ + public Adapter createFamilyAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.family.Person Person}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.family.Person + * @generated + */ + public Adapter createPersonAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.family.Car Car}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.family.Car + * @generated + */ + public Adapter createCarAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.family.Address Address}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.family.Address + * @generated + */ + public Adapter createAddressAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.family.WealthyFamily Wealthy Family}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.family.WealthyFamily + * @generated + */ + public Adapter createWealthyFamilyAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //FamilyAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilySwitch.java b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilySwitch.java new file mode 100755 index 0000000..46a6949 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.booleanexpr-model/src/test/java/org/genivi/family/util/FamilySwitch.java @@ -0,0 +1,202 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.family.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.family.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.family.FamilyPackage + * @generated + */ +public class FamilySwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static FamilyPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public FamilySwitch() { + if (modelPackage == null) { + modelPackage = FamilyPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case FamilyPackage.FAMILY: { + Family family = (Family)theEObject; + T result = caseFamily(family); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FamilyPackage.PERSON: { + Person person = (Person)theEObject; + T result = casePerson(person); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FamilyPackage.CAR: { + Car car = (Car)theEObject; + T result = caseCar(car); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FamilyPackage.ADDRESS: { + Address address = (Address)theEObject; + T result = caseAddress(address); + if (result == null) result = defaultCase(theEObject); + return result; + } + case FamilyPackage.WEALTHY_FAMILY: { + WealthyFamily wealthyFamily = (WealthyFamily)theEObject; + T result = caseWealthyFamily(wealthyFamily); + if (result == null) result = caseFamily(wealthyFamily); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Family'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Family'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFamily(Family object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Person'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Person'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T casePerson(Person object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Car'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Car'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCar(Car object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Address'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Address'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAddress(Address object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Wealthy Family'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Wealthy Family'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseWealthyFamily(WealthyFamily object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //FamilySwitch diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/.classpath b/src/traffic-incidents-service/org.genivi.iconset-model/.classpath new file mode 100755 index 0000000..1bf6a1d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/.project b/src/traffic-incidents-service/org.genivi.iconset-model/.project new file mode 100755 index 0000000..990cebd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/.project @@ -0,0 +1,21 @@ + + + org.genivi.iconset-model + This project contains the model for the GENIVI IconSet. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.iconset-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..dece26a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.iconset-model;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.iconset, + org.genivi.iconset.impl, + org.genivi.iconset.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.iconset-model/ReadMe.confluence new file mode 100755 index 0000000..50818ef --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/ReadMe.confluence @@ -0,0 +1,5 @@ +This project defines an Icon Set. +Icon Sets are used in the TrafficIncidents interface, but can also be used in other locations where icons are used. +Detailed information can be found in the "GENIVI TrafficIncidentsService Component Specification". + +IconSet.ecorediag, in de model folder, provides a good overview of the structure of an Icon Set. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/build.properties b/src/traffic-incidents-service/org.genivi.iconset-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecore b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecore new file mode 100755 index 0000000..7f719b4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecore @@ -0,0 +1,67 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecorediag b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecorediag new file mode 100755 index 0000000..83d72e8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.ecorediag @@ -0,0 +1,260 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.genmodel b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.genmodel new file mode 100755 index 0000000..ee8d66f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/model/IconSet.genmodel @@ -0,0 +1,53 @@ + + + IconSet.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/plugin.properties b/src/traffic-incidents-service/org.genivi.iconset-model/plugin.properties new file mode 100755 index 0000000..dc0a984 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = IconSet Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/plugin.xml b/src/traffic-incidents-service/org.genivi.iconset-model/plugin.xml new file mode 100755 index 0000000..adf2832 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/plugin.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/pom.xml b/src/traffic-incidents-service/org.genivi.iconset-model/pom.xml new file mode 100755 index 0000000..6bd970f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + org.genivi + iconset-model + jar + 1.0-SNAPSHOT + GENIVI IconSet model + This project contains the model for the GENIVI IconSet. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/ColorType.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/ColorType.java new file mode 100755 index 0000000..33c8c3a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/ColorType.java @@ -0,0 +1,323 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Color Type', + * and utility methods for working with them. + * + * @see org.genivi.iconset.IconsetPackage#getColorType() + * @model + * @generated + */ +public enum ColorType implements Enumerator { + /** + * The 'BLACK AND WHITE' literal object. + * + * + * @see #BLACK_AND_WHITE_VALUE + * @generated + * @ordered + */ + BLACK_AND_WHITE(1, "BLACK_AND_WHITE", "BLACK_AND_WHITE"), + + /** + * The 'GRAY 4' literal object. + * + * + * @see #GRAY_4_VALUE + * @generated + * @ordered + */ + GRAY_4(2, "GRAY_4", "GRAY_4"), + + /** + * The 'GRAY 8' literal object. + * + * + * @see #GRAY_8_VALUE + * @generated + * @ordered + */ + GRAY_8(3, "GRAY_8", "GRAY_8"), + + /** + * The 'RGB555' literal object. + * + * + * @see #RGB555_VALUE + * @generated + * @ordered + */ + RGB555(4, "RGB555", "RGB555"), + + /** + * The 'RGB565' literal object. + * + * + * @see #RGB565_VALUE + * @generated + * @ordered + */ + RGB565(5, "RGB565", "RGB565"), + + /** + * The 'RGB888' literal object. + * + * + * @see #RGB888_VALUE + * @generated + * @ordered + */ + RGB888(6, "RGB888", "RGB888"); + + /** + * The 'BLACK AND WHITE' literal value. + * + *

+ * If the meaning of 'BLACK AND WHITE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BLACK_AND_WHITE + * @model + * @generated + * @ordered + */ + public static final int BLACK_AND_WHITE_VALUE = 1; + + /** + * The 'GRAY 4' literal value. + * + *

+ * If the meaning of 'GRAY 4' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GRAY_4 + * @model + * @generated + * @ordered + */ + public static final int GRAY_4_VALUE = 2; + + /** + * The 'GRAY 8' literal value. + * + *

+ * If the meaning of 'GRAY 8' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GRAY_8 + * @model + * @generated + * @ordered + */ + public static final int GRAY_8_VALUE = 3; + + /** + * The 'RGB555' literal value. + * + *

+ * If the meaning of 'RGB555' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RGB555 + * @model + * @generated + * @ordered + */ + public static final int RGB555_VALUE = 4; + + /** + * The 'RGB565' literal value. + * + *

+ * If the meaning of 'RGB565' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RGB565 + * @model + * @generated + * @ordered + */ + public static final int RGB565_VALUE = 5; + + /** + * The 'RGB888' literal value. + * + *

+ * If the meaning of 'RGB888' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RGB888 + * @model + * @generated + * @ordered + */ + public static final int RGB888_VALUE = 6; + + /** + * An array of all the 'Color Type' enumerators. + * + * + * @generated + */ + private static final ColorType[] VALUES_ARRAY = + new ColorType[] { + BLACK_AND_WHITE, + GRAY_4, + GRAY_8, + RGB555, + RGB565, + RGB888, + }; + + /** + * A public read-only list of all the 'Color Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Color Type' literal with the specified literal value. + * + * + * @generated + */ + public static ColorType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ColorType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Color Type' literal with the specified name. + * + * + * @generated + */ + public static ColorType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ColorType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Color Type' literal with the specified integer value. + * + * + * @generated + */ + public static ColorType get(int value) { + switch (value) { + case BLACK_AND_WHITE_VALUE: return BLACK_AND_WHITE; + case GRAY_4_VALUE: return GRAY_4; + case GRAY_8_VALUE: return GRAY_8; + case RGB555_VALUE: return RGB555; + case RGB565_VALUE: return RGB565; + case RGB888_VALUE: return RGB888; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ColorType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ColorType diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconData.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconData.java new file mode 100755 index 0000000..07b4002 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconData.java @@ -0,0 +1,84 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Data'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconData#getData Data}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconData() + * @model + * @generated + */ +public interface IconData extends EObject { + /** + * Returns the value of the 'Data' attribute. + * + *

+ * If the meaning of the 'Data' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Data' attribute. + * @see #isSetData() + * @see #unsetData() + * @see #setData(byte[]) + * @see org.genivi.iconset.IconsetPackage#getIconData_Data() + * @model unsettable="true" + * @generated + */ + byte[] getData(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconData#getData Data}' attribute. + * + * + * @param value the new value of the 'Data' attribute. + * @see #isSetData() + * @see #unsetData() + * @see #getData() + * @generated + */ + void setData(byte[] value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconData#getData Data}' attribute. + * + * + * @see #isSetData() + * @see #getData() + * @see #setData(byte[]) + * @generated + */ + void unsetData(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconData#getData Data}' attribute is set. + * + * + * @return whether the value of the 'Data' attribute is set. + * @see #unsetData() + * @see #getData() + * @see #setData(byte[]) + * @generated + */ + boolean isSetData(); + +} // IconData diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDefinition.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDefinition.java new file mode 100755 index 0000000..7b98447 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDefinition.java @@ -0,0 +1,138 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Definition'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconDefinition#getIconInfo Icon Info}
  • + *
  • {@link org.genivi.iconset.IconDefinition#getIconData Icon Data}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconDefinition() + * @model + * @generated + */ +public interface IconDefinition extends EObject { + /** + * Returns the value of the 'Icon Info' containment reference. + * + *

+ * If the meaning of the 'Icon Info' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Info' containment reference. + * @see #isSetIconInfo() + * @see #unsetIconInfo() + * @see #setIconInfo(IconInfo) + * @see org.genivi.iconset.IconsetPackage#getIconDefinition_IconInfo() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + IconInfo getIconInfo(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconDefinition#getIconInfo Icon Info}' containment reference. + * + * + * @param value the new value of the 'Icon Info' containment reference. + * @see #isSetIconInfo() + * @see #unsetIconInfo() + * @see #getIconInfo() + * @generated + */ + void setIconInfo(IconInfo value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconDefinition#getIconInfo Icon Info}' containment reference. + * + * + * @see #isSetIconInfo() + * @see #getIconInfo() + * @see #setIconInfo(IconInfo) + * @generated + */ + void unsetIconInfo(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconDefinition#getIconInfo Icon Info}' containment reference is set. + * + * + * @return whether the value of the 'Icon Info' containment reference is set. + * @see #unsetIconInfo() + * @see #getIconInfo() + * @see #setIconInfo(IconInfo) + * @generated + */ + boolean isSetIconInfo(); + + /** + * Returns the value of the 'Icon Data' containment reference. + * + *

+ * If the meaning of the 'Icon Data' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Data' containment reference. + * @see #isSetIconData() + * @see #unsetIconData() + * @see #setIconData(IconData) + * @see org.genivi.iconset.IconsetPackage#getIconDefinition_IconData() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + IconData getIconData(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconDefinition#getIconData Icon Data}' containment reference. + * + * + * @param value the new value of the 'Icon Data' containment reference. + * @see #isSetIconData() + * @see #unsetIconData() + * @see #getIconData() + * @generated + */ + void setIconData(IconData value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconDefinition#getIconData Icon Data}' containment reference. + * + * + * @see #isSetIconData() + * @see #getIconData() + * @see #setIconData(IconData) + * @generated + */ + void unsetIconData(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconDefinition#getIconData Icon Data}' containment reference is set. + * + * + * @return whether the value of the 'Icon Data' containment reference is set. + * @see #unsetIconData() + * @see #getIconData() + * @see #setIconData(IconData) + * @generated + */ + boolean isSetIconData(); + +} // IconDefinition diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDescriptor.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDescriptor.java new file mode 100755 index 0000000..e028118 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDescriptor.java @@ -0,0 +1,138 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Descriptor'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconDescriptor#getUrl Url}
  • + *
  • {@link org.genivi.iconset.IconDescriptor#getIconId Icon Id}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconDescriptor() + * @model + * @generated + */ +public interface IconDescriptor extends EObject { + /** + * Returns the value of the 'Url' attribute. + * + *

+ * If the meaning of the 'Url' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Url' attribute. + * @see #isSetUrl() + * @see #unsetUrl() + * @see #setUrl(String) + * @see org.genivi.iconset.IconsetPackage#getIconDescriptor_Url() + * @model unsettable="true" + * @generated + */ + String getUrl(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconDescriptor#getUrl Url}' attribute. + * + * + * @param value the new value of the 'Url' attribute. + * @see #isSetUrl() + * @see #unsetUrl() + * @see #getUrl() + * @generated + */ + void setUrl(String value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconDescriptor#getUrl Url}' attribute. + * + * + * @see #isSetUrl() + * @see #getUrl() + * @see #setUrl(String) + * @generated + */ + void unsetUrl(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconDescriptor#getUrl Url}' attribute is set. + * + * + * @return whether the value of the 'Url' attribute is set. + * @see #unsetUrl() + * @see #getUrl() + * @see #setUrl(String) + * @generated + */ + boolean isSetUrl(); + + /** + * Returns the value of the 'Icon Id' attribute. + * + *

+ * If the meaning of the 'Icon Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Id' attribute. + * @see #isSetIconId() + * @see #unsetIconId() + * @see #setIconId(int) + * @see org.genivi.iconset.IconsetPackage#getIconDescriptor_IconId() + * @model unsettable="true" required="true" + * @generated + */ + int getIconId(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconDescriptor#getIconId Icon Id}' attribute. + * + * + * @param value the new value of the 'Icon Id' attribute. + * @see #isSetIconId() + * @see #unsetIconId() + * @see #getIconId() + * @generated + */ + void setIconId(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconDescriptor#getIconId Icon Id}' attribute. + * + * + * @see #isSetIconId() + * @see #getIconId() + * @see #setIconId(int) + * @generated + */ + void unsetIconId(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconDescriptor#getIconId Icon Id}' attribute is set. + * + * + * @return whether the value of the 'Icon Id' attribute is set. + * @see #unsetIconId() + * @see #getIconId() + * @see #setIconId(int) + * @generated + */ + boolean isSetIconId(); + +} // IconDescriptor diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDimension.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDimension.java new file mode 100755 index 0000000..567a13e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconDimension.java @@ -0,0 +1,215 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Icon Dimension', + * and utility methods for working with them. + * + * @see org.genivi.iconset.IconsetPackage#getIconDimension() + * @model + * @generated + */ +public enum IconDimension implements Enumerator { + /** + * The 'D2D' literal object. + * + * + * @see #D2D_VALUE + * @generated + * @ordered + */ + D2D(1, "D_2D", "D_2D"), + + /** + * The 'D25D' literal object. + * + * + * @see #D25D_VALUE + * @generated + * @ordered + */ + D25D(2, "D_2_5D", "D_2_5D"); + + /** + * The 'D2D' literal value. + * + *

+ * If the meaning of 'D2D' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #D2D + * @model name="D_2D" + * @generated + * @ordered + */ + public static final int D2D_VALUE = 1; + + /** + * The 'D25D' literal value. + * + *

+ * If the meaning of 'D25D' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #D25D + * @model name="D_2_5D" + * @generated + * @ordered + */ + public static final int D25D_VALUE = 2; + + /** + * An array of all the 'Icon Dimension' enumerators. + * + * + * @generated + */ + private static final IconDimension[] VALUES_ARRAY = + new IconDimension[] { + D2D, + D25D, + }; + + /** + * A public read-only list of all the 'Icon Dimension' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Icon Dimension' literal with the specified literal value. + * + * + * @generated + */ + public static IconDimension get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + IconDimension result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Icon Dimension' literal with the specified name. + * + * + * @generated + */ + public static IconDimension getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + IconDimension result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Icon Dimension' literal with the specified integer value. + * + * + * @generated + */ + public static IconDimension get(int value) { + switch (value) { + case D2D_VALUE: return D2D; + case D25D_VALUE: return D25D; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private IconDimension(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //IconDimension diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconInfo.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconInfo.java new file mode 100755 index 0000000..2af6314 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconInfo.java @@ -0,0 +1,138 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Info'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconInfo#getIconSetId Icon Set Id}
  • + *
  • {@link org.genivi.iconset.IconInfo#getIconId Icon Id}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconInfo() + * @model + * @generated + */ +public interface IconInfo extends EObject { + /** + * Returns the value of the 'Icon Set Id' attribute. + * + *

+ * If the meaning of the 'Icon Set Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Set Id' attribute. + * @see #isSetIconSetId() + * @see #unsetIconSetId() + * @see #setIconSetId(int) + * @see org.genivi.iconset.IconsetPackage#getIconInfo_IconSetId() + * @model unsettable="true" required="true" + * @generated + */ + int getIconSetId(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconInfo#getIconSetId Icon Set Id}' attribute. + * + * + * @param value the new value of the 'Icon Set Id' attribute. + * @see #isSetIconSetId() + * @see #unsetIconSetId() + * @see #getIconSetId() + * @generated + */ + void setIconSetId(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconInfo#getIconSetId Icon Set Id}' attribute. + * + * + * @see #isSetIconSetId() + * @see #getIconSetId() + * @see #setIconSetId(int) + * @generated + */ + void unsetIconSetId(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconInfo#getIconSetId Icon Set Id}' attribute is set. + * + * + * @return whether the value of the 'Icon Set Id' attribute is set. + * @see #unsetIconSetId() + * @see #getIconSetId() + * @see #setIconSetId(int) + * @generated + */ + boolean isSetIconSetId(); + + /** + * Returns the value of the 'Icon Id' attribute. + * + *

+ * If the meaning of the 'Icon Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Id' attribute. + * @see #isSetIconId() + * @see #unsetIconId() + * @see #setIconId(int) + * @see org.genivi.iconset.IconsetPackage#getIconInfo_IconId() + * @model unsettable="true" required="true" + * @generated + */ + int getIconId(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconInfo#getIconId Icon Id}' attribute. + * + * + * @param value the new value of the 'Icon Id' attribute. + * @see #isSetIconId() + * @see #unsetIconId() + * @see #getIconId() + * @generated + */ + void setIconId(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconInfo#getIconId Icon Id}' attribute. + * + * + * @see #isSetIconId() + * @see #getIconId() + * @see #setIconId(int) + * @generated + */ + void unsetIconId(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconInfo#getIconId Icon Id}' attribute is set. + * + * + * @return whether the value of the 'Icon Id' attribute is set. + * @see #unsetIconId() + * @see #getIconId() + * @see #setIconId(int) + * @generated + */ + boolean isSetIconId(); + +} // IconInfo diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSet.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSet.java new file mode 100755 index 0000000..6cc5741 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSet.java @@ -0,0 +1,456 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Set'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconSet#getIconSetId Icon Set Id}
  • + *
  • {@link org.genivi.iconset.IconSet#getColorType Color Type}
  • + *
  • {@link org.genivi.iconset.IconSet#getDimension Dimension}
  • + *
  • {@link org.genivi.iconset.IconSet#getSize Size}
  • + *
  • {@link org.genivi.iconset.IconSet#isDayTimeIcon Day Time Icon}
  • + *
  • {@link org.genivi.iconset.IconSet#getThemeId Theme Id}
  • + *
  • {@link org.genivi.iconset.IconSet#getMediumType Medium Type}
  • + *
  • {@link org.genivi.iconset.IconSet#getIconDescriptors Icon Descriptors}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconSet() + * @model + * @generated + */ +public interface IconSet extends EObject { + /** + * Returns the value of the 'Icon Set Id' attribute. + * + *

+ * If the meaning of the 'Icon Set Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Set Id' attribute. + * @see #isSetIconSetId() + * @see #unsetIconSetId() + * @see #setIconSetId(int) + * @see org.genivi.iconset.IconsetPackage#getIconSet_IconSetId() + * @model unsettable="true" required="true" + * @generated + */ + int getIconSetId(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getIconSetId Icon Set Id}' attribute. + * + * + * @param value the new value of the 'Icon Set Id' attribute. + * @see #isSetIconSetId() + * @see #unsetIconSetId() + * @see #getIconSetId() + * @generated + */ + void setIconSetId(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getIconSetId Icon Set Id}' attribute. + * + * + * @see #isSetIconSetId() + * @see #getIconSetId() + * @see #setIconSetId(int) + * @generated + */ + void unsetIconSetId(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getIconSetId Icon Set Id}' attribute is set. + * + * + * @return whether the value of the 'Icon Set Id' attribute is set. + * @see #unsetIconSetId() + * @see #getIconSetId() + * @see #setIconSetId(int) + * @generated + */ + boolean isSetIconSetId(); + + /** + * Returns the value of the 'Color Type' attribute. + * The literals are from the enumeration {@link org.genivi.iconset.ColorType}. + * + *

+ * If the meaning of the 'Color Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Color Type' attribute. + * @see org.genivi.iconset.ColorType + * @see #isSetColorType() + * @see #unsetColorType() + * @see #setColorType(ColorType) + * @see org.genivi.iconset.IconsetPackage#getIconSet_ColorType() + * @model unsettable="true" required="true" + * @generated + */ + ColorType getColorType(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getColorType Color Type}' attribute. + * + * + * @param value the new value of the 'Color Type' attribute. + * @see org.genivi.iconset.ColorType + * @see #isSetColorType() + * @see #unsetColorType() + * @see #getColorType() + * @generated + */ + void setColorType(ColorType value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getColorType Color Type}' attribute. + * + * + * @see #isSetColorType() + * @see #getColorType() + * @see #setColorType(ColorType) + * @generated + */ + void unsetColorType(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getColorType Color Type}' attribute is set. + * + * + * @return whether the value of the 'Color Type' attribute is set. + * @see #unsetColorType() + * @see #getColorType() + * @see #setColorType(ColorType) + * @generated + */ + boolean isSetColorType(); + + /** + * Returns the value of the 'Dimension' attribute. + * The literals are from the enumeration {@link org.genivi.iconset.IconDimension}. + * + *

+ * If the meaning of the 'Dimension' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Dimension' attribute. + * @see org.genivi.iconset.IconDimension + * @see #isSetDimension() + * @see #unsetDimension() + * @see #setDimension(IconDimension) + * @see org.genivi.iconset.IconsetPackage#getIconSet_Dimension() + * @model unsettable="true" + * @generated + */ + IconDimension getDimension(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getDimension Dimension}' attribute. + * + * + * @param value the new value of the 'Dimension' attribute. + * @see org.genivi.iconset.IconDimension + * @see #isSetDimension() + * @see #unsetDimension() + * @see #getDimension() + * @generated + */ + void setDimension(IconDimension value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getDimension Dimension}' attribute. + * + * + * @see #isSetDimension() + * @see #getDimension() + * @see #setDimension(IconDimension) + * @generated + */ + void unsetDimension(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getDimension Dimension}' attribute is set. + * + * + * @return whether the value of the 'Dimension' attribute is set. + * @see #unsetDimension() + * @see #getDimension() + * @see #setDimension(IconDimension) + * @generated + */ + boolean isSetDimension(); + + /** + * Returns the value of the 'Size' containment reference. + * + *

+ * If the meaning of the 'Size' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Size' containment reference. + * @see #isSetSize() + * @see #unsetSize() + * @see #setSize(IconSize) + * @see org.genivi.iconset.IconsetPackage#getIconSet_Size() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + IconSize getSize(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getSize Size}' containment reference. + * + * + * @param value the new value of the 'Size' containment reference. + * @see #isSetSize() + * @see #unsetSize() + * @see #getSize() + * @generated + */ + void setSize(IconSize value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getSize Size}' containment reference. + * + * + * @see #isSetSize() + * @see #getSize() + * @see #setSize(IconSize) + * @generated + */ + void unsetSize(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getSize Size}' containment reference is set. + * + * + * @return whether the value of the 'Size' containment reference is set. + * @see #unsetSize() + * @see #getSize() + * @see #setSize(IconSize) + * @generated + */ + boolean isSetSize(); + + /** + * Returns the value of the 'Day Time Icon' attribute. + * + *

+ * If the meaning of the 'Day Time Icon' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Day Time Icon' attribute. + * @see #isSetDayTimeIcon() + * @see #unsetDayTimeIcon() + * @see #setDayTimeIcon(boolean) + * @see org.genivi.iconset.IconsetPackage#getIconSet_DayTimeIcon() + * @model unsettable="true" required="true" + * @generated + */ + boolean isDayTimeIcon(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#isDayTimeIcon Day Time Icon}' attribute. + * + * + * @param value the new value of the 'Day Time Icon' attribute. + * @see #isSetDayTimeIcon() + * @see #unsetDayTimeIcon() + * @see #isDayTimeIcon() + * @generated + */ + void setDayTimeIcon(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#isDayTimeIcon Day Time Icon}' attribute. + * + * + * @see #isSetDayTimeIcon() + * @see #isDayTimeIcon() + * @see #setDayTimeIcon(boolean) + * @generated + */ + void unsetDayTimeIcon(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#isDayTimeIcon Day Time Icon}' attribute is set. + * + * + * @return whether the value of the 'Day Time Icon' attribute is set. + * @see #unsetDayTimeIcon() + * @see #isDayTimeIcon() + * @see #setDayTimeIcon(boolean) + * @generated + */ + boolean isSetDayTimeIcon(); + + /** + * Returns the value of the 'Theme Id' attribute. + * + *

+ * If the meaning of the 'Theme Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Theme Id' attribute. + * @see #isSetThemeId() + * @see #unsetThemeId() + * @see #setThemeId(int) + * @see org.genivi.iconset.IconsetPackage#getIconSet_ThemeId() + * @model unsettable="true" + * @generated + */ + int getThemeId(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getThemeId Theme Id}' attribute. + * + * + * @param value the new value of the 'Theme Id' attribute. + * @see #isSetThemeId() + * @see #unsetThemeId() + * @see #getThemeId() + * @generated + */ + void setThemeId(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getThemeId Theme Id}' attribute. + * + * + * @see #isSetThemeId() + * @see #getThemeId() + * @see #setThemeId(int) + * @generated + */ + void unsetThemeId(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getThemeId Theme Id}' attribute is set. + * + * + * @return whether the value of the 'Theme Id' attribute is set. + * @see #unsetThemeId() + * @see #getThemeId() + * @see #setThemeId(int) + * @generated + */ + boolean isSetThemeId(); + + /** + * Returns the value of the 'Medium Type' attribute. + * + *

+ * If the meaning of the 'Medium Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Medium Type' attribute. + * @see #isSetMediumType() + * @see #unsetMediumType() + * @see #setMediumType(String) + * @see org.genivi.iconset.IconsetPackage#getIconSet_MediumType() + * @model unsettable="true" required="true" + * @generated + */ + String getMediumType(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSet#getMediumType Medium Type}' attribute. + * + * + * @param value the new value of the 'Medium Type' attribute. + * @see #isSetMediumType() + * @see #unsetMediumType() + * @see #getMediumType() + * @generated + */ + void setMediumType(String value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getMediumType Medium Type}' attribute. + * + * + * @see #isSetMediumType() + * @see #getMediumType() + * @see #setMediumType(String) + * @generated + */ + void unsetMediumType(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getMediumType Medium Type}' attribute is set. + * + * + * @return whether the value of the 'Medium Type' attribute is set. + * @see #unsetMediumType() + * @see #getMediumType() + * @see #setMediumType(String) + * @generated + */ + boolean isSetMediumType(); + + /** + * Returns the value of the 'Icon Descriptors' containment reference list. + * The list contents are of type {@link org.genivi.iconset.IconDescriptor}. + * + *

+ * If the meaning of the 'Icon Descriptors' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icon Descriptors' containment reference list. + * @see #isSetIconDescriptors() + * @see #unsetIconDescriptors() + * @see org.genivi.iconset.IconsetPackage#getIconSet_IconDescriptors() + * @model containment="true" unsettable="true" + * @generated + */ + EList getIconDescriptors(); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSet#getIconDescriptors Icon Descriptors}' containment reference list. + * + * + * @see #isSetIconDescriptors() + * @see #getIconDescriptors() + * @generated + */ + void unsetIconDescriptors(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSet#getIconDescriptors Icon Descriptors}' containment reference list is set. + * + * + * @return whether the value of the 'Icon Descriptors' containment reference list is set. + * @see #unsetIconDescriptors() + * @see #getIconDescriptors() + * @generated + */ + boolean isSetIconDescriptors(); + +} // IconSet diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSize.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSize.java new file mode 100755 index 0000000..8c74955 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconSize.java @@ -0,0 +1,192 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Icon Size'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.iconset.IconSize#getWidth Width}
  • + *
  • {@link org.genivi.iconset.IconSize#getHeight Height}
  • + *
  • {@link org.genivi.iconset.IconSize#getDpi Dpi}
  • + *
+ *

+ * + * @see org.genivi.iconset.IconsetPackage#getIconSize() + * @model + * @generated + */ +public interface IconSize extends EObject { + /** + * Returns the value of the 'Width' attribute. + * + *

+ * If the meaning of the 'Width' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Width' attribute. + * @see #isSetWidth() + * @see #unsetWidth() + * @see #setWidth(int) + * @see org.genivi.iconset.IconsetPackage#getIconSize_Width() + * @model unsettable="true" required="true" + * @generated + */ + int getWidth(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSize#getWidth Width}' attribute. + * + * + * @param value the new value of the 'Width' attribute. + * @see #isSetWidth() + * @see #unsetWidth() + * @see #getWidth() + * @generated + */ + void setWidth(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSize#getWidth Width}' attribute. + * + * + * @see #isSetWidth() + * @see #getWidth() + * @see #setWidth(int) + * @generated + */ + void unsetWidth(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSize#getWidth Width}' attribute is set. + * + * + * @return whether the value of the 'Width' attribute is set. + * @see #unsetWidth() + * @see #getWidth() + * @see #setWidth(int) + * @generated + */ + boolean isSetWidth(); + + /** + * Returns the value of the 'Height' attribute. + * + *

+ * If the meaning of the 'Height' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Height' attribute. + * @see #isSetHeight() + * @see #unsetHeight() + * @see #setHeight(int) + * @see org.genivi.iconset.IconsetPackage#getIconSize_Height() + * @model unsettable="true" required="true" + * @generated + */ + int getHeight(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSize#getHeight Height}' attribute. + * + * + * @param value the new value of the 'Height' attribute. + * @see #isSetHeight() + * @see #unsetHeight() + * @see #getHeight() + * @generated + */ + void setHeight(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSize#getHeight Height}' attribute. + * + * + * @see #isSetHeight() + * @see #getHeight() + * @see #setHeight(int) + * @generated + */ + void unsetHeight(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSize#getHeight Height}' attribute is set. + * + * + * @return whether the value of the 'Height' attribute is set. + * @see #unsetHeight() + * @see #getHeight() + * @see #setHeight(int) + * @generated + */ + boolean isSetHeight(); + + /** + * Returns the value of the 'Dpi' attribute. + * + *

+ * If the meaning of the 'Dpi' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Dpi' attribute. + * @see #isSetDpi() + * @see #unsetDpi() + * @see #setDpi(int) + * @see org.genivi.iconset.IconsetPackage#getIconSize_Dpi() + * @model unsettable="true" + * @generated + */ + int getDpi(); + + /** + * Sets the value of the '{@link org.genivi.iconset.IconSize#getDpi Dpi}' attribute. + * + * + * @param value the new value of the 'Dpi' attribute. + * @see #isSetDpi() + * @see #unsetDpi() + * @see #getDpi() + * @generated + */ + void setDpi(int value); + + /** + * Unsets the value of the '{@link org.genivi.iconset.IconSize#getDpi Dpi}' attribute. + * + * + * @see #isSetDpi() + * @see #getDpi() + * @see #setDpi(int) + * @generated + */ + void unsetDpi(); + + /** + * Returns whether the value of the '{@link org.genivi.iconset.IconSize#getDpi Dpi}' attribute is set. + * + * + * @return whether the value of the 'Dpi' attribute is set. + * @see #unsetDpi() + * @see #getDpi() + * @see #setDpi(int) + * @generated + */ + boolean isSetDpi(); + +} // IconSize diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetFactory.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetFactory.java new file mode 100755 index 0000000..5941e3c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetFactory.java @@ -0,0 +1,94 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.iconset.IconsetPackage + * @generated + */ +public interface IconsetFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + IconsetFactory eINSTANCE = org.genivi.iconset.impl.IconsetFactoryImpl.init(); + + /** + * Returns a new object of class 'Icon Set'. + * + * + * @return a new object of class 'Icon Set'. + * @generated + */ + IconSet createIconSet(); + + /** + * Returns a new object of class 'Icon Size'. + * + * + * @return a new object of class 'Icon Size'. + * @generated + */ + IconSize createIconSize(); + + /** + * Returns a new object of class 'Icon Descriptor'. + * + * + * @return a new object of class 'Icon Descriptor'. + * @generated + */ + IconDescriptor createIconDescriptor(); + + /** + * Returns a new object of class 'Icon Data'. + * + * + * @return a new object of class 'Icon Data'. + * @generated + */ + IconData createIconData(); + + /** + * Returns a new object of class 'Icon Info'. + * + * + * @return a new object of class 'Icon Info'. + * @generated + */ + IconInfo createIconInfo(); + + /** + * Returns a new object of class 'Icon Definition'. + * + * + * @return a new object of class 'Icon Definition'. + * @generated + */ + IconDefinition createIconDefinition(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + IconsetPackage getIconsetPackage(); + +} //IconsetFactory diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetPackage.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetPackage.java new file mode 100755 index 0000000..4e74c3b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/IconsetPackage.java @@ -0,0 +1,890 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.iconset.IconsetFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface IconsetPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "iconset"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.iconset"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "iconset"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + IconsetPackage eINSTANCE = org.genivi.iconset.impl.IconsetPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconSetImpl Icon Set}' class. + * + * + * @see org.genivi.iconset.impl.IconSetImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconSet() + * @generated + */ + int ICON_SET = 0; + + /** + * The feature id for the 'Icon Set Id' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__ICON_SET_ID = 0; + + /** + * The feature id for the 'Color Type' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__COLOR_TYPE = 1; + + /** + * The feature id for the 'Dimension' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__DIMENSION = 2; + + /** + * The feature id for the 'Size' containment reference. + * + * + * @generated + * @ordered + */ + int ICON_SET__SIZE = 3; + + /** + * The feature id for the 'Day Time Icon' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__DAY_TIME_ICON = 4; + + /** + * The feature id for the 'Theme Id' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__THEME_ID = 5; + + /** + * The feature id for the 'Medium Type' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SET__MEDIUM_TYPE = 6; + + /** + * The feature id for the 'Icon Descriptors' containment reference list. + * + * + * @generated + * @ordered + */ + int ICON_SET__ICON_DESCRIPTORS = 7; + + /** + * The number of structural features of the 'Icon Set' class. + * + * + * @generated + * @ordered + */ + int ICON_SET_FEATURE_COUNT = 8; + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconSizeImpl Icon Size}' class. + * + * + * @see org.genivi.iconset.impl.IconSizeImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconSize() + * @generated + */ + int ICON_SIZE = 1; + + /** + * The feature id for the 'Width' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SIZE__WIDTH = 0; + + /** + * The feature id for the 'Height' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SIZE__HEIGHT = 1; + + /** + * The feature id for the 'Dpi' attribute. + * + * + * @generated + * @ordered + */ + int ICON_SIZE__DPI = 2; + + /** + * The number of structural features of the 'Icon Size' class. + * + * + * @generated + * @ordered + */ + int ICON_SIZE_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconDescriptorImpl Icon Descriptor}' class. + * + * + * @see org.genivi.iconset.impl.IconDescriptorImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDescriptor() + * @generated + */ + int ICON_DESCRIPTOR = 2; + + /** + * The feature id for the 'Url' attribute. + * + * + * @generated + * @ordered + */ + int ICON_DESCRIPTOR__URL = 0; + + /** + * The feature id for the 'Icon Id' attribute. + * + * + * @generated + * @ordered + */ + int ICON_DESCRIPTOR__ICON_ID = 1; + + /** + * The number of structural features of the 'Icon Descriptor' class. + * + * + * @generated + * @ordered + */ + int ICON_DESCRIPTOR_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconDataImpl Icon Data}' class. + * + * + * @see org.genivi.iconset.impl.IconDataImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconData() + * @generated + */ + int ICON_DATA = 3; + + /** + * The feature id for the 'Data' attribute. + * + * + * @generated + * @ordered + */ + int ICON_DATA__DATA = 0; + + /** + * The number of structural features of the 'Icon Data' class. + * + * + * @generated + * @ordered + */ + int ICON_DATA_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconInfoImpl Icon Info}' class. + * + * + * @see org.genivi.iconset.impl.IconInfoImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconInfo() + * @generated + */ + int ICON_INFO = 4; + + /** + * The feature id for the 'Icon Set Id' attribute. + * + * + * @generated + * @ordered + */ + int ICON_INFO__ICON_SET_ID = 0; + + /** + * The feature id for the 'Icon Id' attribute. + * + * + * @generated + * @ordered + */ + int ICON_INFO__ICON_ID = 1; + + /** + * The number of structural features of the 'Icon Info' class. + * + * + * @generated + * @ordered + */ + int ICON_INFO_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.iconset.impl.IconDefinitionImpl Icon Definition}' class. + * + * + * @see org.genivi.iconset.impl.IconDefinitionImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDefinition() + * @generated + */ + int ICON_DEFINITION = 5; + + /** + * The feature id for the 'Icon Info' containment reference. + * + * + * @generated + * @ordered + */ + int ICON_DEFINITION__ICON_INFO = 0; + + /** + * The feature id for the 'Icon Data' containment reference. + * + * + * @generated + * @ordered + */ + int ICON_DEFINITION__ICON_DATA = 1; + + /** + * The number of structural features of the 'Icon Definition' class. + * + * + * @generated + * @ordered + */ + int ICON_DEFINITION_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.iconset.ColorType Color Type}' enum. + * + * + * @see org.genivi.iconset.ColorType + * @see org.genivi.iconset.impl.IconsetPackageImpl#getColorType() + * @generated + */ + int COLOR_TYPE = 6; + + /** + * The meta object id for the '{@link org.genivi.iconset.IconDimension Icon Dimension}' enum. + * + * + * @see org.genivi.iconset.IconDimension + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDimension() + * @generated + */ + int ICON_DIMENSION = 7; + + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconSet Icon Set}'. + * + * + * @return the meta object for class 'Icon Set'. + * @see org.genivi.iconset.IconSet + * @generated + */ + EClass getIconSet(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#getIconSetId Icon Set Id}'. + * + * + * @return the meta object for the attribute 'Icon Set Id'. + * @see org.genivi.iconset.IconSet#getIconSetId() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_IconSetId(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#getColorType Color Type}'. + * + * + * @return the meta object for the attribute 'Color Type'. + * @see org.genivi.iconset.IconSet#getColorType() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_ColorType(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#getDimension Dimension}'. + * + * + * @return the meta object for the attribute 'Dimension'. + * @see org.genivi.iconset.IconSet#getDimension() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_Dimension(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.iconset.IconSet#getSize Size}'. + * + * + * @return the meta object for the containment reference 'Size'. + * @see org.genivi.iconset.IconSet#getSize() + * @see #getIconSet() + * @generated + */ + EReference getIconSet_Size(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#isDayTimeIcon Day Time Icon}'. + * + * + * @return the meta object for the attribute 'Day Time Icon'. + * @see org.genivi.iconset.IconSet#isDayTimeIcon() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_DayTimeIcon(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#getThemeId Theme Id}'. + * + * + * @return the meta object for the attribute 'Theme Id'. + * @see org.genivi.iconset.IconSet#getThemeId() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_ThemeId(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSet#getMediumType Medium Type}'. + * + * + * @return the meta object for the attribute 'Medium Type'. + * @see org.genivi.iconset.IconSet#getMediumType() + * @see #getIconSet() + * @generated + */ + EAttribute getIconSet_MediumType(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.iconset.IconSet#getIconDescriptors Icon Descriptors}'. + * + * + * @return the meta object for the containment reference list 'Icon Descriptors'. + * @see org.genivi.iconset.IconSet#getIconDescriptors() + * @see #getIconSet() + * @generated + */ + EReference getIconSet_IconDescriptors(); + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconSize Icon Size}'. + * + * + * @return the meta object for class 'Icon Size'. + * @see org.genivi.iconset.IconSize + * @generated + */ + EClass getIconSize(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSize#getWidth Width}'. + * + * + * @return the meta object for the attribute 'Width'. + * @see org.genivi.iconset.IconSize#getWidth() + * @see #getIconSize() + * @generated + */ + EAttribute getIconSize_Width(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSize#getHeight Height}'. + * + * + * @return the meta object for the attribute 'Height'. + * @see org.genivi.iconset.IconSize#getHeight() + * @see #getIconSize() + * @generated + */ + EAttribute getIconSize_Height(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconSize#getDpi Dpi}'. + * + * + * @return the meta object for the attribute 'Dpi'. + * @see org.genivi.iconset.IconSize#getDpi() + * @see #getIconSize() + * @generated + */ + EAttribute getIconSize_Dpi(); + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconDescriptor Icon Descriptor}'. + * + * + * @return the meta object for class 'Icon Descriptor'. + * @see org.genivi.iconset.IconDescriptor + * @generated + */ + EClass getIconDescriptor(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconDescriptor#getUrl Url}'. + * + * + * @return the meta object for the attribute 'Url'. + * @see org.genivi.iconset.IconDescriptor#getUrl() + * @see #getIconDescriptor() + * @generated + */ + EAttribute getIconDescriptor_Url(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconDescriptor#getIconId Icon Id}'. + * + * + * @return the meta object for the attribute 'Icon Id'. + * @see org.genivi.iconset.IconDescriptor#getIconId() + * @see #getIconDescriptor() + * @generated + */ + EAttribute getIconDescriptor_IconId(); + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconData Icon Data}'. + * + * + * @return the meta object for class 'Icon Data'. + * @see org.genivi.iconset.IconData + * @generated + */ + EClass getIconData(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconData#getData Data}'. + * + * + * @return the meta object for the attribute 'Data'. + * @see org.genivi.iconset.IconData#getData() + * @see #getIconData() + * @generated + */ + EAttribute getIconData_Data(); + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconInfo Icon Info}'. + * + * + * @return the meta object for class 'Icon Info'. + * @see org.genivi.iconset.IconInfo + * @generated + */ + EClass getIconInfo(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconInfo#getIconSetId Icon Set Id}'. + * + * + * @return the meta object for the attribute 'Icon Set Id'. + * @see org.genivi.iconset.IconInfo#getIconSetId() + * @see #getIconInfo() + * @generated + */ + EAttribute getIconInfo_IconSetId(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.iconset.IconInfo#getIconId Icon Id}'. + * + * + * @return the meta object for the attribute 'Icon Id'. + * @see org.genivi.iconset.IconInfo#getIconId() + * @see #getIconInfo() + * @generated + */ + EAttribute getIconInfo_IconId(); + + /** + * Returns the meta object for class '{@link org.genivi.iconset.IconDefinition Icon Definition}'. + * + * + * @return the meta object for class 'Icon Definition'. + * @see org.genivi.iconset.IconDefinition + * @generated + */ + EClass getIconDefinition(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.iconset.IconDefinition#getIconInfo Icon Info}'. + * + * + * @return the meta object for the containment reference 'Icon Info'. + * @see org.genivi.iconset.IconDefinition#getIconInfo() + * @see #getIconDefinition() + * @generated + */ + EReference getIconDefinition_IconInfo(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.iconset.IconDefinition#getIconData Icon Data}'. + * + * + * @return the meta object for the containment reference 'Icon Data'. + * @see org.genivi.iconset.IconDefinition#getIconData() + * @see #getIconDefinition() + * @generated + */ + EReference getIconDefinition_IconData(); + + /** + * Returns the meta object for enum '{@link org.genivi.iconset.ColorType Color Type}'. + * + * + * @return the meta object for enum 'Color Type'. + * @see org.genivi.iconset.ColorType + * @generated + */ + EEnum getColorType(); + + /** + * Returns the meta object for enum '{@link org.genivi.iconset.IconDimension Icon Dimension}'. + * + * + * @return the meta object for enum 'Icon Dimension'. + * @see org.genivi.iconset.IconDimension + * @generated + */ + EEnum getIconDimension(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + IconsetFactory getIconsetFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconSetImpl Icon Set}' class. + * + * + * @see org.genivi.iconset.impl.IconSetImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconSet() + * @generated + */ + EClass ICON_SET = eINSTANCE.getIconSet(); + + /** + * The meta object literal for the 'Icon Set Id' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__ICON_SET_ID = eINSTANCE.getIconSet_IconSetId(); + + /** + * The meta object literal for the 'Color Type' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__COLOR_TYPE = eINSTANCE.getIconSet_ColorType(); + + /** + * The meta object literal for the 'Dimension' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__DIMENSION = eINSTANCE.getIconSet_Dimension(); + + /** + * The meta object literal for the 'Size' containment reference feature. + * + * + * @generated + */ + EReference ICON_SET__SIZE = eINSTANCE.getIconSet_Size(); + + /** + * The meta object literal for the 'Day Time Icon' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__DAY_TIME_ICON = eINSTANCE.getIconSet_DayTimeIcon(); + + /** + * The meta object literal for the 'Theme Id' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__THEME_ID = eINSTANCE.getIconSet_ThemeId(); + + /** + * The meta object literal for the 'Medium Type' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SET__MEDIUM_TYPE = eINSTANCE.getIconSet_MediumType(); + + /** + * The meta object literal for the 'Icon Descriptors' containment reference list feature. + * + * + * @generated + */ + EReference ICON_SET__ICON_DESCRIPTORS = eINSTANCE.getIconSet_IconDescriptors(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconSizeImpl Icon Size}' class. + * + * + * @see org.genivi.iconset.impl.IconSizeImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconSize() + * @generated + */ + EClass ICON_SIZE = eINSTANCE.getIconSize(); + + /** + * The meta object literal for the 'Width' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SIZE__WIDTH = eINSTANCE.getIconSize_Width(); + + /** + * The meta object literal for the 'Height' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SIZE__HEIGHT = eINSTANCE.getIconSize_Height(); + + /** + * The meta object literal for the 'Dpi' attribute feature. + * + * + * @generated + */ + EAttribute ICON_SIZE__DPI = eINSTANCE.getIconSize_Dpi(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconDescriptorImpl Icon Descriptor}' class. + * + * + * @see org.genivi.iconset.impl.IconDescriptorImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDescriptor() + * @generated + */ + EClass ICON_DESCRIPTOR = eINSTANCE.getIconDescriptor(); + + /** + * The meta object literal for the 'Url' attribute feature. + * + * + * @generated + */ + EAttribute ICON_DESCRIPTOR__URL = eINSTANCE.getIconDescriptor_Url(); + + /** + * The meta object literal for the 'Icon Id' attribute feature. + * + * + * @generated + */ + EAttribute ICON_DESCRIPTOR__ICON_ID = eINSTANCE.getIconDescriptor_IconId(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconDataImpl Icon Data}' class. + * + * + * @see org.genivi.iconset.impl.IconDataImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconData() + * @generated + */ + EClass ICON_DATA = eINSTANCE.getIconData(); + + /** + * The meta object literal for the 'Data' attribute feature. + * + * + * @generated + */ + EAttribute ICON_DATA__DATA = eINSTANCE.getIconData_Data(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconInfoImpl Icon Info}' class. + * + * + * @see org.genivi.iconset.impl.IconInfoImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconInfo() + * @generated + */ + EClass ICON_INFO = eINSTANCE.getIconInfo(); + + /** + * The meta object literal for the 'Icon Set Id' attribute feature. + * + * + * @generated + */ + EAttribute ICON_INFO__ICON_SET_ID = eINSTANCE.getIconInfo_IconSetId(); + + /** + * The meta object literal for the 'Icon Id' attribute feature. + * + * + * @generated + */ + EAttribute ICON_INFO__ICON_ID = eINSTANCE.getIconInfo_IconId(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.impl.IconDefinitionImpl Icon Definition}' class. + * + * + * @see org.genivi.iconset.impl.IconDefinitionImpl + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDefinition() + * @generated + */ + EClass ICON_DEFINITION = eINSTANCE.getIconDefinition(); + + /** + * The meta object literal for the 'Icon Info' containment reference feature. + * + * + * @generated + */ + EReference ICON_DEFINITION__ICON_INFO = eINSTANCE.getIconDefinition_IconInfo(); + + /** + * The meta object literal for the 'Icon Data' containment reference feature. + * + * + * @generated + */ + EReference ICON_DEFINITION__ICON_DATA = eINSTANCE.getIconDefinition_IconData(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.ColorType Color Type}' enum. + * + * + * @see org.genivi.iconset.ColorType + * @see org.genivi.iconset.impl.IconsetPackageImpl#getColorType() + * @generated + */ + EEnum COLOR_TYPE = eINSTANCE.getColorType(); + + /** + * The meta object literal for the '{@link org.genivi.iconset.IconDimension Icon Dimension}' enum. + * + * + * @see org.genivi.iconset.IconDimension + * @see org.genivi.iconset.impl.IconsetPackageImpl#getIconDimension() + * @generated + */ + EEnum ICON_DIMENSION = eINSTANCE.getIconDimension(); + + } + +} //IconsetPackage diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDataImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDataImpl.java new file mode 100755 index 0000000..1a5abfe --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDataImpl.java @@ -0,0 +1,204 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.iconset.IconData; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Data'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconDataImpl#getData Data}
  • + *
+ *

+ * + * @generated + */ +public class IconDataImpl extends EObjectImpl implements IconData { + /** + * The default value of the '{@link #getData() Data}' attribute. + * + * + * @see #getData() + * @generated + * @ordered + */ + protected static final byte[] DATA_EDEFAULT = null; + + /** + * The cached value of the '{@link #getData() Data}' attribute. + * + * + * @see #getData() + * @generated + * @ordered + */ + protected byte[] data = DATA_EDEFAULT; + + /** + * This is true if the Data attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dataESet; + + /** + * + * + * @generated + */ + protected IconDataImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_DATA; + } + + /** + * + * + * @generated + */ + public byte[] getData() { + return data; + } + + /** + * + * + * @generated + */ + public void setData(byte[] newData) { + byte[] oldData = data; + data = newData; + boolean oldDataESet = dataESet; + dataESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DATA__DATA, oldData, data, !oldDataESet)); + } + + /** + * + * + * @generated + */ + public void unsetData() { + byte[] oldData = data; + boolean oldDataESet = dataESet; + data = DATA_EDEFAULT; + dataESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DATA__DATA, oldData, DATA_EDEFAULT, oldDataESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetData() { + return dataESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_DATA__DATA: + return getData(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_DATA__DATA: + setData((byte[])newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DATA__DATA: + unsetData(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DATA__DATA: + return isSetData(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (data: "); + if (dataESet) result.append(data); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //IconDataImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDefinitionImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDefinitionImpl.java new file mode 100755 index 0000000..e633fa8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDefinitionImpl.java @@ -0,0 +1,372 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.iconset.IconData; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Definition'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconDefinitionImpl#getIconInfo Icon Info}
  • + *
  • {@link org.genivi.iconset.impl.IconDefinitionImpl#getIconData Icon Data}
  • + *
+ *

+ * + * @generated + */ +public class IconDefinitionImpl extends EObjectImpl implements IconDefinition { + /** + * The cached value of the '{@link #getIconInfo() Icon Info}' containment reference. + * + * + * @see #getIconInfo() + * @generated + * @ordered + */ + protected IconInfo iconInfo; + + /** + * This is true if the Icon Info containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconInfoESet; + + /** + * The cached value of the '{@link #getIconData() Icon Data}' containment reference. + * + * + * @see #getIconData() + * @generated + * @ordered + */ + protected IconData iconData; + + /** + * This is true if the Icon Data containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconDataESet; + + /** + * + * + * @generated + */ + protected IconDefinitionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_DEFINITION; + } + + /** + * + * + * @generated + */ + public IconInfo getIconInfo() { + return iconInfo; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetIconInfo(IconInfo newIconInfo, NotificationChain msgs) { + IconInfo oldIconInfo = iconInfo; + iconInfo = newIconInfo; + boolean oldIconInfoESet = iconInfoESet; + iconInfoESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DEFINITION__ICON_INFO, oldIconInfo, newIconInfo, !oldIconInfoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setIconInfo(IconInfo newIconInfo) { + if (newIconInfo != iconInfo) { + NotificationChain msgs = null; + if (iconInfo != null) + msgs = ((InternalEObject)iconInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_INFO, null, msgs); + if (newIconInfo != null) + msgs = ((InternalEObject)newIconInfo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_INFO, null, msgs); + msgs = basicSetIconInfo(newIconInfo, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldIconInfoESet = iconInfoESet; + iconInfoESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DEFINITION__ICON_INFO, newIconInfo, newIconInfo, !oldIconInfoESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetIconInfo(NotificationChain msgs) { + IconInfo oldIconInfo = iconInfo; + iconInfo = null; + boolean oldIconInfoESet = iconInfoESet; + iconInfoESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DEFINITION__ICON_INFO, oldIconInfo, null, oldIconInfoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetIconInfo() { + if (iconInfo != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)iconInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_INFO, null, msgs); + msgs = basicUnsetIconInfo(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldIconInfoESet = iconInfoESet; + iconInfoESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DEFINITION__ICON_INFO, null, null, oldIconInfoESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetIconInfo() { + return iconInfoESet; + } + + /** + * + * + * @generated + */ + public IconData getIconData() { + return iconData; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetIconData(IconData newIconData, NotificationChain msgs) { + IconData oldIconData = iconData; + iconData = newIconData; + boolean oldIconDataESet = iconDataESet; + iconDataESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DEFINITION__ICON_DATA, oldIconData, newIconData, !oldIconDataESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setIconData(IconData newIconData) { + if (newIconData != iconData) { + NotificationChain msgs = null; + if (iconData != null) + msgs = ((InternalEObject)iconData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_DATA, null, msgs); + if (newIconData != null) + msgs = ((InternalEObject)newIconData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_DATA, null, msgs); + msgs = basicSetIconData(newIconData, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldIconDataESet = iconDataESet; + iconDataESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DEFINITION__ICON_DATA, newIconData, newIconData, !oldIconDataESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetIconData(NotificationChain msgs) { + IconData oldIconData = iconData; + iconData = null; + boolean oldIconDataESet = iconDataESet; + iconDataESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DEFINITION__ICON_DATA, oldIconData, null, oldIconDataESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetIconData() { + if (iconData != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)iconData).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_DEFINITION__ICON_DATA, null, msgs); + msgs = basicUnsetIconData(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldIconDataESet = iconDataESet; + iconDataESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DEFINITION__ICON_DATA, null, null, oldIconDataESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetIconData() { + return iconDataESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case IconsetPackage.ICON_DEFINITION__ICON_INFO: + return basicUnsetIconInfo(msgs); + case IconsetPackage.ICON_DEFINITION__ICON_DATA: + return basicUnsetIconData(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_DEFINITION__ICON_INFO: + return getIconInfo(); + case IconsetPackage.ICON_DEFINITION__ICON_DATA: + return getIconData(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_DEFINITION__ICON_INFO: + setIconInfo((IconInfo)newValue); + return; + case IconsetPackage.ICON_DEFINITION__ICON_DATA: + setIconData((IconData)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DEFINITION__ICON_INFO: + unsetIconInfo(); + return; + case IconsetPackage.ICON_DEFINITION__ICON_DATA: + unsetIconData(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DEFINITION__ICON_INFO: + return isSetIconInfo(); + case IconsetPackage.ICON_DEFINITION__ICON_DATA: + return isSetIconData(); + } + return super.eIsSet(featureID); + } + +} //IconDefinitionImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDescriptorImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDescriptorImpl.java new file mode 100755 index 0000000..1440228 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconDescriptorImpl.java @@ -0,0 +1,289 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.iconset.IconDescriptor; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Descriptor'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconDescriptorImpl#getUrl Url}
  • + *
  • {@link org.genivi.iconset.impl.IconDescriptorImpl#getIconId Icon Id}
  • + *
+ *

+ * + * @generated + */ +public class IconDescriptorImpl extends EObjectImpl implements IconDescriptor { + /** + * The default value of the '{@link #getUrl() Url}' attribute. + * + * + * @see #getUrl() + * @generated + * @ordered + */ + protected static final String URL_EDEFAULT = null; + + /** + * The cached value of the '{@link #getUrl() Url}' attribute. + * + * + * @see #getUrl() + * @generated + * @ordered + */ + protected String url = URL_EDEFAULT; + + /** + * This is true if the Url attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean urlESet; + + /** + * The default value of the '{@link #getIconId() Icon Id}' attribute. + * + * + * @see #getIconId() + * @generated + * @ordered + */ + protected static final int ICON_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIconId() Icon Id}' attribute. + * + * + * @see #getIconId() + * @generated + * @ordered + */ + protected int iconId = ICON_ID_EDEFAULT; + + /** + * This is true if the Icon Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconIdESet; + + /** + * + * + * @generated + */ + protected IconDescriptorImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_DESCRIPTOR; + } + + /** + * + * + * @generated + */ + public String getUrl() { + return url; + } + + /** + * + * + * @generated + */ + public void setUrl(String newUrl) { + String oldUrl = url; + url = newUrl; + boolean oldUrlESet = urlESet; + urlESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DESCRIPTOR__URL, oldUrl, url, !oldUrlESet)); + } + + /** + * + * + * @generated + */ + public void unsetUrl() { + String oldUrl = url; + boolean oldUrlESet = urlESet; + url = URL_EDEFAULT; + urlESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DESCRIPTOR__URL, oldUrl, URL_EDEFAULT, oldUrlESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetUrl() { + return urlESet; + } + + /** + * + * + * @generated + */ + public int getIconId() { + return iconId; + } + + /** + * + * + * @generated + */ + public void setIconId(int newIconId) { + int oldIconId = iconId; + iconId = newIconId; + boolean oldIconIdESet = iconIdESet; + iconIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_DESCRIPTOR__ICON_ID, oldIconId, iconId, !oldIconIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetIconId() { + int oldIconId = iconId; + boolean oldIconIdESet = iconIdESet; + iconId = ICON_ID_EDEFAULT; + iconIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_DESCRIPTOR__ICON_ID, oldIconId, ICON_ID_EDEFAULT, oldIconIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetIconId() { + return iconIdESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_DESCRIPTOR__URL: + return getUrl(); + case IconsetPackage.ICON_DESCRIPTOR__ICON_ID: + return getIconId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_DESCRIPTOR__URL: + setUrl((String)newValue); + return; + case IconsetPackage.ICON_DESCRIPTOR__ICON_ID: + setIconId((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DESCRIPTOR__URL: + unsetUrl(); + return; + case IconsetPackage.ICON_DESCRIPTOR__ICON_ID: + unsetIconId(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_DESCRIPTOR__URL: + return isSetUrl(); + case IconsetPackage.ICON_DESCRIPTOR__ICON_ID: + return isSetIconId(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (url: "); + if (urlESet) result.append(url); else result.append(""); + result.append(", iconId: "); + if (iconIdESet) result.append(iconId); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //IconDescriptorImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconInfoImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconInfoImpl.java new file mode 100755 index 0000000..b16cab4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconInfoImpl.java @@ -0,0 +1,309 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Info'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconInfoImpl#getIconSetId Icon Set Id}
  • + *
  • {@link org.genivi.iconset.impl.IconInfoImpl#getIconId Icon Id}
  • + *
+ *

+ * + * @generated + */ +public class IconInfoImpl extends EObjectImpl implements IconInfo { + /** + * The default value of the '{@link #getIconSetId() Icon Set Id}' attribute. + * + * + * @see #getIconSetId() + * @generated + * @ordered + */ + protected static final int ICON_SET_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIconSetId() Icon Set Id}' attribute. + * + * + * @see #getIconSetId() + * @generated + * @ordered + */ + protected int iconSetId = ICON_SET_ID_EDEFAULT; + + /** + * This is true if the Icon Set Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconSetIdESet; + + /** + * The default value of the '{@link #getIconId() Icon Id}' attribute. + * + * + * @see #getIconId() + * @generated + * @ordered + */ + protected static final int ICON_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIconId() Icon Id}' attribute. + * + * + * @see #getIconId() + * @generated + * @ordered + */ + protected int iconId = ICON_ID_EDEFAULT; + + /** + * This is true if the Icon Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconIdESet; + + /** + * + * + * @generated + */ + protected IconInfoImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_INFO; + } + + /** + * + * + * @generated + */ + public int getIconSetId() { + return iconSetId; + } + + /** + * + * + * @generated + */ + public void setIconSetId(int newIconSetId) { + int oldIconSetId = iconSetId; + iconSetId = newIconSetId; + boolean oldIconSetIdESet = iconSetIdESet; + iconSetIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_INFO__ICON_SET_ID, oldIconSetId, iconSetId, !oldIconSetIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetIconSetId() { + int oldIconSetId = iconSetId; + boolean oldIconSetIdESet = iconSetIdESet; + iconSetId = ICON_SET_ID_EDEFAULT; + iconSetIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_INFO__ICON_SET_ID, oldIconSetId, ICON_SET_ID_EDEFAULT, oldIconSetIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetIconSetId() { + return iconSetIdESet; + } + + /** + * + * + * @generated + */ + public int getIconId() { + return iconId; + } + + /** + * + * + * @generated + */ + public void setIconId(int newIconId) { + int oldIconId = iconId; + iconId = newIconId; + boolean oldIconIdESet = iconIdESet; + iconIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_INFO__ICON_ID, oldIconId, iconId, !oldIconIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetIconId() { + int oldIconId = iconId; + boolean oldIconIdESet = iconIdESet; + iconId = ICON_ID_EDEFAULT; + iconIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_INFO__ICON_ID, oldIconId, ICON_ID_EDEFAULT, oldIconIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetIconId() { + return iconIdESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_INFO__ICON_SET_ID: + return getIconSetId(); + case IconsetPackage.ICON_INFO__ICON_ID: + return getIconId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_INFO__ICON_SET_ID: + setIconSetId((Integer)newValue); + return; + case IconsetPackage.ICON_INFO__ICON_ID: + setIconId((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_INFO__ICON_SET_ID: + unsetIconSetId(); + return; + case IconsetPackage.ICON_INFO__ICON_ID: + unsetIconId(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_INFO__ICON_SET_ID: + return isSetIconSetId(); + case IconsetPackage.ICON_INFO__ICON_ID: + return isSetIconId(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (iconSetId: "); + if (iconSetIdESet) result.append(iconSetId); else result.append(""); + result.append(", iconId: "); + if (iconIdESet) result.append(iconId); else result.append(""); + result.append(')'); + return result.toString(); + } + + @Override + public boolean equals(Object obj) { + return iconSetId == ((IconInfo) obj).getIconSetId() && + iconId == ((IconInfo) obj).getIconId(); + } + + + @Override + public int hashCode() { + int hash = 7; + + hash = 31 * hash + iconSetId; + hash = 31 * hash + (iconId); + + return hash; + } + +} //IconInfoImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSetImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSetImpl.java new file mode 100755 index 0000000..c05206c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSetImpl.java @@ -0,0 +1,851 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.iconset.ColorType; +import org.genivi.iconset.IconDescriptor; +import org.genivi.iconset.IconDimension; +import org.genivi.iconset.IconSet; +import org.genivi.iconset.IconSize; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Set'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getIconSetId Icon Set Id}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getColorType Color Type}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getDimension Dimension}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getSize Size}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#isDayTimeIcon Day Time Icon}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getThemeId Theme Id}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getMediumType Medium Type}
  • + *
  • {@link org.genivi.iconset.impl.IconSetImpl#getIconDescriptors Icon Descriptors}
  • + *
+ *

+ * + * @generated + */ +public class IconSetImpl extends EObjectImpl implements IconSet { + /** + * The default value of the '{@link #getIconSetId() Icon Set Id}' attribute. + * + * + * @see #getIconSetId() + * @generated + * @ordered + */ + protected static final int ICON_SET_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getIconSetId() Icon Set Id}' attribute. + * + * + * @see #getIconSetId() + * @generated + * @ordered + */ + protected int iconSetId = ICON_SET_ID_EDEFAULT; + + /** + * This is true if the Icon Set Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean iconSetIdESet; + + /** + * The default value of the '{@link #getColorType() Color Type}' attribute. + * + * + * @see #getColorType() + * @generated + * @ordered + */ + protected static final ColorType COLOR_TYPE_EDEFAULT = ColorType.BLACK_AND_WHITE; + + /** + * The cached value of the '{@link #getColorType() Color Type}' attribute. + * + * + * @see #getColorType() + * @generated + * @ordered + */ + protected ColorType colorType = COLOR_TYPE_EDEFAULT; + + /** + * This is true if the Color Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean colorTypeESet; + + /** + * The default value of the '{@link #getDimension() Dimension}' attribute. + * + * + * @see #getDimension() + * @generated + * @ordered + */ + protected static final IconDimension DIMENSION_EDEFAULT = IconDimension.D2D; + + /** + * The cached value of the '{@link #getDimension() Dimension}' attribute. + * + * + * @see #getDimension() + * @generated + * @ordered + */ + protected IconDimension dimension = DIMENSION_EDEFAULT; + + /** + * This is true if the Dimension attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dimensionESet; + + /** + * The cached value of the '{@link #getSize() Size}' containment reference. + * + * + * @see #getSize() + * @generated + * @ordered + */ + protected IconSize size; + + /** + * This is true if the Size containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean sizeESet; + + /** + * The default value of the '{@link #isDayTimeIcon() Day Time Icon}' attribute. + * + * + * @see #isDayTimeIcon() + * @generated + * @ordered + */ + protected static final boolean DAY_TIME_ICON_EDEFAULT = false; + + /** + * The cached value of the '{@link #isDayTimeIcon() Day Time Icon}' attribute. + * + * + * @see #isDayTimeIcon() + * @generated + * @ordered + */ + protected boolean dayTimeIcon = DAY_TIME_ICON_EDEFAULT; + + /** + * This is true if the Day Time Icon attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dayTimeIconESet; + + /** + * The default value of the '{@link #getThemeId() Theme Id}' attribute. + * + * + * @see #getThemeId() + * @generated + * @ordered + */ + protected static final int THEME_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getThemeId() Theme Id}' attribute. + * + * + * @see #getThemeId() + * @generated + * @ordered + */ + protected int themeId = THEME_ID_EDEFAULT; + + /** + * This is true if the Theme Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean themeIdESet; + + /** + * The default value of the '{@link #getMediumType() Medium Type}' attribute. + * + * + * @see #getMediumType() + * @generated + * @ordered + */ + protected static final String MEDIUM_TYPE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getMediumType() Medium Type}' attribute. + * + * + * @see #getMediumType() + * @generated + * @ordered + */ + protected String mediumType = MEDIUM_TYPE_EDEFAULT; + + /** + * This is true if the Medium Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean mediumTypeESet; + + /** + * The cached value of the '{@link #getIconDescriptors() Icon Descriptors}' containment reference list. + * + * + * @see #getIconDescriptors() + * @generated + * @ordered + */ + protected EList iconDescriptors; + + /** + * + * + * @generated + */ + protected IconSetImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_SET; + } + + /** + * + * + * @generated + */ + public int getIconSetId() { + return iconSetId; + } + + /** + * + * + * @generated + */ + public void setIconSetId(int newIconSetId) { + int oldIconSetId = iconSetId; + iconSetId = newIconSetId; + boolean oldIconSetIdESet = iconSetIdESet; + iconSetIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__ICON_SET_ID, oldIconSetId, iconSetId, !oldIconSetIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetIconSetId() { + int oldIconSetId = iconSetId; + boolean oldIconSetIdESet = iconSetIdESet; + iconSetId = ICON_SET_ID_EDEFAULT; + iconSetIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__ICON_SET_ID, oldIconSetId, ICON_SET_ID_EDEFAULT, oldIconSetIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetIconSetId() { + return iconSetIdESet; + } + + /** + * + * + * @generated + */ + public ColorType getColorType() { + return colorType; + } + + /** + * + * + * @generated + */ + public void setColorType(ColorType newColorType) { + ColorType oldColorType = colorType; + colorType = newColorType == null ? COLOR_TYPE_EDEFAULT : newColorType; + boolean oldColorTypeESet = colorTypeESet; + colorTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__COLOR_TYPE, oldColorType, colorType, !oldColorTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetColorType() { + ColorType oldColorType = colorType; + boolean oldColorTypeESet = colorTypeESet; + colorType = COLOR_TYPE_EDEFAULT; + colorTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__COLOR_TYPE, oldColorType, COLOR_TYPE_EDEFAULT, oldColorTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetColorType() { + return colorTypeESet; + } + + /** + * + * + * @generated + */ + public IconDimension getDimension() { + return dimension; + } + + /** + * + * + * @generated + */ + public void setDimension(IconDimension newDimension) { + IconDimension oldDimension = dimension; + dimension = newDimension == null ? DIMENSION_EDEFAULT : newDimension; + boolean oldDimensionESet = dimensionESet; + dimensionESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__DIMENSION, oldDimension, dimension, !oldDimensionESet)); + } + + /** + * + * + * @generated + */ + public void unsetDimension() { + IconDimension oldDimension = dimension; + boolean oldDimensionESet = dimensionESet; + dimension = DIMENSION_EDEFAULT; + dimensionESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__DIMENSION, oldDimension, DIMENSION_EDEFAULT, oldDimensionESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDimension() { + return dimensionESet; + } + + /** + * + * + * @generated + */ + public IconSize getSize() { + return size; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetSize(IconSize newSize, NotificationChain msgs) { + IconSize oldSize = size; + size = newSize; + boolean oldSizeESet = sizeESet; + sizeESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__SIZE, oldSize, newSize, !oldSizeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setSize(IconSize newSize) { + if (newSize != size) { + NotificationChain msgs = null; + if (size != null) + msgs = ((InternalEObject)size).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_SET__SIZE, null, msgs); + if (newSize != null) + msgs = ((InternalEObject)newSize).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_SET__SIZE, null, msgs); + msgs = basicSetSize(newSize, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSizeESet = sizeESet; + sizeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__SIZE, newSize, newSize, !oldSizeESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetSize(NotificationChain msgs) { + IconSize oldSize = size; + size = null; + boolean oldSizeESet = sizeESet; + sizeESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__SIZE, oldSize, null, oldSizeESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetSize() { + if (size != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)size).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - IconsetPackage.ICON_SET__SIZE, null, msgs); + msgs = basicUnsetSize(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldSizeESet = sizeESet; + sizeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__SIZE, null, null, oldSizeESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetSize() { + return sizeESet; + } + + /** + * + * + * @generated + */ + public boolean isDayTimeIcon() { + return dayTimeIcon; + } + + /** + * + * + * @generated + */ + public void setDayTimeIcon(boolean newDayTimeIcon) { + boolean oldDayTimeIcon = dayTimeIcon; + dayTimeIcon = newDayTimeIcon; + boolean oldDayTimeIconESet = dayTimeIconESet; + dayTimeIconESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__DAY_TIME_ICON, oldDayTimeIcon, dayTimeIcon, !oldDayTimeIconESet)); + } + + /** + * + * + * @generated + */ + public void unsetDayTimeIcon() { + boolean oldDayTimeIcon = dayTimeIcon; + boolean oldDayTimeIconESet = dayTimeIconESet; + dayTimeIcon = DAY_TIME_ICON_EDEFAULT; + dayTimeIconESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__DAY_TIME_ICON, oldDayTimeIcon, DAY_TIME_ICON_EDEFAULT, oldDayTimeIconESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDayTimeIcon() { + return dayTimeIconESet; + } + + /** + * + * + * @generated + */ + public int getThemeId() { + return themeId; + } + + /** + * + * + * @generated + */ + public void setThemeId(int newThemeId) { + int oldThemeId = themeId; + themeId = newThemeId; + boolean oldThemeIdESet = themeIdESet; + themeIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__THEME_ID, oldThemeId, themeId, !oldThemeIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetThemeId() { + int oldThemeId = themeId; + boolean oldThemeIdESet = themeIdESet; + themeId = THEME_ID_EDEFAULT; + themeIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__THEME_ID, oldThemeId, THEME_ID_EDEFAULT, oldThemeIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetThemeId() { + return themeIdESet; + } + + /** + * + * + * @generated + */ + public String getMediumType() { + return mediumType; + } + + /** + * + * + * @generated + */ + public void setMediumType(String newMediumType) { + String oldMediumType = mediumType; + mediumType = newMediumType; + boolean oldMediumTypeESet = mediumTypeESet; + mediumTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SET__MEDIUM_TYPE, oldMediumType, mediumType, !oldMediumTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetMediumType() { + String oldMediumType = mediumType; + boolean oldMediumTypeESet = mediumTypeESet; + mediumType = MEDIUM_TYPE_EDEFAULT; + mediumTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SET__MEDIUM_TYPE, oldMediumType, MEDIUM_TYPE_EDEFAULT, oldMediumTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMediumType() { + return mediumTypeESet; + } + + /** + * + * + * @generated + */ + public EList getIconDescriptors() { + if (iconDescriptors == null) { + iconDescriptors = new EObjectContainmentEList.Unsettable(IconDescriptor.class, this, IconsetPackage.ICON_SET__ICON_DESCRIPTORS); + } + return iconDescriptors; + } + + /** + * + * + * @generated + */ + public void unsetIconDescriptors() { + if (iconDescriptors != null) ((InternalEList.Unsettable)iconDescriptors).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetIconDescriptors() { + return iconDescriptors != null && ((InternalEList.Unsettable)iconDescriptors).isSet(); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case IconsetPackage.ICON_SET__SIZE: + return basicUnsetSize(msgs); + case IconsetPackage.ICON_SET__ICON_DESCRIPTORS: + return ((InternalEList)getIconDescriptors()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_SET__ICON_SET_ID: + return getIconSetId(); + case IconsetPackage.ICON_SET__COLOR_TYPE: + return getColorType(); + case IconsetPackage.ICON_SET__DIMENSION: + return getDimension(); + case IconsetPackage.ICON_SET__SIZE: + return getSize(); + case IconsetPackage.ICON_SET__DAY_TIME_ICON: + return isDayTimeIcon(); + case IconsetPackage.ICON_SET__THEME_ID: + return getThemeId(); + case IconsetPackage.ICON_SET__MEDIUM_TYPE: + return getMediumType(); + case IconsetPackage.ICON_SET__ICON_DESCRIPTORS: + return getIconDescriptors(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_SET__ICON_SET_ID: + setIconSetId((Integer)newValue); + return; + case IconsetPackage.ICON_SET__COLOR_TYPE: + setColorType((ColorType)newValue); + return; + case IconsetPackage.ICON_SET__DIMENSION: + setDimension((IconDimension)newValue); + return; + case IconsetPackage.ICON_SET__SIZE: + setSize((IconSize)newValue); + return; + case IconsetPackage.ICON_SET__DAY_TIME_ICON: + setDayTimeIcon((Boolean)newValue); + return; + case IconsetPackage.ICON_SET__THEME_ID: + setThemeId((Integer)newValue); + return; + case IconsetPackage.ICON_SET__MEDIUM_TYPE: + setMediumType((String)newValue); + return; + case IconsetPackage.ICON_SET__ICON_DESCRIPTORS: + getIconDescriptors().clear(); + getIconDescriptors().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_SET__ICON_SET_ID: + unsetIconSetId(); + return; + case IconsetPackage.ICON_SET__COLOR_TYPE: + unsetColorType(); + return; + case IconsetPackage.ICON_SET__DIMENSION: + unsetDimension(); + return; + case IconsetPackage.ICON_SET__SIZE: + unsetSize(); + return; + case IconsetPackage.ICON_SET__DAY_TIME_ICON: + unsetDayTimeIcon(); + return; + case IconsetPackage.ICON_SET__THEME_ID: + unsetThemeId(); + return; + case IconsetPackage.ICON_SET__MEDIUM_TYPE: + unsetMediumType(); + return; + case IconsetPackage.ICON_SET__ICON_DESCRIPTORS: + unsetIconDescriptors(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_SET__ICON_SET_ID: + return isSetIconSetId(); + case IconsetPackage.ICON_SET__COLOR_TYPE: + return isSetColorType(); + case IconsetPackage.ICON_SET__DIMENSION: + return isSetDimension(); + case IconsetPackage.ICON_SET__SIZE: + return isSetSize(); + case IconsetPackage.ICON_SET__DAY_TIME_ICON: + return isSetDayTimeIcon(); + case IconsetPackage.ICON_SET__THEME_ID: + return isSetThemeId(); + case IconsetPackage.ICON_SET__MEDIUM_TYPE: + return isSetMediumType(); + case IconsetPackage.ICON_SET__ICON_DESCRIPTORS: + return isSetIconDescriptors(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (iconSetId: "); + if (iconSetIdESet) result.append(iconSetId); else result.append(""); + result.append(", colorType: "); + if (colorTypeESet) result.append(colorType); else result.append(""); + result.append(", dimension: "); + if (dimensionESet) result.append(dimension); else result.append(""); + result.append(", dayTimeIcon: "); + if (dayTimeIconESet) result.append(dayTimeIcon); else result.append(""); + result.append(", themeId: "); + if (themeIdESet) result.append(themeId); else result.append(""); + result.append(", mediumType: "); + if (mediumTypeESet) result.append(mediumType); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //IconSetImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSizeImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSizeImpl.java new file mode 100755 index 0000000..5afad2a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconSizeImpl.java @@ -0,0 +1,380 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.iconset.IconSize; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model object 'Icon Size'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.iconset.impl.IconSizeImpl#getWidth Width}
  • + *
  • {@link org.genivi.iconset.impl.IconSizeImpl#getHeight Height}
  • + *
  • {@link org.genivi.iconset.impl.IconSizeImpl#getDpi Dpi}
  • + *
+ *

+ * + * @generated + */ +public class IconSizeImpl extends EObjectImpl implements IconSize { + /** + * The default value of the '{@link #getWidth() Width}' attribute. + * + * + * @see #getWidth() + * @generated + * @ordered + */ + protected static final int WIDTH_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getWidth() Width}' attribute. + * + * + * @see #getWidth() + * @generated + * @ordered + */ + protected int width = WIDTH_EDEFAULT; + + /** + * This is true if the Width attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean widthESet; + + /** + * The default value of the '{@link #getHeight() Height}' attribute. + * + * + * @see #getHeight() + * @generated + * @ordered + */ + protected static final int HEIGHT_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getHeight() Height}' attribute. + * + * + * @see #getHeight() + * @generated + * @ordered + */ + protected int height = HEIGHT_EDEFAULT; + + /** + * This is true if the Height attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean heightESet; + + /** + * The default value of the '{@link #getDpi() Dpi}' attribute. + * + * + * @see #getDpi() + * @generated + * @ordered + */ + protected static final int DPI_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getDpi() Dpi}' attribute. + * + * + * @see #getDpi() + * @generated + * @ordered + */ + protected int dpi = DPI_EDEFAULT; + + /** + * This is true if the Dpi attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dpiESet; + + /** + * + * + * @generated + */ + protected IconSizeImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return IconsetPackage.Literals.ICON_SIZE; + } + + /** + * + * + * @generated + */ + public int getWidth() { + return width; + } + + /** + * + * + * @generated + */ + public void setWidth(int newWidth) { + int oldWidth = width; + width = newWidth; + boolean oldWidthESet = widthESet; + widthESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SIZE__WIDTH, oldWidth, width, !oldWidthESet)); + } + + /** + * + * + * @generated + */ + public void unsetWidth() { + int oldWidth = width; + boolean oldWidthESet = widthESet; + width = WIDTH_EDEFAULT; + widthESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SIZE__WIDTH, oldWidth, WIDTH_EDEFAULT, oldWidthESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetWidth() { + return widthESet; + } + + /** + * + * + * @generated + */ + public int getHeight() { + return height; + } + + /** + * + * + * @generated + */ + public void setHeight(int newHeight) { + int oldHeight = height; + height = newHeight; + boolean oldHeightESet = heightESet; + heightESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SIZE__HEIGHT, oldHeight, height, !oldHeightESet)); + } + + /** + * + * + * @generated + */ + public void unsetHeight() { + int oldHeight = height; + boolean oldHeightESet = heightESet; + height = HEIGHT_EDEFAULT; + heightESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SIZE__HEIGHT, oldHeight, HEIGHT_EDEFAULT, oldHeightESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetHeight() { + return heightESet; + } + + /** + * + * + * @generated + */ + public int getDpi() { + return dpi; + } + + /** + * + * + * @generated + */ + public void setDpi(int newDpi) { + int oldDpi = dpi; + dpi = newDpi; + boolean oldDpiESet = dpiESet; + dpiESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, IconsetPackage.ICON_SIZE__DPI, oldDpi, dpi, !oldDpiESet)); + } + + /** + * + * + * @generated + */ + public void unsetDpi() { + int oldDpi = dpi; + boolean oldDpiESet = dpiESet; + dpi = DPI_EDEFAULT; + dpiESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, IconsetPackage.ICON_SIZE__DPI, oldDpi, DPI_EDEFAULT, oldDpiESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDpi() { + return dpiESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case IconsetPackage.ICON_SIZE__WIDTH: + return getWidth(); + case IconsetPackage.ICON_SIZE__HEIGHT: + return getHeight(); + case IconsetPackage.ICON_SIZE__DPI: + return getDpi(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case IconsetPackage.ICON_SIZE__WIDTH: + setWidth((Integer)newValue); + return; + case IconsetPackage.ICON_SIZE__HEIGHT: + setHeight((Integer)newValue); + return; + case IconsetPackage.ICON_SIZE__DPI: + setDpi((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_SIZE__WIDTH: + unsetWidth(); + return; + case IconsetPackage.ICON_SIZE__HEIGHT: + unsetHeight(); + return; + case IconsetPackage.ICON_SIZE__DPI: + unsetDpi(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case IconsetPackage.ICON_SIZE__WIDTH: + return isSetWidth(); + case IconsetPackage.ICON_SIZE__HEIGHT: + return isSetHeight(); + case IconsetPackage.ICON_SIZE__DPI: + return isSetDpi(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (width: "); + if (widthESet) result.append(width); else result.append(""); + result.append(", height: "); + if (heightESet) result.append(height); else result.append(""); + result.append(", dpi: "); + if (dpiESet) result.append(dpi); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //IconSizeImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetFactoryImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetFactoryImpl.java new file mode 100755 index 0000000..2e72047 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetFactoryImpl.java @@ -0,0 +1,232 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.iconset.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class IconsetFactoryImpl extends EFactoryImpl implements IconsetFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static IconsetFactory init() { + try { + IconsetFactory theIconsetFactory = (IconsetFactory)EPackage.Registry.INSTANCE.getEFactory(IconsetPackage.eNS_URI); + if (theIconsetFactory != null) { + return theIconsetFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new IconsetFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public IconsetFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case IconsetPackage.ICON_SET: return createIconSet(); + case IconsetPackage.ICON_SIZE: return createIconSize(); + case IconsetPackage.ICON_DESCRIPTOR: return createIconDescriptor(); + case IconsetPackage.ICON_DATA: return createIconData(); + case IconsetPackage.ICON_INFO: return createIconInfo(); + case IconsetPackage.ICON_DEFINITION: return createIconDefinition(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case IconsetPackage.COLOR_TYPE: + return createColorTypeFromString(eDataType, initialValue); + case IconsetPackage.ICON_DIMENSION: + return createIconDimensionFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case IconsetPackage.COLOR_TYPE: + return convertColorTypeToString(eDataType, instanceValue); + case IconsetPackage.ICON_DIMENSION: + return convertIconDimensionToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public IconSet createIconSet() { + IconSetImpl iconSet = new IconSetImpl(); + return iconSet; + } + + /** + * + * + * @generated + */ + public IconSize createIconSize() { + IconSizeImpl iconSize = new IconSizeImpl(); + return iconSize; + } + + /** + * + * + * @generated + */ + public IconDescriptor createIconDescriptor() { + IconDescriptorImpl iconDescriptor = new IconDescriptorImpl(); + return iconDescriptor; + } + + /** + * + * + * @generated + */ + public IconData createIconData() { + IconDataImpl iconData = new IconDataImpl(); + return iconData; + } + + /** + * + * + * @generated + */ + public IconInfo createIconInfo() { + IconInfoImpl iconInfo = new IconInfoImpl(); + return iconInfo; + } + + /** + * + * + * @generated + */ + public IconDefinition createIconDefinition() { + IconDefinitionImpl iconDefinition = new IconDefinitionImpl(); + return iconDefinition; + } + + /** + * + * + * @generated + */ + public ColorType createColorTypeFromString(EDataType eDataType, String initialValue) { + ColorType result = ColorType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertColorTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public IconDimension createIconDimensionFromString(EDataType eDataType, String initialValue) { + IconDimension result = IconDimension.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertIconDimensionToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public IconsetPackage getIconsetPackage() { + return (IconsetPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static IconsetPackage getPackage() { + return IconsetPackage.eINSTANCE; + } + +} //IconsetFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetPackageImpl.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetPackageImpl.java new file mode 100755 index 0000000..5ebf0ee --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/impl/IconsetPackageImpl.java @@ -0,0 +1,549 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.iconset.ColorType; +import org.genivi.iconset.IconData; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconDescriptor; +import org.genivi.iconset.IconDimension; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.iconset.IconSize; +import org.genivi.iconset.IconsetFactory; +import org.genivi.iconset.IconsetPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class IconsetPackageImpl extends EPackageImpl implements IconsetPackage { + /** + * + * + * @generated + */ + private EClass iconSetEClass = null; + + /** + * + * + * @generated + */ + private EClass iconSizeEClass = null; + + /** + * + * + * @generated + */ + private EClass iconDescriptorEClass = null; + + /** + * + * + * @generated + */ + private EClass iconDataEClass = null; + + /** + * + * + * @generated + */ + private EClass iconInfoEClass = null; + + /** + * + * + * @generated + */ + private EClass iconDefinitionEClass = null; + + /** + * + * + * @generated + */ + private EEnum colorTypeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum iconDimensionEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.iconset.IconsetPackage#eNS_URI + * @see #init() + * @generated + */ + private IconsetPackageImpl() { + super(eNS_URI, IconsetFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link IconsetPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static IconsetPackage init() { + if (isInited) return (IconsetPackage)EPackage.Registry.INSTANCE.getEPackage(IconsetPackage.eNS_URI); + + // Obtain or create and register package + IconsetPackageImpl theIconsetPackage = (IconsetPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof IconsetPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new IconsetPackageImpl()); + + isInited = true; + + // Create package meta-data objects + theIconsetPackage.createPackageContents(); + + // Initialize created meta-data + theIconsetPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theIconsetPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(IconsetPackage.eNS_URI, theIconsetPackage); + return theIconsetPackage; + } + + /** + * + * + * @generated + */ + public EClass getIconSet() { + return iconSetEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_IconSetId() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_ColorType() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_Dimension() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getIconSet_Size() { + return (EReference)iconSetEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_DayTimeIcon() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_ThemeId() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSet_MediumType() { + return (EAttribute)iconSetEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + public EReference getIconSet_IconDescriptors() { + return (EReference)iconSetEClass.getEStructuralFeatures().get(7); + } + + /** + * + * + * @generated + */ + public EClass getIconSize() { + return iconSizeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getIconSize_Width() { + return (EAttribute)iconSizeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSize_Height() { + return (EAttribute)iconSizeEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getIconSize_Dpi() { + return (EAttribute)iconSizeEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getIconDescriptor() { + return iconDescriptorEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getIconDescriptor_Url() { + return (EAttribute)iconDescriptorEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getIconDescriptor_IconId() { + return (EAttribute)iconDescriptorEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getIconData() { + return iconDataEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getIconData_Data() { + return (EAttribute)iconDataEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getIconInfo() { + return iconInfoEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getIconInfo_IconSetId() { + return (EAttribute)iconInfoEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getIconInfo_IconId() { + return (EAttribute)iconInfoEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getIconDefinition() { + return iconDefinitionEClass; + } + + /** + * + * + * @generated + */ + public EReference getIconDefinition_IconInfo() { + return (EReference)iconDefinitionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getIconDefinition_IconData() { + return (EReference)iconDefinitionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EEnum getColorType() { + return colorTypeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getIconDimension() { + return iconDimensionEEnum; + } + + /** + * + * + * @generated + */ + public IconsetFactory getIconsetFactory() { + return (IconsetFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + iconSetEClass = createEClass(ICON_SET); + createEAttribute(iconSetEClass, ICON_SET__ICON_SET_ID); + createEAttribute(iconSetEClass, ICON_SET__COLOR_TYPE); + createEAttribute(iconSetEClass, ICON_SET__DIMENSION); + createEReference(iconSetEClass, ICON_SET__SIZE); + createEAttribute(iconSetEClass, ICON_SET__DAY_TIME_ICON); + createEAttribute(iconSetEClass, ICON_SET__THEME_ID); + createEAttribute(iconSetEClass, ICON_SET__MEDIUM_TYPE); + createEReference(iconSetEClass, ICON_SET__ICON_DESCRIPTORS); + + iconSizeEClass = createEClass(ICON_SIZE); + createEAttribute(iconSizeEClass, ICON_SIZE__WIDTH); + createEAttribute(iconSizeEClass, ICON_SIZE__HEIGHT); + createEAttribute(iconSizeEClass, ICON_SIZE__DPI); + + iconDescriptorEClass = createEClass(ICON_DESCRIPTOR); + createEAttribute(iconDescriptorEClass, ICON_DESCRIPTOR__URL); + createEAttribute(iconDescriptorEClass, ICON_DESCRIPTOR__ICON_ID); + + iconDataEClass = createEClass(ICON_DATA); + createEAttribute(iconDataEClass, ICON_DATA__DATA); + + iconInfoEClass = createEClass(ICON_INFO); + createEAttribute(iconInfoEClass, ICON_INFO__ICON_SET_ID); + createEAttribute(iconInfoEClass, ICON_INFO__ICON_ID); + + iconDefinitionEClass = createEClass(ICON_DEFINITION); + createEReference(iconDefinitionEClass, ICON_DEFINITION__ICON_INFO); + createEReference(iconDefinitionEClass, ICON_DEFINITION__ICON_DATA); + + // Create enums + colorTypeEEnum = createEEnum(COLOR_TYPE); + iconDimensionEEnum = createEEnum(ICON_DIMENSION); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(iconSetEClass, IconSet.class, "IconSet", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getIconSet_IconSetId(), ecorePackage.getEInt(), "iconSetId", null, 1, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSet_ColorType(), this.getColorType(), "colorType", null, 1, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSet_Dimension(), this.getIconDimension(), "dimension", null, 0, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getIconSet_Size(), this.getIconSize(), null, "size", null, 1, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSet_DayTimeIcon(), ecorePackage.getEBoolean(), "dayTimeIcon", null, 1, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSet_ThemeId(), ecorePackage.getEInt(), "themeId", null, 0, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSet_MediumType(), ecorePackage.getEString(), "mediumType", null, 1, 1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getIconSet_IconDescriptors(), this.getIconDescriptor(), null, "iconDescriptors", null, 0, -1, IconSet.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(iconSizeEClass, IconSize.class, "IconSize", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getIconSize_Width(), ecorePackage.getEInt(), "width", null, 1, 1, IconSize.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSize_Height(), ecorePackage.getEInt(), "height", null, 1, 1, IconSize.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconSize_Dpi(), ecorePackage.getEInt(), "dpi", null, 0, 1, IconSize.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(iconDescriptorEClass, IconDescriptor.class, "IconDescriptor", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getIconDescriptor_Url(), ecorePackage.getEString(), "url", null, 0, 1, IconDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconDescriptor_IconId(), ecorePackage.getEInt(), "iconId", null, 1, 1, IconDescriptor.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(iconDataEClass, IconData.class, "IconData", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getIconData_Data(), ecorePackage.getEByteArray(), "data", null, 0, 1, IconData.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(iconInfoEClass, IconInfo.class, "IconInfo", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getIconInfo_IconSetId(), ecorePackage.getEInt(), "iconSetId", null, 1, 1, IconInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getIconInfo_IconId(), ecorePackage.getEInt(), "iconId", null, 1, 1, IconInfo.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(iconDefinitionEClass, IconDefinition.class, "IconDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getIconDefinition_IconInfo(), this.getIconInfo(), null, "iconInfo", null, 1, 1, IconDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getIconDefinition_IconData(), this.getIconData(), null, "iconData", null, 1, 1, IconDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(colorTypeEEnum, ColorType.class, "ColorType"); + addEEnumLiteral(colorTypeEEnum, ColorType.BLACK_AND_WHITE); + addEEnumLiteral(colorTypeEEnum, ColorType.GRAY_4); + addEEnumLiteral(colorTypeEEnum, ColorType.GRAY_8); + addEEnumLiteral(colorTypeEEnum, ColorType.RGB555); + addEEnumLiteral(colorTypeEEnum, ColorType.RGB565); + addEEnumLiteral(colorTypeEEnum, ColorType.RGB888); + + initEEnum(iconDimensionEEnum, IconDimension.class, "IconDimension"); + addEEnumLiteral(iconDimensionEEnum, IconDimension.D2D); + addEEnumLiteral(iconDimensionEEnum, IconDimension.D25D); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //IconsetPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetAdapterFactory.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetAdapterFactory.java new file mode 100755 index 0000000..edc3f92 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetAdapterFactory.java @@ -0,0 +1,217 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.iconset.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.iconset.IconsetPackage + * @generated + */ +public class IconsetAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static IconsetPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public IconsetAdapterFactory() { + if (modelPackage == null) { + modelPackage = IconsetPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected IconsetSwitch modelSwitch = + new IconsetSwitch() { + @Override + public Adapter caseIconSet(IconSet object) { + return createIconSetAdapter(); + } + @Override + public Adapter caseIconSize(IconSize object) { + return createIconSizeAdapter(); + } + @Override + public Adapter caseIconDescriptor(IconDescriptor object) { + return createIconDescriptorAdapter(); + } + @Override + public Adapter caseIconData(IconData object) { + return createIconDataAdapter(); + } + @Override + public Adapter caseIconInfo(IconInfo object) { + return createIconInfoAdapter(); + } + @Override + public Adapter caseIconDefinition(IconDefinition object) { + return createIconDefinitionAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconSet Icon Set}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconSet + * @generated + */ + public Adapter createIconSetAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconSize Icon Size}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconSize + * @generated + */ + public Adapter createIconSizeAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconDescriptor Icon Descriptor}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconDescriptor + * @generated + */ + public Adapter createIconDescriptorAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconData Icon Data}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconData + * @generated + */ + public Adapter createIconDataAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconInfo Icon Info}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconInfo + * @generated + */ + public Adapter createIconInfoAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.iconset.IconDefinition Icon Definition}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.iconset.IconDefinition + * @generated + */ + public Adapter createIconDefinitionAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //IconsetAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetSwitch.java b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetSwitch.java new file mode 100755 index 0000000..8d5a550 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.iconset-model/src/org/genivi/iconset/util/IconsetSwitch.java @@ -0,0 +1,222 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.iconset.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.iconset.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.iconset.IconsetPackage + * @generated + */ +public class IconsetSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static IconsetPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public IconsetSwitch() { + if (modelPackage == null) { + modelPackage = IconsetPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case IconsetPackage.ICON_SET: { + IconSet iconSet = (IconSet)theEObject; + T result = caseIconSet(iconSet); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IconsetPackage.ICON_SIZE: { + IconSize iconSize = (IconSize)theEObject; + T result = caseIconSize(iconSize); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IconsetPackage.ICON_DESCRIPTOR: { + IconDescriptor iconDescriptor = (IconDescriptor)theEObject; + T result = caseIconDescriptor(iconDescriptor); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IconsetPackage.ICON_DATA: { + IconData iconData = (IconData)theEObject; + T result = caseIconData(iconData); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IconsetPackage.ICON_INFO: { + IconInfo iconInfo = (IconInfo)theEObject; + T result = caseIconInfo(iconInfo); + if (result == null) result = defaultCase(theEObject); + return result; + } + case IconsetPackage.ICON_DEFINITION: { + IconDefinition iconDefinition = (IconDefinition)theEObject; + T result = caseIconDefinition(iconDefinition); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Set'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Set'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconSet(IconSet object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Size'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Size'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconSize(IconSize object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Descriptor'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Descriptor'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconDescriptor(IconDescriptor object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Data'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Data'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconData(IconData object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Info'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Info'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconInfo(IconInfo object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Icon Definition'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Icon Definition'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseIconDefinition(IconDefinition object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //IconsetSwitch diff --git a/src/traffic-incidents-service/org.genivi.locref-model/.classpath b/src/traffic-incidents-service/org.genivi.locref-model/.classpath new file mode 100755 index 0000000..1af8d0d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.locref-model/.project b/src/traffic-incidents-service/org.genivi.locref-model/.project new file mode 100755 index 0000000..d3f8643 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/.project @@ -0,0 +1,23 @@ + + + org.genivi.locref-model + This project contains the model for GENIVI location references. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.locref-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.locref-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..2b78f58 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.locref-model;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.locref, + org.genivi.locref.impl, + org.genivi.locref.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.genivi.basetypes-model +Bundle-ActivationPolicy: lazy diff --git a/src/traffic-incidents-service/org.genivi.locref-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.locref-model/ReadMe.confluence new file mode 100755 index 0000000..5d0b2a9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/ReadMe.confluence @@ -0,0 +1,4 @@ +This project defines an interface for decoding Location References. +Currently this is an internal interface within the TrafficIncidentsService. However, in the future, they may be a separate component for decoding Location References (as part of Map Data Access). + +LocationReference.ecorediag, in de model folder, provides an overview of the interface. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.locref-model/build.properties b/src/traffic-incidents-service/org.genivi.locref-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecore b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecore new file mode 100755 index 0000000..74c2bd0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecore @@ -0,0 +1,41 @@ + + + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecorediag b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecorediag new file mode 100755 index 0000000..58f3380 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.ecorediag @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.genmodel b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.genmodel new file mode 100755 index 0000000..dc830eb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/model/LocationReference.genmodel @@ -0,0 +1,42 @@ + + + LocationReference.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.locref-model/plugin.properties b/src/traffic-incidents-service/org.genivi.locref-model/plugin.properties new file mode 100755 index 0000000..a1daed6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = LocationReference Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.locref-model/plugin.xml b/src/traffic-incidents-service/org.genivi.locref-model/plugin.xml new file mode 100755 index 0000000..353c7a1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/plugin.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.locref-model/pom.xml b/src/traffic-incidents-service/org.genivi.locref-model/pom.xml new file mode 100755 index 0000000..7109855 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + org.genivi + locref-model + jar + 1.0-SNAPSHOT + GENIVI Location Reference model + This project contains the model for GENIVI location references. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi + basetypes-model + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReference.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReference.java new file mode 100755 index 0000000..54e0240 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReference.java @@ -0,0 +1,138 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Location Reference'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.locref.LocationReference#getData Data}
  • + *
  • {@link org.genivi.locref.LocationReference#getLocationReferenceType Location Reference Type}
  • + *
+ *

+ * + * @see org.genivi.locref.locrefPackage#getLocationReference() + * @model + * @generated + */ +public interface LocationReference extends EObject { + /** + * Returns the value of the 'Location Reference Type' attribute. + * + *

+ * If the meaning of the 'Location Reference Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location Reference Type' attribute. + * @see #isSetLocationReferenceType() + * @see #unsetLocationReferenceType() + * @see #setLocationReferenceType(byte) + * @see org.genivi.locref.locrefPackage#getLocationReference_LocationReferenceType() + * @model unsettable="true" required="true" + * @generated + */ + byte getLocationReferenceType(); + + /** + * Sets the value of the '{@link org.genivi.locref.LocationReference#getLocationReferenceType Location Reference Type}' attribute. + * + * + * @param value the new value of the 'Location Reference Type' attribute. + * @see #isSetLocationReferenceType() + * @see #unsetLocationReferenceType() + * @see #getLocationReferenceType() + * @generated + */ + void setLocationReferenceType(byte value); + + /** + * Unsets the value of the '{@link org.genivi.locref.LocationReference#getLocationReferenceType Location Reference Type}' attribute. + * + * + * @see #isSetLocationReferenceType() + * @see #getLocationReferenceType() + * @see #setLocationReferenceType(byte) + * @generated + */ + void unsetLocationReferenceType(); + + /** + * Returns whether the value of the '{@link org.genivi.locref.LocationReference#getLocationReferenceType Location Reference Type}' attribute is set. + * + * + * @return whether the value of the 'Location Reference Type' attribute is set. + * @see #unsetLocationReferenceType() + * @see #getLocationReferenceType() + * @see #setLocationReferenceType(byte) + * @generated + */ + boolean isSetLocationReferenceType(); + + /** + * Returns the value of the 'Data' attribute. + * + *

+ * If the meaning of the 'Data' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Data' attribute. + * @see #isSetData() + * @see #unsetData() + * @see #setData(Object) + * @see org.genivi.locref.locrefPackage#getLocationReference_Data() + * @model unsettable="true" required="true" + * @generated + */ + Object getData(); + + /** + * Sets the value of the '{@link org.genivi.locref.LocationReference#getData Data}' attribute. + * + * + * @param value the new value of the 'Data' attribute. + * @see #isSetData() + * @see #unsetData() + * @see #getData() + * @generated + */ + void setData(Object value); + + /** + * Unsets the value of the '{@link org.genivi.locref.LocationReference#getData Data}' attribute. + * + * + * @see #isSetData() + * @see #getData() + * @see #setData(Object) + * @generated + */ + void unsetData(); + + /** + * Returns whether the value of the '{@link org.genivi.locref.LocationReference#getData Data}' attribute is set. + * + * + * @return whether the value of the 'Data' attribute is set. + * @see #unsetData() + * @see #getData() + * @see #setData(Object) + * @generated + */ + boolean isSetData(); + +} // LocationReference diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingService.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingService.java new file mode 100755 index 0000000..4d65cb5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingService.java @@ -0,0 +1,49 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Location Reference Decoding Service'. + * + * + * + * @see org.genivi.locref.locrefPackage#getLocationReferenceDecodingService() + * @model + * @generated + */ +public interface LocationReferenceDecodingService extends EObject { + /** + * + * + * @model listenerRequired="true" locationReferenceRequired="true" + * @generated + */ + void decode(LocationReferenceDecodingServiceListener listener, LocationReference locationReference); + + /** + * + * + * @model + * @generated + */ + void setLanguage(String languageCode, String countryCode); + + /** + * + * + * @model + * @generated + */ + void getLanguage(LocationReferenceDecodingServiceListener listener); + +} // LocationReferenceDecodingService diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingServiceListener.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingServiceListener.java new file mode 100755 index 0000000..ccb8967 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceDecodingServiceListener.java @@ -0,0 +1,43 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import org.eclipse.emf.ecore.EObject; +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; + +/** + * + * A representation of the model object 'Location Reference Decoding Service Listener'. + * + * + * + * @see org.genivi.locref.locrefPackage#getLocationReferenceDecodingServiceListener() + * @model + * @generated + */ +public interface LocationReferenceDecodingServiceListener extends EObject { + /** + * + * + * @model locationRequired="true" + * @generated + */ + void decodeReply(Location location, LocationInfo locationInfo); + + /** + * + * + * @model + * @generated + */ + void getLanguageReply(String languageCode, String countryCode); + +} // LocationReferenceDecodingServiceListener diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceType.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceType.java new file mode 100755 index 0000000..418f2a0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceType.java @@ -0,0 +1,215 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Location Reference Type', + * and utility methods for working with them. + * + * @see org.genivi.locref.locrefPackage#getLocationReferenceType() + * @model + * @generated + */ +public enum LocationReferenceType implements Enumerator { + /** + * The 'TMC LOC' literal object. + * + * + * @see #TMC_LOC_VALUE + * @generated + * @ordered + */ + TMC_LOC(1, "TMC_LOC", "TMC_LOC"), + + /** + * The 'OPEN LR' literal object. + * + * + * @see #OPEN_LR_VALUE + * @generated + * @ordered + */ + OPEN_LR(2, "OPEN_LR", "OPEN_LR"); + + /** + * The 'TMC LOC' literal value. + * + *

+ * If the meaning of 'TMC LOC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TMC_LOC + * @model + * @generated + * @ordered + */ + public static final int TMC_LOC_VALUE = 1; + + /** + * The 'OPEN LR' literal value. + * + *

+ * If the meaning of 'OPEN LR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OPEN_LR + * @model + * @generated + * @ordered + */ + public static final int OPEN_LR_VALUE = 2; + + /** + * An array of all the 'Location Reference Type' enumerators. + * + * + * @generated + */ + private static final LocationReferenceType[] VALUES_ARRAY = + new LocationReferenceType[] { + TMC_LOC, + OPEN_LR, + }; + + /** + * A public read-only list of all the 'Location Reference Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Location Reference Type' literal with the specified literal value. + * + * + * @generated + */ + public static LocationReferenceType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LocationReferenceType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Location Reference Type' literal with the specified name. + * + * + * @generated + */ + public static LocationReferenceType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LocationReferenceType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Location Reference Type' literal with the specified integer value. + * + * + * @generated + */ + public static LocationReferenceType get(int value) { + switch (value) { + case TMC_LOC_VALUE: return TMC_LOC; + case OPEN_LR_VALUE: return OPEN_LR; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private LocationReferenceType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //LocationReferenceType diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceTypes.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceTypes.java new file mode 100755 index 0000000..aca9b50 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/LocationReferenceTypes.java @@ -0,0 +1,16 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +public interface LocationReferenceTypes { + + public static final String OPEN_LR = "OpenLR"; + +} diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceImpl.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceImpl.java new file mode 100755 index 0000000..6b9f986 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceImpl.java @@ -0,0 +1,83 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.locref.LocationReference; +import org.genivi.locref.LocationReferenceDecodingService; +import org.genivi.locref.LocationReferenceDecodingServiceListener; +import org.genivi.locref.locrefPackage; + +/** + * + * An implementation of the model object 'Location Reference Decoding Service'. + * + *

+ *

+ * + * @generated + */ +public class LocationReferenceDecodingServiceImpl extends EObjectImpl implements LocationReferenceDecodingService { + /** + * + * + * @generated + */ + protected LocationReferenceDecodingServiceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return locrefPackage.Literals.LOCATION_REFERENCE_DECODING_SERVICE; + } + + /** + * + * + * @generated + */ + public void decode(LocationReferenceDecodingServiceListener listener, LocationReference locationReference) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setLanguage(String languageCode, String countryCode) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguage(LocationReferenceDecodingServiceListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //LocationReferenceDecodingServiceImpl diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceListenerImpl.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceListenerImpl.java new file mode 100755 index 0000000..eeb31f3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceDecodingServiceListenerImpl.java @@ -0,0 +1,73 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.location.Location; + +import org.genivi.location.LocationInfo; +import org.genivi.locref.LocationReferenceDecodingServiceListener; +import org.genivi.locref.locrefPackage; + +/** + * + * An implementation of the model object 'Location Reference Decoding Service Listener'. + * + *

+ *

+ * + * @generated + */ +public class LocationReferenceDecodingServiceListenerImpl extends EObjectImpl implements LocationReferenceDecodingServiceListener { + /** + * + * + * @generated + */ + protected LocationReferenceDecodingServiceListenerImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return locrefPackage.Literals.LOCATION_REFERENCE_DECODING_SERVICE_LISTENER; + } + + /** + * + * + * @generated + */ + public void decodeReply(Location location, LocationInfo locationInfo) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguageReply(String languageCode, String countryCode) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //LocationReferenceDecodingServiceListenerImpl diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceImpl.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceImpl.java new file mode 100755 index 0000000..f5f7411 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/LocationReferenceImpl.java @@ -0,0 +1,292 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.locref.LocationReference; +import org.genivi.locref.locrefPackage; + +/** + * + * An implementation of the model object 'Location Reference'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.locref.impl.LocationReferenceImpl#getData Data}
  • + *
  • {@link org.genivi.locref.impl.LocationReferenceImpl#getLocationReferenceType Location Reference Type}
  • + *
+ *

+ * + * @generated + */ +public class LocationReferenceImpl extends EObjectImpl implements LocationReference { + /** + * The default value of the '{@link #getData() Data}' attribute. + * + * + * @see #getData() + * @generated + * @ordered + */ + protected static final Object DATA_EDEFAULT = null; + + /** + * The cached value of the '{@link #getData() Data}' attribute. + * + * + * @see #getData() + * @generated + * @ordered + */ + protected Object data = DATA_EDEFAULT; + + /** + * This is true if the Data attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dataESet; + + /** + * The default value of the '{@link #getLocationReferenceType() Location Reference Type}' attribute. + * + * + * @see #getLocationReferenceType() + * @generated + * @ordered + */ + protected static final byte LOCATION_REFERENCE_TYPE_EDEFAULT = 0x00; + + /** + * The cached value of the '{@link #getLocationReferenceType() Location Reference Type}' attribute. + * + * + * @see #getLocationReferenceType() + * @generated + * @ordered + */ + protected byte locationReferenceType = LOCATION_REFERENCE_TYPE_EDEFAULT; + + /** + * This is true if the Location Reference Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean locationReferenceTypeESet; + + /** + * + * + * @generated + */ + protected LocationReferenceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return locrefPackage.Literals.LOCATION_REFERENCE; + } + + /** + * + * + * @generated + */ + public Object getData() { + return data; + } + + /** + * + * + * @generated + */ + public void setData(Object newData) { + Object oldData = data; + data = newData; + boolean oldDataESet = dataESet; + dataESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, locrefPackage.LOCATION_REFERENCE__DATA, oldData, data, !oldDataESet)); + } + + /** + * + * + * @generated + */ + public void unsetData() { + Object oldData = data; + boolean oldDataESet = dataESet; + data = DATA_EDEFAULT; + dataESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, locrefPackage.LOCATION_REFERENCE__DATA, oldData, DATA_EDEFAULT, oldDataESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetData() { + return dataESet; + } + + /** + * + * + * @generated + */ + public byte getLocationReferenceType() { + return locationReferenceType; + } + + /** + * + * + * @generated + */ + public void setLocationReferenceType(byte newLocationReferenceType) { + byte oldLocationReferenceType = locationReferenceType; + locationReferenceType = newLocationReferenceType; + boolean oldLocationReferenceTypeESet = locationReferenceTypeESet; + locationReferenceTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE, oldLocationReferenceType, locationReferenceType, !oldLocationReferenceTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetLocationReferenceType() { + byte oldLocationReferenceType = locationReferenceType; + boolean oldLocationReferenceTypeESet = locationReferenceTypeESet; + locationReferenceType = LOCATION_REFERENCE_TYPE_EDEFAULT; + locationReferenceTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE, oldLocationReferenceType, LOCATION_REFERENCE_TYPE_EDEFAULT, oldLocationReferenceTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLocationReferenceType() { + return locationReferenceTypeESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case locrefPackage.LOCATION_REFERENCE__DATA: + return getData(); + case locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE: + return getLocationReferenceType(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case locrefPackage.LOCATION_REFERENCE__DATA: + setData(newValue); + return; + case locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE: + setLocationReferenceType((Byte)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case locrefPackage.LOCATION_REFERENCE__DATA: + unsetData(); + return; + case locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE: + unsetLocationReferenceType(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case locrefPackage.LOCATION_REFERENCE__DATA: + return isSetData(); + case locrefPackage.LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE: + return isSetLocationReferenceType(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (data: "); + if (dataESet) result.append(data); else result.append(""); + result.append(", locationReferenceType: "); + if (locationReferenceTypeESet) result.append(locationReferenceType); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LocationReferenceImpl diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefFactoryImpl.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefFactoryImpl.java new file mode 100755 index 0000000..c4af42f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefFactoryImpl.java @@ -0,0 +1,175 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.locref.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class locrefFactoryImpl extends EFactoryImpl implements locrefFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static locrefFactory init() { + try { + locrefFactory thelocrefFactory = (locrefFactory)EPackage.Registry.INSTANCE.getEFactory(locrefPackage.eNS_URI); + if (thelocrefFactory != null) { + return thelocrefFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new locrefFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public locrefFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case locrefPackage.LOCATION_REFERENCE: return createLocationReference(); + case locrefPackage.LOCATION_REFERENCE_DECODING_SERVICE: return createLocationReferenceDecodingService(); + case locrefPackage.LOCATION_REFERENCE_DECODING_SERVICE_LISTENER: return createLocationReferenceDecodingServiceListener(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case locrefPackage.LOCATION_REFERENCE_TYPE: + return createLocationReferenceTypeFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case locrefPackage.LOCATION_REFERENCE_TYPE: + return convertLocationReferenceTypeToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public LocationReference createLocationReference() { + LocationReferenceImpl locationReference = new LocationReferenceImpl(); + return locationReference; + } + + /** + * + * + * @generated + */ + public LocationReferenceDecodingService createLocationReferenceDecodingService() { + LocationReferenceDecodingServiceImpl locationReferenceDecodingService = new LocationReferenceDecodingServiceImpl(); + return locationReferenceDecodingService; + } + + /** + * + * + * @generated + */ + public LocationReferenceDecodingServiceListener createLocationReferenceDecodingServiceListener() { + LocationReferenceDecodingServiceListenerImpl locationReferenceDecodingServiceListener = new LocationReferenceDecodingServiceListenerImpl(); + return locationReferenceDecodingServiceListener; + } + + /** + * + * + * @generated + */ + public LocationReferenceType createLocationReferenceTypeFromString(EDataType eDataType, String initialValue) { + LocationReferenceType result = LocationReferenceType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertLocationReferenceTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public locrefPackage getlocrefPackage() { + return (locrefPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static locrefPackage getPackage() { + return locrefPackage.eINSTANCE; + } + +} //locrefFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefPackageImpl.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefPackageImpl.java new file mode 100755 index 0000000..993bf15 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/impl/locrefPackageImpl.java @@ -0,0 +1,314 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.common.CommonPackage; + +import org.genivi.location.LocationPackage; + +import org.genivi.locref.LocationReference; +import org.genivi.locref.LocationReferenceDecodingService; +import org.genivi.locref.LocationReferenceDecodingServiceListener; +import org.genivi.locref.LocationReferenceType; +import org.genivi.locref.locrefFactory; +import org.genivi.locref.locrefPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class locrefPackageImpl extends EPackageImpl implements locrefPackage { + /** + * + * + * @generated + */ + private EClass locationReferenceEClass = null; + + /** + * + * + * @generated + */ + private EClass locationReferenceDecodingServiceEClass = null; + + /** + * + * + * @generated + */ + private EClass locationReferenceDecodingServiceListenerEClass = null; + + /** + * + * + * @generated + */ + private EEnum locationReferenceTypeEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.locref.locrefPackage#eNS_URI + * @see #init() + * @generated + */ + private locrefPackageImpl() { + super(eNS_URI, locrefFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link locrefPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static locrefPackage init() { + if (isInited) return (locrefPackage)EPackage.Registry.INSTANCE.getEPackage(locrefPackage.eNS_URI); + + // Obtain or create and register package + locrefPackageImpl thelocrefPackage = (locrefPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof locrefPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new locrefPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + LocationPackage.eINSTANCE.eClass(); + CommonPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thelocrefPackage.createPackageContents(); + + // Initialize created meta-data + thelocrefPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thelocrefPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(locrefPackage.eNS_URI, thelocrefPackage); + return thelocrefPackage; + } + + /** + * + * + * @generated + */ + public EClass getLocationReference() { + return locationReferenceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLocationReference_Data() { + return (EAttribute)locationReferenceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLocationReference_LocationReferenceType() { + return (EAttribute)locationReferenceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getLocationReferenceDecodingService() { + return locationReferenceDecodingServiceEClass; + } + + /** + * + * + * @generated + */ + public EClass getLocationReferenceDecodingServiceListener() { + return locationReferenceDecodingServiceListenerEClass; + } + + /** + * + * + * @generated + */ + public EEnum getLocationReferenceType() { + return locationReferenceTypeEEnum; + } + + /** + * + * + * @generated + */ + public locrefFactory getlocrefFactory() { + return (locrefFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + locationReferenceEClass = createEClass(LOCATION_REFERENCE); + createEAttribute(locationReferenceEClass, LOCATION_REFERENCE__DATA); + createEAttribute(locationReferenceEClass, LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE); + + locationReferenceDecodingServiceEClass = createEClass(LOCATION_REFERENCE_DECODING_SERVICE); + + locationReferenceDecodingServiceListenerEClass = createEClass(LOCATION_REFERENCE_DECODING_SERVICE_LISTENER); + + // Create enums + locationReferenceTypeEEnum = createEEnum(LOCATION_REFERENCE_TYPE); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + LocationPackage theLocationPackage = (LocationPackage)EPackage.Registry.INSTANCE.getEPackage(LocationPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(locationReferenceEClass, LocationReference.class, "LocationReference", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLocationReference_Data(), ecorePackage.getEJavaObject(), "data", null, 1, 1, LocationReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLocationReference_LocationReferenceType(), ecorePackage.getEByte(), "locationReferenceType", null, 1, 1, LocationReference.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(locationReferenceDecodingServiceEClass, LocationReferenceDecodingService.class, "LocationReferenceDecodingService", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + EOperation op = addEOperation(locationReferenceDecodingServiceEClass, null, "decode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getLocationReferenceDecodingServiceListener(), "listener", 1, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getLocationReference(), "locationReference", 1, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(locationReferenceDecodingServiceEClass, null, "setLanguage", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "languageCode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "countryCode", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(locationReferenceDecodingServiceEClass, null, "getLanguage", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getLocationReferenceDecodingServiceListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(locationReferenceDecodingServiceListenerEClass, LocationReferenceDecodingServiceListener.class, "LocationReferenceDecodingServiceListener", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + op = addEOperation(locationReferenceDecodingServiceListenerEClass, null, "decodeReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theLocationPackage.getLocation(), "location", 1, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theLocationPackage.getLocationInfo(), "locationInfo", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(locationReferenceDecodingServiceListenerEClass, null, "getLanguageReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "languageCode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "countryCode", 0, 1, IS_UNIQUE, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(locationReferenceTypeEEnum, LocationReferenceType.class, "LocationReferenceType"); + addEEnumLiteral(locationReferenceTypeEEnum, LocationReferenceType.TMC_LOC); + addEEnumLiteral(locationReferenceTypeEEnum, LocationReferenceType.OPEN_LR); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //locrefPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefFactory.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefFactory.java new file mode 100755 index 0000000..d473fb6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefFactory.java @@ -0,0 +1,67 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.locref.locrefPackage + * @generated + */ +public interface locrefFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + locrefFactory eINSTANCE = org.genivi.locref.impl.locrefFactoryImpl.init(); + + /** + * Returns a new object of class 'Location Reference'. + * + * + * @return a new object of class 'Location Reference'. + * @generated + */ + LocationReference createLocationReference(); + + /** + * Returns a new object of class 'Location Reference Decoding Service'. + * + * + * @return a new object of class 'Location Reference Decoding Service'. + * @generated + */ + LocationReferenceDecodingService createLocationReferenceDecodingService(); + + /** + * Returns a new object of class 'Location Reference Decoding Service Listener'. + * + * + * @return a new object of class 'Location Reference Decoding Service Listener'. + * @generated + */ + LocationReferenceDecodingServiceListener createLocationReferenceDecodingServiceListener(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + locrefPackage getlocrefPackage(); + +} //locrefFactory diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefPackage.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefPackage.java new file mode 100755 index 0000000..16c5e93 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/locrefPackage.java @@ -0,0 +1,295 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.locref.locrefFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface locrefPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "locref"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.locref"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "locref"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + locrefPackage eINSTANCE = org.genivi.locref.impl.locrefPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.locref.impl.LocationReferenceImpl Location Reference}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReference() + * @generated + */ + int LOCATION_REFERENCE = 0; + + /** + * The feature id for the 'Data' attribute. + * + * + * @generated + * @ordered + */ + int LOCATION_REFERENCE__DATA = 0; + + /** + * The feature id for the 'Location Reference Type' attribute. + * + * + * @generated + * @ordered + */ + int LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE = 1; + + /** + * The number of structural features of the 'Location Reference' class. + * + * + * @generated + * @ordered + */ + int LOCATION_REFERENCE_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.locref.impl.LocationReferenceDecodingServiceImpl Location Reference Decoding Service}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceDecodingServiceImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceDecodingService() + * @generated + */ + int LOCATION_REFERENCE_DECODING_SERVICE = 1; + + /** + * The number of structural features of the 'Location Reference Decoding Service' class. + * + * + * @generated + * @ordered + */ + int LOCATION_REFERENCE_DECODING_SERVICE_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.locref.impl.LocationReferenceDecodingServiceListenerImpl Location Reference Decoding Service Listener}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceDecodingServiceListenerImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceDecodingServiceListener() + * @generated + */ + int LOCATION_REFERENCE_DECODING_SERVICE_LISTENER = 2; + + /** + * The number of structural features of the 'Location Reference Decoding Service Listener' class. + * + * + * @generated + * @ordered + */ + int LOCATION_REFERENCE_DECODING_SERVICE_LISTENER_FEATURE_COUNT = 0; + + + /** + * The meta object id for the '{@link org.genivi.locref.LocationReferenceType Location Reference Type}' enum. + * + * + * @see org.genivi.locref.LocationReferenceType + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceType() + * @generated + */ + int LOCATION_REFERENCE_TYPE = 3; + + + /** + * Returns the meta object for class '{@link org.genivi.locref.LocationReference Location Reference}'. + * + * + * @return the meta object for class 'Location Reference'. + * @see org.genivi.locref.LocationReference + * @generated + */ + EClass getLocationReference(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.locref.LocationReference#getData Data}'. + * + * + * @return the meta object for the attribute 'Data'. + * @see org.genivi.locref.LocationReference#getData() + * @see #getLocationReference() + * @generated + */ + EAttribute getLocationReference_Data(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.locref.LocationReference#getLocationReferenceType Location Reference Type}'. + * + * + * @return the meta object for the attribute 'Location Reference Type'. + * @see org.genivi.locref.LocationReference#getLocationReferenceType() + * @see #getLocationReference() + * @generated + */ + EAttribute getLocationReference_LocationReferenceType(); + + /** + * Returns the meta object for class '{@link org.genivi.locref.LocationReferenceDecodingService Location Reference Decoding Service}'. + * + * + * @return the meta object for class 'Location Reference Decoding Service'. + * @see org.genivi.locref.LocationReferenceDecodingService + * @generated + */ + EClass getLocationReferenceDecodingService(); + + /** + * Returns the meta object for class '{@link org.genivi.locref.LocationReferenceDecodingServiceListener Location Reference Decoding Service Listener}'. + * + * + * @return the meta object for class 'Location Reference Decoding Service Listener'. + * @see org.genivi.locref.LocationReferenceDecodingServiceListener + * @generated + */ + EClass getLocationReferenceDecodingServiceListener(); + + /** + * Returns the meta object for enum '{@link org.genivi.locref.LocationReferenceType Location Reference Type}'. + * + * + * @return the meta object for enum 'Location Reference Type'. + * @see org.genivi.locref.LocationReferenceType + * @generated + */ + EEnum getLocationReferenceType(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + locrefFactory getlocrefFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.locref.impl.LocationReferenceImpl Location Reference}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReference() + * @generated + */ + EClass LOCATION_REFERENCE = eINSTANCE.getLocationReference(); + + /** + * The meta object literal for the 'Data' attribute feature. + * + * + * @generated + */ + EAttribute LOCATION_REFERENCE__DATA = eINSTANCE.getLocationReference_Data(); + + /** + * The meta object literal for the 'Location Reference Type' attribute feature. + * + * + * @generated + */ + EAttribute LOCATION_REFERENCE__LOCATION_REFERENCE_TYPE = eINSTANCE.getLocationReference_LocationReferenceType(); + + /** + * The meta object literal for the '{@link org.genivi.locref.impl.LocationReferenceDecodingServiceImpl Location Reference Decoding Service}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceDecodingServiceImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceDecodingService() + * @generated + */ + EClass LOCATION_REFERENCE_DECODING_SERVICE = eINSTANCE.getLocationReferenceDecodingService(); + + /** + * The meta object literal for the '{@link org.genivi.locref.impl.LocationReferenceDecodingServiceListenerImpl Location Reference Decoding Service Listener}' class. + * + * + * @see org.genivi.locref.impl.LocationReferenceDecodingServiceListenerImpl + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceDecodingServiceListener() + * @generated + */ + EClass LOCATION_REFERENCE_DECODING_SERVICE_LISTENER = eINSTANCE.getLocationReferenceDecodingServiceListener(); + + /** + * The meta object literal for the '{@link org.genivi.locref.LocationReferenceType Location Reference Type}' enum. + * + * + * @see org.genivi.locref.LocationReferenceType + * @see org.genivi.locref.impl.locrefPackageImpl#getLocationReferenceType() + * @generated + */ + EEnum LOCATION_REFERENCE_TYPE = eINSTANCE.getLocationReferenceType(); + + } + +} //locrefPackage diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefAdapterFactory.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefAdapterFactory.java new file mode 100755 index 0000000..4c4d30a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefAdapterFactory.java @@ -0,0 +1,163 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.locref.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.locref.locrefPackage + * @generated + */ +public class locrefAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static locrefPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public locrefAdapterFactory() { + if (modelPackage == null) { + modelPackage = locrefPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected locrefSwitch modelSwitch = + new locrefSwitch() { + @Override + public Adapter caseLocationReference(LocationReference object) { + return createLocationReferenceAdapter(); + } + @Override + public Adapter caseLocationReferenceDecodingService(LocationReferenceDecodingService object) { + return createLocationReferenceDecodingServiceAdapter(); + } + @Override + public Adapter caseLocationReferenceDecodingServiceListener(LocationReferenceDecodingServiceListener object) { + return createLocationReferenceDecodingServiceListenerAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.locref.LocationReference Location Reference}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.locref.LocationReference + * @generated + */ + public Adapter createLocationReferenceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.locref.LocationReferenceDecodingService Location Reference Decoding Service}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.locref.LocationReferenceDecodingService + * @generated + */ + public Adapter createLocationReferenceDecodingServiceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.locref.LocationReferenceDecodingServiceListener Location Reference Decoding Service Listener}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.locref.LocationReferenceDecodingServiceListener + * @generated + */ + public Adapter createLocationReferenceDecodingServiceListenerAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //locrefAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefSwitch.java b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefSwitch.java new file mode 100755 index 0000000..7bbd7f1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.locref-model/src/org/genivi/locref/util/locrefSwitch.java @@ -0,0 +1,159 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.locref.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.locref.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.locref.locrefPackage + * @generated + */ +public class locrefSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static locrefPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public locrefSwitch() { + if (modelPackage == null) { + modelPackage = locrefPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case locrefPackage.LOCATION_REFERENCE: { + LocationReference locationReference = (LocationReference)theEObject; + T result = caseLocationReference(locationReference); + if (result == null) result = defaultCase(theEObject); + return result; + } + case locrefPackage.LOCATION_REFERENCE_DECODING_SERVICE: { + LocationReferenceDecodingService locationReferenceDecodingService = (LocationReferenceDecodingService)theEObject; + T result = caseLocationReferenceDecodingService(locationReferenceDecodingService); + if (result == null) result = defaultCase(theEObject); + return result; + } + case locrefPackage.LOCATION_REFERENCE_DECODING_SERVICE_LISTENER: { + LocationReferenceDecodingServiceListener locationReferenceDecodingServiceListener = (LocationReferenceDecodingServiceListener)theEObject; + T result = caseLocationReferenceDecodingServiceListener(locationReferenceDecodingServiceListener); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Location Reference'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Location Reference'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocationReference(LocationReference object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Location Reference Decoding Service'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Location Reference Decoding Service'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocationReferenceDecodingService(LocationReferenceDecodingService object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Location Reference Decoding Service Listener'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Location Reference Decoding Service Listener'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLocationReferenceDecodingServiceListener(LocationReferenceDecodingServiceListener object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //locrefSwitch diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.classpath new file mode 100755 index 0000000..f6a3397 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.classpath @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.project new file mode 100755 index 0000000..1af0408 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/.project @@ -0,0 +1,28 @@ + + + org.genivi.trafficincidentsservice.dbus.impl + This project contains the Traffic Incidents Service of the GENIVI Traffic Information project. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.trafficinfo + org.genivi.trafficinfo.dbus-java + org.genivi.trafficinfo.libmatthew + org.genivi.trafficincidentsservice.trafficincidentsservice-model + org.genivi.booleanexpr-model + org.genivi.trafficinfo.demo + org.genivi.iconset-model + org.genivi.locref-model + org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + org.genivi.trafficincidentsservice.dbuswrapper + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/ReadMe.confluence new file mode 100755 index 0000000..83b2c42 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/ReadMe.confluence @@ -0,0 +1 @@ +This project contains a class to wrap the TrafficIncidentsService from org.genivi.trafficincidentsservice.refimpl into a D-Bus service. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/pom.xml new file mode 100755 index 0000000..cb6118d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice + dbus.impl + jar + 1.0-SNAPSHOT + GENIVI Traffic Incidents Service + This project contains the Traffic Incidents Service of the GENIVI Traffic Information project. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.genivi + basetypes-model + + + org.genivi + trafficinfo + + + org.genivi.trafficincidentsservice + dbuswrapper + + + org.genivi.trafficincidentsservice + trafficincidentsservice-model + + + org.genivi.trafficinfo + dbus-java + + + org.genivi.trafficinfo + libmatthew + + + + src/main/java + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.genivi.trafficincidentsservice.dbus.impl.DBusTrafficIncidentsService + true + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/src/main/java/org/genivi/trafficincidentsservice/dbus/impl/DBusTrafficIncidentsService.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/src/main/java/org/genivi/trafficincidentsservice/dbus/impl/DBusTrafficIncidentsService.java new file mode 100755 index 0000000..5e86d63 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbus.impl/src/main/java/org/genivi/trafficincidentsservice/dbus/impl/DBusTrafficIncidentsService.java @@ -0,0 +1,108 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.dbus.impl; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +import openlr.map.MapDatabase; +import openlr.map.teleatlas.sqlite.impl.MapDatabaseImpl; + +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.exceptions.DBusException; +import org.genivi.locref.LocationReferenceType; +import org.genivi.locref.decoder.openlr.OpenLRDecoder; +import org.genivi.locref.refimpl.LocationReferenceDecodingHandlerRefImpl; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.refimpl.TrafficIncidentsService; +import org.genivi.trafficincidentsservice.textgenerator.basictextgenerator.BasicTextGenerator; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.impl.TrafficIncidentsUpdatesAdaptor; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.impl.TrafficIncidentsAdaptor; + +public class DBusTrafficIncidentsService { + private final static Logger LOGGER = Logger.getLogger(DBusTrafficIncidentsService.class.getName()); + private final static String TRAFFIC_INCIDENTS_SERVICE_NAME = "org.genivi.trafficinfo.TrafficIncidentsDBus"; + private final static String TRAFFIC_INCIDENT_FEED_SERVICE_NAME = "org.genivi.trafficinfo.TrafficIncidentsUpdatesDBus"; + private final static String MAP_PATH = "../resources/tomtom_utrecht_2008_04.db3"; + + //settings to control what to run and what not + private final static Level logLevel = Level.SEVERE; + + DBusTrafficIncidentsService() throws DBusException { + + logSetup(); + + // Create the Traffic Incidents Service + TrafficIncidentsService trafficIncidentsService = createTrafficIncidentsService(); + + // Create the Traffic Incident Feed Adaptor + createTrafficIncidentFeedAdaptor(trafficIncidentsService); + + // Create the Traffic Incidents Adaptor + createTrafficIncidentsAdaptor(trafficIncidentsService); + } + + private void logSetup() { + // Create Logger + Logger logger = Logger.getLogger(""); + logger.setLevel(logLevel); + + Handler consoleHandler = null; + for (Handler handler: logger.getHandlers()) { + if (handler.getClass().getName().equals("java.util.logging.ConsoleHandler")) { + consoleHandler = handler; + break; + } + } + consoleHandler.setLevel(Level.INFO); + } + + private TrafficIncidentsService createTrafficIncidentsService() { + // Create a Location Reference Decoding Handler to be used by the Traffic Incidents Service + LocationReferenceDecodingHandlerRefImpl locationReferenceDecodingHandlerRefImpl = new LocationReferenceDecodingHandlerRefImpl(); + + // Open a map database to be used by the location decoders + MapDatabase mapDataBase = new MapDatabaseImpl(MAP_PATH); + + // Create an OpenLR decoder and register it on the LocationReferenceDecodingHandlerRefImpl + OpenLRDecoder openLRDecoder = new OpenLRDecoder(mapDataBase); + locationReferenceDecodingHandlerRefImpl.addDecoder((Byte) (byte) LocationReferenceType.OPEN_LR.getValue(), openLRDecoder); + + // Create the Traffic Incidents Service + TrafficIncidentsService trafficIncidentsService = new TrafficIncidentsService(locationReferenceDecodingHandlerRefImpl, new BasicTextGenerator()); + + return trafficIncidentsService; + } + + private void createTrafficIncidentFeedAdaptor(TrafficIncidentFeed trafficIncidentFeed) throws DBusException { + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + LOGGER.info("DBusConnection obtained"); + + conn.requestBusName(TRAFFIC_INCIDENT_FEED_SERVICE_NAME); + conn.exportObject("/trafficincidentfeed", new TrafficIncidentsUpdatesAdaptor(conn, trafficIncidentFeed)); + LOGGER.info("D-Bus Service TrafficIncidentsUpdatesDBus running"); + } + + private void createTrafficIncidentsAdaptor(TrafficIncidentsService trafficIncidentsService) throws DBusException { + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + LOGGER.info("DBusConnection obtained"); + + conn.requestBusName(TRAFFIC_INCIDENTS_SERVICE_NAME); + + conn.exportObject("/java", new TrafficIncidentsAdaptor(conn, trafficIncidentsService)); + LOGGER.info("D-Bus Service TrafficIncidentsDBus running"); + } + + public static void main(String[] args) throws DBusException { + @SuppressWarnings("unused") + DBusTrafficIncidentsService dBusTrafficIncidentsService = new DBusTrafficIncidentsService(); + LOGGER.info("DBusTrafficIncidentsService running"); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.classpath new file mode 100755 index 0000000..ce5fb3a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.classpath @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.project new file mode 100755 index 0000000..fa7882c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/.project @@ -0,0 +1,27 @@ + + + org.genivi.trafficincidentsservice.dbuswrapper + This project contains the glue code between D-Bus and the clean Java interfaces. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.trafficinfo + org.genivi.trafficinfo.dbus-java + org.genivi.trafficinfo.libmatthew + org.genivi.trafficincidentsservice.trafficincidentsservice-model + org.genivi.booleanexpr-model + org.genivi.trafficinfo.demo + org.genivi.iconset-model + org.genivi.locref-model + org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/ReadMe.confluence new file mode 100755 index 0000000..254733a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/ReadMe.confluence @@ -0,0 +1 @@ +This project defines the D-Bus version of the interfaces of the TrafficIncidentsService and it contains the Proxies and Adaptors to connect the D-Bus interfaces to the plain java interfaces. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/pom.xml new file mode 100755 index 0000000..bead4d5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice + dbuswrapper + jar + 1.0-SNAPSHOT + GENIVI Traffic Incidents D-Bus wrapper + This project contains the glue code between D-Bus and the clean Java interfaces. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.genivi + basetypes-model + + + org.genivi + trafficinfo + + + org.genivi.trafficinfo + dbus-java + + + org.genivi.trafficincidentsservice + trafficincidentsservice-model + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/AdviceStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/AdviceStruct.java new file mode 100755 index 0000000..577edf9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/AdviceStruct.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class AdviceStruct extends Struct { + @Position(0) + public final Byte mainAdvice; // AdviceCode + + @Position(1) + public final Byte subAdvice; + + @Position(2) + public final List freeText; + + @Position(3) + public final List applicability; + + public AdviceStruct(Byte mainAdvice, Byte subAdvice, + List freeText, List applicability) { + super(); + this.mainAdvice = mainAdvice; + this.subAdvice = subAdvice; + this.freeText = freeText; + this.applicability = applicability; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/ApplicabilityStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/ApplicabilityStruct.java new file mode 100755 index 0000000..d0abb66 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/ApplicabilityStruct.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class ApplicabilityStruct extends Struct { + @Position(0) + public final Byte vehicleType; // VehicleType + + @Position(1) + public final List vehicleRelatedRestrictions; + + public ApplicabilityStruct(Byte vehicleType, + List vehicleRelatedRestrictions) { + super(); + this.vehicleType = vehicleType; + this.vehicleRelatedRestrictions = vehicleRelatedRestrictions; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseDiscriminatedVariant.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseDiscriminatedVariant.java new file mode 100755 index 0000000..8097cb2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseDiscriminatedVariant.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Variant; + +public class CauseDiscriminatedVariant extends Struct { + @Position(0) + public final Byte causeType; + + @Position(1) + public final Variant cause; + + public CauseDiscriminatedVariant( + Byte causeType, + Variant cause + ) { + super(); + this.causeType = causeType; + this.cause = cause; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseStruct.java new file mode 100755 index 0000000..01b4ff4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseStruct.java @@ -0,0 +1,15 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Struct; + +public class CauseStruct extends Struct { + public CauseStruct() { + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseType.java new file mode 100755 index 0000000..5dbd7dc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/CauseType.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +public enum CauseType { + DIRECT((byte) 1), + LINKED((byte) 2); + + private Byte value; + + CauseType(Byte value) { + this.value = value; + } + + public Byte getValue() { + return value; + } + + public static CauseType getCauseType(Byte value) { + for (CauseType causeType: values()) { + if (causeType.value == value) { + return causeType; + } + } + + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/DirectCauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/DirectCauseStruct.java new file mode 100755 index 0000000..db5ebe5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/DirectCauseStruct.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; + +public class DirectCauseStruct extends CauseStruct { + @Position(0) + public final Byte mainCause; + + @Position(1) + public final Byte warningLevel; + + @Position(2) + public final Boolean unverifiedInformation; + + @Position(3) + public final Byte subCause; + + @Position(4) + public final Integer lengthAffected; + + @Position(5) + public final Integer causeOffset; + + @Position(6) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List laneRestrictions; + + @Position(7) + public final List freeText; + + public DirectCauseStruct(Byte mainCause, Byte warningLevel, + Boolean unverifiedInformation, Byte subCause, Integer lengthAffected, Integer causeOffset, + List laneRestrictions, List freeText) { + super(); + this.mainCause = mainCause; + this.warningLevel = warningLevel; + this.unverifiedInformation = unverifiedInformation; + this.subCause = subCause; + this.lengthAffected = lengthAffected; + this.causeOffset = causeOffset; + this.laneRestrictions = laneRestrictions; + this.freeText = freeText; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LaneRestrictionsStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LaneRestrictionsStruct.java new file mode 100755 index 0000000..0a0139a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LaneRestrictionsStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class LaneRestrictionsStruct extends Struct { + @Position(0) + public final Byte laneRestrictionType; // LaneRestrictionType + + @Position(1) + public final Integer numberOfLanes; + + public LaneRestrictionsStruct(Byte laneRestrictionType, int numberOfLanes) { + super(); + this.laneRestrictionType = laneRestrictionType; + this.numberOfLanes = numberOfLanes; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LinkedCauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LinkedCauseStruct.java new file mode 100755 index 0000000..1243226 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LinkedCauseStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; + +public class LinkedCauseStruct extends CauseStruct { + @Position(0) + public final Byte mainCause; + + @Position(1) + public final String causeTrafficIncidentId; + + public LinkedCauseStruct(Byte mainCause, String causeTrafficIncidentId) { + super(); + this.mainCause = mainCause; + this.causeTrafficIncidentId = causeTrafficIncidentId; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocalizedStringStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocalizedStringStruct.java new file mode 100755 index 0000000..0f623dc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocalizedStringStruct.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class LocalizedStringStruct extends Struct { + @Position(0) + public final String languageCode; + + @Position(1) + public final String countryCode; + + @Position(2) + public final String string; + + public LocalizedStringStruct(String languageCode, String countryCode, + String string) { + super(); + this.languageCode = languageCode; + this.countryCode = countryCode; + this.string = string; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocationReferenceStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocationReferenceStruct.java new file mode 100755 index 0000000..e0829e1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/LocationReferenceStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class LocationReferenceStruct extends Struct { + @Position(0) + public final Byte locationReferenceType; + + @Position(1) + public final byte[] data; + + public LocationReferenceStruct(Byte locationReferenceType, byte[] data) { + super(); + this.locationReferenceType = locationReferenceType; + this.data = data; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitSectionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitSectionStruct.java new file mode 100755 index 0000000..6e3ef60 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitSectionStruct.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2014 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TemporarySpeedLimitSectionStruct extends Struct { + @Position(0) + public final Short speedLimitValue; + + @Position(1) + public final Short speedLimitValueWet; + + @Position(2) + public final Integer speedLimitLength; + + + public TemporarySpeedLimitSectionStruct(Short speedLimitValue, + Short speedLimitValueWet, Integer speedLimitLength) { + super(); + this.speedLimitValue = speedLimitValue; + this.speedLimitValueWet = speedLimitValueWet; + this.speedLimitLength = speedLimitLength; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitStruct.java new file mode 100755 index 0000000..2750532 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TemporarySpeedLimitStruct.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2014 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TemporarySpeedLimitStruct extends Struct { + @Position(0) + public final Boolean unitsMPH; + + @Position(1) + public final Integer offset; + + @Position(2) + public final List temporarySpeedLimitSections; + + @Position(3) + public final List applicability; + + + public TemporarySpeedLimitStruct(Boolean unitsMPH, Integer offset, + List temporarySpeedLimitSections, + List applicability) { + super(); + this.unitsMPH = unitsMPH; + this.offset = offset; + this.temporarySpeedLimitSections = temporarySpeedLimitSections; + this.applicability = applicability; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentFeedDBus.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentFeedDBus.java new file mode 100755 index 0000000..243ee13 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentFeedDBus.java @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TwoTuple; + +public interface TrafficIncidentFeedDBus extends DBusInterface { + public VersionStruct GetVersion(); + + public TwoTuple GetLanguage(); + + public Integer RegisterFeed(String dataProviderName, String protocolName, + String communicationChannelName); + + public void Clear(); + + public void UpdateIncidents(Integer feedId, List cancelledIncidentIds, + List updatedIncidents); + + public void UpdateStatus(Integer feedId, Byte feedStatus, Byte incidentsStatus); + + public void AddLanguageListener(); + + public void RemoveLanguageListener(); + + public class LanguageChanged extends DBusSignal { + public final String languageCode; + public final String countryCode; + + public LanguageChanged(String path, String languageCode, String countryCode) throws DBusException { + super(path, languageCode, countryCode); + this.languageCode = languageCode; + this.countryCode = countryCode; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentStruct.java new file mode 100755 index 0000000..ca56600 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/TrafficIncidentStruct.java @@ -0,0 +1,106 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TrafficIncidentStruct extends Struct { + @Position(0) + public final String trafficIncidentId; + + @Position(1) + public final Byte effectCode; // EffectCode + + @Position(2) + public final Integer startTime; + + @Position(3) + public final Integer stopTime; + + @Position(4) + public final Byte tendency; // Tendency + + @Position(5) + public final Integer lengthAffected; + + @Position(6) + public final Integer averageSpeedAbsolute; + + @Position(7) + public final Integer delay; + + @Position(8) + public final Integer segmentSpeedLimit; + + @Position(9) + public final Integer expectedSpeedAbsolute; + + @Position(10) + public final List causes; + + @Position(11) + public final List advices; + + @Position(12) + public final List applicability; + + @Position(13) + public final List temporarySpeedLimits; + + @Position(14) + public final Integer expirationTime; + + @Position(15) + public final Integer updateTime; + + @Position(16) + public final LocationReferenceStruct locationReference; + + + public TrafficIncidentStruct( + String trafficIncidentManagementId, + Byte effectCode, + Integer startTime, + Integer stopTime, + Byte tendency, + Integer lengthAffected, + Integer averageSpeedAbsolute, + Integer delay, + Integer segmentSpeedLimit, + Integer expectedSpeedAbsolute, + List causes, + List advices, + List applicability, + List temporarySpeedLimits, + Integer expirationTime, + Integer updateTime, + LocationReferenceStruct locationReference + ) { + super(); + this.trafficIncidentId = trafficIncidentManagementId; + this.effectCode = effectCode; + this.startTime = startTime; + this.stopTime = stopTime; + this.tendency = tendency; + this.lengthAffected = lengthAffected; + this.averageSpeedAbsolute = averageSpeedAbsolute; + this.delay = delay; + this.segmentSpeedLimit = segmentSpeedLimit; + this.expectedSpeedAbsolute = expectedSpeedAbsolute; + this.causes = causes; + this.advices = advices; + this.applicability = applicability; + this.temporarySpeedLimits = temporarySpeedLimits; + this.expirationTime = expirationTime; + this.updateTime = updateTime; + this.locationReference = locationReference; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VehicleRelatedRestrictionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VehicleRelatedRestrictionStruct.java new file mode 100755 index 0000000..3c7d854 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VehicleRelatedRestrictionStruct.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class VehicleRelatedRestrictionStruct extends Struct { + @Position(0) + public final Byte restrictionType; // RestrictionType + + @Position(1) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List restrictionValue; + + @Position(2) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List restrictionLocationReference; + + public VehicleRelatedRestrictionStruct(Byte restrictionType, + List restrictionValue, + List restrictionLocationReference + ) { + super(); + this.restrictionType = restrictionType; + this.restrictionValue = restrictionValue; + this.restrictionLocationReference = restrictionLocationReference; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VersionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VersionStruct.java new file mode 100755 index 0000000..870ceac --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/VersionStruct.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.UInt16; + +public class VersionStruct extends Struct { + @Position(0) + public final UInt16 major; + + @Position(1) + public final UInt16 minor; + + @Position(2) + public final UInt16 micro; + + @Position(3) + public final String date; + + public VersionStruct(UInt16 major, UInt16 minor, UInt16 micro, String date) { + super(); + this.major = major; + this.minor = minor; + this.micro = micro; + this.date = date; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/StructUtil.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/StructUtil.java new file mode 100755 index 0000000..4234365 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/StructUtil.java @@ -0,0 +1,1447 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.EList; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.Variant; +import org.genivi.common.CommonFactory; +import org.genivi.common.LocalizedString; +import org.genivi.common.Version; +import org.genivi.locref.LocationReference; +import org.genivi.locref.locrefFactory; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.trafficincidentsserviceFactory; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.AdviceStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.ApplicabilityStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.CauseDiscriminatedVariant; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.CauseStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.CauseType; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.DirectCauseStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.LaneRestrictionsStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.LinkedCauseStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.LocalizedStringStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.LocationReferenceStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TemporarySpeedLimitSectionStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TemporarySpeedLimitStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.VehicleRelatedRestrictionStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentFactory; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.FeedInformationStruct; +import org.genivi.trafficincidentsservice.trafficincidenttables.Accident; +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue; +import org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle; +import org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully; +import org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Fire; +import org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion; +import org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind; +import org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility; +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent; +import org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment; +import org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint; +import org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation; +import org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons; +import org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure; +import org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire; +import org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; +import org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay; +import org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion; +import org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; +import org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +public class StructUtil { + private final static Logger LOGGER = Logger.getLogger(StructUtil.class.getName()); + private final static CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; + private final static locrefFactory LOCATION_REFERENCE_FACTORY = locrefFactory.eINSTANCE; + private final static XTrafficIncidentFactory TRAFFIC_INCIDENT_FACTORY = XTrafficIncidentFactory.eINSTANCE; + private final static trafficincidentsserviceFactory TRAFFIC_INCIDENTS_SVC_FACTORY = trafficincidentsserviceFactory.eINSTANCE; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + public static Version versionStructToVersion(VersionStruct versionStruct) { + Version version = COMMON_FACTORY.createVersion(); + + version.setMajor(versionStruct.major.intValue()); + version.setMinor(versionStruct.minor.intValue()); + version.setMicro(versionStruct.micro.intValue()); + version.setDate(versionStruct.date); + + return version; + } + + public static VersionStruct versionToVersionStruct(Version version) { + LOGGER.info("=>"); + UInt16 major = new UInt16(version.getMajor()); + UInt16 minor = new UInt16(version.getMinor()); + UInt16 micro = new UInt16(version.getMicro()); + + VersionStruct versionStruct = new VersionStruct(major, minor, micro, version.getDate()); + + LOGGER.info("<= " + versionStruct); + return versionStruct; + } + + public static TrafficIncident trafficIncidentStructToTrafficIncident(TrafficIncidentStruct trafficIncidentStruct) { + LOGGER.info("trafficIncidentStructToTrafficIncident =>"); + TrafficIncident trafficIncident = TRAFFIC_INCIDENT_FACTORY.createTrafficIncident(); + + if (trafficIncidentStruct.effectCode != 0) { + EffectCode effectCode = EffectCode.get(trafficIncidentStruct.effectCode); + trafficIncident.setEffectCode(effectCode); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: effectCode set: " + trafficIncident.getEffectCode()); + } + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: effectCode handled OK"); + + long startTimeValue = trafficIncidentStruct.startTime; + if (startTimeValue != -1) { + Date startTime = new Date(startTimeValue * 1000 * 60); + trafficIncident.setStartTime(startTime); + LOGGER.info("startTimeValue = " + startTimeValue); + LOGGER.info("startTimeValue * 1000 * 60 = " + startTimeValue * 1000 * 60); + LOGGER.info("trafficIncidentStruct.startTime * 1000 * 60 = " + trafficIncidentStruct.startTime * 1000 * 60); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: startTime set: " + trafficIncident.getStartTime()); + } + + long stopTimeValue = trafficIncidentStruct.stopTime; + if (stopTimeValue != -1) { + Date stopTime = new Date(stopTimeValue * 1000 * 60); + trafficIncident.setStopTime(stopTime); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: stopTime set: " + trafficIncident.getStopTime()); + } + + if (trafficIncidentStruct.tendency != 0) { + Tendency tendency = Tendency.get(trafficIncidentStruct.tendency); + trafficIncident.setTendency(tendency); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: tendency set: " + trafficIncident.getTendency()); + } + + if (trafficIncidentStruct.lengthAffected != -1) { + trafficIncident.setLengthAffected(trafficIncidentStruct.lengthAffected); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: lengthAffected set: " + trafficIncident.getLengthAffected()); + } + + if (trafficIncidentStruct.averageSpeedAbsolute != -1) { + trafficIncident.setAverageSpeedAbsolute(trafficIncidentStruct.averageSpeedAbsolute); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: averageSpeedAbsolute set: " + trafficIncident.getAverageSpeedAbsolute()); + } + + if (trafficIncidentStruct.delay != -1) { + trafficIncident.setDelay(trafficIncidentStruct.delay); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: delay set: " + trafficIncident.getDelay()); + } + + if (trafficIncidentStruct.segmentSpeedLimit != -1) { + trafficIncident.setSegmentSpeedLimit(trafficIncidentStruct.segmentSpeedLimit); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: segmentSpeedLimit set: " + trafficIncident.getSegmentSpeedLimit()); + } + + if (trafficIncidentStruct.expectedSpeedAbsolute != -1) { + trafficIncident.setExpectedSpeedAbsolute(trafficIncidentStruct.expectedSpeedAbsolute); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: expectedSpeedAbsolute set: " + trafficIncident.getExpectedSpeedAbsolute()); + } + + for (CauseDiscriminatedVariant causeDiscriminatedVariant: trafficIncidentStruct.causes) { + Cause cause = causeDiscriminatedVariantToCause(causeDiscriminatedVariant); + trafficIncident.getCauses().add(cause); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: cause added: " + cause); + } + + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: number of advices = " + trafficIncidentStruct.advices.size()); + for (AdviceStruct adviceUpdateStruct: trafficIncidentStruct.advices) { + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: loop start"); + Advice advice = adviceStructToAdvice(adviceUpdateStruct); + trafficIncident.getAdvices().add(advice); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: advice added: " + advice); + } + + for (ApplicabilityStruct applicabilityStruct: trafficIncidentStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + trafficIncident.getApplicability().add(applicability); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: applicability added: " + applicability); + } + + for (TemporarySpeedLimitStruct temporarySpeedLimitStruct: trafficIncidentStruct.temporarySpeedLimits) { + TemporarySpeedLimit temporarySpeedLimit = temporarySpeedLimitStructToTemporarySpeedLimit(temporarySpeedLimitStruct); + trafficIncident.getTemporarySpeedLimit().add(temporarySpeedLimit); + LOGGER.info("temporarySpeedLimit added: " + temporarySpeedLimit); + } + + trafficIncident.setTrafficIncidentId(trafficIncidentStruct.trafficIncidentId); + + long expirationTimeValue = trafficIncidentStruct.expirationTime; + if (expirationTimeValue != -1) { + Date expirationTime = new Date(expirationTimeValue * 1000 * 60); + trafficIncident.setExpirationTime(expirationTime); + } + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: expirationTime handled OK"); + + long updateTimeValue = trafficIncidentStruct.updateTime; + if (updateTimeValue != -1) { + Date updateTime = new Date(updateTimeValue * 1000 * 60); + trafficIncident.setUpdateTime(updateTime); + } + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: updateTime handled OK"); + + LocationReference locationReference = locationReferenceStructToLocationReference(trafficIncidentStruct.locationReference); + trafficIncident.setLocationReference(locationReference); + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident: locationReference handled OK"); + + LOGGER.info("managedTrafficIncidentStructToManagedTrafficIncident <="); + return trafficIncident; + } + + public static TrafficIncidentStruct trafficIncidentToTrafficIncidentStruct( + TrafficIncident trafficIncident) { + + byte effectCodeId = 0; + EffectCode effectCode = trafficIncident.getEffectCode(); + if (effectCode != null) { + effectCodeId = (byte) effectCode.getValue(); + } + + Integer startTime; + if (trafficIncident.isSetStartTime()) { + LOGGER.info("Start date = " + trafficIncident.getStartTime()); + LOGGER.info("Start date.time = " + trafficIncident.getStartTime().getTime()); + startTime = (int) (trafficIncident.getStartTime().getTime() / (1000 * 60)); + LOGGER.info("Start struct = " + startTime); + } else { + startTime = -1; + } + + Integer stopTime; + if (trafficIncident.isSetStopTime()) { + stopTime = (int) (trafficIncident.getStopTime().getTime() / (1000 * 60)); + } else { + stopTime = -1; + } + + Byte tendencyId = 0; + Tendency tendency = trafficIncident.getTendency(); + if (tendency != null) { + tendencyId = (Byte) (byte) tendency.getValue(); + } + + int lengthAffected = -1; + if (trafficIncident.getLengthAffected() != null) { + lengthAffected =trafficIncident.getLengthAffected(); + } + + int averageSpeedAbsolute = -1; + if (trafficIncident.getAverageSpeedAbsolute() != null) { + averageSpeedAbsolute = trafficIncident.getAverageSpeedAbsolute(); + } + + int delay = -1; + if (trafficIncident.isSetDelay() && trafficIncident.getDelay() != null) { + Integer integerDelay = trafficIncident.getDelay(); + if (integerDelay != null) { + delay = integerDelay; + } + } + + int segmentSpeedLimit = -1; + if (trafficIncident.getSegmentSpeedLimit() != null) { + segmentSpeedLimit = trafficIncident.getSegmentSpeedLimit(); + } + + int expectedSpeedAbsolute = -1; + if (trafficIncident.getExpectedSpeedAbsolute() != null) { + expectedSpeedAbsolute = trafficIncident.getExpectedSpeedAbsolute(); + } + + EList causes = trafficIncident.getCauses(); + List causeDiscriminatedVariants = new ArrayList<>(); + for (Cause cause: causes) { + CauseDiscriminatedVariant causeDiscriminatedVariant = causeToCauseDiscriminatedVariant(cause); + causeDiscriminatedVariants.add(causeDiscriminatedVariant); + } + + EList advices = trafficIncident.getAdvices(); + List adviceStructs = new ArrayList<>(); + for (int i = 0; i < advices.size(); i++) { + AdviceStruct adviceStruct = adviceToAdviceStruct(advices.get(i)); + adviceStructs.add(adviceStruct); + } + + EList applicabilities = trafficIncident.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + EList temporarySpeedLimits = trafficIncident.getTemporarySpeedLimit(); + List temporarySpeedLimitStructs = new ArrayList<>(); + for (int i = 0; i < temporarySpeedLimits.size(); i++) { + TemporarySpeedLimitStruct temporarySpeedLimitStruct = temporarySpeedLimitToTemporarySpeedLimitStruct(temporarySpeedLimits.get(i)); + temporarySpeedLimitStructs.add(temporarySpeedLimitStruct); + } + + String trafficIncidentManagementId = trafficIncident.getTrafficIncidentId(); + + Integer expirationTime; + if (trafficIncident.isSetExpirationTime() && trafficIncident.getExpirationTime() != null) { + expirationTime = (int) (trafficIncident.getExpirationTime().getTime() / (1000 * 60)); + } else { + expirationTime = -1; + } + + Integer updateTime; + if (trafficIncident.isSetUpdateTime()) { + updateTime = (int) (trafficIncident.getUpdateTime().getTime() / (1000 * 60)); + } else { + updateTime = -1; + } + + LocationReferenceStruct locationReferenceStruct = locationReferenceToLocationReferenceStruct(trafficIncident.getLocationReference()); + + + TrafficIncidentStruct trafficIncidentStruct = new TrafficIncidentStruct( + trafficIncidentManagementId, + effectCodeId, + startTime, + stopTime, + tendencyId, + lengthAffected, + averageSpeedAbsolute, + delay, + segmentSpeedLimit, + expectedSpeedAbsolute, + causeDiscriminatedVariants, + adviceStructs, + applicabilityStructs, + temporarySpeedLimitStructs, + expirationTime, + updateTime, + locationReferenceStruct + ); + + return trafficIncidentStruct; + } + + private static Cause causeDiscriminatedVariantToCause(CauseDiscriminatedVariant causeDiscriminatedVariant) { + CauseType causeType = CauseType.getCauseType(causeDiscriminatedVariant.causeType); + CauseStruct causeStruct = reconstructCauseStruct(causeType, causeDiscriminatedVariant.cause); + LOGGER.info("causeStruct = " + causeStruct); + Cause cause; + switch (causeType) { + case DIRECT: + LOGGER.info("is DirectCauseStruct"); + DirectCauseStruct directCauseStruct = (DirectCauseStruct) causeStruct; + cause = directCauseStructToDirectCause(directCauseStruct); + break; + + case LINKED: + LOGGER.info("is LinkedCauseStruct"); + LinkedCauseStruct linkedCauseStruct = (LinkedCauseStruct) causeStruct; + cause = linkedCauseStructToLinkedCause(linkedCauseStruct); + break; + + default: + throw new RuntimeException("Illegal causeType: " + causeType); + } + + return cause; + } + + private static CauseStruct reconstructCauseStruct(CauseType causeType, Variant causeVariant) { + LOGGER.info("reconstructCauseStruct => causeType = " + causeType + ", causeVariant" + causeVariant); + + Object[] structFields = (Object[]) causeVariant.getValue(); + CauseStruct causeStruct = null; + + Byte mainCause; + + switch (causeType) { + case DIRECT: + if (!(structFields.length == 8 && + structFields[0] instanceof Byte && + structFields[1] instanceof Byte && + structFields[2] instanceof Boolean && + structFields[3] instanceof Byte && + structFields[4] instanceof Integer && + structFields[5] instanceof Integer && + structFields[6] instanceof Vector && + structFields[7] instanceof Vector)) { + for (Object structField: structFields) { + LOGGER.info("reconstructCauseStructs field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for DirectCause"); + } + mainCause = (Byte) structFields[0]; + Byte warningLevel = (Byte) structFields[1]; + LOGGER.info("warningLevel OK"); + Boolean unverifiedInformation = (Boolean) structFields[2]; + LOGGER.info("unverifiedInformation OK"); + Byte subCause = (Byte) structFields[3]; + LOGGER.info("subCause OK"); + int lengthAffected = (Integer) structFields[4]; + LOGGER.info("lengthAffected OK"); + int causeOffset = (Integer) structFields[5]; + LOGGER.info("causeCode OK"); + @SuppressWarnings("unchecked") + List laneRestrictions = reconstructLaneRestrictionsStructs((Vector) structFields[6]); + LOGGER.info("LaneRestrictionsStruct OK"); + @SuppressWarnings("unchecked") + List freeTexts = reconstructLocalizedStringStructs((Vector) structFields[7]); + LOGGER.info("freeTexts OK"); + causeStruct = new DirectCauseStruct(mainCause, warningLevel, unverifiedInformation, + subCause, lengthAffected, causeOffset, laneRestrictions, freeTexts); + break; + + case LINKED: + if (!(structFields.length == 2 && + structFields[0] instanceof Byte && + structFields[1] instanceof String)) { + LOGGER.severe("Wrong signature for LinkedCause"); + for (Object structField: structFields) { + LOGGER.severe("reconstructCauseStructs field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for LinkedCause"); + } + mainCause = (Byte) structFields[0]; + String causeTrafficIncidentId = (String) structFields[1]; + causeStruct = new LinkedCauseStruct(mainCause, causeTrafficIncidentId); + break; + } + + LOGGER.info("reconstructCauseStruct <= " + causeStruct); + return causeStruct; + } + + private static CauseDiscriminatedVariant causeToCauseDiscriminatedVariant(Cause cause) { + CauseType causeType; + CauseStruct causeStruct; + + if (cause instanceof DirectCause) { + causeType = CauseType.DIRECT; + causeStruct = directCauseToDirectCauseStruct((DirectCause) cause); + } else if (cause instanceof LinkedCause) { + causeType = CauseType.LINKED; + causeStruct = linkedCauseToLinkedCauseStruct((LinkedCause) cause); + } else { + throw new IllegalArgumentException("Unknow subclass of Cause"); + } + + Variant causeVariant = new Variant(causeStruct); + return new CauseDiscriminatedVariant(causeType.getValue(), causeVariant); + } + + private static LinkedCause linkedCauseStructToLinkedCause(LinkedCauseStruct linkedCauseStruct) { + LinkedCause linkedCause = TRAFFIC_INCIDENT_FACTORY.createLinkedCause(); + + CauseCode mainCause = CauseCode.get(linkedCauseStruct.mainCause); + linkedCause.setMainCause(mainCause); + + linkedCause.setCauseTrafficIncidentId(linkedCauseStruct.causeTrafficIncidentId); + + return linkedCause; + } + + private static LinkedCauseStruct linkedCauseToLinkedCauseStruct(LinkedCause linkedCause) { + Byte mainCause = (byte) linkedCause.getMainCause().getValue(); + String causeTrafficIncidentId = linkedCause.getCauseTrafficIncidentId(); + + LinkedCauseStruct linkedCauseStruct = new LinkedCauseStruct(mainCause, causeTrafficIncidentId); + + return linkedCauseStruct; + } + + private static DirectCause directCauseStructToDirectCause(DirectCauseStruct directCauseStruct) { + DirectCause directCause = TRAFFIC_INCIDENT_FACTORY.createDirectCause(); + + CauseCode mainCause = CauseCode.get(directCauseStruct.mainCause); + directCause.setMainCause(mainCause); + + if (directCauseStruct.warningLevel != 0) { + WarningLevel warningLevel = WarningLevel.get(directCauseStruct.warningLevel); + directCause.setWarningLevel(warningLevel); + } + + boolean unverifiedInformation = directCauseStruct.unverifiedInformation; + directCause.setUnverifiedInformation(unverifiedInformation); + + Byte subCauseValue = directCauseStruct.subCause; + + if (subCauseValue != 0) { + Object subCause; + switch (mainCause) { + case ACCIDENT: + subCause = Accident.get(subCauseValue); + break; + + case ANIMALS_ON_ROADWAY: + subCause = AnimalsOnRoadway.get(subCauseValue); + break; + + case BROKEN_DOWN_VEHICLES: + subCause = BrokenDownVehicles.get(subCauseValue); + break; + + case DANGEROUS_END_OF_QUEUE: + subCause = DangerousEndOfQueue.get(subCauseValue); + break; + + case EXTREME_WEATHER_CONDITIONS: + subCause = ExtremeWeatherConditions.get(subCauseValue); + break; + + case FIRE: + subCause = Fire.get(subCauseValue); + break; + + case HAZARDOUS_DRIVING_CONDITIONS: + subCause = HazardousDrivingConditions.get(subCauseValue); + break; + + case IMPASSIBILITY: + subCause = Impassibility.get(subCauseValue); + break; + + case MAJOR_EVENT: + subCause = MajorEvent.get(subCauseValue); + break; + + case MALFUNCTIONING_ROADSIDE_EQUIPMENT: + subCause = MalfunctioningRoadsideEquipment.get(subCauseValue); + break; + + case NARROW_LANES: + subCause = NarrowLanes.get(subCauseValue); + break; + + case OBJECTS_ON_THE_ROAD: + subCause = ObjectsOnTheRoad.get(subCauseValue); + break; + + case PEOPLE_ON_ROADWAY: + subCause = PeopleOnRoadway.get(subCauseValue); + break; + + case POLICE_CHECKPOINT: + subCause = PoliceCheckpoint.get(subCauseValue); + break; + + case PRECIPITATION: + subCause = Precipitation.get(subCauseValue); + break; + + case RECKLESS_PERSONS: + subCause = RecklessPersons.get(subCauseValue); + break; + + case REGULATORY_MEASURE: + subCause = RegulatoryMeasure.get(subCauseValue); + break; + + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + subCause = RescueAndRecoveryWorkInProgress.get(subCauseValue); + break; + + case RISK_OF_FIRE: + subCause = RiskOfFire.get(subCauseValue); + break; + + case ROADWORKS: + subCause = RoadWorks.get(subCauseValue); + break; + + case SERVICE_NOT_OPERATING: + subCause = ServiceNotOperating.get(subCauseValue); + break; + + case SERVICE_NOT_USEABLE: + subCause = ServiceNotUsable.get(subCauseValue); + break; + + case SLIPPERY_ROAD: + subCause = SlipperyRoad.get(subCauseValue); + break; + + case SLOW_MOVING_VEHICLES: + subCause = SlowMovingVehicles.get(subCauseValue); + break; + + case TIME_DELAY: + subCause = TimeDelay.get(subCauseValue); + break; + + case TRAFFIC_CONGESTION: + subCause = TrafficCongestion.get(subCauseValue); + break; + + case VISIBILITY_REDUCED: + subCause = VisibilityReduced.get(subCauseValue); + break; + + case AQUAPLANING: + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED: + case TRAFFIC_REGULATIONS_CHANGED: + case VEHICLE_ON_WRONG_CARRIAGEWAY: + throw new IllegalArgumentException("Subcause for main cause which doesn't support a subcause"); + + default: + throw new IllegalArgumentException("Unknown mainCause"); + } + + directCause.setSubCause(subCause); + } + + if (directCauseStruct.lengthAffected != -1) { + directCause.setLengthAffected(directCauseStruct.lengthAffected); + } + + if (directCauseStruct.causeOffset != -1) { + directCause.setCauseOffset(directCauseStruct.causeOffset); + } + + if (directCauseStruct.laneRestrictions.size() == 1) { + LaneRestrictions laneRestrictions = laneRestrictionsStructToLaneRestrictions(directCauseStruct.laneRestrictions.get(0)); + directCause.setLaneRestrictions(laneRestrictions); + } else if (directCauseStruct.laneRestrictions.size() == 0) { + // no action + } else { + throw new RuntimeException("Illegal size of LaneRestrictions list: " + directCauseStruct.laneRestrictions.size()); + } + + for (LocalizedStringStruct localizedStringStruct: directCauseStruct.freeText) { + LocalizedString freeText = localizedStringStructToLocalizedString(localizedStringStruct); + directCause.getFreeText().add(freeText); + } + + return directCause; + } + + private static DirectCauseStruct directCauseToDirectCauseStruct(DirectCause directCause) { + Byte mainCause = (byte) directCause.getMainCause().getValue(); + + Byte warningLevel = 0; + if (directCause.getWarningLevel() != null) { + warningLevel = (byte) directCause.getWarningLevel().getValue(); + } + + Boolean unverifiedInformation = directCause.isUnverifiedInformation(); + + Object subCauseObj = directCause.getSubCause(); + int subCauseValue = -1; + Byte subCause = 0; + if (subCauseObj != null) { + switch (directCause.getMainCause()) { + case ACCIDENT: + subCauseValue = ((Accident) subCauseObj).getValue(); + break; + + case ANIMALS_ON_ROADWAY: + subCauseValue = ((AnimalsOnRoadway) subCauseObj).getValue(); + break; + + case BROKEN_DOWN_VEHICLES: + subCauseValue = ((BrokenDownVehicles) subCauseObj).getValue(); + break; + + case DANGEROUS_END_OF_QUEUE: + subCauseValue = ((DangerousEndOfQueue) subCauseObj).getValue(); + break; + + case EXTREME_WEATHER_CONDITIONS: + subCauseValue = ((ExtremeWeatherConditions) subCauseObj).getValue(); + break; + + case FIRE: + subCauseValue = ((Fire) subCauseObj).getValue(); + break; + + case HAZARDOUS_DRIVING_CONDITIONS: + subCauseValue = ((HazardousDrivingConditions) subCauseObj).getValue(); + break; + + case IMPASSIBILITY: + subCauseValue = ((Impassibility) subCauseObj).getValue(); + break; + + case MAJOR_EVENT: + subCauseValue = ((MajorEvent) subCauseObj).getValue(); + break; + + case MALFUNCTIONING_ROADSIDE_EQUIPMENT: + subCauseValue = ((MalfunctioningRoadsideEquipment) subCauseObj).getValue(); + break; + + case NARROW_LANES: + subCauseValue = ((NarrowLanes) subCauseObj).getValue(); + break; + + case OBJECTS_ON_THE_ROAD: + subCauseValue = ((ObjectsOnTheRoad) subCauseObj).getValue(); + break; + + case PEOPLE_ON_ROADWAY: + subCauseValue = ((PeopleOnRoadway) subCauseObj).getValue(); + break; + + case POLICE_CHECKPOINT: + subCauseValue = ((PoliceCheckpoint) subCauseObj).getValue(); + break; + + case PRECIPITATION: + subCauseValue = ((Precipitation) subCauseObj).getValue(); + break; + + case RECKLESS_PERSONS: + subCauseValue = ((RecklessPersons) subCauseObj).getValue(); + break; + + case REGULATORY_MEASURE: + subCauseValue = ((RegulatoryMeasure) subCauseObj).getValue(); + break; + + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + subCauseValue = ((RescueAndRecoveryWorkInProgress) subCauseObj).getValue(); + break; + + case RISK_OF_FIRE: + subCauseValue = ((RiskOfFire) subCauseObj).getValue(); + break; + + case ROADWORKS: + subCauseValue = ((RoadWorks) subCauseObj).getValue(); + break; + + case SERVICE_NOT_OPERATING: + subCauseValue = ((ServiceNotOperating) subCauseObj).getValue(); + break; + + case SERVICE_NOT_USEABLE: + subCauseValue = ((ServiceNotUsable) subCauseObj).getValue(); + break; + + case SLIPPERY_ROAD: + subCauseValue = ((SlipperyRoad) subCauseObj).getValue(); + break; + + case SLOW_MOVING_VEHICLES: + subCauseValue = ((SlowMovingVehicles) subCauseObj).getValue(); + break; + + case TIME_DELAY: + subCauseValue = ((TimeDelay) subCauseObj).getValue(); + break; + + case TRAFFIC_CONGESTION: + subCauseValue = ((TrafficCongestion) subCauseObj).getValue(); + break; + + case VISIBILITY_REDUCED: + subCauseValue = ((VisibilityReduced) subCauseObj).getValue(); + break; + + case AQUAPLANING: + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED: + case TRAFFIC_REGULATIONS_CHANGED: + case VEHICLE_ON_WRONG_CARRIAGEWAY: + throw new IllegalArgumentException("Subcause for main cause which doesn't support a subcause"); + + default: + throw new IllegalArgumentException("Unknown mainCause"); + } + subCause = (byte) subCauseValue; + } + + int lengthAffected = -1; + if (directCause.getLengthAffected() != null) { + lengthAffected = directCause.getLengthAffected(); + } + + int causeOffset = -1; + if (directCause.getCauseOffset() != null) { + causeOffset = directCause.getCauseOffset(); + } + + LaneRestrictions laneRestrictions = directCause.getLaneRestrictions(); + List laneRestrictionsStructs = new ArrayList<>(); + if (laneRestrictions != null) { + LaneRestrictionsStruct laneRestrictionsStruct = laneRestrictionsToLaneRestrictionsStruct(laneRestrictions); + laneRestrictionsStructs.add(laneRestrictionsStruct); + } + + EList freeTexts = directCause.getFreeText(); + List freeTextStructs = new ArrayList<>(); + for (int i = 0; i < freeTexts.size(); i++) { + LocalizedStringStruct freeTextStruct = localizedStringToLocalizedStringStruct(freeTexts.get(i)); + freeTextStructs.add(freeTextStruct); + } + + DirectCauseStruct directCauseStruct = new DirectCauseStruct( + mainCause, + warningLevel, + unverifiedInformation, + subCause, + lengthAffected, + causeOffset, + laneRestrictionsStructs, + freeTextStructs); + + return directCauseStruct; + } + + private static List reconstructLocalizedStringStructs(Vector vector) { + LOGGER.info("reconstructLocalizedStringStructs =>"); + List localizedStringStructs = new ArrayList<>(); + + for (Object object: vector) { + LOGGER.info("Handling object: " + object + " = " + object.getClass().getName()); + if (object instanceof Object[]) { + LOGGER.info("Type OK"); + LocalizedStringStruct localizedStringStruct = reconstructLocalizedStringStruct((Object[]) object); + localizedStringStructs.add(localizedStringStruct); + } else { + LOGGER.info("Wrong Type"); + } + } + + LOGGER.info("reconstructLocalizedStringStructs <= " + localizedStringStructs); + return localizedStringStructs; + } + + private static LocalizedStringStruct reconstructLocalizedStringStruct(Object[] objects) { + LOGGER.info("reconstructLocalizedStringStruct => " + objects); + + LocalizedStringStruct localizedStringStruct = null; + + if (objects.length != 3) { + LOGGER.info("Wrong number of elements"); + return null; + } + + String languageCode = null; + String text = null; + String countryCode = null; + + if (objects[0] instanceof String) { + languageCode = (String) objects[0]; + LOGGER.fine("languageCode OK"); + } else { + LOGGER.info("Wrong type for languageCode"); + } + + if (objects[1] instanceof String) { + text = (String) objects[1]; + LOGGER.fine("text OK"); + } else { + LOGGER.info("Wrong type for text"); + } + + if (objects[2] instanceof String) { + countryCode = (String) objects[2]; + LOGGER.fine("countryCode OK"); + } else { + LOGGER.info("Wrong type for countryCode"); + } + + localizedStringStruct = new LocalizedStringStruct(languageCode, text, countryCode); + + LOGGER.info("reconstructLocalizedStringStruct <= " + localizedStringStruct); + return localizedStringStruct; + } + + private static List reconstructLaneRestrictionsStructs(Vector vector) { + LOGGER.info("reconstructLaneRestrictionsStructs =>"); + List laneRestrictionsStructs = new ArrayList<>(); + + for (Object object: vector) { + LOGGER.info("Handling object: " + object + " = " + object.getClass().getName()); + if (object instanceof Object[]) { + LOGGER.info("Type OK"); + LaneRestrictionsStruct laneRestrictionsStruct = reconstructLaneRestrictionsStruct((Object[]) object); + laneRestrictionsStructs.add(laneRestrictionsStruct); + } else { + LOGGER.info("Wrong Type"); + } + } + + LOGGER.info("reconstructLaneRestrictionsStructs <= " + laneRestrictionsStructs); + return laneRestrictionsStructs; + } + + private static LaneRestrictionsStruct reconstructLaneRestrictionsStruct(Object[] objects) { + LOGGER.info("reconstructLaneRestrictionsStruct =>"); + if (objects.length != 2) { + LOGGER.info("Wrong number of elements"); + return null; + } + + Byte laneRestrictionType = 0; + int numberOfLanes = -1; + + if (objects[0] instanceof Byte) { + laneRestrictionType = (Byte) objects[0]; + LOGGER.info("laneRestrictionType OK"); + } else { + LOGGER.info("Wrong type for laneRestrictionType"); + } + + if (objects[1] instanceof Integer) { + numberOfLanes = (Integer) objects[1]; + LOGGER.info("numberOfLanes OK"); + } else { + LOGGER.info("Wrong type for numberOfLanes"); + } + + LaneRestrictionsStruct laneRestrictionsStruct = new LaneRestrictionsStruct(laneRestrictionType, numberOfLanes); + + LOGGER.info("reconstructLaneRestrictionsStruct <= " + laneRestrictionsStruct); + return laneRestrictionsStruct; + } + + private static Advice adviceStructToAdvice(AdviceStruct adviceStruct) { + LOGGER.info("adviceStructToAdvice => adviceStruct = " + adviceStruct); + Advice advice = TRAFFIC_INCIDENT_FACTORY.createAdvice(); + + AdviceCode mainAdvice = AdviceCode.get(adviceStruct.mainAdvice); + advice.setMainAdvice(mainAdvice); + + Byte subAdviceValue = adviceStruct.subAdvice; + if (subAdviceValue != 0) { + Object subAdviceObj; + switch (mainAdvice) { + case DO_NOT_LEAVE_YOUR_VEHICLE: + subAdviceObj = DoNotLeaveYourVehicle.get(subAdviceValue); + break; + + case DRIVE_CAREFULLY: + subAdviceObj = DriveCarefully.get(subAdviceValue); + break; + + case DRIVING_NOT_ALLOWED: + subAdviceObj = DrivingNotAllowed.get(subAdviceValue); + break; + + case FOLLOW_DIVERSION: + subAdviceObj = FollowDiversion.get(subAdviceValue); + break; + + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND: + subAdviceObj = GivingPathVehiclesFromBehind.get(subAdviceValue); + break; + + case OVERTAKING_NOT_ALLOWED: + subAdviceObj = OvertakingNotAllowed.get(subAdviceValue); + break; + + case USE_TOLL_LANES: + subAdviceObj = UseTollLanes.get(subAdviceValue); + break; + + case AVOID_THE_AREA: + case DO_NOT_DIVERT: + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE: + case FOLLOW_POLICE_INSTRUCTIONS: + case NO_DIVERSION_TO_RECOMMEND: + case SWITCH_ON_RADIO: + case USE_HARD_SHOULDER_AS_LANE: + case WAIT_FOR_CONVOI: + case WAIT_FOR_IMPROVED_WEATHER: + case WAIT_FOR_POLICE_PATROL: + throw new IllegalArgumentException("Subadvice for main advice which doesn't support a subadvice"); + + default: + throw new IllegalArgumentException("Unknown mainAdvice"); + } + advice.setSubAdvice(subAdviceObj); + } + + for (LocalizedStringStruct localizedStringStruct: adviceStruct.freeText) { + LocalizedString localizedString = localizedStringStructToLocalizedString(localizedStringStruct); + advice.getFreeText().add(localizedString); + } + + for (ApplicabilityStruct applicabilityStruct: adviceStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + advice.getApplicability().add(applicability); + } + + LOGGER.info("adviceStructToAdvice <= advice = " + advice); + return advice; + } + + private static AdviceStruct adviceToAdviceStruct(Advice advice) { + Byte mainAdvice = (Byte) (byte) advice.getMainAdvice().getValue(); + + Object subAdviceObj = advice.getSubAdvice(); + int subAdviceValue = 0; + if (subAdviceObj != null) { + switch (advice.getMainAdvice()) { + case DO_NOT_LEAVE_YOUR_VEHICLE: + subAdviceValue = ((DoNotLeaveYourVehicle) subAdviceObj).getValue(); + break; + + case DRIVE_CAREFULLY: + subAdviceValue = ((DriveCarefully) subAdviceObj).getValue(); + break; + + case DRIVING_NOT_ALLOWED: + subAdviceValue = ((DrivingNotAllowed) subAdviceObj).getValue(); + break; + + case FOLLOW_DIVERSION: + subAdviceValue = ((FollowDiversion) subAdviceObj).getValue(); + break; + + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND: + subAdviceValue = ((GivingPathVehiclesFromBehind) subAdviceObj).getValue(); + break; + + case OVERTAKING_NOT_ALLOWED: + subAdviceValue = ((OvertakingNotAllowed) subAdviceObj).getValue(); + break; + + case USE_TOLL_LANES: + subAdviceValue = ((UseTollLanes) subAdviceObj).getValue(); + break; + + case AVOID_THE_AREA: + case DO_NOT_DIVERT: + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE: + case FOLLOW_POLICE_INSTRUCTIONS: + case NO_DIVERSION_TO_RECOMMEND: + case SWITCH_ON_RADIO: + case USE_HARD_SHOULDER_AS_LANE: + case WAIT_FOR_CONVOI: + case WAIT_FOR_IMPROVED_WEATHER: + case WAIT_FOR_POLICE_PATROL: + throw new IllegalArgumentException("Subadvice for main advice which doesn't support a subadvice"); + + default: + throw new IllegalArgumentException("Unknown mainAdvice"); + } + } + Byte subAdvice = (Byte) (byte) subAdviceValue; + + EList freeTexts = advice.getFreeText(); + List freeTextStructs = new ArrayList<>(); + for (int i = 0; i < freeTexts.size(); i++) { + LocalizedStringStruct localizedStringStruct = localizedStringToLocalizedStringStruct(freeTexts.get(i)); + freeTextStructs.add(localizedStringStruct); + } + + EList applicabilities = advice.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + AdviceStruct adviceStruct = new AdviceStruct( + mainAdvice, + subAdvice, + freeTextStructs, + applicabilityStructs); + + return adviceStruct; + } + + public static Applicability applicabilityStructToApplicability(ApplicabilityStruct applicabilityStruct) { + LOGGER.info("applicabilityStructToApplicability() => " + applicabilityStruct); + Applicability applicability = TRAFFIC_INCIDENT_FACTORY.createApplicability(); + + if (applicabilityStruct.vehicleType != 0) { + VehicleType vehicleType = VehicleType.get(applicabilityStruct.vehicleType); + applicability.setVehicleType(vehicleType); + LOGGER.info("applicabilityStructToApplicability: vehicleType set to " + vehicleType + " = " + vehicleType.getValue()); + } + + for (VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct: applicabilityStruct.vehicleRelatedRestrictions) { + LOGGER.info("applicabilityStructToApplicability: loop for vehicleRelatedRestrictionStruct = " + vehicleRelatedRestrictionStruct); + VehicleRelatedRestriction vehicleRelatedRestriction = vehicleRelatedRestrictionStructToVehicleRelatedRestriction(vehicleRelatedRestrictionStruct); + applicability.getVehicleRelatedRestrictions().add(vehicleRelatedRestriction); + LOGGER.info("applicabilityStructToApplicability: loop: vehicleRelatedRestriction = " + vehicleRelatedRestriction); + } + + LOGGER.info("applicabilityStructToApplicability() <= " + applicability); + return applicability; + } + + public static ApplicabilityStruct applicabilityToApplicabilityStruct(Applicability applicability) { + Byte vehicleType = 0; + if (applicability.getVehicleType() != null) { + vehicleType = (Byte) (byte) applicability.getVehicleType().getValue(); + } + + EList vehicleRelatedRestrictions = applicability.getVehicleRelatedRestrictions(); + List vehicleRelatedRestrictionStructs = new ArrayList<>(); + for (int i = 0; i < vehicleRelatedRestrictions.size(); i++) { + VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct = vehicleRelatedRestrictionToVehicleRelatedRestrictionStruct(vehicleRelatedRestrictions.get(i)); + vehicleRelatedRestrictionStructs.add(vehicleRelatedRestrictionStruct); + } + + ApplicabilityStruct applicabilityStruct = new ApplicabilityStruct( + vehicleType, + vehicleRelatedRestrictionStructs); + + return applicabilityStruct; + } + + public static VehicleRelatedRestriction vehicleRelatedRestrictionStructToVehicleRelatedRestriction(VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct) { + LOGGER.info("vehicleRelatedRestrictionStructToVehicleRelatedRestriction() => " + vehicleRelatedRestrictionStruct); + VehicleRelatedRestriction vehicleRelatedRestriction = TRAFFIC_INCIDENT_FACTORY.createVehicleRelatedRestriction(); + RestrictionType restrictionType = RestrictionType.get(vehicleRelatedRestrictionStruct.restrictionType); + vehicleRelatedRestriction.setRestrictionType(restrictionType); + LOGGER.info("restrictionType = " + restrictionType + " = " + restrictionType.getValue()); + + if (vehicleRelatedRestrictionStruct.restrictionValue.size() == 1) { + vehicleRelatedRestriction.setRestrictionValue(vehicleRelatedRestrictionStruct.restrictionValue.get(0)); + LOGGER.info("restrictionValue = " + vehicleRelatedRestriction.getRestrictionValue()); + } else if (vehicleRelatedRestrictionStruct.restrictionValue.size() == 0) { + LOGGER.info("No restrictionValue"); + } else { + throw new RuntimeException("Illegal size of restrictionValue: " + vehicleRelatedRestrictionStruct.restrictionValue); + } + + if (vehicleRelatedRestrictionStruct.restrictionLocationReference.size() == 1) { + LocationReference restrictionLocationReference = locationReferenceStructToLocationReference(vehicleRelatedRestrictionStruct.restrictionLocationReference.get(0)); + vehicleRelatedRestriction.setRestrictionLocationReference(restrictionLocationReference); + } else if (vehicleRelatedRestrictionStruct.restrictionLocationReference.size() == 0) { + // No action + } else { + throw new RuntimeException("Illegal size for restrictionLocation: " + vehicleRelatedRestrictionStruct.restrictionLocationReference.size()); + } + LOGGER.info("RestrictionLocation is handled"); + + LOGGER.info("vehicleRelatedRestrictionStructToVehicleRelatedRestriction() <= " + vehicleRelatedRestriction); + return vehicleRelatedRestriction; + } + + public static VehicleRelatedRestrictionStruct vehicleRelatedRestrictionToVehicleRelatedRestrictionStruct(VehicleRelatedRestriction vehicleRelatedRestriction) { + Byte restrictionType = (Byte) (byte) vehicleRelatedRestriction.getRestrictionType().getValue(); + + List restrictionValues = new ArrayList<>(); + if (vehicleRelatedRestriction.getRestrictionValue() != null) { + Integer restrictionValue = vehicleRelatedRestriction.getRestrictionValue(); + restrictionValues.add(restrictionValue); + } + + List restrictionLocationReferences = new ArrayList<>(); + if (vehicleRelatedRestriction.isSetRestrictionLocationReference()) { + LocationReferenceStruct locationReferenceStruct = locationReferenceToLocationReferenceStruct(vehicleRelatedRestriction.getRestrictionLocationReference()); + restrictionLocationReferences.add(locationReferenceStruct); + } + + VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct = new VehicleRelatedRestrictionStruct( + restrictionType, restrictionValues, restrictionLocationReferences); + + return vehicleRelatedRestrictionStruct; + } + + public static LaneRestrictions laneRestrictionsStructToLaneRestrictions(LaneRestrictionsStruct laneRestrictionsStruct) { + LaneRestrictions laneRestrictions = TRAFFIC_INCIDENT_FACTORY.createLaneRestrictions(); + + if (laneRestrictionsStruct.laneRestrictionType != 0 ) { + LaneRestrictionType laneRestrictionType = LaneRestrictionType.get(laneRestrictionsStruct.laneRestrictionType); + laneRestrictions.setLaneRestrictionType(laneRestrictionType); + } + + if (laneRestrictionsStruct.numberOfLanes != -1) { + laneRestrictions.setNumberOfLanes(laneRestrictionsStruct.numberOfLanes); + } + + return laneRestrictions; + } + + public static LaneRestrictionsStruct laneRestrictionsToLaneRestrictionsStruct(LaneRestrictions laneRestrictions) { + Byte laneRestrictionType = 0; + if (laneRestrictions.getLaneRestrictionType() != null) { + laneRestrictionType = (Byte) (byte) laneRestrictions.getLaneRestrictionType().getValue(); + } + + int numberOfLanes = -1; + if (laneRestrictions.getNumberOfLanes() != null) { + numberOfLanes= laneRestrictions.getNumberOfLanes(); + } + + LaneRestrictionsStruct laneRestrictionsStruct = new LaneRestrictionsStruct( + laneRestrictionType, + numberOfLanes); + + return laneRestrictionsStruct; + } + + public static LocalizedString localizedStringStructToLocalizedString(LocalizedStringStruct localizedStringStruct) { + LocalizedString localizedString = COMMON_FACTORY.createLocalizedString(); + + localizedString.setLanguageCode(localizedStringStruct.languageCode); + if (!localizedStringStruct.countryCode.isEmpty()) { + localizedString.setCountryCode(localizedStringStruct.countryCode); + } + localizedString.setString(localizedStringStruct.string); + + return localizedString; + } + + public static LocalizedStringStruct localizedStringToLocalizedStringStruct(LocalizedString localizedString) { + String languageCode = localizedString.getLanguageCode(); + if (languageCode == null) { + throw new IllegalArgumentException("languageCode may not be null"); + } + String countryCode = localizedString.getCountryCode(); + if (countryCode == null) { + countryCode = ""; + } + String string = localizedString.getString(); + if (string == null) { + throw new IllegalArgumentException("string may not be null"); + } + + LocalizedStringStruct localizedStringStruct = new LocalizedStringStruct( + languageCode, countryCode, string); + + return localizedStringStruct; + } + + public static FeedInformation feedInformationStructToFeedInformation(FeedInformationStruct feedInformationStruct) { + FeedInformation feedInformation = TRAFFIC_INCIDENTS_SVC_FACTORY.createFeedInformation(); + + if (!feedInformationStruct.dataProviderName.isEmpty()) { + feedInformation.setDataProviderName(feedInformationStruct.dataProviderName); + } + + if (!feedInformationStruct.protocolName.isEmpty()) { + feedInformation.setProtocolName(feedInformationStruct.protocolName); + } + + if (!feedInformationStruct.communicationChannelName.isEmpty()) { + feedInformation.setCommunicationChannelName(feedInformationStruct.communicationChannelName); + } + + if (feedInformationStruct.feedStatus != 0) { + TrafficIncidentFeedStatus trafficIncidentFeedStatus = TrafficIncidentFeedStatus.get(feedInformationStruct.feedStatus); + feedInformation.setFeedStatus(trafficIncidentFeedStatus); + } + + if (feedInformationStruct.trafficIncidentsStatus != 0) { + TrafficIncidentsStatus trafficIncidentsStatus = TrafficIncidentsStatus.get(feedInformationStruct.trafficIncidentsStatus); + feedInformation.setTrafficIncidentsStatus(trafficIncidentsStatus); + } + + return feedInformation; + } + + public static FeedInformationStruct feedInformationToFeedInformationStruct(FeedInformation feedInformation) { + String dataProviderName = feedInformation.getDataProviderName(); + if (dataProviderName == null) { + dataProviderName = ""; + } + + String protocolName = feedInformation.getProtocolName(); + if (protocolName == null) { + protocolName = ""; + } + + String communicationChannelName = feedInformation.getCommunicationChannelName(); + if (communicationChannelName == null) { + communicationChannelName = ""; + } + + TrafficIncidentFeedStatus feedStatus = feedInformation.getFeedStatus(); + Byte feedStatusId; + if (feedStatus != null) { + feedStatusId = (Byte) (byte) feedStatus.getValue(); + } else { + feedStatusId = 0; + } + + TrafficIncidentsStatus trafficIncidentsStatus = feedInformation.getTrafficIncidentsStatus(); + Byte trafficIncidentsStatusId; + if (trafficIncidentsStatus != null) { + trafficIncidentsStatusId = (Byte) (byte) trafficIncidentsStatus.getValue(); + } else { + trafficIncidentsStatusId = 0; + } + + FeedInformationStruct feedInformationStruct = new FeedInformationStruct( + dataProviderName, protocolName, communicationChannelName, + feedStatusId, trafficIncidentsStatusId); + + return feedInformationStruct; + } + + private static LocationReference locationReferenceStructToLocationReference(LocationReferenceStruct locationReferenceStruct) { + LOGGER.info("locationReferenceStructToLocationReference =>"); + LocationReference locationReference = LOCATION_REFERENCE_FACTORY.createLocationReference(); + + locationReference.setLocationReferenceType(locationReferenceStruct.locationReferenceType); + locationReference.setData(locationReferenceStruct.data); + + LOGGER.info("locationReferenceStructToLocationReference <="); + return locationReference; + } + + private static LocationReferenceStruct locationReferenceToLocationReferenceStruct(LocationReference locationReference) { + Byte locationReferenceType = 0; + if (locationReference.isSetLocationReferenceType()) { + locationReferenceType = (Byte) (byte) locationReference.getLocationReferenceType(); + } + + byte[] data; + if (locationReference.isSetData()) { + data = (byte[]) locationReference.getData(); + } else { + data = new byte[0]; + } + + LocationReferenceStruct locationReferenceStruct = new LocationReferenceStruct( + locationReferenceType, + data + ); + + return locationReferenceStruct; + } + + private static TemporarySpeedLimit temporarySpeedLimitStructToTemporarySpeedLimit(TemporarySpeedLimitStruct temporarySpeedLimitStruct) { + LOGGER.info("temporarySpeedLimitStructToTemporarySpeedLimit() => " + temporarySpeedLimitStruct); + TemporarySpeedLimit temporarySpeedLimit = TRAFFIC_INCIDENT_FACTORY.createTemporarySpeedLimit(); + + temporarySpeedLimit.setUnitsMPH(temporarySpeedLimitStruct.unitsMPH); + + if (temporarySpeedLimitStruct.offset != -1) { + temporarySpeedLimit.setOffset(temporarySpeedLimitStruct.offset); + } + + for (TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct: temporarySpeedLimitStruct.temporarySpeedLimitSections) { + TemporarySpeedLimitSection temporarySpeedLimitSection = temporarySpeedLimitSectionStructToTemporarySpeedLimitSection(temporarySpeedLimitSectionStruct); + temporarySpeedLimit.getTemporarySpeedLimitSections().add(temporarySpeedLimitSection); + } + + for (ApplicabilityStruct applicabilityStruct: temporarySpeedLimitStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + temporarySpeedLimit.getApplicability().add(applicability); + } + + LOGGER.info("temporarySpeedLimitStructToTemporarySpeedLimit() <= " + temporarySpeedLimit); + return temporarySpeedLimit; + } + + private static TemporarySpeedLimitStruct temporarySpeedLimitToTemporarySpeedLimitStruct(TemporarySpeedLimit temporarySpeedLimit) { + Boolean unitsMPH = temporarySpeedLimit.isUnitsMPH(); + + Integer offset = -1; + if (temporarySpeedLimit.isSetOffset()) { + offset = temporarySpeedLimit.getOffset(); + } + + EList temporarySpeedLimitSections = temporarySpeedLimit.getTemporarySpeedLimitSections(); + List temporarySpeedLimitSectionStructs = new ArrayList<>(); + for (int i = 0; i < temporarySpeedLimitSections.size(); i++) { + TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct = temporarySpeedLimitSectionToTemporarySpeedLimitSectionStruct(temporarySpeedLimitSections.get(i)); + temporarySpeedLimitSectionStructs.add(temporarySpeedLimitSectionStruct); + } + + EList applicabilities = temporarySpeedLimit.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + TemporarySpeedLimitStruct temporarySpeedLimitStruct = new TemporarySpeedLimitStruct( + unitsMPH, + offset, + temporarySpeedLimitSectionStructs, + applicabilityStructs + ); + + return temporarySpeedLimitStruct; + } + + private static TemporarySpeedLimitSection temporarySpeedLimitSectionStructToTemporarySpeedLimitSection(TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct) { + TemporarySpeedLimitSection temporarySpeedLimitSection = TRAFFIC_INCIDENT_FACTORY.createTemporarySpeedLimitSection(); + + if (temporarySpeedLimitSectionStruct.speedLimitValue != -1) { + temporarySpeedLimitSection.setSpeedLimitValue(temporarySpeedLimitSectionStruct.speedLimitValue); + } + + if (temporarySpeedLimitSectionStruct.speedLimitValueWet != -1) { + temporarySpeedLimitSection.setSpeedLimitValueWet(temporarySpeedLimitSectionStruct.speedLimitValueWet); + } + + if (temporarySpeedLimitSectionStruct.speedLimitLength != -1) { + temporarySpeedLimitSection.setSpeedLimitLength(temporarySpeedLimitSectionStruct.speedLimitLength); + } + + return temporarySpeedLimitSection; + } + + private static TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionToTemporarySpeedLimitSectionStruct(TemporarySpeedLimitSection temporarySpeedLimitSection) { + Short speedLimitValue = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitValue()) { + speedLimitValue = temporarySpeedLimitSection.getSpeedLimitValue(); + } + + Short speedLimitValueWet = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitValueWet()) { + speedLimitValueWet = temporarySpeedLimitSection.getSpeedLimitValueWet(); + } + + Integer speedLimitLength = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitLength()) { + speedLimitLength = temporarySpeedLimitSection.getSpeedLimitLength(); + } + + TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct = new TemporarySpeedLimitSectionStruct( + speedLimitValue, + speedLimitValueWet, + speedLimitLength + ); + + return temporarySpeedLimitSectionStruct; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentFeedDBusProxy.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentFeedDBusProxy.java new file mode 100755 index 0000000..8509275 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentFeedDBusProxy.java @@ -0,0 +1,319 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.freedesktop.dbus.CallbackHandler; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.genivi.common.Version; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TrafficIncidentFeedDBus; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TwoTuple; + +public class TrafficIncidentFeedDBusProxy extends EObjectImpl implements TrafficIncidentFeed { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentFeedDBusProxy.class.getName()); + + private DBusConnection conn; + private TrafficIncidentFeedDBus trafficIncidentFeedDBus; + + private Map, TrafficIncidentFeedListener> callsInProgress = new HashMap<>(); + private List languageChangedListeners = new ArrayList<>(); + + public TrafficIncidentFeedDBusProxy(DBusConnection conn, TrafficIncidentFeedDBus trafficIncidentFeedDBus) { + super(); + this.conn = conn; + this.trafficIncidentFeedDBus = trafficIncidentFeedDBus; + LOGGER.setLevel(Level.SEVERE); + + try { + conn.addSigHandler(TrafficIncidentFeedDBus.LanguageChanged.class, new LanguageChangedSignalHandler()); + } catch (DBusException e) { + LOGGER.severe("Failed to install signal handler for LanguageChanged"); + e.printStackTrace(); + } + } + + @Override + public void getVersion(TrafficIncidentFeedListener listener) { + LOGGER.info("getVersion => listener = " + listener); + + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(VersionStruct versionStruct) { + LOGGER.info("getVersion:handle => versionStruct " + versionStruct); + TrafficIncidentFeedListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + Version version = StructUtil.versionStructToVersion(versionStruct); + + LOGGER.info("version = " + version); + + listener.getVersionReply(version); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentFeedDBus, "GetVersion", callbackHandler); + + LOGGER.info("getVersion <="); + } + + @Override + public void getLanguage(TrafficIncidentFeedListener listener) { + LOGGER.info("getLanguage => listener = " + listener); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(TwoTuple languageTuple) { + LOGGER.info("getLanguage:handle => languageTuple = " + languageTuple); + TrafficIncidentFeedListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + String languageCode = languageTuple.a; + String countryCode = languageTuple.b; + if (countryCode.isEmpty()) { + countryCode = null; + } + LOGGER.info("languageCode = " + languageCode + ", countryCode = " + countryCode); + + listener.getLanguageReply(languageCode, countryCode); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentFeedDBus, "GetLanguage", callbackHandler); + + LOGGER.info("getLanguage <="); + } + + @Override + public void addLanguageListener( + TrafficIncidentFeedListener listener, TrafficIncidentFeedListener languageChangedListener) { + LOGGER.info("addLanguageListener => listener = " + listener + ", languageChangedListener = " + languageChangedListener); + + languageChangedListeners.add(languageChangedListener); + + if (languageChangedListeners.size() == 1) { + // First listener added, so notify the TrafficIncidentsService that we are listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addLanguageListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentFeedListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addLanguageListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentFeedDBus, "AddLanguageListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentFeedDBus, "AddLanguageListener"); + } + } else { + if (listener != null) { + listener.addLanguageListenerReply(); + } + } + + LOGGER.info("addLanguageListener <="); + } + + @Override + public void removeLanguageListener(TrafficIncidentFeedListener listener, TrafficIncidentFeedListener languageChangedListener) { + LOGGER.info("removeLanguageListener => listener = " + listener + ", languageChangedListener = " + languageChangedListener); + + languageChangedListeners.remove(languageChangedListener); + + if (languageChangedListeners.isEmpty()) { + // Last listener removed, so notify the TrafficIncidentsService that we are no longer listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeLanguageListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentFeedListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeLanguageListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentFeedDBus, "RemoveLanguageListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentFeedDBus, "RemoveLanguageListener"); + } + } else { + if (listener != null) { + listener.removeLanguageListenerReply(); + } + } + + LOGGER.fine("removeLanguageListener <="); + } + + @Override + public void clear() { + LOGGER.info("clear =>"); + + conn.callMethodAsync(trafficIncidentFeedDBus, "Clear"); + + LOGGER.info("clear <="); + } + + @Override + public void updateIncidents(int feedId, EList cancelledIncidentIds, + EList updatedIncidents) { + LOGGER.info("updateIncidents => feedId = " + feedId + ", cancelledIncidentIds = " + cancelledIncidentIds + ", updatedIncidents = " + updatedIncidents); + + UInt32 feedIdUInt32 = new UInt32(feedId); + List updatedIncidentStructs = new ArrayList<>(); + for (TrafficIncident managedTrafficIncident: updatedIncidents) { + TrafficIncidentStruct managedTrafficIncidentStruct = StructUtil.trafficIncidentToTrafficIncidentStruct(managedTrafficIncident); + updatedIncidentStructs.add(managedTrafficIncidentStruct); + LOGGER.info("updateIncidents, added incident = " + managedTrafficIncidentStruct); + } + conn.callMethodAsync(trafficIncidentFeedDBus, "UpdateIncidents", feedIdUInt32, cancelledIncidentIds, + updatedIncidentStructs); + + LOGGER.info("updateIncidents <="); + } + + @Override + public void updateStatus(int feedId, TrafficIncidentFeedStatus feedStatus, + TrafficIncidentsStatus incidentsStatus) { + LOGGER.info("updateStatus => feedId = " + feedId + ", feedStatus = " + feedStatus + ", incidentsStatus = " + incidentsStatus); + + UInt32 feedIdUInt32 = new UInt32(feedId); + Integer feedStatusValue = feedStatus.getValue(); + Integer incidentsStatusValue = incidentsStatus.getValue(); + conn.callMethodAsync(trafficIncidentFeedDBus, "UpdateStatus", feedIdUInt32, feedStatusValue, + incidentsStatusValue); + + LOGGER.info("updateStatus <="); + } + + @Override + public void registerFeed(TrafficIncidentFeedListener listener, + String dataProviderName, String protocolName, + String communicationChannelName) { + LOGGER.info("registerFeed => listener = " + listener + ", dataProviderName = " + dataProviderName + + ", protocolName = " + protocolName + + ", communicationChannelName = " + communicationChannelName); + + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer feedId) { + LOGGER.info("registerFeed:handle => feedId " + feedId); + TrafficIncidentFeedListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.registerFeedReply(feedId); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + + conn.callWithCallback(trafficIncidentFeedDBus, "RegisterFeed", callbackHandler, dataProviderName, protocolName, + communicationChannelName); + + LOGGER.info("registerFeed <="); + } + + + class LanguageChangedSignalHandler implements DBusSigHandler { + public void handle(TrafficIncidentFeedDBus.LanguageChanged languageChanged) { + LOGGER.info("LanguageChangedSignalHandler => path = " + languageChanged.getPath()); + + String languageCode = null; + if (!languageChanged.languageCode.isEmpty()) { + languageCode = languageChanged.languageCode; + } + + String countryCode = null; + if (!languageChanged.countryCode.isEmpty()) { + countryCode = languageChanged.countryCode; + } + + if (languageChangedListeners.isEmpty()) { + LOGGER.info("No listener registered"); + } else { + for (TrafficIncidentFeedListener listener: languageChangedListeners) { + LOGGER.info("Calling getLanguageReply: languageCode = " + languageCode + ", countryCode = " + countryCode); + listener.getLanguageReply(languageCode, countryCode); + } + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentsUpdatesAdaptor.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentsUpdatesAdaptor.java new file mode 100755 index 0000000..7b52098 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidentfeed/dbus/impl/TrafficIncidentsUpdatesAdaptor.java @@ -0,0 +1,363 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.freedesktop.dbus.AbstractConnection; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.exceptions.DBusException; +import org.genivi.common.Version; +import org.genivi.trafficincidentsservice.DefaultTrafficIncidentsUpdatesListener; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.TrafficIncidentFeedDBus; +import org.genivi.trafficincidentsservice.trafficincidentfeed.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TwoTuple; + +public class TrafficIncidentsUpdatesAdaptor implements TrafficIncidentFeedDBus { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentsUpdatesAdaptor.class.getName()); + + private DBusConnection conn; + private TrafficIncidentFeed trafficIncidentsService; + private List languageChangedListeners = new ArrayList<>(); + private TrafficIncidentFeedListener languageChangedListener = null; + + private PendingReplyGetLanguage pendingReplyGetLanguage; + private PendingReply pendingReplyAddLanguageListener; + private PendingReply pendingReplyRemoveLanguageListener; + private PendingReplyGetVersion pendingReplyGetVersion; + private PendingReplyRegisterFeed pendingReplyRegisterFeed; + + + public TrafficIncidentsUpdatesAdaptor(DBusConnection conn, TrafficIncidentFeed trafficIncidentsService) { + this.conn = conn; + this.trafficIncidentsService = trafficIncidentsService; + + LOGGER.setLevel(Level.SEVERE); + } + +@Override + public boolean isRemote() { + return false; + } + + @Override + public VersionStruct GetVersion() { + LOGGER.info("getVersion =>"); + TrafficIncidentFeedListener listener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void getVersionReply(Version trafficIncidentsVersion) { + LOGGER.info("getVersionReply => trafficIncidentsVersion = " + trafficIncidentsVersion); + pendingReplyGetVersion.setVersion(trafficIncidentsVersion); + pendingReplyGetVersion.setReplyReceived(true); + } + }; + pendingReplyGetVersion = new PendingReplyGetVersion(listener); + + trafficIncidentsService.getVersion(listener); + + while (!pendingReplyGetVersion.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getVersion - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("getVersion: reply received"); + Version version = pendingReplyGetVersion.getVersion(); + LOGGER.info("getVersion: version = " + version); + VersionStruct versionStruct = StructUtil.versionToVersionStruct(version); + + LOGGER.info("getVersion <= versionStruct = " + versionStruct); + return versionStruct; + } + + @Override + public TwoTuple GetLanguage() { + LOGGER.info("getLanguage =>"); + TrafficIncidentFeedListener listener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + LOGGER.info("getLanguageReply => languageCode = " + languageCode + ", countryCode = " + countryCode); + pendingReplyGetLanguage.setLanguageCode(languageCode); + pendingReplyGetLanguage.setCountryCode(countryCode); + pendingReplyGetLanguage.setReplyReceived(true); + } + }; + pendingReplyGetLanguage = new PendingReplyGetLanguage(listener); + + trafficIncidentsService.getLanguage(listener); + + while (!pendingReplyGetLanguage.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getLanguage - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + String countryCode = pendingReplyGetLanguage.getCountryCode(); + if (countryCode == null) { + countryCode = ""; + } + TwoTuple language = new TwoTuple<>( + pendingReplyGetLanguage.getLanguageCode(), + countryCode); + LOGGER.info("getLanguage <= language = " + language.a + ", " + language.b); + return language; + } + + @Override + public void AddLanguageListener() { + LOGGER.info("addLanguageListener =>"); + + String sender = AbstractConnection.currentSender; + if (!languageChangedListeners.contains(sender)) { + languageChangedListeners.add(sender); + } + + if (languageChangedListener == null) { + languageChangedListener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + LOGGER.info("getLanguageReply: " + languageCode + ", " + countryCode); + sendLanguageChangedSignal(languageCode, countryCode); + } + }; + + TrafficIncidentFeedListener listener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void addLanguageListenerReply() { + LOGGER.info("addLanguageListenerReply =>"); + pendingReplyAddLanguageListener.setReplyReceived(true); + } + }; + pendingReplyAddLanguageListener = new PendingReply(listener); + + trafficIncidentsService.addLanguageListener(listener, languageChangedListener); + + while (!pendingReplyAddLanguageListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("pendingReplyAddLanguageListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("addLanguageListener <="); + } + + @Override + public void RemoveLanguageListener() { + LOGGER.info("removeLanguageListener =>"); + + String sender = AbstractConnection.currentSender; + languageChangedListeners.remove(sender); + + if (languageChangedListeners.isEmpty()) { + TrafficIncidentFeedListener listener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void removeLanguageListenerReply() { + LOGGER.info("removeLanguageListenerReply =>"); + languageChangedListener = null; + pendingReplyRemoveLanguageListener.setReplyReceived(true); + } + }; + pendingReplyRemoveLanguageListener = new PendingReply(listener); + + trafficIncidentsService.removeLanguageListener(listener, languageChangedListener); + + while (!pendingReplyRemoveLanguageListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeLanguageListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("removeLanguageListener <="); + } + + @Override + public Integer RegisterFeed(String dataProviderName, String protocolName, + String communicationChannelName) { + LOGGER.info("registerFeed => dataProviderName = " + dataProviderName + + ", protocolName = " + protocolName + ", communicationChannelName = " + communicationChannelName); + TrafficIncidentFeedListener listener = new DefaultTrafficIncidentsUpdatesListener() { + + @Override + public void registerFeedReply(int feedId) { + LOGGER.info("registerFeedReply => feedId = " + feedId); + pendingReplyRegisterFeed.setFeedId(feedId); + pendingReplyRegisterFeed.setReplyReceived(true); + } + }; + pendingReplyRegisterFeed = new PendingReplyRegisterFeed(listener); + + trafficIncidentsService.registerFeed(listener, dataProviderName, protocolName, communicationChannelName); + + while (!pendingReplyRegisterFeed.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("registerFeed - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + Integer feedId = pendingReplyRegisterFeed.getFeedId(); + + LOGGER.info("registerFeed <= feedId = " + feedId); + return feedId; + } + + @Override + public void Clear() { + LOGGER.info("clear =>"); + trafficIncidentsService.clear(); + + LOGGER.info("clear <="); + } + + @Override + public void UpdateIncidents(Integer feedId, List cancelledIncidentIds, + List updatedIncidentStructs) { + LOGGER.info("updateIncidents => feedId = " + feedId + ", cancelledIncidentIds = " + + cancelledIncidentIds + ", updatedIncidentStructs = " + updatedIncidentStructs); + EList cancelledIncidentIdsEList = new BasicEList<>(cancelledIncidentIds); + + EList updatedIncidents = new BasicEList<>(); + for (TrafficIncidentStruct managedTrafficIncidentStruct: updatedIncidentStructs) { + TrafficIncident managedTrafficIncident = StructUtil.trafficIncidentStructToTrafficIncident(managedTrafficIncidentStruct); + updatedIncidents.add(managedTrafficIncident); + } + LOGGER.info("Calling service feedId = " + feedId + ", cancelledIncidentIdsEList = " + + cancelledIncidentIdsEList + ", updatedIncidents = " + updatedIncidents); + trafficIncidentsService.updateIncidents(feedId, cancelledIncidentIdsEList, updatedIncidents); + + LOGGER.info("updateIncidents <="); + } + + @Override + public void UpdateStatus(Integer feedId, Byte feedStatusId, + Byte incidentsStatusId) { + LOGGER.info("updateStatus => feedId = " + feedId + + ", feedStatusId = " + feedStatusId + ", incidentsStatusId = " + incidentsStatusId); + + TrafficIncidentFeedStatus feedStatus = TrafficIncidentFeedStatus.get(feedStatusId); + TrafficIncidentsStatus incidentsStatus = TrafficIncidentsStatus.get(incidentsStatusId); + + trafficIncidentsService.updateStatus(feedId, feedStatus, incidentsStatus); + LOGGER.info("updateStatus <="); + } + + private void sendLanguageChangedSignal(String languageCode, String countryCode) { + LOGGER.info("going to send LanguageChanged signal"); + + try { + conn.sendSignal(new TrafficIncidentFeedDBus.LanguageChanged("/trafficincidentfeed", languageCode, countryCode)); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + public class PendingReply { + private boolean replyReceived = false; + private TrafficIncidentFeedListener listener; + + public PendingReply(TrafficIncidentFeedListener listener) { + this.listener = listener; + } + + public boolean isReplyReceived() { + return replyReceived; + } + + public void setReplyReceived(boolean replyReceived) { + this.replyReceived = replyReceived; + } + + public TrafficIncidentFeedListener getListener() { + return listener; + } + } + + class PendingReplyGetVersion extends PendingReply { + private Version version; + + public PendingReplyGetVersion(TrafficIncidentFeedListener listener) { + super(listener); + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + } + + class PendingReplyGetLanguage extends PendingReply { + private String languageCode; + private String countryCode; + + public PendingReplyGetLanguage(TrafficIncidentFeedListener listener) { + super(listener); + } + + public String getLanguageCode() { + return languageCode; + } + + public void setLanguageCode(String languageCode) { + this.languageCode = languageCode; + } + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + } + + class PendingReplyRegisterFeed extends PendingReply { + private Integer feedId; + + public PendingReplyRegisterFeed(TrafficIncidentFeedListener listener) { + super(listener); + } + + public Integer getFeedId() { + return feedId; + } + + public void setFeedId(Integer feedId) { + this.feedId = feedId; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AdviceStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AdviceStruct.java new file mode 100755 index 0000000..e744902 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AdviceStruct.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class AdviceStruct extends Struct { + @Position(0) + public final Byte mainAdvice; // AdviceCode + + @Position(1) + public final Byte subAdvice; + + @Position(2) + public final String freeText; + + @Position(3) + public final List applicability; + + public AdviceStruct(Byte mainAdvice, Byte subAdvice, + String freeText, List applicability) { + super(); + this.mainAdvice = mainAdvice; + this.subAdvice = subAdvice; + this.freeText = freeText; + this.applicability = applicability; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/ApplicabilityStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/ApplicabilityStruct.java new file mode 100755 index 0000000..75a65a8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/ApplicabilityStruct.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class ApplicabilityStruct extends Struct { + @Position(0) + public final Byte vehicleType; // VehicleType + + @Position(1) + public final List vehicleRelatedRestrictions; + + public ApplicabilityStruct(Byte vehicleType, + List vehicleRelatedRestrictions) { + super(); + this.vehicleType = vehicleType; + this.vehicleRelatedRestrictions = vehicleRelatedRestrictions; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationInfoStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationInfoStruct.java new file mode 100755 index 0000000..f75570e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationInfoStruct.java @@ -0,0 +1,28 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; + +public class AreaLocationInfoStruct extends LocationInfoStruct { + @Position(0) + public final String name; + + @Position(1) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List mainLocation; + + public AreaLocationInfoStruct(String name, List mainLocation) { + super(); + this.name = name; + this.mainLocation = mainLocation; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationStruct.java new file mode 100755 index 0000000..3bff33b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/AreaLocationStruct.java @@ -0,0 +1,12 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +public class AreaLocationStruct extends LocationStruct { + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CategoryDefinitionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CategoryDefinitionStruct.java new file mode 100755 index 0000000..ff7d491 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CategoryDefinitionStruct.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class CategoryDefinitionStruct extends Struct { + @Position(0) + public final List localizedNames; + + @Position(1) + public final int categoryId; + + @Position(2) + public final List icons; + + @Position(3) + public final String expression; + + public CategoryDefinitionStruct( + List localizedNames, + int categoryId, + List icons, + String expression) { + super(); + this.localizedNames = localizedNames; + this.categoryId = categoryId; + this.icons = icons; + this.expression = expression; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseDiscriminatedVariant.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseDiscriminatedVariant.java new file mode 100755 index 0000000..ced2914 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseDiscriminatedVariant.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Variant; + +public class CauseDiscriminatedVariant extends Struct { + @Position(0) + public final Byte causeType; + + @Position(1) + public final Variant cause; + + public CauseDiscriminatedVariant( + Byte causeType, + Variant cause + ) { + super(); + this.causeType = causeType; + this.cause = cause; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseStruct.java new file mode 100755 index 0000000..074c3d8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseStruct.java @@ -0,0 +1,15 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Struct; + +public class CauseStruct extends Struct { + public CauseStruct() { + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseType.java new file mode 100755 index 0000000..462fb8a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CauseType.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +public enum CauseType { + DIRECT((byte) 1), + LINKED((byte) 2); + + private Byte value; + + CauseType(Byte value) { + this.value = value; + } + + public Byte getValue() { + return value; + } + + public static CauseType getCauseType(Byte value) { + for (CauseType causeType: values()) { + if (causeType.value == value) { + return causeType; + } + } + + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CoordinateStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CoordinateStruct.java new file mode 100755 index 0000000..694b059 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/CoordinateStruct.java @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class CoordinateStruct extends Struct { + @Position(0) + public final Double latitude; + + @Position(1) + public final Double longitude; + + @Position(2) + public final int altitude; + + public CoordinateStruct(Double latitude, Double longitude, int altitude) { + super(); + this.latitude = latitude; + this.longitude = longitude; + this.altitude = altitude; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/DirectCauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/DirectCauseStruct.java new file mode 100755 index 0000000..4a7ed9a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/DirectCauseStruct.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; + +public class DirectCauseStruct extends CauseStruct { + @Position(0) + public final Byte mainCause; + + @Position(1) + public final Byte warningLevel; + + @Position(2) + public final Boolean unverifiedInformation; + + @Position(3) + public final Byte subCause; + + @Position(4) + public final Integer lengthAffected; + + @Position(5) + public final Integer causeOffset; + + @Position(6) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List laneRestrictions; + + @Position(7) + public final String freeText; + + public DirectCauseStruct(Byte mainCause, Byte warningLevel, + Boolean unverifiedInformation, Byte subCause, Integer lengthAffected, Integer causeOffset, + List laneRestrictions, String freeText) { + super(); + this.mainCause = mainCause; + this.warningLevel = warningLevel; + this.unverifiedInformation = unverifiedInformation; + this.subCause = subCause; + this.lengthAffected = lengthAffected; + this.causeOffset = causeOffset; + this.laneRestrictions = laneRestrictions; + this.freeText = freeText; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/FeedInformationStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/FeedInformationStruct.java new file mode 100755 index 0000000..e2e8403 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/FeedInformationStruct.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class FeedInformationStruct extends Struct { + @Position(0) + public final String dataProviderName; + + @Position(1) + public final String protocolName; + + @Position(2) + public final String communicationChannelName; + + @Position(3) + public final Byte feedStatus; + + @Position(4) + public final Byte trafficIncidentsStatus; + + public FeedInformationStruct(String dataProviderName, String protocolName, + String communicationChannelName, + Byte feedStatus, + Byte trafficIncidentsStatus) { + super(); + this.dataProviderName = dataProviderName; + this.protocolName = protocolName; + this.communicationChannelName = communicationChannelName; + this.feedStatus = feedStatus; + this.trafficIncidentsStatus = trafficIncidentsStatus; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDataStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDataStruct.java new file mode 100755 index 0000000..ee6055c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDataStruct.java @@ -0,0 +1,22 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconDataStruct extends Struct { + @Position(0) + public final byte[] data; + + public IconDataStruct(byte[] data) { + super(); + this.data = data; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDefinitionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDefinitionStruct.java new file mode 100755 index 0000000..c50ca27 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDefinitionStruct.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconDefinitionStruct extends Struct { + @Position(0) + public final IconInfoStruct iconInfo; + + @Position(1) + public final IconDataStruct iconData; + + public IconDefinitionStruct(IconInfoStruct iconInfo, IconDataStruct iconData) { + super(); + this.iconInfo = iconInfo; + this.iconData = iconData; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDescriptorStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDescriptorStruct.java new file mode 100755 index 0000000..7194938 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconDescriptorStruct.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconDescriptorStruct extends Struct { + @Position(0) + public final String url; + + @Position(1) + public final int iconId; + + public IconDescriptorStruct(String url, int iconId) { + super(); + this.url = url; + this.iconId = iconId; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconInfoStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconInfoStruct.java new file mode 100755 index 0000000..69543e7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconInfoStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconInfoStruct extends Struct { + @Position(0) + public final int iconSetId; + + @Position(1) + public final int iconId; + + public IconInfoStruct(int iconSetId, int iconId) { + super(); + this.iconSetId = iconSetId; + this.iconId = iconId; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSetStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSetStruct.java new file mode 100755 index 0000000..5991407 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSetStruct.java @@ -0,0 +1,52 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconSetStruct extends Struct { + @Position(0) + public final Integer iconSetId; + + @Position(1) + public final Byte colorType; // ColorType + + @Position(2) + public final Byte dimension; // IconDimension + + @Position(3) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final IconSizeStruct[] size; + + @Position(4) + public final Boolean dayTimeIcon; + + @Position(5) + public final Integer themeId; + + @Position(6) + public final String mediumType; + + @Position(7) + public final IconDescriptorStruct[] iconDescriptors; + + public IconSetStruct(int iconSetId, byte colorType, byte dimension, + IconSizeStruct[] size, Boolean dayTimeIcon, int themeId, String mediumType, + IconDescriptorStruct[] iconDescriptors) { + super(); + this.iconSetId = iconSetId; + this.colorType = colorType; + this.dimension = dimension; + this.size = size; + this.dayTimeIcon = dayTimeIcon; + this.themeId = themeId; + this.mediumType = mediumType; + this.iconDescriptors = iconDescriptors; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSizeStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSizeStruct.java new file mode 100755 index 0000000..bfb7ab1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/IconSizeStruct.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class IconSizeStruct extends Struct { + @Position(0) + public final int width; + + @Position(1) + public final int height; + + @Position(2) + public final int dpi; + + public IconSizeStruct(int width, int height, int dpi) { + super(); + this.width = width; + this.height = height; + this.dpi = dpi; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LaneRestrictionsStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LaneRestrictionsStruct.java new file mode 100755 index 0000000..4b8f02c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LaneRestrictionsStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class LaneRestrictionsStruct extends Struct { + @Position(0) + public final Byte laneRestrictionType; // LaneRestrictionType + + @Position(1) + public final Integer numberOfLanes; + + public LaneRestrictionsStruct(Byte laneRestrictionType, int numberOfLanes) { + super(); + this.laneRestrictionType = laneRestrictionType; + this.numberOfLanes = numberOfLanes; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationInfoStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationInfoStruct.java new file mode 100755 index 0000000..d7bb7de --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationInfoStruct.java @@ -0,0 +1,51 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; + +public class LinearLocationInfoStruct extends LocationInfoStruct { + @Position(0) + public final String name; + + @Position(1) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List mainLocation; + + @Position(2) + public final String fromLocationName; + + @Position(3) + public final String fromLocationParentName; + + @Position(4) + public final String toLocationName; + + @Position(5) + public final String toLocationParentName; + + @Position(6) + public final List coordinates; + + public LinearLocationInfoStruct(String name, List mainLocation, + String fromLocationName, String fromLocationParentName, + String toLocationName, String toLocationParentName, + List coordinates) { + super(); + this.name = name; + this.mainLocation = mainLocation; + this.fromLocationName = fromLocationName; + this.fromLocationParentName = fromLocationParentName; + this.toLocationName = toLocationName; + this.toLocationParentName = toLocationParentName; + this.coordinates = coordinates; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationStruct.java new file mode 100755 index 0000000..b0288fd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinearLocationStruct.java @@ -0,0 +1,33 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.UInt32; + +public class LinearLocationStruct extends LocationStruct { + @Position(0) + public final List segments; + + @Position(1) + public final UInt32 positiveOffset; + + @Position(2) + public final UInt32 negativeOffset; + + public LinearLocationStruct(List segments, UInt32 positiveOffset, + UInt32 negativeOffset) { + super(); + this.segments = segments; + this.positiveOffset = positiveOffset; + this.negativeOffset = negativeOffset; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinkedCauseStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinkedCauseStruct.java new file mode 100755 index 0000000..f8e6eba --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LinkedCauseStruct.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; + +public class LinkedCauseStruct extends CauseStruct { + @Position(0) + public final Byte mainCause; + + @Position(1) + public final Integer causeTrafficIncidentId; + + public LinkedCauseStruct(Byte mainCause, Integer causeTrafficIncidentId) { + super(); + this.mainCause = mainCause; + this.causeTrafficIncidentId = causeTrafficIncidentId; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocalizedStringStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocalizedStringStruct.java new file mode 100755 index 0000000..7049b79 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocalizedStringStruct.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class LocalizedStringStruct extends Struct { + @Position(0) + public final String languageCode; + + @Position(1) + public final String countryCode; + + @Position(2) + public final String string; + + public LocalizedStringStruct(String languageCode, String countryCode, + String string) { + super(); + this.languageCode = languageCode; + this.countryCode = countryCode; + this.string = string; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationDiscriminatedVariant.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationDiscriminatedVariant.java new file mode 100755 index 0000000..16d3c5f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationDiscriminatedVariant.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Variant; + +public class LocationDiscriminatedVariant extends Struct { + @Position(0) + public final Byte locationType; + + @Position(1) + public final Variant location; + + + public LocationDiscriminatedVariant( + Byte locationType, + Variant location + ) { + super(); + this.locationType = locationType; + this.location = location; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoDiscriminatedVariant.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoDiscriminatedVariant.java new file mode 100755 index 0000000..d677e64 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoDiscriminatedVariant.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Variant; + +public class LocationInfoDiscriminatedVariant extends Struct { + public static final Byte LOCATION_INFO_TYPE_POINT = 1; + public static final Byte LOCATION_INFO_TYPE_LINEAR = 2; + public static final Byte LOCATION_INFO_TYPE_AREA = 3; + + @Position(0) + public final Byte locationInfoType; + + @Position(1) + public final Variant locationInfo; + + + public LocationInfoDiscriminatedVariant( + Byte locationInfoType, + Variant locationInfo + ) { + super(); + this.locationInfoType = locationInfoType; + this.locationInfo = locationInfo; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoStruct.java new file mode 100755 index 0000000..21f4a8b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoStruct.java @@ -0,0 +1,15 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Struct; + +public class LocationInfoStruct extends Struct { + public LocationInfoStruct() { + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoType.java new file mode 100755 index 0000000..70a6a55 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationInfoType.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +public enum LocationInfoType { + POINT((byte) 1), + LINEAR((byte) 2), + AREA((byte) 3); + + private Byte value; + + LocationInfoType(Byte value) { + this.value = value; + } + + public Byte getValue() { + return value; + } + + public static LocationInfoType getLocationInfoType(Byte value) { + for (LocationInfoType causeType: values()) { + if (causeType.value == value) { + return causeType; + } + } + + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationStruct.java new file mode 100755 index 0000000..f58076d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationStruct.java @@ -0,0 +1,14 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Struct; + +public class LocationStruct extends Struct { + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationType.java new file mode 100755 index 0000000..b37cdaf --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/LocationType.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +public enum LocationType { + POINT((byte) 1), + LINEAR((byte) 2), + AREA((byte) 3); + + private Byte value; + + LocationType(Byte value) { + this.value = value; + } + + public Byte getValue() { + return value; + } + + public static LocationType getLocationType(Byte value) { + for (LocationType causeType: values()) { + if (causeType.value == value) { + return causeType; + } + } + + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationInfoStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationInfoStruct.java new file mode 100755 index 0000000..9262b74 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationInfoStruct.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; + +public class PointLocationInfoStruct extends LocationInfoStruct { + @Position(0) + public final String name; + + @Position(1) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List mainLocation; + + @Position(2) + public final int locationType; // PointLocationType + + public PointLocationInfoStruct(String name, List mainLocation, + int locationType) { + super(); + this.name = name; + this.mainLocation = mainLocation; + this.locationType = locationType; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationStruct.java new file mode 100755 index 0000000..5058975 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/PointLocationStruct.java @@ -0,0 +1,12 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + + +public class PointLocationStruct extends LocationStruct { +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/RectangularAreaStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/RectangularAreaStruct.java new file mode 100755 index 0000000..16055f4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/RectangularAreaStruct.java @@ -0,0 +1,26 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class RectangularAreaStruct extends Struct { + @Position(0) + public final CoordinateStruct bottomLeft; + + @Position(1) + public final CoordinateStruct topRight; + + public RectangularAreaStruct(CoordinateStruct bottomLeft, + CoordinateStruct topRight) { + super(); + this.bottomLeft = bottomLeft; + this.topRight = topRight; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitSectionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitSectionStruct.java new file mode 100755 index 0000000..d057cbf --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitSectionStruct.java @@ -0,0 +1,32 @@ +/** + * Copyright (C) 2014 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TemporarySpeedLimitSectionStruct extends Struct { + @Position(0) + public final Short speedLimitValue; + + @Position(1) + public final Short speedLimitValueWet; + + @Position(2) + public final Integer speedLimitLength; + + + public TemporarySpeedLimitSectionStruct(Short speedLimitValue, + Short speedLimitValueWet, Integer speedLimitLength) { + super(); + this.speedLimitValue = speedLimitValue; + this.speedLimitValueWet = speedLimitValueWet; + this.speedLimitLength = speedLimitLength; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitStruct.java new file mode 100755 index 0000000..8b9cb38 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TemporarySpeedLimitStruct.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2014 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TemporarySpeedLimitStruct extends Struct { + @Position(0) + public final Boolean unitsMPH; + + @Position(1) + public final Integer offset; + + @Position(2) + public final List temporarySpeedLimitSections; + + @Position(3) + public final List applicability; + + + public TemporarySpeedLimitStruct(Boolean unitsMPH, Integer offset, + List temporarySpeedLimitSections, + List applicability) { + super(); + this.unitsMPH = unitsMPH; + this.offset = offset; + this.temporarySpeedLimitSections = temporarySpeedLimitSections; + this.applicability = applicability; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentStruct.java new file mode 100755 index 0000000..bac57fc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentStruct.java @@ -0,0 +1,138 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class TrafficIncidentStruct extends Struct { + @Position(0) + public final Integer trafficIncidentId; + + @Position(1) + public final Byte effectCode; + + @Position(2) + public final String effectText; + + @Position(3) + public final Integer startTime; + + @Position(4) + public final Integer stopTime; + + @Position(5) + public final Byte tendency; // Tendency + + @Position(6) + public final String tendencyText; + + @Position(7) + public final Integer lengthAffected; + + @Position(8) + public final Integer averageSpeedAbsolute; + + @Position(9) + public final Integer delay; + + @Position(10) + public final Integer segmentSpeedLimit; + + @Position(11) + public final Integer expectedSpeedAbsolute; + + @Position(12) + public final List causes; + + @Position(13) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List location; // LocationUnion + + @Position(14) + public final List advices; + + @Position(15) + public final List applicability; + + @Position(16) + public final List temporarySpeedLimits; + + @Position(17) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List locationInfo; // LocationInfoUnion + + @Position(18) + public final List causeTexts; + + @Position(19) + public final List applicabilityTexts; + + @Position(20) + public final List adviceTexts; + + @Position(21) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List locationBoundingBox; + + @Position(22) + public final List categoryIds; + + public TrafficIncidentStruct( + Integer trafficIncidentId, + Byte effectCode, + String effectText, + Integer startTime, + Integer stopTime, + Byte tendency, + String tendencyText, + Integer lengthAffected, + Integer averageSpeedAbsolute, + Integer delay, + Integer segmentSpeedLimit, + Integer expectedSpeedAbsolute, + List causes, + List location, + List advices, + List applicability, + List temporarySpeedLimits, + List locationInfo, + List causeTexts, + List applicabilityTexts, + List adviceTexts, + List locationBoundingBox, + List categoryIds + ) { + super(); + this.trafficIncidentId = trafficIncidentId; + this.effectCode = effectCode; + this.effectText = effectText; + this.startTime = startTime; + this.stopTime = stopTime; + this.tendency = tendency; + this.tendencyText = tendencyText; + this.lengthAffected = lengthAffected; + this.averageSpeedAbsolute = averageSpeedAbsolute; + this.delay = delay; + this.segmentSpeedLimit = segmentSpeedLimit; + this.expectedSpeedAbsolute = expectedSpeedAbsolute; + this.causes = causes; + this.location = location; + this.advices = advices; + this.applicability = applicability; + this.locationInfo = locationInfo; + this.causeTexts = causeTexts; + this.applicabilityTexts = applicabilityTexts; + this.adviceTexts = adviceTexts; + this.locationBoundingBox = locationBoundingBox; + this.categoryIds = categoryIds; + this.temporarySpeedLimits = temporarySpeedLimits; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentsDBus.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentsDBus.java new file mode 100755 index 0000000..c9805ad --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TrafficIncidentsDBus.java @@ -0,0 +1,145 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; + +public interface TrafficIncidentsDBus extends DBusInterface { + public VersionStruct GetVersion(); + + public TwoTuple GetLanguage(); + + public void SetLanguage(String languageCode, String countryCode); + + public void SetTimeFormat(String timeFormat); + + public void SetDateFormat(String dateFormat); + + public void SetLengthUnit(Byte lengthUnit); + + public void SetWeightUnit(Byte weightUnit); + + public String GetApplicability(); + + public void SetApplicability(String expression); + + public List ReserveIconSetIds(Integer numberOfIds); + + public void FreeIconSetIds(List iconSetIds); + + public List GetIconSets(); + + public void AddIconSetDefinitions(List iconSets); + + public void RemoveIconSetDefinitions(List iconSetIds); + + public List GetIconDefinitions(List iconInfos); + + public void AddIconDefinitions(List iconDefinitions); + + public void RemoveIconDefinitions(List iconInfos); + + public List ReserveCategoryIds(Integer numberOfIds); + + public void FreeCategoryIds(List categoryIds); + + public List GetCategoryDefinitions(); + + public void AddCategoryDefinitions(List categoryDefinitions); + + public void RemoveCategoryDefinitions(List categoryIds); + + public List GetTrafficIncidentIds(List warningLevels, List categoryIds); + + public List GetTrafficIncidentIdsInAreas(List warningLevels, List categoryIds, List areas); + + public List GetTrafficIncidents(List trafficIncidentIds, boolean includeTextFields); + + public List GetTrafficIncidentsFields(List trafficIncidentIds, List trafficIncidentFields); + + public List GetTexts(List trafficIncidentIds, Byte textDetailLevel); + + public void AddTrafficIncidentsStatusListener(); + + public void RemoveTrafficIncidentsStatusListener(); + + public void AddFeedInformationListener(); + + public void RemoveFeedInformationListener(); + + public void AddUpdateListener(Integer listenerId, List warningLevels, List categoryIds); + + public void RemoveUpdateListener(Integer listenerId); + + public void AddAreasUpdateListener(Integer listenerId, List warningLevels, List categoryIds, List areas); + + public void RemoveAreasUpdateListener(Integer listenerId); + + + public class TrafficIncidentsStatus extends DBusSignal { + public final Byte trafficIncidentFeedStatus; + public final Byte trafficIncidentsStatus; + + public TrafficIncidentsStatus(String path, + Byte trafficIncidentFeedStatus, + Byte trafficIncidentsStatus) throws DBusException { + super(path, trafficIncidentFeedStatus, trafficIncidentsStatus); + this.trafficIncidentFeedStatus = trafficIncidentFeedStatus; + this.trafficIncidentsStatus =trafficIncidentsStatus; + } + } + + + public class FeedInformation extends DBusSignal { + public final List feedsInformation; + + public FeedInformation(String path, List feedsInformation) throws DBusException { + super(path, feedsInformation); + this.feedsInformation = feedsInformation; + } + } + + + public class Updates extends DBusSignal { + public final Integer listenerId; + public final List unchangedTrafficIncidentIds; + public final List changedTrafficIncidentIds; + public final List newTrafficIncidentIds; + public final List deletedTrafficIncidentIds; + + public Updates(String path, Integer listenerId, + List unchangedTrafficIncidentIds, + List changedTrafficIncidentIds, + List newTrafficIncidentIds, + List deletedTrafficIncidentIds) throws DBusException { + super(path, listenerId, unchangedTrafficIncidentIds, changedTrafficIncidentIds, newTrafficIncidentIds, deletedTrafficIncidentIds); + this.listenerId = listenerId; + this.unchangedTrafficIncidentIds = unchangedTrafficIncidentIds; + this.changedTrafficIncidentIds = changedTrafficIncidentIds; + this.newTrafficIncidentIds = newTrafficIncidentIds; + this.deletedTrafficIncidentIds = deletedTrafficIncidentIds; + } + } + + + public class UpdatesInAreas extends DBusSignal { + public final Integer listenerId; + public final List areas; + + public UpdatesInAreas(String path, Integer listenerId, + List areas) throws DBusException { + super(path, listenerId, areas); + this.listenerId = listenerId; + this.areas = areas; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TwoTuple.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TwoTuple.java new file mode 100755 index 0000000..d2fa41d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/TwoTuple.java @@ -0,0 +1,24 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Tuple; + +public class TwoTuple extends Tuple { + @Position(0) + public final A a; + + @Position(1) + public final B b; + + public TwoTuple(A a, B b) { + this.a = a; + this.b = b; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VehicleRelatedRestrictionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VehicleRelatedRestrictionStruct.java new file mode 100755 index 0000000..4763e7d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VehicleRelatedRestrictionStruct.java @@ -0,0 +1,36 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import java.util.List; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public class VehicleRelatedRestrictionStruct extends Struct { + @Position(0) + public final Byte restrictionType; // RestrictionType + + @Position(1) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List restrictionValue; + + @Position(2) + // Actually an optional value, which is represented by an array of length 0 or 1. + public final List restrictionLocation; + + public VehicleRelatedRestrictionStruct(Byte restrictionType, + List restrictionValue, + List restrictionLocation + ) { + super(); + this.restrictionType = restrictionType; + this.restrictionValue = restrictionValue; + this.restrictionLocation = restrictionLocation; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VersionStruct.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VersionStruct.java new file mode 100755 index 0000000..280c9cb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/VersionStruct.java @@ -0,0 +1,35 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.UInt16; + +public class VersionStruct extends Struct { + @Position(0) + public final UInt16 major; + + @Position(1) + public final UInt16 minor; + + @Position(2) + public final UInt16 micro; + + @Position(3) + public final String date; + + public VersionStruct(UInt16 major, UInt16 minor, UInt16 micro, String date) { + super(); + this.major = major; + this.minor = minor; + this.micro = micro; + this.date = date; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/StructUtil.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/StructUtil.java new file mode 100755 index 0000000..3caef1a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/StructUtil.java @@ -0,0 +1,2236 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Vector; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.EList; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.Variant; +import org.genivi.common.CommonFactory; +import org.genivi.common.Coordinate; +import org.genivi.common.LocalizedString; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; +import org.genivi.iconset.ColorType; +import org.genivi.iconset.IconData; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconDescriptor; +import org.genivi.iconset.IconDimension; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.iconset.IconSize; +import org.genivi.iconset.IconsetFactory; +import org.genivi.location.AreaLocation; +import org.genivi.location.AreaLocationInfo; +import org.genivi.location.LinearLocation; +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.Location; +import org.genivi.location.LocationFactory; +import org.genivi.location.LocationInfo; +import org.genivi.location.PointLocation; +import org.genivi.location.PointLocationInfo; +import org.genivi.location.PointLocationType; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.trafficincidentsserviceFactory; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.AdviceStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.ApplicabilityStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.AreaLocationInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.AreaLocationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CategoryDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CauseDiscriminatedVariant; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CauseStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CauseType; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CoordinateStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.DirectCauseStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.FeedInformationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconDataStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconDescriptorStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconSetStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconSizeStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LaneRestrictionsStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LinearLocationInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LinearLocationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LinkedCauseStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocalizedStringStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationDiscriminatedVariant; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationInfoDiscriminatedVariant; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationInfoType; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.LocationType; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.PointLocationInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.PointLocationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.RectangularAreaStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TemporarySpeedLimitSectionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TemporarySpeedLimitStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.VehicleRelatedRestrictionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentFactory; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidenttables.Accident; +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue; +import org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle; +import org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully; +import org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Fire; +import org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion; +import org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind; +import org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility; +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent; +import org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment; +import org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint; +import org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation; +import org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons; +import org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure; +import org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire; +import org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; +import org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay; +import org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion; +import org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; +import org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +public class StructUtil { + private final static Logger LOGGER = Logger.getLogger(StructUtil.class.getName()); + private final static CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; + private final static LocationFactory LOCATION_FACTORY = LocationFactory.eINSTANCE; + private final static trafficincidentFactory TRAFFIC_INCIDENT_FACTORY = trafficincidentFactory.eINSTANCE; + private final static trafficincidentsserviceFactory TRAFFIC_INCIDENTS_SVC_FACTORY = trafficincidentsserviceFactory.eINSTANCE; + private final static IconsetFactory ICON_SET_FACTORY = IconsetFactory.eINSTANCE; + + static { + LOGGER.setLevel(Level.SEVERE); + } + + public static Version versionStructToVersion(VersionStruct versionStruct) { + Version version = COMMON_FACTORY.createVersion(); + + version.setMajor(versionStruct.major.intValue()); + version.setMinor(versionStruct.minor.intValue()); + version.setMicro(versionStruct.micro.intValue()); + version.setDate(versionStruct.date); + + return version; + } + + public static VersionStruct versionToVersionStruct(Version version) { + UInt16 major = new UInt16(version.getMajor()); + UInt16 minor = new UInt16(version.getMinor()); + UInt16 micro = new UInt16(version.getMicro()); + + VersionStruct versionStruct = new VersionStruct(major, minor, micro, version.getDate()); + + return versionStruct; + } + + public static TrafficIncident trafficIncidentStructToTrafficIncident(TrafficIncidentStruct trafficIncidentStruct) { + TrafficIncident trafficIncident = TRAFFIC_INCIDENT_FACTORY.createTrafficIncident(); + + if (trafficIncidentStruct.effectCode != 0) { + EffectCode effectCode = EffectCode.get(trafficIncidentStruct.effectCode); + trafficIncident.setEffectCode(effectCode); + } + + if (!trafficIncidentStruct.effectText.isEmpty()) { + trafficIncident.setEffectText(trafficIncidentStruct.effectText); + } + + long startTimeValue = trafficIncidentStruct.startTime; + if (startTimeValue != -1) { + Date startTime = new Date(startTimeValue * 1000 * 60); + trafficIncident.setStartTime(startTime); + } + + long stopTimeValue = trafficIncidentStruct.stopTime; + if (stopTimeValue != -1) { + Date stopTime = new Date(stopTimeValue * 1000 * 60); + trafficIncident.setStopTime(stopTime); + } + + if (trafficIncidentStruct.tendency != 0) { + Tendency tendency = Tendency.get(trafficIncidentStruct.tendency); + trafficIncident.setTendency(tendency); + } + + if (!trafficIncidentStruct.tendencyText.isEmpty()) { + trafficIncident.setTendencyText(trafficIncidentStruct.tendencyText); + } + + if (trafficIncidentStruct.lengthAffected != -1) { + trafficIncident.setLengthAffected(trafficIncidentStruct.lengthAffected); + } + + if (trafficIncidentStruct.averageSpeedAbsolute != -1) { + trafficIncident.setAverageSpeedAbsolute(trafficIncidentStruct.averageSpeedAbsolute); + } + + if (trafficIncidentStruct.delay != -1) { + trafficIncident.setDelay(trafficIncidentStruct.delay); + } + + if (trafficIncidentStruct.segmentSpeedLimit != -1) { + trafficIncident.setSegmentSpeedLimit(trafficIncidentStruct.segmentSpeedLimit); + } + + if (trafficIncidentStruct.expectedSpeedAbsolute != -1) { + trafficIncident.setExpectedSpeedAbsolute(trafficIncidentStruct.expectedSpeedAbsolute); + } + + for (CauseDiscriminatedVariant causeDiscriminatedVariant: trafficIncidentStruct.causes) { + Cause cause = causeDiscriminatedVariantToCause(causeDiscriminatedVariant); + trafficIncident.getCauses().add(cause); + } + + if (trafficIncidentStruct.location.size() == 1) { + Location location = locationDiscriminatedVariantToLocation(trafficIncidentStruct.location.get(0)); + trafficIncident.setLocation(location); + } else if (trafficIncidentStruct.location.size() == 0) { + // No action + } else { + throw new RuntimeException("Illegal size for location: " + trafficIncidentStruct.location.size()); + } + + for (AdviceStruct adviceStruct: trafficIncidentStruct.advices) { + Advice advice = adviceStructToAdvice(adviceStruct); + trafficIncident.getAdvices().add(advice); + } + + for (ApplicabilityStruct applicabilityStruct: trafficIncidentStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + trafficIncident.getApplicability().add(applicability); + } + + for (TemporarySpeedLimitStruct temporarySpeedLimitStruct: trafficIncidentStruct.temporarySpeedLimits) { + TemporarySpeedLimit temporarySpeedLimit = temporarySpeedLimitStructToTemporarySpeedLimit(temporarySpeedLimitStruct); + trafficIncident.getTemporarySpeedLimit().add(temporarySpeedLimit); + LOGGER.info("temporarySpeedLimit added: " + temporarySpeedLimit); + } + + trafficIncident.setTrafficIncidentId(trafficIncidentStruct.trafficIncidentId); + + if (trafficIncidentStruct.locationInfo.size() == 1) { + LocationInfo locationInfo = locationInfoDiscriminatedVariantToLocationInfo(trafficIncidentStruct.locationInfo.get(0)); + trafficIncident.setLocationInfo(locationInfo); + } else if (trafficIncidentStruct.locationInfo.size() == 0) { + // No action + } else { + throw new RuntimeException("Illegal size for locationInfo: " + trafficIncidentStruct.locationInfo.size()); + } + + for (String string: trafficIncidentStruct.causeTexts) { + trafficIncident.getCauseTexts().add(string); + } + + for (String string: trafficIncidentStruct.applicabilityTexts) { + trafficIncident.getApplicabilityTexts().add(string); + } + + for (String string: trafficIncidentStruct.adviceTexts) { + trafficIncident.getAdviceTexts().add(string); + } + + if (trafficIncidentStruct.locationBoundingBox.size() == 1) { + RectangularArea locationBoundingBox = rectangularAreaStructToRectangularArea(trafficIncidentStruct.locationBoundingBox.get(0)); + trafficIncident.setLocationBoundingBox(locationBoundingBox); + } else if (trafficIncidentStruct.locationBoundingBox.size() != 0) { + throw new RuntimeException("Illegal size for locationBoundingBox: " + trafficIncidentStruct.locationBoundingBox.size()); + } + + for (Integer categoryId: trafficIncidentStruct.categoryIds) { + trafficIncident.getCategoryIds().add(categoryId); + } + + return trafficIncident; + } + + public static TrafficIncidentStruct trafficIncidentToTrafficIncidentStruct(TrafficIncident trafficIncident) { + Integer trafficIncidentId = trafficIncident.getTrafficIncidentId(); + + byte effectCodeId = 0; + EffectCode effectCode = trafficIncident.getEffectCode(); + if (effectCode != null) { + effectCodeId = (byte) effectCode.getValue(); + } + + String effectText; + if (trafficIncident.getEffectText() != null) { + effectText = trafficIncident.getEffectText(); + } else { + effectText = ""; + } + + Integer startTime; + if (trafficIncident.isSetStartTime()) { + startTime = (int) (trafficIncident.getStartTime().getTime() / (1000 * 60)); + } else { + startTime = -1; + } + + Integer stopTime; + if (trafficIncident.getStopTime() != null) { + stopTime = (int) (trafficIncident.getStopTime().getTime() / (1000 * 60)); + } else { + stopTime = -1; + } + + Byte tendencyId = 0; + Tendency tendency = trafficIncident.getTendency(); + if (tendency != null) { + tendencyId = (Byte) (byte) tendency.getValue(); + } + + String tendencyText; + if (trafficIncident.getTendencyText() != null) { + tendencyText= trafficIncident.getTendencyText(); + } else { + tendencyText = ""; + } + + int lengthAffected = -1; + if (trafficIncident.getLengthAffected() != null) { + lengthAffected =trafficIncident.getLengthAffected(); + } + + int averageSpeedAbsolute = -1; + if (trafficIncident.getAverageSpeedAbsolute() != null) { + averageSpeedAbsolute = trafficIncident.getAverageSpeedAbsolute(); + } + + int delay = -1; + if (trafficIncident.isSetDelay() && trafficIncident.getDelay() != null) { + delay = trafficIncident.getDelay(); + } + + int segmentSpeedLimit = -1; + if (trafficIncident.getSegmentSpeedLimit() != null) { + segmentSpeedLimit = trafficIncident.getSegmentSpeedLimit(); + } + + int expectedSpeedAbsolute = -1; + if (trafficIncident.getExpectedSpeedAbsolute() != null) { + expectedSpeedAbsolute = trafficIncident.getExpectedSpeedAbsolute(); + } + + EList causes = trafficIncident.getCauses(); + List causeDiscriminatedVariants = new ArrayList<>(); + for (Cause cause: causes) { + CauseDiscriminatedVariant causeDiscriminatedVariant = causeToCauseDiscriminatedVariant(cause); + causeDiscriminatedVariants.add(causeDiscriminatedVariant); + } + + List locationDiscriminatedVariants = new ArrayList<>(); + if (trafficIncident.getLocation() != null) { + LocationDiscriminatedVariant locationDiscriminatedVariant = locationToLocationDiscriminatedVariant(trafficIncident.getLocation()); + locationDiscriminatedVariants.add(locationDiscriminatedVariant); + } + + EList advices = trafficIncident.getAdvices(); + List adviceStructs = new ArrayList<>(); + for (int i = 0; i < advices.size(); i++) { + AdviceStruct adviceStruct = adviceToAdviceStruct(advices.get(i)); + adviceStructs.add(adviceStruct); + } + + EList applicabilities = trafficIncident.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + EList temporarySpeedLimits = trafficIncident.getTemporarySpeedLimit(); + List temporarySpeedLimitStructs = new ArrayList<>(); + for (int i = 0; i < temporarySpeedLimits.size(); i++) { + TemporarySpeedLimitStruct temporarySpeedLimitStruct = temporarySpeedLimitToTemporarySpeedLimitStruct(temporarySpeedLimits.get(i)); + temporarySpeedLimitStructs.add(temporarySpeedLimitStruct); + } + + List locationInfoDiscriminatedVariants = new ArrayList<>(); + if (trafficIncident.getLocationInfo() != null) { + LocationInfoDiscriminatedVariant locationInfoDiscriminatedVariant = locationInfoToLocationInfoDiscriminatedVariant(trafficIncident.getLocationInfo()); + locationInfoDiscriminatedVariants.add(locationInfoDiscriminatedVariant); + } + + List causeTexts = new ArrayList<>(); + for (String text: trafficIncident.getCauseTexts()) { + causeTexts.add(text); + } + + List applicabilityTexts = new ArrayList<>(); + for (String text: trafficIncident.getApplicabilityTexts()) { + applicabilityTexts.add(text); + } + + List adviceTexts = new ArrayList<>(); + for (String text: trafficIncident.getAdviceTexts()) { + adviceTexts.add(text); + } + + RectangularArea locationBoundingBox = trafficIncident.getLocationBoundingBox(); + List locationBoundingBoxStructs = new ArrayList<>(); + if (locationBoundingBox != null) { + RectangularAreaStruct locationBoundingBoxStruct = rectangularAreaToRectangularAreaStruct(locationBoundingBox); + locationBoundingBoxStructs.add(locationBoundingBoxStruct); + } + + List categoryIds = new ArrayList<>(); + for (Integer categoryId: trafficIncident.getCategoryIds()) { + categoryIds.add(categoryId); + } + + TrafficIncidentStruct trafficIncidentStruct = new TrafficIncidentStruct( + trafficIncidentId, + effectCodeId, + effectText, + startTime, + stopTime, + tendencyId, + tendencyText, + lengthAffected, + averageSpeedAbsolute, + delay, + segmentSpeedLimit, + expectedSpeedAbsolute, + causeDiscriminatedVariants, + locationDiscriminatedVariants, + adviceStructs, + applicabilityStructs, + temporarySpeedLimitStructs, + locationInfoDiscriminatedVariants, + causeTexts, + applicabilityTexts, + adviceTexts, + locationBoundingBoxStructs, + categoryIds + ); + + return trafficIncidentStruct; + } + + private static Cause causeDiscriminatedVariantToCause(CauseDiscriminatedVariant causeDiscriminatedVariant) { + CauseType causeType = CauseType.getCauseType(causeDiscriminatedVariant.causeType); + CauseStruct causeStruct = reconstructCauseStruct(causeType, causeDiscriminatedVariant.cause); + LOGGER.info("causeStruct = " + causeStruct); + Cause cause; + switch (causeType) { + case DIRECT: + LOGGER.info("is DirectCauseStruct"); + DirectCauseStruct directCauseStruct = (DirectCauseStruct) causeStruct; + cause = directCauseStructToDirectCause(directCauseStruct); + break; + + case LINKED: + LOGGER.info("is LinkedCauseStruct"); + LinkedCauseStruct linkedCauseStruct = (LinkedCauseStruct) causeStruct; + cause = linkedCauseStructToLinkedCause(linkedCauseStruct); + break; + + default: + throw new RuntimeException("Illegal causeType: " + causeType); + } + + return cause; + } + + private static CauseStruct reconstructCauseStruct(CauseType causeType, Variant causeVariant) { + LOGGER.info("reconstructCauseStruct => causeType = " + causeType + ", causeVariant" + causeVariant); + + Object[] structFields = (Object[]) causeVariant.getValue(); + CauseStruct causeStruct = null; + + Byte mainCause; + + switch (causeType) { + case DIRECT: + if (!(structFields.length == 8 && + structFields[0] instanceof Byte && + structFields[1] instanceof Byte && + structFields[2] instanceof Boolean && + structFields[3] instanceof Byte && + structFields[4] instanceof Integer && + structFields[5] instanceof Integer && + structFields[6] instanceof Vector && + structFields[7] instanceof String)) { + for (Object structField: structFields) { + LOGGER.info("reconstructCauseStructs field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for DirectCause"); + } + mainCause = (Byte) structFields[0]; + Byte warningLevel = (Byte) structFields[1]; + LOGGER.info("warningLevel OK"); + Boolean unverifiedInformation = (Boolean) structFields[2]; + LOGGER.info("unverifiedInformation OK"); + Byte subCause = (Byte) structFields[3]; + LOGGER.info("subCause OK"); + int lengthAffected = (Integer) structFields[4]; + LOGGER.info("lengthAffected OK"); + int causeOffset = (Integer) structFields[5]; + LOGGER.info("causeOffset OK"); + @SuppressWarnings("unchecked") + List laneRestrictions = reconstructLaneRestrictionsStructs((Vector) structFields[6]); + LOGGER.info("LaneRestrictionsStruct OK"); + String freeText = (String) structFields[7]; + LOGGER.info("freeTexts OK"); + causeStruct = new DirectCauseStruct(mainCause, warningLevel, unverifiedInformation, + subCause, lengthAffected, causeOffset, laneRestrictions, freeText); + break; + + case LINKED: + if (!(structFields.length == 2 && + structFields[0] instanceof Byte && + structFields[1] instanceof Integer)) { + LOGGER.severe("Wrong signature for LinkedCause"); + for (Object structField: structFields) { + LOGGER.severe("reconstructCauseStructs field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for LinkedCause"); + } + mainCause = (Byte) structFields[0]; + Integer causeTrafficIncidentId = (Integer) structFields[1]; + causeStruct = new LinkedCauseStruct(mainCause, causeTrafficIncidentId); + break; + } + + LOGGER.info("reconstructCauseStruct <= " + causeStruct); + return causeStruct; + } + + private static CauseDiscriminatedVariant causeToCauseDiscriminatedVariant(Cause cause) { + CauseType causeType; + CauseStruct causeStruct; + + if (cause instanceof DirectCause) { + causeType = CauseType.DIRECT; + causeStruct = directCauseToDirectCauseStruct((DirectCause) cause); + } else if (cause instanceof LinkedCause) { + causeType = CauseType.LINKED; + causeStruct = linkedCauseToLinkedCauseStruct((LinkedCause) cause); + } else { + throw new IllegalArgumentException("Unknow subclass of Cause"); + } + + Variant causeVariant = new Variant(causeStruct); + return new CauseDiscriminatedVariant(causeType.getValue(), causeVariant); + } + + private static LinkedCause linkedCauseStructToLinkedCause(LinkedCauseStruct linkedCauseStruct) { + LinkedCause linkedCause = TRAFFIC_INCIDENT_FACTORY.createLinkedCause(); + + CauseCode mainCause = CauseCode.get(linkedCauseStruct.mainCause); + linkedCause.setMainCause(mainCause); + + linkedCause.setCauseTrafficIncidentId(linkedCauseStruct.causeTrafficIncidentId); + + return linkedCause; + } + + private static LinkedCauseStruct linkedCauseToLinkedCauseStruct(LinkedCause linkedCause) { + Byte mainCause = (byte) linkedCause.getMainCause().getValue(); + Integer causeTrafficIncidentId = linkedCause.getCauseTrafficIncidentId(); + + LinkedCauseStruct linkedCauseStruct = new LinkedCauseStruct(mainCause, causeTrafficIncidentId); + + return linkedCauseStruct; + } + + private static DirectCause directCauseStructToDirectCause(DirectCauseStruct directCauseStruct) { + DirectCause directCause = TRAFFIC_INCIDENT_FACTORY.createDirectCause(); + + CauseCode mainCause = CauseCode.get(directCauseStruct.mainCause); + directCause.setMainCause(mainCause); + + if (directCauseStruct.warningLevel != 0) { + WarningLevel warningLevel = WarningLevel.get(directCauseStruct.warningLevel); + directCause.setWarningLevel(warningLevel); + } + + boolean unverifiedInformation = directCauseStruct.unverifiedInformation; + directCause.setUnverifiedInformation(unverifiedInformation); + + Byte subCauseValue = directCauseStruct.subCause; + + if (subCauseValue != 0) { + Object subCause; + switch (mainCause) { + case ACCIDENT: + subCause = Accident.get(subCauseValue); + break; + + case ANIMALS_ON_ROADWAY: + subCause = AnimalsOnRoadway.get(subCauseValue); + break; + + case BROKEN_DOWN_VEHICLES: + subCause = BrokenDownVehicles.get(subCauseValue); + break; + + case DANGEROUS_END_OF_QUEUE: + subCause = DangerousEndOfQueue.get(subCauseValue); + break; + + case EXTREME_WEATHER_CONDITIONS: + subCause = ExtremeWeatherConditions.get(subCauseValue); + break; + + case FIRE: + subCause = Fire.get(subCauseValue); + break; + + case HAZARDOUS_DRIVING_CONDITIONS: + subCause = HazardousDrivingConditions.get(subCauseValue); + break; + + case IMPASSIBILITY: + subCause = Impassibility.get(subCauseValue); + break; + + case MAJOR_EVENT: + subCause = MajorEvent.get(subCauseValue); + break; + + case MALFUNCTIONING_ROADSIDE_EQUIPMENT: + subCause = MalfunctioningRoadsideEquipment.get(subCauseValue); + break; + + case NARROW_LANES: + subCause = NarrowLanes.get(subCauseValue); + break; + + case OBJECTS_ON_THE_ROAD: + subCause = ObjectsOnTheRoad.get(subCauseValue); + break; + + case PEOPLE_ON_ROADWAY: + subCause = PeopleOnRoadway.get(subCauseValue); + break; + + case POLICE_CHECKPOINT: + subCause = PoliceCheckpoint.get(subCauseValue); + break; + + case PRECIPITATION: + subCause = Precipitation.get(subCauseValue); + break; + + case RECKLESS_PERSONS: + subCause = RecklessPersons.get(subCauseValue); + break; + + case REGULATORY_MEASURE: + subCause = RegulatoryMeasure.get(subCauseValue); + break; + + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + subCause = RescueAndRecoveryWorkInProgress.get(subCauseValue); + break; + + case RISK_OF_FIRE: + subCause = RiskOfFire.get(subCauseValue); + break; + + case ROADWORKS: + subCause = RoadWorks.get(subCauseValue); + break; + + case SERVICE_NOT_OPERATING: + subCause = ServiceNotOperating.get(subCauseValue); + break; + + case SERVICE_NOT_USEABLE: + subCause = ServiceNotUsable.get(subCauseValue); + break; + + case SLIPPERY_ROAD: + subCause = SlipperyRoad.get(subCauseValue); + break; + + case SLOW_MOVING_VEHICLES: + subCause = SlowMovingVehicles.get(subCauseValue); + break; + + case TIME_DELAY: + subCause = TimeDelay.get(subCauseValue); + break; + + case TRAFFIC_CONGESTION: + subCause = TrafficCongestion.get(subCauseValue); + break; + + case VISIBILITY_REDUCED: + subCause = VisibilityReduced.get(subCauseValue); + break; + + case AQUAPLANING: + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED: + case TRAFFIC_REGULATIONS_CHANGED: + case VEHICLE_ON_WRONG_CARRIAGEWAY: + throw new IllegalArgumentException("Subcause for main cause which doesn't support a subcause"); + + default: + throw new IllegalArgumentException("Unknown mainCause"); + } + + directCause.setSubCause(subCause); + } + + if (directCauseStruct.lengthAffected != -1) { + directCause.setLengthAffected(directCauseStruct.lengthAffected); + } + + if (directCauseStruct.causeOffset != -1) { + directCause.setCauseOffset(directCauseStruct.causeOffset); + } + + if (directCauseStruct.laneRestrictions.size() == 1) { + LaneRestrictions laneRestrictions = laneRestrictionsStructToLaneRestrictions(directCauseStruct.laneRestrictions.get(0)); + directCause.setLaneRestrictions(laneRestrictions); + } else if (directCauseStruct.laneRestrictions.size() == 0) { + // no action + } else { + throw new RuntimeException("Illegal size of LaneRestrictions list: " + directCauseStruct.laneRestrictions.size()); + } + + if (!directCauseStruct.freeText.isEmpty()) { + directCause.setFreeText(directCauseStruct.freeText); + } + + return directCause; + } + + private static DirectCauseStruct directCauseToDirectCauseStruct(DirectCause directCause) { + Byte mainCause = (byte) directCause.getMainCause().getValue(); + + Byte warningLevel = 0; + if (directCause.getWarningLevel() != null) { + warningLevel = (byte) directCause.getWarningLevel().getValue(); + } + + Boolean unverifiedInformation = directCause.isUnverifiedInformation(); + + Object subCauseObj = directCause.getSubCause(); + int subCauseValue = -1; + Byte subCause = 0; + if (subCauseObj != null) { + switch (directCause.getMainCause()) { + case ACCIDENT: + subCauseValue = ((Accident) subCauseObj).getValue(); + break; + + case ANIMALS_ON_ROADWAY: + subCauseValue = ((AnimalsOnRoadway) subCauseObj).getValue(); + break; + + case BROKEN_DOWN_VEHICLES: + subCauseValue = ((BrokenDownVehicles) subCauseObj).getValue(); + break; + + case DANGEROUS_END_OF_QUEUE: + subCauseValue = ((DangerousEndOfQueue) subCauseObj).getValue(); + break; + + case EXTREME_WEATHER_CONDITIONS: + subCauseValue = ((ExtremeWeatherConditions) subCauseObj).getValue(); + break; + + case FIRE: + subCauseValue = ((Fire) subCauseObj).getValue(); + break; + + case HAZARDOUS_DRIVING_CONDITIONS: + subCauseValue = ((HazardousDrivingConditions) subCauseObj).getValue(); + break; + + case IMPASSIBILITY: + subCauseValue = ((Impassibility) subCauseObj).getValue(); + break; + + case MAJOR_EVENT: + subCauseValue = ((MajorEvent) subCauseObj).getValue(); + break; + + case MALFUNCTIONING_ROADSIDE_EQUIPMENT: + subCauseValue = ((MalfunctioningRoadsideEquipment) subCauseObj).getValue(); + break; + + case NARROW_LANES: + subCauseValue = ((NarrowLanes) subCauseObj).getValue(); + break; + + case OBJECTS_ON_THE_ROAD: + subCauseValue = ((ObjectsOnTheRoad) subCauseObj).getValue(); + break; + + case PEOPLE_ON_ROADWAY: + subCauseValue = ((PeopleOnRoadway) subCauseObj).getValue(); + break; + + case POLICE_CHECKPOINT: + subCauseValue = ((PoliceCheckpoint) subCauseObj).getValue(); + break; + + case PRECIPITATION: + subCauseValue = ((Precipitation) subCauseObj).getValue(); + break; + + case RECKLESS_PERSONS: + subCauseValue = ((RecklessPersons) subCauseObj).getValue(); + break; + + case REGULATORY_MEASURE: + subCauseValue = ((RegulatoryMeasure) subCauseObj).getValue(); + break; + + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + subCauseValue = ((RescueAndRecoveryWorkInProgress) subCauseObj).getValue(); + break; + + case RISK_OF_FIRE: + subCauseValue = ((RiskOfFire) subCauseObj).getValue(); + break; + + case ROADWORKS: + subCauseValue = ((RoadWorks) subCauseObj).getValue(); + break; + + case SERVICE_NOT_OPERATING: + subCauseValue = ((ServiceNotOperating) subCauseObj).getValue(); + break; + + case SERVICE_NOT_USEABLE: + subCauseValue = ((ServiceNotUsable) subCauseObj).getValue(); + break; + + case SLIPPERY_ROAD: + subCauseValue = ((SlipperyRoad) subCauseObj).getValue(); + break; + + case SLOW_MOVING_VEHICLES: + subCauseValue = ((SlowMovingVehicles) subCauseObj).getValue(); + break; + + case TIME_DELAY: + subCauseValue = ((TimeDelay) subCauseObj).getValue(); + break; + + case TRAFFIC_CONGESTION: + subCauseValue = ((TrafficCongestion) subCauseObj).getValue(); + break; + + case VISIBILITY_REDUCED: + subCauseValue = ((VisibilityReduced) subCauseObj).getValue(); + break; + + case AQUAPLANING: + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED: + case TRAFFIC_REGULATIONS_CHANGED: + case VEHICLE_ON_WRONG_CARRIAGEWAY: + throw new IllegalArgumentException("Subcause for main cause which doesn't support a subcause"); + + default: + throw new IllegalArgumentException("Unknown mainCause"); + } + subCause = (byte) subCauseValue; + } + + int lengthAffected = -1; + if (directCause.getLengthAffected() != null) { + lengthAffected = directCause.getLengthAffected(); + } + + int causeOffset = -1; + if (directCause.getCauseOffset() != null) { + causeOffset = directCause.getCauseOffset(); + } + + LaneRestrictions laneRestrictions = directCause.getLaneRestrictions(); + List laneRestrictionsStructs = new ArrayList<>(); + if (laneRestrictions != null) { + LaneRestrictionsStruct laneRestrictionsStruct = laneRestrictionsToLaneRestrictionsStruct(laneRestrictions); + laneRestrictionsStructs.add(laneRestrictionsStruct); + } + + String freeText = ""; + if (directCause.isSetFreeText()) { + freeText = directCause.getFreeText(); + } + + DirectCauseStruct directCauseStruct = new DirectCauseStruct( + mainCause, + warningLevel, + unverifiedInformation, + subCause, + lengthAffected, + causeOffset, + laneRestrictionsStructs, + freeText); + + return directCauseStruct; + } + + private static List reconstructLaneRestrictionsStructs(Vector vector) { + LOGGER.info("reconstructLaneRestrictionsStructs =>"); + List laneRestrictionsStructs = new ArrayList<>(); + + for (Object object: vector) { + LOGGER.info("Handling object: " + object + " = " + object.getClass().getName()); + if (object instanceof Object[]) { + LOGGER.info("Type OK"); + LaneRestrictionsStruct laneRestrictionsStruct = reconstructLaneRestrictionsStruct((Object[]) object); + laneRestrictionsStructs.add(laneRestrictionsStruct); + } else { + LOGGER.info("Wrong Type"); + } + } + + LOGGER.info("reconstructLaneRestrictionsStructs <= " + laneRestrictionsStructs); + return laneRestrictionsStructs; + } + + private static LaneRestrictionsStruct reconstructLaneRestrictionsStruct(Object[] objects) { + LOGGER.info("reconstructLaneRestrictionsStruct =>"); + if (objects.length != 2) { + LOGGER.info("Wrong number of elements"); + return null; + } + + Byte laneRestrictionType = 0; + int numberOfLanes = -1; + + if (objects[0] instanceof Byte) { + laneRestrictionType = (Byte) objects[0]; + LOGGER.info("laneRestrictionType OK"); + } else { + LOGGER.info("Wrong type for laneRestrictionType"); + } + + if (objects[1] instanceof Integer) { + numberOfLanes = (Integer) objects[1]; + LOGGER.info("numberOfLanes OK"); + } else { + LOGGER.info("Wrong type for numberOfLanes"); + } + + LaneRestrictionsStruct laneRestrictionsStruct = new LaneRestrictionsStruct(laneRestrictionType, numberOfLanes); + + LOGGER.info("reconstructLaneRestrictionsStruct <= " + laneRestrictionsStruct); + return laneRestrictionsStruct; + } + + private static Location locationDiscriminatedVariantToLocation(LocationDiscriminatedVariant locationDiscriminatedVariant) { + LocationType locationType = LocationType.getLocationType(locationDiscriminatedVariant.locationType); + LocationStruct locationStruct = reconstructLocationStruct(locationType, locationDiscriminatedVariant.location); + LOGGER.info("locationStruct = " + locationStruct); + + Location location; + + switch (locationType) { + case POINT: + LOGGER.info("is PointLocation"); + PointLocationStruct pointLocationStruct = (PointLocationStruct) locationStruct; + location = pointLocationStructToPointLocation(pointLocationStruct); + break; + + case LINEAR: + LOGGER.info("is LinearLocation"); + LinearLocationStruct linearLocationStruct = (LinearLocationStruct) locationStruct; + location = linearLocationStructToLinearLocation(linearLocationStruct); + break; + + case AREA: + LOGGER.info("is AreaLocation"); + AreaLocationStruct areaLocationStruct = (AreaLocationStruct) locationStruct; + location = areaLocationStructToAreaLocation(areaLocationStruct); + break; + + default: + throw new RuntimeException("Illegal locationType: " + locationType); + } + + return location; + } + + private static LocationStruct reconstructLocationStruct(LocationType locationType, Variant locationVariant) { + LOGGER.info("reconstructLocationStruct => locationType = " + locationType + ", locationVariant" + locationVariant); + + Object[] structFields = (Object[]) locationVariant.getValue(); + LocationStruct locationStruct = null; + + + switch (locationType) { + case POINT: + throw new RuntimeException("PointLocation isn't supported"); + + case LINEAR: + if (!(structFields.length == 3 && + structFields[0] instanceof List && + structFields[1] instanceof UInt32 && + structFields[2] instanceof UInt32)) { + LOGGER.severe("Wrong signature for LinearLocation"); + for (Object structField: structFields) { + LOGGER.severe("reconstructLocationStruct field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for LinearLocation"); + } + LOGGER.info("LinearLocationStruct"); + @SuppressWarnings("unchecked") + List segments = (List) structFields[0]; + LOGGER.fine("parameter 0 OK"); + UInt32 positiveOffset = (UInt32) structFields[1]; + LOGGER.fine("parameter 1 OK"); + UInt32 negativeOffset = (UInt32) structFields[2]; + LOGGER.fine("parameter 2 OK"); + locationStruct = new LinearLocationStruct(segments, positiveOffset, negativeOffset); + break; + + case AREA: + throw new RuntimeException("AreaLocation isn't supported"); + } + + LOGGER.info("reconstructLocationStruct <= " + locationStruct); + return locationStruct; + } + + public static Location locationStructToLocation(LocationStruct locationStruct) { + Location location = LOCATION_FACTORY.createLocation(); + + if (locationStruct instanceof PointLocationStruct) { + location = pointLocationStructToPointLocation((PointLocationStruct) locationStruct); + } else if (locationStruct instanceof LinearLocationStruct) { + location = linearLocationStructToLinearLocation((LinearLocationStruct) locationStruct); + } else if (locationStruct instanceof AreaLocationStruct) { + location = areaLocationStructToAreaLocation((AreaLocationStruct) locationStruct); + } else { + throw new IllegalArgumentException("Unknown subclass of LocationStruct"); + } + + return location; + } + + private static LocationDiscriminatedVariant locationToLocationDiscriminatedVariant(Location location) { + LocationType locationType; + LocationStruct locationStruct; + + if (location instanceof PointLocation) { + locationType = LocationType.POINT; + locationStruct = pointLocationToPointLocationStruct((PointLocation) location); + } else if (location instanceof LinearLocation) { + locationType = LocationType.LINEAR; + locationStruct = linearLocationToLinearLocationStruct((LinearLocation) location); + } else if (location instanceof AreaLocation) { + locationType = LocationType.AREA; + locationStruct = areaLocationToAreaLocationStruct((AreaLocation) location); + } else { + throw new IllegalArgumentException("Unknow subclass of Location"); + } + + Variant locationVariant = new Variant(locationStruct); + return new LocationDiscriminatedVariant(locationType.getValue(), locationVariant); + } + + public static PointLocation pointLocationStructToPointLocation(PointLocationStruct pointLocationStruct) { + PointLocation pointLocation = LOCATION_FACTORY.createPointLocation(); + + return pointLocation; + } + + public static PointLocationStruct pointLocationToPointLocationStruct(PointLocation pointLocation) { + PointLocationStruct pointLocationStruct = new PointLocationStruct(); + + return pointLocationStruct; + } + + public static LinearLocation linearLocationStructToLinearLocation(LinearLocationStruct linearLocationStruct) { + LinearLocation linearLocation = LOCATION_FACTORY.createLinearLocation(); + + for (Long segment: linearLocationStruct.segments) { + linearLocation.getSegments().add(segment.longValue()); + } + + linearLocation.setPositiveOffset(linearLocationStruct.positiveOffset.longValue()); + + linearLocation.setNegativeOffset(linearLocationStruct.negativeOffset.longValue()); + + return linearLocation; + } + + public static LinearLocationStruct linearLocationToLinearLocationStruct(LinearLocation linearLocation) { + EList segments = linearLocation.getSegments(); + + UInt32 positiveOffset = new UInt32(linearLocation.getPositiveOffset()); + + UInt32 negativeOffset = new UInt32(linearLocation.getNegativeOffset()); + + LinearLocationStruct linearLocationStruct = new LinearLocationStruct( + segments, positiveOffset, negativeOffset); + + return linearLocationStruct; + } + + public static AreaLocation areaLocationStructToAreaLocation(AreaLocationStruct areaLocationStruct) { + AreaLocation areaLocation = LOCATION_FACTORY.createAreaLocation(); + + return areaLocation; + } + + public static AreaLocationStruct areaLocationToAreaLocationStruct(AreaLocation areaLocation) { + AreaLocationStruct areaLocationStruct = new AreaLocationStruct(); + + return areaLocationStruct; + } + + private static LocationInfo locationInfoDiscriminatedVariantToLocationInfo(LocationInfoDiscriminatedVariant locationInfoDiscriminatedVariant) { + LocationInfoType locationInfoType = LocationInfoType.getLocationInfoType(locationInfoDiscriminatedVariant.locationInfoType); + LocationInfoStruct locationInfoStruct = reconstructLocationInfoStruct(locationInfoType, locationInfoDiscriminatedVariant.locationInfo); + LOGGER.info("locationInfoStruct = " + locationInfoStruct); + + LocationInfo locationInfo; + + switch (locationInfoType) { + case POINT: + LOGGER.info("is PointLocationInfo"); + PointLocationInfoStruct pointLocationInfoStruct = (PointLocationInfoStruct) locationInfoStruct; + locationInfo = pointLocationInfoStructToPointLocationInfo(pointLocationInfoStruct); + break; + + case LINEAR: + LOGGER.info("is LinearLocationInfo"); + LinearLocationInfoStruct linearLocationInfoStruct = (LinearLocationInfoStruct) locationInfoStruct; + locationInfo = linearLocationInfoStructToLinearLocationInfo(linearLocationInfoStruct); + break; + + case AREA: + LOGGER.info("is AreaLocationInfo"); + AreaLocationInfoStruct areaLocationInfoStruct = (AreaLocationInfoStruct) locationInfoStruct; + locationInfo = areaLocationInfoStructToAreaLocationInfo(areaLocationInfoStruct); + break; + + default: + throw new RuntimeException("Illegal locationInfoType: " + locationInfoType); + } + + return locationInfo; + } + + @SuppressWarnings("unchecked") + private static LocationInfoStruct reconstructLocationInfoStruct(LocationInfoType locationInfoType, Variant locationInfoVariant) { + LOGGER.info("reconstructLocationInfoStruct => locationInfoType = " + locationInfoType + ", locationInfoVariant" + locationInfoVariant); + + Object[] structFields = (Object[]) locationInfoVariant.getValue(); + LocationInfoStruct locationInfoStruct = null; + + String name; + List mainLocationStructs; + + if (structFields.length >= 2 && + structFields[0] instanceof String && + structFields[1] instanceof Vector) { + name = (String) structFields[0]; + mainLocationStructs = reconstructCoordinateStructs((Vector) structFields[1]); + } else { + LOGGER.severe("Wrong signature for LocationInfo"); + for (Object structField: structFields) { + LOGGER.severe("reconstructLocationStruct field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for LocationInfo"); + } + + switch (locationInfoType) { + case POINT: + if (!(structFields.length == 3 && + structFields[2] instanceof Integer)) { + LOGGER.severe("Wrong signature for PointLocationInfo"); + for (Object structField: structFields) { + LOGGER.severe("reconstructLocationStruct field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for PointLocationInfo"); + } + LOGGER.info("PointLocationInfoStruct"); + int locationType = (Integer) structFields[2]; + LOGGER.info("locationType OK"); + locationInfoStruct = new PointLocationInfoStruct(name, mainLocationStructs, locationType); + break; + + case LINEAR: + if (!(structFields.length == 7 && + structFields[2] instanceof String && + structFields[3] instanceof String && + structFields[4] instanceof String && + structFields[5] instanceof String && + structFields[6] instanceof Vector)) { + LOGGER.severe("Wrong signature for LinearLocationInfo"); + for (Object structField: structFields) { + LOGGER.severe("reconstructLocationStruct field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for LinearLocationInfo"); + } + LOGGER.info("LinearLocationInfoStruct"); + String fromLocationName = (String) structFields[2]; + LOGGER.info("fromLocationName OK"); + String fromLocationParentName = (String) structFields[3]; + LOGGER.info("fromLocationParentName OK"); + String toLocationName = (String) structFields[4]; + LOGGER.info("toLocationName OK"); + String toLocationParentName = (String) structFields[5]; + LOGGER.info("toLocationParentName OK"); + List coordinates = reconstructCoordinateStructs((Vector) structFields[6]); + LOGGER.info("coordinates OK"); + locationInfoStruct = new LinearLocationInfoStruct(name, mainLocationStructs, fromLocationName, + fromLocationParentName, toLocationName, toLocationParentName, coordinates); + break; + + case AREA: + if (!(structFields.length == 2)) { + LOGGER.severe("Wrong signature for AreaLocationInfo"); + for (Object structField: structFields) { + LOGGER.severe("reconstructLocationStruct field = " + structField + " = " + structField.getClass().getName()); + } + throw new RuntimeException("Wrong signature for AreaLocationInfo"); + } + LOGGER.info("AreaLocationInfoStruct"); + locationInfoStruct = new AreaLocationInfoStruct(name, mainLocationStructs); + break; + } + + LOGGER.info("reconstructLocationInfoStruct <= " + locationInfoStruct); + return locationInfoStruct; + } + + public static LocationInfo locationInfoStructToLocationInfo(LocationInfoStruct locationInfoStruct) { + if (locationInfoStruct instanceof PointLocationInfoStruct) { + return pointLocationInfoStructToPointLocationInfo((PointLocationInfoStruct) locationInfoStruct); + } else if (locationInfoStruct instanceof LinearLocationInfoStruct) { + return linearLocationInfoStructToLinearLocationInfo((LinearLocationInfoStruct) locationInfoStruct); + } else if (locationInfoStruct instanceof AreaLocationInfoStruct) { + return areaLocationInfoStructToAreaLocationInfo((AreaLocationInfoStruct) locationInfoStruct); + } else { + throw new IllegalArgumentException("Unknow subclass of LocationInfoStruct"); + } + } + + private static LocationInfoDiscriminatedVariant locationInfoToLocationInfoDiscriminatedVariant(LocationInfo locationInfo) { + LocationInfoType locationInfoType; + LocationInfoStruct locationInfoStruct; + + if (locationInfo instanceof PointLocationInfo) { + locationInfoType = LocationInfoType.POINT; + locationInfoStruct = pointLocationInfoToPointLocationInfoStruct((PointLocationInfo) locationInfo); + } else if (locationInfo instanceof LinearLocationInfo) { + locationInfoType = LocationInfoType.LINEAR; + locationInfoStruct = linearLocationInfoToLinearLocationInfoStruct((LinearLocationInfo) locationInfo); + } else if (locationInfo instanceof AreaLocationInfo) { + locationInfoType = LocationInfoType.AREA; + locationInfoStruct = areaLocationInfoToAreaLocationInfoStruct((AreaLocationInfo) locationInfo); + } else { + throw new IllegalArgumentException("Unknow subclass of LocationInfo"); + } + + Variant locationInfoVariant = new Variant(locationInfoStruct); + return new LocationInfoDiscriminatedVariant(locationInfoType.getValue(), locationInfoVariant); + } + + public static PointLocationInfo pointLocationInfoStructToPointLocationInfo(PointLocationInfoStruct pointLocationInfoStruct) { + PointLocationInfo pointLocationInfo = LOCATION_FACTORY.createPointLocationInfo(); + + String name = pointLocationInfoStruct.name; + pointLocationInfo.setName(name); + + if (pointLocationInfoStruct.mainLocation.size() == 1) { + Coordinate mainLocation = coordinateStructToCoordinate(pointLocationInfoStruct.mainLocation.get(0)); + pointLocationInfo.setMainLocation(mainLocation); + } else if (pointLocationInfoStruct.mainLocation.size() != 0){ + throw new RuntimeException("Illegal size of mainLocation: " + pointLocationInfoStruct.mainLocation.size()); + } + + PointLocationType pointLocationType = PointLocationType.get(pointLocationInfoStruct.locationType); + pointLocationInfo.setLocationType(pointLocationType); + + return pointLocationInfo; + } + + public static PointLocationInfoStruct pointLocationInfoToPointLocationInfoStruct(PointLocationInfo pointLocationInfo) { + String name = pointLocationInfo.getName(); + + Coordinate mainLocation = pointLocationInfo.getMainLocation(); + List mainLocationStructs = new ArrayList<>(); + if (mainLocation != null) { + CoordinateStruct mainLocationStruct = coordinateToCoordinateStruct(mainLocation); + mainLocationStructs.add(mainLocationStruct); + } + + int locationType = pointLocationInfo.getLocationType().getValue(); + + PointLocationInfoStruct pointLocationInfoStruct = new PointLocationInfoStruct( + name, mainLocationStructs, locationType); + + return pointLocationInfoStruct; + } + + public static LinearLocationInfo linearLocationInfoStructToLinearLocationInfo(LinearLocationInfoStruct linearLocationInfoStruct) { + LinearLocationInfo linearLocationInfo = LOCATION_FACTORY.createLinearLocationInfo(); + + String name = linearLocationInfoStruct.name; + if (!name.isEmpty()) { + linearLocationInfo.setName(name); + } + + if (linearLocationInfoStruct.mainLocation.size() == 1) { + Coordinate mainLocation = coordinateStructToCoordinate(linearLocationInfoStruct.mainLocation.get(0)); + linearLocationInfo.setMainLocation(mainLocation); + } else if (linearLocationInfoStruct.mainLocation.size() != 0){ + throw new RuntimeException("Illegal size of mainLocation: " + linearLocationInfoStruct.mainLocation.size()); + } + + if (!linearLocationInfoStruct.fromLocationName.isEmpty()) { + linearLocationInfo.setFromLocationName(linearLocationInfoStruct.fromLocationName); + } + + if (!linearLocationInfoStruct.fromLocationParentName.isEmpty()) { + linearLocationInfo.setFromLocationParentName(linearLocationInfoStruct.fromLocationParentName); + } + + if (!linearLocationInfoStruct.toLocationName.isEmpty()) { + linearLocationInfo.setToLocationName(linearLocationInfoStruct.toLocationName); + } + + if (!linearLocationInfoStruct.toLocationParentName.isEmpty()) { + linearLocationInfo.setToLocationParentName(linearLocationInfoStruct.toLocationParentName); + } + + for (CoordinateStruct coordinateStruct: linearLocationInfoStruct.coordinates) { + Coordinate coordinate = coordinateStructToCoordinate(coordinateStruct); + linearLocationInfo.getCoordinates().add(coordinate); + } + + return linearLocationInfo; + } + + public static LinearLocationInfoStruct linearLocationInfoToLinearLocationInfoStruct(LinearLocationInfo linearLocationInfo) { + String name; + if (linearLocationInfo.getName() != null) { + name = linearLocationInfo.getName(); + } else { + name = ""; + } + + Coordinate mainLocation = linearLocationInfo.getMainLocation(); + List mainLocationStructs = new ArrayList<>(); + if (mainLocation != null) { + CoordinateStruct mainLocationStruct = coordinateToCoordinateStruct(mainLocation); + mainLocationStructs.add(mainLocationStruct); + } + + String fromLocationName; + if (linearLocationInfo.getFromLocationName() != null) { + fromLocationName = linearLocationInfo.getFromLocationName(); + } else { + fromLocationName = ""; + } + + String fromLocationParentName; + if (linearLocationInfo.getFromLocationParentName() != null) { + fromLocationParentName = linearLocationInfo.getFromLocationParentName(); + } else { + fromLocationParentName = ""; + } + + String toLocationName; + if (linearLocationInfo.getToLocationName() != null) { + toLocationName = linearLocationInfo.getToLocationName(); + } else { + toLocationName = ""; + } + + String toLocationParentName; + if (linearLocationInfo.getToLocationParentName() != null) { + toLocationParentName = linearLocationInfo.getToLocationParentName(); + } else { + toLocationParentName = ""; + } + + EList coordinates = linearLocationInfo.getCoordinates(); + List coordinateStructs = new ArrayList<>(); + for (int i = 0; i < coordinates.size(); i++) { + CoordinateStruct coordinateStruct = coordinateToCoordinateStruct(coordinates.get(i)); + coordinateStructs.add(coordinateStruct); + } + + LinearLocationInfoStruct linearLocationInfoStruct = new LinearLocationInfoStruct( + name, mainLocationStructs, + fromLocationName, fromLocationParentName, + toLocationName, toLocationParentName, + coordinateStructs); + + return linearLocationInfoStruct; + } + + public static AreaLocationInfo areaLocationInfoStructToAreaLocationInfo(AreaLocationInfoStruct areaLocationInfoStruct) { + AreaLocationInfo areaLocationInfo = LOCATION_FACTORY.createAreaLocationInfo(); + + String name = areaLocationInfoStruct.name; + areaLocationInfo.setName(name); + + if (areaLocationInfoStruct.mainLocation.size() == 1) { + Coordinate mainLocation = coordinateStructToCoordinate(areaLocationInfoStruct.mainLocation.get(0)); + areaLocationInfo.setMainLocation(mainLocation); + } else if (areaLocationInfoStruct.mainLocation.size() != 0){ + throw new RuntimeException("Illegal size of mainLocation: " + areaLocationInfoStruct.mainLocation.size()); + } + + return areaLocationInfo; + } + + public static AreaLocationInfoStruct areaLocationInfoToAreaLocationInfoStruct(AreaLocationInfo areaLocationInfo) { + String name = areaLocationInfo.getName(); + + Coordinate mainLocation = areaLocationInfo.getMainLocation(); + List mainLocationStructs = new ArrayList<>(); + if (mainLocation != null) { + CoordinateStruct mainLocationStruct = coordinateToCoordinateStruct(mainLocation); + mainLocationStructs.add(mainLocationStruct); + } + + AreaLocationInfoStruct areaLocationInfoStruct = new AreaLocationInfoStruct( + name, mainLocationStructs); + + return areaLocationInfoStruct; + } + + private static List reconstructCoordinateStructs(Vector vector) { + LOGGER.info("reconstructCoordinateStructs => " + vector); + List coordinateStructs = new ArrayList<>(); + + for (Object object: vector) { + if (object instanceof Object[]) { + CoordinateStruct coordinateStruct = reconstructCoordinateStruct((Object[]) object); + coordinateStructs.add(coordinateStruct); + } else { + LOGGER.severe("Wrong type"); + } + } + + LOGGER.info("reconstructCoordinateStructs <= " + coordinateStructs); + return coordinateStructs; + } + + private static CoordinateStruct reconstructCoordinateStruct(Object[] objects) { + LOGGER.info("reconstructCoordinateStruct => " + objects); + + CoordinateStruct coordinateStruct = null; + + if (objects.length != 3) { + LOGGER.info("Wrong number of elements"); + return null; + } + + Double latitude = null; + Double longitude = null; + int altitude = -1; + + if (objects[0] instanceof Double) { + latitude = (Double) objects[0]; + LOGGER.info("latitude OK"); + } else { + LOGGER.severe("Wrong type for latitude"); + } + + if (objects[1] instanceof Double) { + longitude = (Double) objects[1]; + LOGGER.info("longitude OK"); + } else { + LOGGER.severe("Wrong type for longitude"); + } + + if (objects[2] instanceof Integer) { + altitude = (Integer) objects[2]; + LOGGER.info("altitude OK"); + } else { + LOGGER.severe("Wrong type for altitude"); + } + + coordinateStruct = new CoordinateStruct(latitude, longitude, altitude); + + LOGGER.info("reconstructCoordinateStruct <= " + coordinateStruct); + return coordinateStruct; + } + + private static Advice adviceStructToAdvice(AdviceStruct adviceStruct) { + LOGGER.info("adviceStructToAdvice => adviceStruct = " + adviceStruct); + Advice advice = TRAFFIC_INCIDENT_FACTORY.createAdvice(); + + AdviceCode mainAdvice = AdviceCode.get(adviceStruct.mainAdvice); + advice.setMainAdvice(mainAdvice); + + Byte subAdviceValue = adviceStruct.subAdvice; + if (subAdviceValue != 0) { + Object subAdviceObj; + switch (mainAdvice) { + case DO_NOT_LEAVE_YOUR_VEHICLE: + subAdviceObj = DoNotLeaveYourVehicle.get(subAdviceValue); + break; + + case DRIVE_CAREFULLY: + subAdviceObj = DriveCarefully.get(subAdviceValue); + break; + + case DRIVING_NOT_ALLOWED: + subAdviceObj = DrivingNotAllowed.get(subAdviceValue); + break; + + case FOLLOW_DIVERSION: + subAdviceObj = FollowDiversion.get(subAdviceValue); + break; + + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND: + subAdviceObj = GivingPathVehiclesFromBehind.get(subAdviceValue); + break; + + case OVERTAKING_NOT_ALLOWED: + subAdviceObj = OvertakingNotAllowed.get(subAdviceValue); + break; + + case USE_TOLL_LANES: + subAdviceObj = UseTollLanes.get(subAdviceValue); + break; + + case AVOID_THE_AREA: + case DO_NOT_DIVERT: + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE: + case FOLLOW_POLICE_INSTRUCTIONS: + case NO_DIVERSION_TO_RECOMMEND: + case SWITCH_ON_RADIO: + case USE_HARD_SHOULDER_AS_LANE: + case WAIT_FOR_CONVOI: + case WAIT_FOR_IMPROVED_WEATHER: + case WAIT_FOR_POLICE_PATROL: + throw new IllegalArgumentException("Subadvice for main advice which doesn't support a subadvice"); + + default: + throw new IllegalArgumentException("Unknown mainAdvice"); + } + advice.setSubAdvice(subAdviceObj); + } + + if (!adviceStruct.freeText.isEmpty()) { + advice.setFreeText(adviceStruct.freeText); + } + + for (ApplicabilityStruct applicabilityStruct: adviceStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + advice.getApplicability().add(applicability); + } + + LOGGER.info("adviceStructToAdvice <= advice = " + advice); + return advice; + } + + private static AdviceStruct adviceToAdviceStruct(Advice advice) { + Byte mainAdvice = (Byte) (byte) advice.getMainAdvice().getValue(); + + Object subAdviceObj = advice.getSubAdvice(); + int subAdviceValue = 0; + if (subAdviceObj != null) { + switch (advice.getMainAdvice()) { + case DO_NOT_LEAVE_YOUR_VEHICLE: + subAdviceValue = ((DoNotLeaveYourVehicle) subAdviceObj).getValue(); + break; + + case DRIVE_CAREFULLY: + subAdviceValue = ((DriveCarefully) subAdviceObj).getValue(); + break; + + case DRIVING_NOT_ALLOWED: + subAdviceValue = ((DrivingNotAllowed) subAdviceObj).getValue(); + break; + + case FOLLOW_DIVERSION: + subAdviceValue = ((FollowDiversion) subAdviceObj).getValue(); + break; + + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND: + subAdviceValue = ((GivingPathVehiclesFromBehind) subAdviceObj).getValue(); + break; + + case OVERTAKING_NOT_ALLOWED: + subAdviceValue = ((OvertakingNotAllowed) subAdviceObj).getValue(); + break; + + case USE_TOLL_LANES: + subAdviceValue = ((UseTollLanes) subAdviceObj).getValue(); + break; + + case AVOID_THE_AREA: + case DO_NOT_DIVERT: + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE: + case FOLLOW_POLICE_INSTRUCTIONS: + case NO_DIVERSION_TO_RECOMMEND: + case SWITCH_ON_RADIO: + case USE_HARD_SHOULDER_AS_LANE: + case WAIT_FOR_CONVOI: + case WAIT_FOR_IMPROVED_WEATHER: + case WAIT_FOR_POLICE_PATROL: + throw new IllegalArgumentException("Subadvice for main advice which doesn't support a subadvice"); + + default: + throw new IllegalArgumentException("Unknown mainAdvice"); + } + } + Byte subAdvice = (Byte) (byte) subAdviceValue; + + String freeText = ""; + if (advice.isSetFreeText()) { + freeText = advice.getFreeText(); + } + + EList applicabilities = advice.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + AdviceStruct adviceStruct = new AdviceStruct( + mainAdvice, + subAdvice, + freeText, + applicabilityStructs); + + return adviceStruct; + } + + public static Applicability applicabilityStructToApplicability(ApplicabilityStruct applicabilityStruct) { + LOGGER.info("applicabilityStructToApplicability() => " + applicabilityStruct); + Applicability applicability = TRAFFIC_INCIDENT_FACTORY.createApplicability(); + + if (applicabilityStruct.vehicleType != 0) { + VehicleType vehicleType = VehicleType.get(applicabilityStruct.vehicleType); + applicability.setVehicleType(vehicleType); + LOGGER.info("applicabilityStructToApplicability: vehicleType set to " + vehicleType + " = " + vehicleType.getValue()); + } + + for (VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct: applicabilityStruct.vehicleRelatedRestrictions) { + LOGGER.info("applicabilityStructToApplicability: loop for vehicleRelatedRestrictionStruct = " + vehicleRelatedRestrictionStruct); + VehicleRelatedRestriction vehicleRelatedRestriction = vehicleRelatedRestrictionStructToVehicleRelatedRestriction(vehicleRelatedRestrictionStruct); + applicability.getVehicleRelatedRestrictions().add(vehicleRelatedRestriction); + LOGGER.info("applicabilityStructToApplicability: loop: vehicleRelatedRestriction = " + vehicleRelatedRestriction); + } + + LOGGER.info("applicabilityStructToApplicability() <= " + applicability); + return applicability; + } + + public static ApplicabilityStruct applicabilityToApplicabilityStruct(Applicability applicability) { + Byte vehicleType = 0; + if (applicability.getVehicleType() != null) { + vehicleType = (Byte) (byte) applicability.getVehicleType().getValue(); + } + + EList vehicleRelatedRestrictions = applicability.getVehicleRelatedRestrictions(); + List vehicleRelatedRestrictionStructs = new ArrayList<>(); + for (int i = 0; i < vehicleRelatedRestrictions.size(); i++) { + VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct = vehicleRelatedRestrictionToVehicleRelatedRestrictionStruct(vehicleRelatedRestrictions.get(i)); + vehicleRelatedRestrictionStructs.add(vehicleRelatedRestrictionStruct); + } + + ApplicabilityStruct applicabilityStruct = new ApplicabilityStruct( + vehicleType, + vehicleRelatedRestrictionStructs); + + return applicabilityStruct; + } + + public static VehicleRelatedRestriction vehicleRelatedRestrictionStructToVehicleRelatedRestriction(VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct) { + LOGGER.info("vehicleRelatedRestrictionStructToVehicleRelatedRestriction() => " + vehicleRelatedRestrictionStruct); + VehicleRelatedRestriction vehicleRelatedRestriction = TRAFFIC_INCIDENT_FACTORY.createVehicleRelatedRestriction(); + RestrictionType restrictionType = RestrictionType.get(vehicleRelatedRestrictionStruct.restrictionType); + vehicleRelatedRestriction.setRestrictionType(restrictionType); + LOGGER.info("restrictionType = " + restrictionType + " = " + restrictionType.getValue()); + + if (vehicleRelatedRestrictionStruct.restrictionValue.size() == 1) { + vehicleRelatedRestriction.setRestrictionValue(vehicleRelatedRestrictionStruct.restrictionValue.get(0)); + LOGGER.info("restrictionValue = " + vehicleRelatedRestriction.getRestrictionValue()); + } else if (vehicleRelatedRestrictionStruct.restrictionValue.size() == 0) { + LOGGER.info("No restrictionValue"); + } else { + throw new RuntimeException("Illegal size of restrictionValue: " + vehicleRelatedRestrictionStruct.restrictionValue); + } + + if (vehicleRelatedRestrictionStruct.restrictionLocation.size() == 1) { + Location restrictionLocation = locationDiscriminatedVariantToLocation(vehicleRelatedRestrictionStruct.restrictionLocation.get(0)); + vehicleRelatedRestriction.setRestrictionLocation(restrictionLocation); + } else if (vehicleRelatedRestrictionStruct.restrictionLocation.size() == 0) { + // No action + } else { + throw new RuntimeException("Illegal size for restrictionLocation: " + vehicleRelatedRestrictionStruct.restrictionLocation.size()); + } + LOGGER.info("RestrictionLocation is handled"); + + LOGGER.info("vehicleRelatedRestrictionStructToVehicleRelatedRestriction() <= " + vehicleRelatedRestriction); + return vehicleRelatedRestriction; + } + + public static VehicleRelatedRestrictionStruct vehicleRelatedRestrictionToVehicleRelatedRestrictionStruct(VehicleRelatedRestriction vehicleRelatedRestriction) { + Byte restrictionType = (Byte) (byte) vehicleRelatedRestriction.getRestrictionType().getValue(); + + List restrictionValues = new ArrayList<>(); + if (vehicleRelatedRestriction.getRestrictionValue() != null) { + Integer restrictionValue = vehicleRelatedRestriction.getRestrictionValue(); + restrictionValues.add(restrictionValue); + } + + List restrictionLocationDiscriminatedVariants = new ArrayList<>(); + if (vehicleRelatedRestriction.getRestrictionLocation() != null) { + LocationDiscriminatedVariant restrictionLocationDiscriminatedVariant = locationToLocationDiscriminatedVariant(vehicleRelatedRestriction.getRestrictionLocation()); + restrictionLocationDiscriminatedVariants.add(restrictionLocationDiscriminatedVariant); + } + + VehicleRelatedRestrictionStruct vehicleRelatedRestrictionStruct = new VehicleRelatedRestrictionStruct( + restrictionType, restrictionValues, restrictionLocationDiscriminatedVariants); + + return vehicleRelatedRestrictionStruct; + } + + public static LaneRestrictions laneRestrictionsStructToLaneRestrictions(LaneRestrictionsStruct laneRestrictionsStruct) { + LaneRestrictions laneRestrictions = TRAFFIC_INCIDENT_FACTORY.createLaneRestrictions(); + + if (laneRestrictionsStruct.laneRestrictionType != 0 ) { + LaneRestrictionType laneRestrictionType = LaneRestrictionType.get(laneRestrictionsStruct.laneRestrictionType); + laneRestrictions.setLaneRestrictionType(laneRestrictionType); + } + + if (laneRestrictionsStruct.numberOfLanes != -1) { + laneRestrictions.setNumberOfLanes(laneRestrictionsStruct.numberOfLanes); + } + + return laneRestrictions; + } + + public static LaneRestrictionsStruct laneRestrictionsToLaneRestrictionsStruct(LaneRestrictions laneRestrictions) { + Byte laneRestrictionType = 0; + if (laneRestrictions.getLaneRestrictionType() != null) { + laneRestrictionType = (Byte) (byte) laneRestrictions.getLaneRestrictionType().getValue(); + } + + int numberOfLanes = -1; + if (laneRestrictions.getNumberOfLanes() != null) { + numberOfLanes= laneRestrictions.getNumberOfLanes(); + } + + LaneRestrictionsStruct laneRestrictionsStruct = new LaneRestrictionsStruct( + laneRestrictionType, + numberOfLanes); + + return laneRestrictionsStruct; + } + + public static IconSet iconSetStructToIconSet(IconSetStruct iconSetStruct) { + IconSet iconSet = ICON_SET_FACTORY.createIconSet(); + + iconSet.setIconSetId(iconSetStruct.iconSetId); + + if (iconSetStruct.colorType != 0) { + ColorType colorType = ColorType.get(iconSetStruct.colorType); + iconSet.setColorType(colorType); + } + + if (iconSetStruct.dimension != 0) { + IconDimension dimension = IconDimension.get(iconSetStruct.dimension); + iconSet.setDimension(dimension); + } + + if (iconSetStruct.size.length != 0) { + IconSize size = iconSizeStructToIconSize(iconSetStruct.size[0]); + iconSet.setSize(size); + } + + iconSet.setDayTimeIcon(iconSetStruct.dayTimeIcon); + + iconSet.setThemeId(iconSetStruct.themeId); + + iconSet.setMediumType(iconSetStruct.mediumType); + + for (IconDescriptorStruct iconDescriptorStruct: iconSetStruct.iconDescriptors) { + IconDescriptor iconDescriptor = iconDescriptorStructToIconDescriptor(iconDescriptorStruct); + iconSet.getIconDescriptors().add(iconDescriptor); + } + + return iconSet; + } + + public static IconSetStruct iconSetToIconSetStruct(IconSet iconSet) { + int iconSetId = iconSet.getIconSetId(); + byte colorType = 0; + if (iconSet.isSetColorType()) { + colorType = (byte) iconSet.getColorType().getValue(); + } + byte dimension = 0; + if (iconSet.isSetDimension()) { + dimension = (byte) iconSet.getDimension().getValue(); + } + IconSizeStruct[] iconSizeStruct; + if (iconSet.isSetSize()) { + iconSizeStruct = new IconSizeStruct[1]; + iconSizeStruct[0] = iconSizeToIconSizeStruct(iconSet.getSize()); + } else { + iconSizeStruct = new IconSizeStruct[0]; + } + Boolean dayTimeIcon = iconSet.isDayTimeIcon(); + int themeId = iconSet.getThemeId(); + String mediumType = iconSet.getMediumType(); + + EList iconDescriptors = iconSet.getIconDescriptors(); + IconDescriptorStruct[] iconDescriptorStructs = new IconDescriptorStruct[iconDescriptors.size()]; + for (int i = 0; i < iconDescriptors.size(); i++) { + IconDescriptorStruct iconDescriptorStruct = iconDescriptorToIconDescriptorStruct(iconDescriptors.get(i)); + iconDescriptorStructs[i] = iconDescriptorStruct; + } + + IconSetStruct iconSetStruct = new IconSetStruct( + iconSetId, + colorType, + dimension, + iconSizeStruct, + dayTimeIcon, + themeId, + mediumType, + iconDescriptorStructs); + + return iconSetStruct; + } + + public static IconDescriptor iconDescriptorStructToIconDescriptor(IconDescriptorStruct iconDescriptorStruct) { + IconDescriptor iconDescriptor = ICON_SET_FACTORY.createIconDescriptor(); + + if (!iconDescriptorStruct.url.isEmpty()) { + iconDescriptor.setUrl(iconDescriptorStruct.url); + } + iconDescriptor.setIconId(iconDescriptorStruct.iconId); + + return iconDescriptor; + } + + public static IconDescriptorStruct iconDescriptorToIconDescriptorStruct(IconDescriptor iconDescriptor) { + String url = iconDescriptor.getUrl(); + if (url == null) { + url = ""; + } + int iconId = iconDescriptor.getIconId(); + + IconDescriptorStruct iconDescriptorStruct = new IconDescriptorStruct(url, iconId); + + return iconDescriptorStruct; + } + + public static IconSize iconSizeStructToIconSize(IconSizeStruct sizeStruct) { + IconSize iconSize = ICON_SET_FACTORY.createIconSize(); + + iconSize.setWidth(sizeStruct.width); + iconSize.setHeight(sizeStruct.height); + iconSize.setDpi(sizeStruct.dpi); + + return iconSize; + } + + public static IconSizeStruct iconSizeToIconSizeStruct(IconSize iconSize) { + int width = iconSize.getWidth(); + int height = iconSize.getHeight(); + int dpi = iconSize.getDpi(); + + IconSizeStruct iconSizeStruct = new IconSizeStruct(width, height, dpi); + + return iconSizeStruct; + } + + public static IconDefinition iconDefinitionStructToIconDefinition(IconDefinitionStruct iconDefinitionStruct) { + IconDefinition iconDefinition = ICON_SET_FACTORY.createIconDefinition(); + + IconInfo iconInfo = iconInfoStructToIconInfo(iconDefinitionStruct.iconInfo); + iconDefinition.setIconInfo(iconInfo); + + IconData iconData = iconDataStructToIconData(iconDefinitionStruct.iconData); + iconDefinition.setIconData(iconData); + + return iconDefinition; + } + + public static IconDefinitionStruct iconDefinitionToIconDefinitionStruct(IconDefinition iconDefinition) { + IconInfoStruct iconInfoStruct = iconInfoToIconInfoStruct(iconDefinition.getIconInfo()); + IconDataStruct iconDataStruct = iconDataToIconDataStruct(iconDefinition.getIconData()); + + IconDefinitionStruct iconDefinitionStruct = new IconDefinitionStruct(iconInfoStruct, iconDataStruct); + + return iconDefinitionStruct; + } + + public static IconData iconDataStructToIconData(IconDataStruct iconDataStruct) { + IconData iconData = ICON_SET_FACTORY.createIconData(); + + iconData.setData(iconDataStruct.data); + + return iconData; + } + + public static IconDataStruct iconDataToIconDataStruct(IconData iconData) { + IconDataStruct iconDataStruct = new IconDataStruct(iconData.getData()); + + return iconDataStruct; + } + + public static IconInfo iconInfoStructToIconInfo(IconInfoStruct iconInfoStruct) { + IconInfo iconInfo = ICON_SET_FACTORY.createIconInfo(); + + iconInfo.setIconSetId(iconInfoStruct.iconSetId); + iconInfo.setIconId(iconInfoStruct.iconId); + + return iconInfo; + } + + public static IconInfoStruct iconInfoToIconInfoStruct(IconInfo iconInfo) { + int iconSetId = iconInfo.getIconSetId(); + int iconId = iconInfo.getIconId(); + + IconInfoStruct iconInfoStruct = new IconInfoStruct(iconSetId, iconId); + + return iconInfoStruct; + } + + public static CategoryDefinition categoryDefinitionStructToCategoryDefinition(CategoryDefinitionStruct categoryDefinitionStruct) { + CategoryDefinition categoryDefinition = TRAFFIC_INCIDENTS_SVC_FACTORY.createCategoryDefinition(); + + List localizedNamesStructs = categoryDefinitionStruct.localizedNames; + LocalizedString[] localizedNames = new LocalizedString[localizedNamesStructs.size()]; + for (int i = 0; i < localizedNamesStructs.size(); i++) { + LocalizedStringStruct localizedStringStruct = localizedNamesStructs.get(i); + LocalizedString localizedString = localizedStringStructToLocalizedString(localizedStringStruct); + localizedNames[i] = localizedString; + } + categoryDefinition.setLocalizedNames(localizedNames); + + categoryDefinition.setCategoryId(categoryDefinitionStruct.categoryId); + List iconStructs = categoryDefinitionStruct.icons; + IconInfo[] icons = new IconInfo[iconStructs.size()]; + for (int i = 0; i < iconStructs.size(); i++) { + IconInfoStruct iconInfoStruct = iconStructs.get(i); + IconInfo iconInfo = iconInfoStructToIconInfo(iconInfoStruct); + icons[i] = iconInfo; + } + categoryDefinition.setIcons(icons); + + categoryDefinition.setExpression(categoryDefinitionStruct.expression); + + return categoryDefinition; + } + + public static CategoryDefinitionStruct categoryDefinitionToCategoryDefinitionStruct(CategoryDefinition categoryDefinition) { + LocalizedString[] localizedNames = categoryDefinition.getLocalizedNames(); + List localizedNameStructs = new ArrayList<>(); + for (int i = 0; i < localizedNames.length; i++) { + LocalizedStringStruct localizedStringStruct = localizedStringToLocalizedStringStruct(localizedNames[i]); + localizedNameStructs.add(localizedStringStruct); + } + + int categoryId = categoryDefinition.getCategoryId(); + + IconInfo[] icons = categoryDefinition.getIcons(); + List iconInfoStructs = new ArrayList<>(); + for (int i = 0; i < icons.length; i++) { + IconInfoStruct iconInfoStruct = iconInfoToIconInfoStruct(icons[i]); + iconInfoStructs.add(iconInfoStruct); + } + + String expression = categoryDefinition.getExpression(); + + CategoryDefinitionStruct categoryDefinitionStruct = new CategoryDefinitionStruct( + localizedNameStructs, categoryId, iconInfoStructs, expression); + + return categoryDefinitionStruct; + } + + public static Coordinate coordinateStructToCoordinate(CoordinateStruct coordinateStruct) { + Coordinate coordinate = COMMON_FACTORY.createCoordinate(); + + coordinate.setLatitude(coordinateStruct.latitude); + coordinate.setLongitude(coordinateStruct.longitude); + coordinate.setAltitude(coordinateStruct.altitude); + + return coordinate; + } + + public static CoordinateStruct coordinateToCoordinateStruct(Coordinate coordinate) { + Double latitude = coordinate.getLatitude(); + Double longitude = coordinate.getLongitude(); + int altitude = coordinate.getAltitude(); + + CoordinateStruct coordinateStruct = new CoordinateStruct( + latitude, longitude, altitude); + + return coordinateStruct; + } + + public static RectangularArea rectangularAreaStructToRectangularArea(RectangularAreaStruct rectangularAreastruct) { + RectangularArea rectangularArea = COMMON_FACTORY.createRectangularArea(); + + Coordinate bottomLeft = coordinateStructToCoordinate(rectangularAreastruct.bottomLeft); + rectangularArea.setBottomLeft(bottomLeft); + + Coordinate topRight = coordinateStructToCoordinate(rectangularAreastruct.topRight); + rectangularArea.setTopRight(topRight); + + return rectangularArea; + } + + public static RectangularAreaStruct rectangularAreaToRectangularAreaStruct(RectangularArea rectangularArea) { + CoordinateStruct bottomLeft = coordinateToCoordinateStruct(rectangularArea.getBottomLeft()); + CoordinateStruct topRight = coordinateToCoordinateStruct(rectangularArea.getTopRight()); + + RectangularAreaStruct rectangularAreaStruct = new RectangularAreaStruct( + bottomLeft, topRight); + + return rectangularAreaStruct; + } + + public static LocalizedString localizedStringStructToLocalizedString(LocalizedStringStruct localizedStringStruct) { + LocalizedString localizedString = COMMON_FACTORY.createLocalizedString(); + + localizedString.setLanguageCode(localizedStringStruct.languageCode); + if (!localizedStringStruct.countryCode.isEmpty()) { + localizedString.setCountryCode(localizedStringStruct.countryCode); + } + localizedString.setString(localizedStringStruct.string); + + return localizedString; + } + + public static LocalizedStringStruct localizedStringToLocalizedStringStruct(LocalizedString localizedString) { + String languageCode = localizedString.getLanguageCode(); + if (languageCode == null) { + throw new IllegalArgumentException("languageCode may not be null"); + } + String countryCode = localizedString.getCountryCode(); + if (countryCode == null) { + countryCode = ""; + } + String string = localizedString.getString(); + if (string == null) { + throw new IllegalArgumentException("string may not be null"); + } + + LocalizedStringStruct localizedStringStruct = new LocalizedStringStruct( + languageCode, countryCode, string); + + return localizedStringStruct; + } + + public static FeedInformation feedInformationStructToFeedInformation(FeedInformationStruct feedInformationStruct) { + FeedInformation feedInformation = TRAFFIC_INCIDENTS_SVC_FACTORY.createFeedInformation(); + + if (!feedInformationStruct.dataProviderName.isEmpty()) { + feedInformation.setDataProviderName(feedInformationStruct.dataProviderName); + } + + if (!feedInformationStruct.protocolName.isEmpty()) { + feedInformation.setProtocolName(feedInformationStruct.protocolName); + } + + if (!feedInformationStruct.communicationChannelName.isEmpty()) { + feedInformation.setCommunicationChannelName(feedInformationStruct.communicationChannelName); + } + + if (feedInformationStruct.feedStatus != 0) { + TrafficIncidentFeedStatus trafficIncidentFeedStatus = TrafficIncidentFeedStatus.get(feedInformationStruct.feedStatus); + feedInformation.setFeedStatus(trafficIncidentFeedStatus); + } + + if (feedInformationStruct.trafficIncidentsStatus != 0) { + TrafficIncidentsStatus trafficIncidentsStatus = TrafficIncidentsStatus.get(feedInformationStruct.trafficIncidentsStatus); + feedInformation.setTrafficIncidentsStatus(trafficIncidentsStatus); + } + + return feedInformation; + } + + public static FeedInformationStruct feedInformationToFeedInformationStruct(FeedInformation feedInformation) { + String dataProviderName = feedInformation.getDataProviderName(); + if (dataProviderName == null) { + dataProviderName = ""; + } + + String protocolName = feedInformation.getProtocolName(); + if (protocolName == null) { + protocolName = ""; + } + + String communicationChannelName = feedInformation.getCommunicationChannelName(); + if (communicationChannelName == null) { + communicationChannelName = ""; + } + + TrafficIncidentFeedStatus feedStatus = feedInformation.getFeedStatus(); + Byte feedStatusId; + if (feedStatus != null) { + feedStatusId = (Byte) (byte) feedStatus.getValue(); + } else { + feedStatusId = 0; + } + + TrafficIncidentsStatus trafficIncidentsStatus = feedInformation.getTrafficIncidentsStatus(); + Byte trafficIncidentsStatusId; + if (trafficIncidentsStatus != null) { + trafficIncidentsStatusId = (Byte) (byte) trafficIncidentsStatus.getValue(); + } else { + trafficIncidentsStatusId = 0; + } + + FeedInformationStruct feedInformationStruct = new FeedInformationStruct( + dataProviderName, protocolName, communicationChannelName, + feedStatusId, trafficIncidentsStatusId); + + return feedInformationStruct; + } + + private static TemporarySpeedLimit temporarySpeedLimitStructToTemporarySpeedLimit(TemporarySpeedLimitStruct temporarySpeedLimitStruct) { + LOGGER.info("temporarySpeedLimitStructToTemporarySpeedLimit() => " + temporarySpeedLimitStruct); + TemporarySpeedLimit temporarySpeedLimit = TRAFFIC_INCIDENT_FACTORY.createTemporarySpeedLimit(); + + temporarySpeedLimit.setUnitsMPH(temporarySpeedLimitStruct.unitsMPH); + + if (temporarySpeedLimitStruct.offset != -1) { + temporarySpeedLimit.setOffset(temporarySpeedLimitStruct.offset); + } + + for (TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct: temporarySpeedLimitStruct.temporarySpeedLimitSections) { + TemporarySpeedLimitSection temporarySpeedLimitSection = temporarySpeedLimitSectionStructToTemporarySpeedLimitSection(temporarySpeedLimitSectionStruct); + temporarySpeedLimit.getTemporarySpeedLimitSections().add(temporarySpeedLimitSection); + } + + for (ApplicabilityStruct applicabilityStruct: temporarySpeedLimitStruct.applicability) { + Applicability applicability = applicabilityStructToApplicability(applicabilityStruct); + temporarySpeedLimit.getApplicability().add(applicability); + } + + LOGGER.info("temporarySpeedLimitStructToTemporarySpeedLimit() <= " + temporarySpeedLimit); + return temporarySpeedLimit; + } + + private static TemporarySpeedLimitStruct temporarySpeedLimitToTemporarySpeedLimitStruct(TemporarySpeedLimit temporarySpeedLimit) { + Boolean unitsMPH = temporarySpeedLimit.isUnitsMPH(); + + Integer offset = -1; + if (temporarySpeedLimit.isSetOffset()) { + offset = temporarySpeedLimit.getOffset(); + } + + EList temporarySpeedLimitSections = temporarySpeedLimit.getTemporarySpeedLimitSections(); + List temporarySpeedLimitSectionStructs = new ArrayList<>(); + for (int i = 0; i < temporarySpeedLimitSections.size(); i++) { + TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct = temporarySpeedLimitSectionToTemporarySpeedLimitSectionStruct(temporarySpeedLimitSections.get(i)); + temporarySpeedLimitSectionStructs.add(temporarySpeedLimitSectionStruct); + } + + EList applicabilities = temporarySpeedLimit.getApplicability(); + List applicabilityStructs = new ArrayList<>(); + for (int i = 0; i < applicabilities.size(); i++) { + ApplicabilityStruct applicabilityStruct = applicabilityToApplicabilityStruct(applicabilities.get(i)); + applicabilityStructs.add(applicabilityStruct); + } + + TemporarySpeedLimitStruct temporarySpeedLimitStruct = new TemporarySpeedLimitStruct( + unitsMPH, + offset, + temporarySpeedLimitSectionStructs, + applicabilityStructs + ); + + return temporarySpeedLimitStruct; + } + + private static TemporarySpeedLimitSection temporarySpeedLimitSectionStructToTemporarySpeedLimitSection(TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct) { + TemporarySpeedLimitSection temporarySpeedLimitSection = TRAFFIC_INCIDENT_FACTORY.createTemporarySpeedLimitSection(); + + if (temporarySpeedLimitSectionStruct.speedLimitValue != -1) { + temporarySpeedLimitSection.setSpeedLimitValue(temporarySpeedLimitSectionStruct.speedLimitValue); + } + + if (temporarySpeedLimitSectionStruct.speedLimitValueWet != -1) { + temporarySpeedLimitSection.setSpeedLimitValueWet(temporarySpeedLimitSectionStruct.speedLimitValueWet); + } + + if (temporarySpeedLimitSectionStruct.speedLimitLength != -1) { + temporarySpeedLimitSection.setSpeedLimitLength(temporarySpeedLimitSectionStruct.speedLimitLength); + } + + return temporarySpeedLimitSection; + } + + private static TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionToTemporarySpeedLimitSectionStruct(TemporarySpeedLimitSection temporarySpeedLimitSection) { + Short speedLimitValue = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitValue()) { + speedLimitValue = temporarySpeedLimitSection.getSpeedLimitValue(); + } + + Short speedLimitValueWet = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitValueWet()) { + speedLimitValueWet = temporarySpeedLimitSection.getSpeedLimitValueWet(); + } + + Integer speedLimitLength = -1; + if (temporarySpeedLimitSection.isSetSpeedLimitLength()) { + speedLimitLength = temporarySpeedLimitSection.getSpeedLimitLength(); + } + + TemporarySpeedLimitSectionStruct temporarySpeedLimitSectionStruct = new TemporarySpeedLimitSectionStruct( + speedLimitValue, + speedLimitValueWet, + speedLimitLength + ); + + return temporarySpeedLimitSectionStruct; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsAdaptor.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsAdaptor.java new file mode 100755 index 0000000..6658291 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsAdaptor.java @@ -0,0 +1,1578 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.freedesktop.dbus.AbstractConnection; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.exceptions.DBusException; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.DefaultTrafficIncidentsListener; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.refimpl.TrafficIncidentsService; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CategoryDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.FeedInformationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconSetStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.RectangularAreaStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentsDBus; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TwoTuple; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +public class TrafficIncidentsAdaptor implements TrafficIncidentsDBus { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentsAdaptor.class.getName()); + + private DBusConnection conn; + private TrafficIncidentsService trafficIncidentsService; + + private List trafficIncidentsStatusListeners = new ArrayList<>(); + private TrafficIncidentsListener trafficIncidentsStatusListener; + private List feedInformationListeners = new ArrayList<>(); + private TrafficIncidentsListener feedInformationListener = null; + private List updatesListeners = new ArrayList<>(); + private List updatesInAreasListeners = new ArrayList<>(); + + private PendingReplyAddAreasUpdateListener pendingReplyAddAreasUpdateListener; + private PendingReply pendingReplyAddCategoryDefinitions; + private PendingReply pendingReplyAddFeedInformationListener; + private PendingReply pendingReplyAddIconDefinitions; + private PendingReply pendingReplyAddIconSetDefinitions; + private PendingReply pendingReplyAddTrafficIncidentsStatusListener; + private PendingReply pendingReplyAddUpdateListener; + private PendingReply pendingReplyFreeCategoryIds; + private PendingReply pendingReplyFreeIconSetIds; + private PendingReplyGetApplicability pendingReplyGetApplicability; + private PendingReplyGetCategoryDefinitions pendingReplyGetCategoryDefinitions; + private PendingReplyGetIconDefinitions pendingReplyGetIconDefinitions; + private PendingReplyGetIconSets pendingReplyGetIconSets; + private PendingReplyGetLanguage pendingReplyGetLanguage; + private PendingReplyGetTexts pendingReplyGetTexts; + private PendingReplyGetTrafficIncidentIds pendingReplyGetTrafficIncidentIds; + private PendingReplyGetTrafficIncidentIdsInAreas pendingReplyGetTrafficIncidentIdsInAreas; + private PendingReplyGetTrafficIncidents pendingReplyGetTrafficIncidents; + private PendingReplyGetTrafficIncidentsFields pendingReplyGetTrafficIncidentsFields; + private PendingReplyGetVersion pendingReplyGetVersion; + private PendingReply pendingReplyRemoveAreasUpdateListener; + private PendingReply pendingReplyRemoveCategoryDefinitions; + private PendingReply pendingReplyRemoveIconDefinitions; + private PendingReply pendingReplyRemoveIconSetDefinitions; + private PendingReply pendingReplyRemoveFeedInformationListener; + private PendingReply pendingReplyRemoveTrafficIncidentsStatusListener; + private PendingReply pendingReplyRemoveUpdateListener; + private PendingReplyReserveCategoryIds pendingReplyReserveCategoryIds; + private PendingReplyReserveIconSetIds pendingReplyReserveIconSetIds; + private PendingReply pendingReplySetApplicability; + private PendingReply pendingReplySetDateFormat; + private PendingReply pendingReplySetLanguage; + private PendingReply pendingReplySetLengthUnit; + private PendingReply pendingReplySetTimeFormat; + private PendingReply pendingReplySetWeightUnit; + + public TrafficIncidentsAdaptor(DBusConnection conn, TrafficIncidentsService trafficIncidentsService) { + this.conn = conn; + this.trafficIncidentsService = trafficIncidentsService; + + LOGGER.setLevel(Level.SEVERE); + } + + @Override + public boolean isRemote() { + return false; + } + + @Override + public VersionStruct GetVersion() { + LOGGER.info("getVersion =>"); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getVersionReply(Version trafficIncidentsVersion) { + LOGGER.info("getVersionReply => trafficIncidentsVersion = " + trafficIncidentsVersion); + pendingReplyGetVersion.setVersion(trafficIncidentsVersion); + pendingReplyGetVersion.setReplyReceived(true); + } + }; + pendingReplyGetVersion = new PendingReplyGetVersion(listener); + + trafficIncidentsService.getVersion(listener); + + while (!pendingReplyGetVersion.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getVersion - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + Version version = pendingReplyGetVersion.getVersion(); + VersionStruct versionStruct = StructUtil.versionToVersionStruct(version); + + LOGGER.info("getVersion <= versionStruct = " + versionStruct); + return versionStruct; + } + + @Override + public TwoTuple GetLanguage() { + LOGGER.info("getLanguage =>"); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + LOGGER.info("getLanguageReply => languageCode = " + languageCode + ", countryCode = " + countryCode); + pendingReplyGetLanguage.setLanguageCode(languageCode); + pendingReplyGetLanguage.setCountryCode(countryCode); + pendingReplyGetLanguage.setReplyReceived(true); + } + }; + pendingReplyGetLanguage = new PendingReplyGetLanguage(listener); + + trafficIncidentsService.getLanguage(listener); + + while (!pendingReplyGetLanguage.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getLanguage - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + String countryCode = pendingReplyGetLanguage.getCountryCode(); + if (countryCode == null) { + countryCode = ""; + } + TwoTuple language = new TwoTuple<>( + pendingReplyGetLanguage.getLanguageCode(), + countryCode); + LOGGER.info("getLanguage <= language = " + language.a + ", " + language.b); + return language; + } + + @Override + public void SetLanguage(String languageCode, String countryCode) { + LOGGER.info("setLanguage => languageCode = " + languageCode + ", countryCode = " + countryCode); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setLanguageReply() { + LOGGER.info("setLanguageReply =>"); + pendingReplySetLanguage.setReplyReceived(true); + } + }; + pendingReplySetLanguage = new PendingReply(listener); + + if (languageCode.isEmpty()) { + languageCode = null; + } + if (countryCode.isEmpty()) { + countryCode = null; + } + + trafficIncidentsService.setLanguage(listener, languageCode, countryCode); + + while (!pendingReplySetLanguage.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setLanguage - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setLanguage <="); + } + + @Override + public void SetTimeFormat(String timeFormat) { + LOGGER.info("setTimeFormat => timeFormat = " + timeFormat); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setTimeFormatReply() { + LOGGER.info("setTimeFormatReply =>"); + pendingReplySetTimeFormat.setReplyReceived(true); + } + }; + pendingReplySetTimeFormat = new PendingReply(listener); + + trafficIncidentsService.setTimeFormat(listener, timeFormat); + + while (!pendingReplySetTimeFormat.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setTimeFormat - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setTimeFormat <="); + } + + @Override + public void SetDateFormat(String dateFormat) { + LOGGER.info("setDateFormat => dateFormat = " + dateFormat); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setDateFormatReply() { + LOGGER.info("setDateFormatReply =>"); + pendingReplySetDateFormat.setReplyReceived(true); + } + }; + pendingReplySetDateFormat = new PendingReply(listener); + + trafficIncidentsService.setDateFormat(listener, dateFormat); + + while (!pendingReplySetDateFormat.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setDateFormat - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setDateFormat <="); + } + + @Override + public void SetLengthUnit(Byte lengthUnitId) { + LOGGER.info("setLengthUnit => lengthUnitId = " + lengthUnitId); + LengthUnit lengthUnit = LengthUnit.get(lengthUnitId); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setLengthUnitReply() { + LOGGER.info("setLengthUnitReply =>"); + pendingReplySetLengthUnit.setReplyReceived(true); + } + }; + pendingReplySetLengthUnit = new PendingReply(listener); + + trafficIncidentsService.setLengthUnit(listener, lengthUnit); + + while (!pendingReplySetLengthUnit.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setLengthUnit - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setLengthUnit <="); + } + + @Override + public void SetWeightUnit(Byte weightUnitId) { + LOGGER.info("setWeightUnit => weightUnitId = " + weightUnitId); + WeightUnit weightUnit = WeightUnit.get(weightUnitId); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setWeightUnitReply() { + LOGGER.info("setWeightUnitReply =>"); + pendingReplySetWeightUnit.setReplyReceived(true); + } + }; + pendingReplySetWeightUnit = new PendingReply(listener); + + trafficIncidentsService.setWeightUnit(listener, weightUnit); + + while (!pendingReplySetWeightUnit.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setWeightUnit - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setWeightUnit <="); + } + + @Override + public String GetApplicability() { + LOGGER.info("getApplicability =>"); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getApplicabilityReply(String filterExpression) { + LOGGER.info("getApplicabilityReply => filterExpression = " + filterExpression); + pendingReplyGetApplicability.setFilterExpression(filterExpression); + pendingReplyGetApplicability.setReplyReceived(true); + } + }; + pendingReplyGetApplicability = new PendingReplyGetApplicability(listener); + + trafficIncidentsService.getApplicability(listener); + + while (!pendingReplyGetApplicability.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getApplicability - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + String filterExpression = pendingReplyGetApplicability.getFilterExpression(); + LOGGER.info("getApplicability <= filterExpression = " + filterExpression); + return filterExpression; + } + + @Override + public void SetApplicability(String expression) { + LOGGER.info("setApplicability => expression = " + expression); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void setApplicabilityReply() { + LOGGER.info("setApplicabilityReply =>"); + pendingReplySetApplicability.setReplyReceived(true); + } + }; + pendingReplySetApplicability = new PendingReply(listener); + + trafficIncidentsService.setApplicability(listener, expression); + + while (!pendingReplySetApplicability.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("setApplicability - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("setApplicability <="); + } + + @Override + public List ReserveIconSetIds(Integer numberOfIds) { + LOGGER.info("reserveIconSetIds => numberOfIds = " + numberOfIds); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void reserveIconSetIdsReply(EList iconSetIds) { + LOGGER.info("reserveIconSetIdsReply => iconSetIds = " + iconSetIds); + pendingReplyReserveIconSetIds.setIconSetIds(iconSetIds); + pendingReplyReserveIconSetIds.setReplyReceived(true); + } + }; + pendingReplyReserveIconSetIds = new PendingReplyReserveIconSetIds(listener); + + trafficIncidentsService.reserveIconSetIds(listener, numberOfIds); + + while (!pendingReplyReserveIconSetIds.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("reserveIconSetIds - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List iconSetIds = pendingReplyReserveIconSetIds.getIconSetIds(); + LOGGER.info("reserveIconSetIds <= iconSetIds = " + iconSetIds); + return iconSetIds; + } + + @Override + public void FreeIconSetIds(List iconSetIds) { + LOGGER.info("freeIconSetIds => iconSetIds = " + iconSetIds); + + EList eListIconSetIds = new BasicEList<>(iconSetIds); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void freeIconSetIdsReply() { + LOGGER.info("freeIconSetIdsReply =>"); + pendingReplyFreeIconSetIds.setReplyReceived(true); + } + }; + pendingReplyFreeIconSetIds = new PendingReply(listener); + + trafficIncidentsService.freeIconSetIds(listener, eListIconSetIds); + + while (!pendingReplyFreeIconSetIds.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("freeIconSetIds - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("freeIconSetIds <="); + } + + @Override + public List GetIconSets() { + LOGGER.info("getIconSets =>"); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getIconSetsReply(EList iconSets) { + LOGGER.info("getIconSetsReply => iconSets = " + iconSets); + pendingReplyGetIconSets.setIconSets(iconSets); + pendingReplyGetIconSets.setReplyReceived(true); + } + }; + pendingReplyGetIconSets = new PendingReplyGetIconSets(listener); + + trafficIncidentsService.getIconSets(listener); + + while (!pendingReplyGetIconSets.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getIconSets - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List iconSetStructs = new ArrayList<>(); + for (IconSet iconSet: pendingReplyGetIconSets.getIconSets()) { + IconSetStruct iconSetStruct = StructUtil.iconSetToIconSetStruct(iconSet); + iconSetStructs.add(iconSetStruct); + } + LOGGER.info("getIconSets <= iconSetStructs = " + iconSetStructs); + return iconSetStructs; + } + + @Override + public void AddIconSetDefinitions(List iconSetStructs) { + LOGGER.info("addIconSetDefinitions => iconSetStructs = " + iconSetStructs); + + EList iconSets = new BasicEList<>(); + for (IconSetStruct iconSetStruct: iconSetStructs) { + IconSet iconSet = StructUtil.iconSetStructToIconSet(iconSetStruct); + iconSets.add(iconSet); + } + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addIconSetDefinitionsReply() { + LOGGER.info("addIconSetDefinitionsReply =>"); + pendingReplyAddIconSetDefinitions.setReplyReceived(true); + } + }; + pendingReplyAddIconSetDefinitions = new PendingReply(listener); + + trafficIncidentsService.addIconSetDefinitions(listener, iconSets); + + while (!pendingReplyAddIconSetDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addIconSetDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("addIconSetDefinitions <="); + } + + @Override + public void RemoveIconSetDefinitions(List iconSetIds) { + LOGGER.info("removeIconSetDefinitions => iconSetIds = " + iconSetIds); + + EList eListIconSetIds = new BasicEList<>(iconSetIds); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeIconSetDefinitionsReply() { + LOGGER.info("removeIconSetDefinitionsReply =>"); + pendingReplyRemoveIconSetDefinitions.setReplyReceived(true); + } + }; + pendingReplyRemoveIconSetDefinitions = new PendingReply(listener); + + trafficIncidentsService.removeIconSetDefinitions(listener, eListIconSetIds); + + while (!pendingReplyRemoveIconSetDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeIconSetDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("removeIconSetDefinitions <="); + } + + @Override + public List GetIconDefinitions(List iconInfoStructs) { + LOGGER.info("getIconDefinitions => iconInfoStructs = " + iconInfoStructs); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getIconDefinitionsReply(EList iconDefinitions) { + LOGGER.info("getIconDefinitionsReply => iconDefinitions = " + iconDefinitions); + pendingReplyGetIconDefinitions.setIconDefinitions(iconDefinitions); + pendingReplyGetIconDefinitions.setReplyReceived(true); + } + }; + pendingReplyGetIconDefinitions = new PendingReplyGetIconDefinitions(listener); + + EList iconInfos = new BasicEList<>(); + if (!(iconInfoStructs.size() == 1 && iconInfoStructs.get(0).iconId == -1 && iconInfoStructs.get(0).iconSetId == -1)) { + for (IconInfoStruct iconInfoStruct: iconInfoStructs) { + IconInfo iconInfo = StructUtil.iconInfoStructToIconInfo(iconInfoStruct); + iconInfos.add(iconInfo); + } + } + trafficIncidentsService.getIconDefinitions(listener, iconInfos); + + while (!pendingReplyGetIconDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getIconDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List iconDefinitionStructs = new ArrayList<>(); + for (IconDefinition iconDefinition: pendingReplyGetIconDefinitions.getIconDefinitions()) { + IconDefinitionStruct iconDefinitionStruct = StructUtil.iconDefinitionToIconDefinitionStruct(iconDefinition); + iconDefinitionStructs.add(iconDefinitionStruct); + } + LOGGER.info("getIconDefinitions <= iconDefinitionStructs = " + iconDefinitionStructs); + return iconDefinitionStructs; + } + + @Override + public void AddIconDefinitions(List iconDefinitionStructs) { + LOGGER.info("addIconDefinitions => iconDefinitionStructs = " + iconDefinitionStructs); + + EList iconDefinitions = new BasicEList<>(); + for (IconDefinitionStruct iconDefinitionStruct: iconDefinitionStructs) { + IconDefinition iconDefinition = StructUtil.iconDefinitionStructToIconDefinition(iconDefinitionStruct); + iconDefinitions.add(iconDefinition); + } + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addIconDefinitionsReply() { + LOGGER.info("addIconDefinitionsReply =>"); + pendingReplyAddIconDefinitions.setReplyReceived(true); + } + }; + pendingReplyAddIconDefinitions = new PendingReply(listener); + + trafficIncidentsService.addIconDefinitions(listener, iconDefinitions); + + while (!pendingReplyAddIconDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addIconDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("addIconDefinitions <="); + } + + @Override + public void RemoveIconDefinitions(List iconInfoStructs) { + LOGGER.info("removeIconDefinitions => iconInfoStructs = " + iconInfoStructs); + + EList iconInfos = new BasicEList<>(); + for (IconInfoStruct iconInfoStruct: iconInfoStructs) { + IconInfo iconInfo = StructUtil.iconInfoStructToIconInfo(iconInfoStruct); + iconInfos.add(iconInfo); + } + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeIconDefinitionsReply() { + LOGGER.info("removeIconDefinitionsReply =>"); + pendingReplyRemoveIconDefinitions.setReplyReceived(true); + } + }; + pendingReplyRemoveIconDefinitions = new PendingReply(listener); + + trafficIncidentsService.removeIconDefinitions(listener, iconInfos); + + while (!pendingReplyRemoveIconDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeIconDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("removeIconDefinitions <="); + } + + @Override + public List ReserveCategoryIds(Integer numberOfIds) { + LOGGER.info("reserveCategoryIds => numberOfIds = " + numberOfIds); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void reserveCategoryIdsReply(EList categoryIds) { + LOGGER.info("reserveCategoryIdsReply => categoryIds = " + categoryIds); + pendingReplyReserveCategoryIds.setCategoryIds(categoryIds); + pendingReplyReserveCategoryIds.setReplyReceived(true); + } + }; + pendingReplyReserveCategoryIds = new PendingReplyReserveCategoryIds(listener); + + trafficIncidentsService.reserveCategoryIds(listener, numberOfIds); + + while (!pendingReplyReserveCategoryIds.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("reserveCategoryIds - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List categoryIds = pendingReplyReserveCategoryIds.getCategoryIds(); + LOGGER.info("reserveCategoryIds <= categoryIds = " + categoryIds); + return categoryIds; + } + + @Override + public void FreeCategoryIds(List categoryIds) { + LOGGER.info("freeCategoryIds => categoryIds = " + categoryIds); + + EList eListCategoryIds = new BasicEList<>(categoryIds); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void freeCategoryIdsReply() { + LOGGER.info("freeCategoryIdsReply =>"); + pendingReplyFreeCategoryIds.setReplyReceived(true); + } + }; + pendingReplyFreeCategoryIds = new PendingReply(listener); + + trafficIncidentsService.freeCategoryIds(listener, eListCategoryIds); + + while (!pendingReplyFreeCategoryIds.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("freeCategoryIds - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("freeCategoryIds <="); + } + + @Override + public List GetCategoryDefinitions() { + LOGGER.info("getCategoryDefinitions =>"); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getCategoryDefinitionsReply(EList categoryDefinitions) { + LOGGER.info("getCategoryDefinitionsReply => categoryDefinitions = " + categoryDefinitions); + pendingReplyGetCategoryDefinitions.setCategoryDefinitions(categoryDefinitions); + pendingReplyGetCategoryDefinitions.setReplyReceived(true); + } + }; + pendingReplyGetCategoryDefinitions = new PendingReplyGetCategoryDefinitions(listener); + + trafficIncidentsService.getCategoryDefinitions(listener); + + while (!pendingReplyGetCategoryDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getCategoryDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List categoryDefinitionStructs = new ArrayList<>(); + for (CategoryDefinition categoryDefinition: pendingReplyGetCategoryDefinitions.getCategoryDefinitions()) { + CategoryDefinitionStruct categoryDefinitionStruct = StructUtil.categoryDefinitionToCategoryDefinitionStruct(categoryDefinition); + categoryDefinitionStructs.add(categoryDefinitionStruct); + } + LOGGER.info("getCategoryDefinitions <= categoryDefinitionStructs = " + categoryDefinitionStructs); + return categoryDefinitionStructs; + } + + @Override + public void AddCategoryDefinitions(List categoryDefinitionStructs) { + LOGGER.info("addCategoryDefinitions => categoryDefinitionStructs = " + categoryDefinitionStructs); + + EList categoryDefinitions = new BasicEList<>(); + for (CategoryDefinitionStruct categoryDefinitionStruct: categoryDefinitionStructs) { + CategoryDefinition categoryDefinition = StructUtil.categoryDefinitionStructToCategoryDefinition(categoryDefinitionStruct); + categoryDefinitions.add(categoryDefinition); + } + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addCategoryDefinitionsReply() { + LOGGER.info("addCategoryDefinitionsReply =>"); + pendingReplyAddCategoryDefinitions.setReplyReceived(true); + } + }; + pendingReplyAddCategoryDefinitions = new PendingReply(listener); + + trafficIncidentsService.addCategoryDefinitions(listener, categoryDefinitions); + + while (!pendingReplyAddCategoryDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addCategoryDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("addCategoryDefinitions <="); + } + + @Override + public void RemoveCategoryDefinitions(List categoryIds) { + LOGGER.info("removeCategoryDefinitions => categoryIds = " + categoryIds); + + EList eListCategoryIds = new BasicEList<>(categoryIds); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeCategoryDefinitionsReply() { + LOGGER.info("removeCategoryDefinitionsReply =>"); + pendingReplyRemoveCategoryDefinitions.setReplyReceived(true); + } + }; + pendingReplyRemoveCategoryDefinitions = new PendingReply(listener); + + trafficIncidentsService.removeCategoryDefinitions(listener, eListCategoryIds); + + while (!pendingReplyRemoveCategoryDefinitions.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeCategoryDefinitions - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("removeCategoryDefinitions <="); + } + + @Override + public synchronized List GetTrafficIncidentIds(List warningLevelIds, List categoryIds) { + LOGGER.info("getTrafficIncidentIds => warningLevelIds = " + warningLevelIds + ", categoryIds = " + categoryIds); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getTrafficIncidentIdsReply(EList incidentIds) { + LOGGER.info("getTrafficIncidentIdsReply => incidentIds = " + incidentIds); + pendingReplyGetTrafficIncidentIds.setIncidentIds(incidentIds); + pendingReplyGetTrafficIncidentIds.setReplyReceived(true); + } + }; + pendingReplyGetTrafficIncidentIds = new PendingReplyGetTrafficIncidentIds(listener); + + EList warningLevels = new BasicEList<>(); + for (Byte warningLevelId: warningLevelIds) { + warningLevels.add(WarningLevel.get(warningLevelId)); + } + EList eListCategoryIds = new BasicEList<>(categoryIds); + trafficIncidentsService.getTrafficIncidentIds(listener, warningLevels, eListCategoryIds); + + while (!pendingReplyGetTrafficIncidentIds.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getTrafficIncidentIds - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List incidentIds = pendingReplyGetTrafficIncidentIds.getIncidentIds(); + + LOGGER.info("getTrafficIncidentIds <= incidentIds = " + incidentIds); + return incidentIds; + } + + @Override + public synchronized List GetTrafficIncidentIdsInAreas(List warningLevelIds, List categoryIds, List areaStructs) { + LOGGER.info("getTrafficIncidentIdsInAreas => warningLevelIds = " + warningLevelIds + ", categoryIds = " + categoryIds + ", areaStructs = " + areaStructs); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getTrafficIncidentIdsReply(EList incidentIds) { + LOGGER.info("getTrafficIncidentIdsReply => incidentIds = " + incidentIds); + pendingReplyGetTrafficIncidentIdsInAreas.setIncidentIds(incidentIds); + pendingReplyGetTrafficIncidentIdsInAreas.setReplyReceived(true); + } + }; + pendingReplyGetTrafficIncidentIdsInAreas = new PendingReplyGetTrafficIncidentIdsInAreas(listener); + + EList warningLevels = new BasicEList<>(); + for (Byte warningLevelId: warningLevelIds) { + warningLevels.add(WarningLevel.get(warningLevelId)); + } + EList areas = new BasicEList<>(); + for (RectangularAreaStruct rectangularAreaStruct: areaStructs) { + RectangularArea rectangularArea = StructUtil.rectangularAreaStructToRectangularArea(rectangularAreaStruct); + areas.add(rectangularArea); + } + EList eListCategoryIds = new BasicEList<>(categoryIds); + trafficIncidentsService.getTrafficIncidentIdsInAreas(listener, warningLevels, eListCategoryIds, areas); + + while (!pendingReplyGetTrafficIncidentIdsInAreas.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getTrafficIncidentIdsInAreas - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List incidentIds = pendingReplyGetTrafficIncidentIdsInAreas.getIncidentIds(); + + LOGGER.info("getTrafficIncidentIdsInAreas <= incidentIds = " + incidentIds); + return incidentIds; + } + + @Override + public synchronized List GetTrafficIncidents(List trafficIncidentIds, boolean includeTextFields) { + LOGGER.info("getTrafficIncidents => trafficIncidentIds = " + trafficIncidentIds + ", includeTextFields = " + includeTextFields); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getTrafficIncidentsReply(EList trafficIncidents) { + LOGGER.info("getTrafficIncidentsReply => trafficIncidents = " + trafficIncidents); + pendingReplyGetTrafficIncidents.setTrafficIncidents(trafficIncidents); + pendingReplyGetTrafficIncidents.setReplyReceived(true); + } + }; + pendingReplyGetTrafficIncidents = new PendingReplyGetTrafficIncidents(listener); + + EList eListTrafficIncidentIds = new BasicEList<>(trafficIncidentIds); + trafficIncidentsService.getTrafficIncidents(listener, eListTrafficIncidentIds, includeTextFields); + + while (!pendingReplyGetTrafficIncidents.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getTrafficIncidents - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + EList trafficIncidents = pendingReplyGetTrafficIncidents.getTrafficIncidents(); + List trafficIncidentStructs = new ArrayList<>(); + for (TrafficIncident trafficIncident: trafficIncidents) { + TrafficIncidentStruct trafficIncidentStruct = StructUtil.trafficIncidentToTrafficIncidentStruct(trafficIncident); + trafficIncidentStructs.add(trafficIncidentStruct); + } + + LOGGER.info("getTrafficIncidents <= trafficIncidentStructs = " + trafficIncidentStructs); + return trafficIncidentStructs; + } + + @Override + public synchronized List GetTrafficIncidentsFields(List trafficIncidentIds, List trafficIncidentFieldIds) { + LOGGER.info("getTrafficIncidentsFields => trafficIncidentIds = " + trafficIncidentIds + ", trafficIncidentFieldIds = " + trafficIncidentFieldIds); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getTrafficIncidentsReply(EList trafficIncidents) { + LOGGER.info("getTrafficIncidentsFieldsReply => trafficIncidents = " + trafficIncidents); + pendingReplyGetTrafficIncidentsFields.setTrafficIncidents(trafficIncidents); + pendingReplyGetTrafficIncidentsFields.setReplyReceived(true); + } + }; + LOGGER.info("listner = " + listener); + pendingReplyGetTrafficIncidentsFields = new PendingReplyGetTrafficIncidentsFields(listener); + + EList trafficIncidentFields = new BasicEList<>(); + for (Byte trafficIncidentFieldId: trafficIncidentFieldIds) { + trafficIncidentFields.add(TrafficIncidentField.get(trafficIncidentFieldId)); + } + EList eListTrafficIncidentIds = new BasicEList<>(trafficIncidentIds); + trafficIncidentsService.getTrafficIncidentsFields(listener, eListTrafficIncidentIds, trafficIncidentFields); + + while (!pendingReplyGetTrafficIncidentsFields.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getTrafficIncidentsFields - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + EList trafficIncidents = pendingReplyGetTrafficIncidentsFields.getTrafficIncidents(); + List trafficIncidentStructs = new ArrayList<>(); + for (TrafficIncident trafficIncident: trafficIncidents) { + TrafficIncidentStruct trafficIncidentStruct = StructUtil.trafficIncidentToTrafficIncidentStruct(trafficIncident); + trafficIncidentStructs.add(trafficIncidentStruct); + } + + LOGGER.info("getTrafficIncidentsFields <= trafficIncidentStructs = " + trafficIncidentStructs); + return trafficIncidentStructs; + } + + @Override + public synchronized List GetTexts(List trafficIncidentIds, Byte textDetailLevelId) { + LOGGER.info("getTexts => trafficIncidentIds = " + trafficIncidentIds + ", textDetailLevelId = " + textDetailLevelId); + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void getTextsReply(EList texts) { + LOGGER.info("getTextsReply => texts = " + texts); + pendingReplyGetTexts.setTexts(texts); + pendingReplyGetTexts.setReplyReceived(true); + } + }; + pendingReplyGetTexts = new PendingReplyGetTexts(listener); + + TextDetailLevel textDetailLevel = TextDetailLevel.get(textDetailLevelId); + EList eListTrafficIncidentIds = new BasicEList<>(trafficIncidentIds); + trafficIncidentsService.getTexts(listener, eListTrafficIncidentIds, textDetailLevel); + + while (!pendingReplyGetTexts.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("getTexts - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + List texts = pendingReplyGetTexts.getTexts(); + LOGGER.info("getTexts <= texts = " + texts); + return texts; + } + + @Override + public void AddTrafficIncidentsStatusListener() { + LOGGER.info("addTrafficIncidentsStatusListener =>"); + + String sender = AbstractConnection.currentSender; + if (!trafficIncidentsStatusListeners.contains(sender)) { + trafficIncidentsStatusListeners.add(sender); + } + + if (trafficIncidentsStatusListener == null) { + trafficIncidentsStatusListener = new DefaultTrafficIncidentsListener() { + + @Override + public void trafficIncidentsStatus( + TrafficIncidentFeedStatus trafficIncidentFeedStatus, + org.genivi.trafficincidentsservice.TrafficIncidentsStatus trafficIncidentsStatus) { + LOGGER.info("trafficIncidentsStatus() called."); + sendSignalTrafficIncidentsStatus(trafficIncidentFeedStatus, trafficIncidentsStatus); + } + }; + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addTrafficIncidentsStatusListenerReply() { + LOGGER.info("addTrafficIncidentsStatusListenerReply =>"); + pendingReplyAddTrafficIncidentsStatusListener.setReplyReceived(true); + } + }; + pendingReplyAddTrafficIncidentsStatusListener = new PendingReply(listener); + + trafficIncidentsService.addTrafficIncidentsStatusListener(listener, trafficIncidentsStatusListener); + + while (!pendingReplyAddTrafficIncidentsStatusListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addTrafficIncidentsStatusListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("addTrafficIncidentsStatusListener <="); + } + + @Override + public void RemoveTrafficIncidentsStatusListener() { + LOGGER.info("removeTrafficIncidentsStatusListener =>"); + + String sender = AbstractConnection.currentSender; + trafficIncidentsStatusListeners.remove(sender); + + if (trafficIncidentsStatusListeners.isEmpty()) { + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeTrafficIncidentsStatusListenerReply() { + LOGGER.info("removeTrafficIncidentsStatusListenerReply =>"); + trafficIncidentsStatusListener = null; + pendingReplyRemoveTrafficIncidentsStatusListener.setReplyReceived(true); + } + }; + pendingReplyRemoveTrafficIncidentsStatusListener = new PendingReply(listener); + + trafficIncidentsService.removeTrafficIncidentsStatusListener(listener, trafficIncidentsStatusListener); + + while (!pendingReplyRemoveTrafficIncidentsStatusListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeTrafficIncidentsStatusListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("removeTrafficIncidentsStatusListener <="); + } + + @Override + public void AddFeedInformationListener() { + LOGGER.info("addFeedInformationListener =>"); + + String sender = AbstractConnection.currentSender; + if (!feedInformationListeners.contains(sender)) { + feedInformationListeners.add(sender); + } + + if (feedInformationListener == null) { + feedInformationListener = new DefaultTrafficIncidentsListener() { + + @Override + public void feedInformation(EList feedsInformation) { + LOGGER.info("feedInformation() called."); + sendSignalFeedInformation(feedsInformation); + } + }; + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addFeedInformationListenerReply() { + LOGGER.info("addFeedInformationListenerReply =>"); + pendingReplyAddFeedInformationListener.setReplyReceived(true); + } + }; + pendingReplyAddFeedInformationListener = new PendingReply(listener); + + trafficIncidentsService.addFeedInformationListener(listener, feedInformationListener); + + while (!pendingReplyAddFeedInformationListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addFeedInformationListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("addFeedInformationListener <="); + } + + @Override + public void RemoveFeedInformationListener() { + LOGGER.info("removeFeedInformationListener =>"); + + String sender = AbstractConnection.currentSender; + feedInformationListeners.remove(sender); + + if (feedInformationListeners.isEmpty()) { + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeFeedInformationListenerReply() { + LOGGER.info("removeFeedInformationListenerReply =>"); + feedInformationListener = null; + pendingReplyRemoveFeedInformationListener.setReplyReceived(true); + } + }; + pendingReplyRemoveFeedInformationListener = new PendingReply(listener); + + trafficIncidentsService.removeFeedInformationListener(listener, feedInformationListener); + + while (!pendingReplyRemoveFeedInformationListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeFeedInformationListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + } + + LOGGER.info("removeFeedInformationListener <="); + } + + @Override + public void AddUpdateListener(Integer listenerId, List warningLevelIds, List categoryIds) { + LOGGER.info("addUpdateListener => listenerId = " + listenerId + + ", warningLevelIds = " + warningLevelIds + ", categoryIds = " + categoryIds); + String sender = AbstractConnection.currentSender; + LOGGER.info(">>> Sender = " + sender); + + // Listener for the addUpdateListenerReply + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addUpdateListenerReply() { + LOGGER.info("addUpdateListenerReply =>"); + pendingReplyAddUpdateListener.setReplyReceived(true); + } + + }; + pendingReplyAddUpdateListener = new PendingReply(listener); + + EList warningLevels = new BasicEList<>(); + for (Byte warningLevelId: warningLevelIds) { + warningLevels.add(WarningLevel.get(warningLevelId)); + } + EList eListCategoryIds = new BasicEList<>(categoryIds); + + // listener proxy to forward the update to the remote client. + TrafficIncidentsListenerProxy trafficIncidentsListenerProxy = new TrafficIncidentsListenerProxy(sender, listenerId); + updatesListeners.add(trafficIncidentsListenerProxy); + trafficIncidentsService.addUpdateListener(listener, warningLevels, eListCategoryIds, trafficIncidentsListenerProxy); + + while (!pendingReplyAddUpdateListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addUpdateListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("addUpdateListener <="); + } + + @Override + public void RemoveUpdateListener(Integer listenerId) { + LOGGER.info("removeUpdateListener => listenerId = " + listenerId); + String sender = AbstractConnection.currentSender; + LOGGER.info(">>> Sender = " + sender); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeUpdateListenerReply() { + LOGGER.info("removeUpdateListenerReply =>"); + pendingReplyRemoveUpdateListener.setReplyReceived(true); + } + + }; + pendingReplyRemoveUpdateListener = new PendingReply(listener); + + TrafficIncidentsListener trafficIncidentsListener = null; + for (TrafficIncidentsListenerProxy trafficIncidentsListenerProxy: updatesListeners) { + if (trafficIncidentsListenerProxy.getDestination().equals(sender) && + trafficIncidentsListenerProxy.getListenerId() == listenerId) { + trafficIncidentsListener = trafficIncidentsListenerProxy; + } + } + updatesListeners.remove(trafficIncidentsListener); + + trafficIncidentsService.removeUpdateListener(listener, trafficIncidentsListener); + + while (!pendingReplyRemoveUpdateListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeUpdateListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("removeUpdateListener <="); + } + + @Override + public void AddAreasUpdateListener(Integer listenerId, List warningLevelIds, List categoryIds, List areaStructs) { + LOGGER.info("addAreasUpdateListener => listenerId = " + listenerId + ", warningLevelIds = " + warningLevelIds + + ", categoryIds = " + categoryIds + ", areaStructs = " + areaStructs); + String sender = AbstractConnection.currentSender; + LOGGER.info(">>> Sender = " + sender); + + // Listener for the addAreasUpdateListenerReply + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void addAreasUpdateListenerReply() { + LOGGER.info("addAreasUpdateListenerReply =>"); + pendingReplyAddAreasUpdateListener.setReplyReceived(true); + } + }; + pendingReplyAddAreasUpdateListener = new PendingReplyAddAreasUpdateListener(listener); + + EList warningLevels = new BasicEList<>(); + for (Byte warningLevelId: warningLevelIds) { + warningLevels.add(WarningLevel.get(warningLevelId)); + } + EList areas = new BasicEList<>(); + for (RectangularAreaStruct rectangularAreaStruct: areaStructs) { + RectangularArea rectangularArea = StructUtil.rectangularAreaStructToRectangularArea(rectangularAreaStruct); + areas.add(rectangularArea); + } + EList eListCategoryIds = new BasicEList<>(categoryIds); + + + // listener proxy to forward the update to the remote client. + TrafficIncidentsListenerProxy trafficIncidentsListenerProxy = new TrafficIncidentsListenerProxy(sender, listenerId); + updatesInAreasListeners.add(trafficIncidentsListenerProxy); + trafficIncidentsService.addAreasUpdateListener(listener, warningLevels, eListCategoryIds, areas, trafficIncidentsListenerProxy); + + while (!pendingReplyAddAreasUpdateListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("addAreasUpdateListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("addAreasUpdateListener <="); + } + + @Override + public void RemoveAreasUpdateListener(Integer listenerId) { + LOGGER.info("removeAreasUpdateListener => listenerId = " + listenerId); + String sender = AbstractConnection.currentSender; + LOGGER.info(">>> Sender = " + sender); + + TrafficIncidentsListener listener = new DefaultTrafficIncidentsListener() { + + @Override + public void removeAreasUpdateListenerReply() { + LOGGER.info("removeAreasUpdateListenerReply =>"); + pendingReplyRemoveAreasUpdateListener.setReplyReceived(true); + } + + }; + pendingReplyRemoveAreasUpdateListener = new PendingReply(listener); + + TrafficIncidentsListener trafficIncidentsListener = null; + for (TrafficIncidentsListenerProxy trafficIncidentsListenerProxy: updatesInAreasListeners) { + if (trafficIncidentsListenerProxy.getDestination().equals(sender) && + trafficIncidentsListenerProxy.getListenerId() == listenerId) { + trafficIncidentsListener = trafficIncidentsListenerProxy; + } + } + updatesInAreasListeners.remove(trafficIncidentsListener); + + trafficIncidentsService.removeAreasUpdateListener(listener, trafficIncidentsListener); + + while (!pendingReplyRemoveAreasUpdateListener.isReplyReceived()) { + try { + Thread.sleep(10); + LOGGER.info("removeAreasUpdateListener - Waiting for reply ..."); + } catch (InterruptedException e) { + } + } + + LOGGER.info("removeAreasUpdateListener <="); + } + + public void sendSignalTrafficIncidentsStatus(TrafficIncidentFeedStatus trafficIncidentFeedStatus, org.genivi.trafficincidentsservice.TrafficIncidentsStatus trafficIncidentsStatus) { + Byte trafficIncidentFeedStatusId = 0; + if (trafficIncidentFeedStatus != null) { + trafficIncidentFeedStatusId = (Byte) (byte) trafficIncidentFeedStatus.getValue(); + } + + Byte trafficIncidentsStatusId = 0; + if (trafficIncidentsStatus != null) { + trafficIncidentsStatusId = (Byte) (byte) trafficIncidentsStatus.getValue(); + } + + LOGGER.info("going to send TrafficIncidentsStatus signal"); + + try { + conn.sendSignal(new TrafficIncidentsDBus.TrafficIncidentsStatus("/java", trafficIncidentFeedStatusId, trafficIncidentsStatusId)); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + public void sendSignalFeedInformation(EList feedsInformation) { + List feedsInformationStructs = new ArrayList<>(); + for (org.genivi.trafficincidentsservice.FeedInformation feedInformation: feedsInformation) { + FeedInformationStruct feedInformationStruct = StructUtil.feedInformationToFeedInformationStruct(feedInformation); + feedsInformationStructs.add(feedInformationStruct); + } + + LOGGER.info("going to send FeedInformation signal"); + + try { + conn.sendSignal(new TrafficIncidentsDBus.FeedInformation("/java", feedsInformationStructs)); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + public class PendingReply { + private boolean replyReceived = false; + private TrafficIncidentsListener listener; + + public PendingReply(TrafficIncidentsListener listener) { + this.listener = listener; + } + + public boolean isReplyReceived() { + return replyReceived; + } + + public void setReplyReceived(boolean replyReceived) { + this.replyReceived = replyReceived; + } + + public TrafficIncidentsListener getListener() { + return listener; + } + } + + class PendingReplyGetVersion extends PendingReply { + private Version version; + + public PendingReplyGetVersion(TrafficIncidentsListener listener) { + super(listener); + } + + public Version getVersion() { + return version; + } + + public void setVersion(Version version) { + this.version = version; + } + } + + class PendingReplyGetTrafficIncidentIds extends PendingReply { + private EList incidentIds; + + public PendingReplyGetTrafficIncidentIds(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getIncidentIds() { + return incidentIds; + } + + public void setIncidentIds(EList incidentIds) { + this.incidentIds = incidentIds; + } + } + + class PendingReplyGetTrafficIncidentIdsInAreas extends PendingReply { + private EList incidentIds; + + public PendingReplyGetTrafficIncidentIdsInAreas(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getIncidentIds() { + return incidentIds; + } + + public void setIncidentIds(EList incidentIds) { + this.incidentIds = incidentIds; + } + } + + class PendingReplyGetTrafficIncidents extends PendingReply { + private EList trafficIncidents; + + public PendingReplyGetTrafficIncidents(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getTrafficIncidents() { + return trafficIncidents; + } + + public void setTrafficIncidents(EList trafficIncidents) { + this.trafficIncidents = trafficIncidents; + } + } + + class PendingReplyGetTrafficIncidentsFields extends PendingReply { + private EList trafficIncidents; + + public PendingReplyGetTrafficIncidentsFields(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getTrafficIncidents() { + return trafficIncidents; + } + + public void setTrafficIncidents(EList trafficIncidents) { + this.trafficIncidents = trafficIncidents; + } + } + + class PendingReplyGetTexts extends PendingReply { + private EList texts; + + public PendingReplyGetTexts(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getTexts() { + return texts; + } + + public void setTexts(EList texts) { + this.texts = texts; + } + } + + class PendingReplyAddAreasUpdateListener extends PendingReply { + private int listenerId; + + public PendingReplyAddAreasUpdateListener(TrafficIncidentsListener listener) { + super(listener); + } + + public int getListenerId() { + return listenerId; + } + + public void setListenerId(int listenerId) { + this.listenerId = listenerId; + } + } + + class PendingReplyGetLanguage extends PendingReply { + private String languageCode; + private String countryCode; + + public PendingReplyGetLanguage(TrafficIncidentsListener listener) { + super(listener); + } + + public String getLanguageCode() { + return languageCode; + } + + public void setLanguageCode(String languageCode) { + this.languageCode = languageCode; + } + + public String getCountryCode() { + return countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + } + + class PendingReplyReserveIconSetIds extends PendingReply { + private EList iconSetIds; + + public PendingReplyReserveIconSetIds(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getIconSetIds() { + return iconSetIds; + } + + public void setIconSetIds(EList iconSetIds) { + this.iconSetIds = iconSetIds; + } + } + + class PendingReplyGetIconSets extends PendingReply { + private EList iconSets; + + public PendingReplyGetIconSets(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getIconSets() { + return iconSets; + } + + public void setIconSets(EList iconSets) { + this.iconSets = iconSets; + } + } + + class PendingReplyGetIconDefinitions extends PendingReply { + private EList iconDefinitions; + + public PendingReplyGetIconDefinitions(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getIconDefinitions() { + return iconDefinitions; + } + + public void setIconDefinitions(EList iconDefinitions) { + this.iconDefinitions = iconDefinitions; + } + } + + class PendingReplyReserveCategoryIds extends PendingReply { + private EList categoryIds; + + public PendingReplyReserveCategoryIds(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getCategoryIds() { + return categoryIds; + } + + public void setCategoryIds(EList categoryIds) { + this.categoryIds = categoryIds; + } + } + + class PendingReplyGetCategoryDefinitions extends PendingReply { + private EList categoryDefinitions; + + public PendingReplyGetCategoryDefinitions(TrafficIncidentsListener listener) { + super(listener); + } + + public EList getCategoryDefinitions() { + return categoryDefinitions; + } + + public void setCategoryDefinitions(EList categoryDefinitions) { + this.categoryDefinitions = categoryDefinitions; + } + } + + class PendingReplyGetApplicability extends PendingReply { + private String filterExpression; + + public PendingReplyGetApplicability(TrafficIncidentsListener listener) { + super(listener); + } + + public String getFilterExpression() { + return filterExpression; + } + + public void setFilterExpression(String filterExpression) { + this.filterExpression = filterExpression; + } + + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsDBusProxy.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsDBusProxy.java new file mode 100755 index 0000000..3de724e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsDBusProxy.java @@ -0,0 +1,1623 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus.impl; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.CallbackHandler; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.CategoryDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.FeedInformationStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconDefinitionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconInfoStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.IconSetStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.RectangularAreaStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentsDBus; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TwoTuple; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.VersionStruct; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * All method have a listener as first parameter. + * For methods where this parameter cannot be null (always a reply): + * A CallBackHandler is created and the remote method is called with 'callWithCallback'. + * + * For methods where this parameter can be null (fire and forget if null): + * If the listener is null, 'callMethodAsync' is called. + * If the listener is not null, same handling as when the parameter cannot be null. + * + * + * A CallBackHandler needs a type, even if there are no output parameters. In this case + * always the type Integer is used, and the parameter of the 'handle' method is called dummyReturnValue. + */ +public class TrafficIncidentsDBusProxy extends EObjectImpl implements TrafficIncidents { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentsDBusProxy.class.getName()); + + private DBusConnection conn; + private TrafficIncidentsDBus trafficIncidentsDBus; + + private Map, TrafficIncidentsListener> callsInProgress = new HashMap<>(); + private Map updatesListeners = new HashMap<>(); + private Map updatesInAreasListeners = new HashMap<>(); + private List trafficIncidentsStatusListeners = new ArrayList<>(); + private List feedInformationListeners = new ArrayList<>(); + + private int firstListenerId; + + public TrafficIncidentsDBusProxy( + String trafficIncidentsInterfaceName, + String trafficIncidentsObjectPath) throws DBusException { + super(); + + LOGGER.setLevel(Level.SEVERE); + + Date date = new Date(); + long time = date.getTime(); + firstListenerId = (int) (time % 100); + LOGGER.info("TrafficIncidentsDBusProxy: firstListenerId = " + firstListenerId); + + conn = DBusConnection.getConnection(DBusConnection.SESSION); + + // Show the D-Bus xml interface definition + Introspectable introSpectable = (Introspectable) conn.getRemoteObject(trafficIncidentsInterfaceName, trafficIncidentsObjectPath, Introspectable.class); + boolean introspectOk = false; + while (!introspectOk) { + LOGGER.fine("Waiting for service to become available ..."); + try { + String data = introSpectable.Introspect(); + LOGGER.severe("Connected to interface with following specification:"); + LOGGER.severe(data); + introspectOk = true; + } catch (Exception e) { + LOGGER.info(e.getMessage()); + } + try { + Thread.sleep(500); + } catch (InterruptedException e) { + } + } + + trafficIncidentsDBus = (TrafficIncidentsDBus) conn.getRemoteObject(trafficIncidentsInterfaceName, trafficIncidentsObjectPath, TrafficIncidentsDBus.class); + LOGGER.fine("TrafficIncidentsDBus obtained"); + + try { + conn.addSigHandlerWithoutMatch(TrafficIncidentsDBus.Updates.class, new UpdatesSignalHandler()); + conn.addSigHandlerWithoutMatch(TrafficIncidentsDBus.UpdatesInAreas.class, new UpdatesInAreasSignalHandler()); + conn.addSigHandler(TrafficIncidentsDBus.TrafficIncidentsStatus.class, new TrafficIncidentsStatusSignalHandler()); + conn.addSigHandler(TrafficIncidentsDBus.FeedInformation.class, new FeedInformationSignalHandler()); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + @Override + public void getVersion(TrafficIncidentsListener listener) { + LOGGER.fine("getVersion => listener = " + listener); + + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(VersionStruct versionStruct) { + LOGGER.fine("getVersion:handle => versionStruct " + versionStruct); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + Version version = StructUtil.versionStructToVersion(versionStruct); + + LOGGER.fine("version = " + version); + + listener.getVersionReply(version); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetVersion", callbackHandler); + + LOGGER.fine("getVersion <="); + } + + @Override + public void getLanguage(TrafficIncidentsListener listener) { + LOGGER.fine("getLanguage => listener = " + listener); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(TwoTuple languageTuple) { + LOGGER.fine("getLanguage:handle => languageTuple = " + languageTuple); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + String languageCode = languageTuple.a; + String countryCode = languageTuple.b; + if (countryCode.isEmpty()) { + countryCode = null; + } + LOGGER.fine("languageCode = " + languageCode + ", countryCode = " + countryCode); + + listener.getLanguageReply(languageCode, countryCode); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetLanguage", callbackHandler); + + LOGGER.fine("getLanguage <="); + } + + @Override + public void setLanguage(TrafficIncidentsListener listener, String languageCode, String countryCode) { + LOGGER.info("setLanguage => languageCode = " + languageCode + ", countryCode = " + countryCode); + + if (languageCode == null) { + languageCode = ""; + } + + if (countryCode == null) { + countryCode = ""; + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setLanguage:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setLanguageReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetLanguage", callbackHandler, languageCode, countryCode); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetLanguage", languageCode, countryCode); + } + + LOGGER.fine("setLanguage <="); + } + + @Override + public void setTimeFormat(TrafficIncidentsListener listener, String timeFormat) { + LOGGER.fine("setTimeFormat => timeFormat = " + timeFormat); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setTimeFormat:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setTimeFormatReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetTimeFormat", callbackHandler, timeFormat); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetTimeFormat", timeFormat); + } + + LOGGER.fine("setTimeFormat <="); + } + + @Override + public void setDateFormat(TrafficIncidentsListener listener, String dateFormat) { + LOGGER.fine("setDateFormat => + dateFormat = " + dateFormat); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setDateFormat:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setDateFormatReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetDateFormat", callbackHandler, dateFormat); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetDateFormat", dateFormat); + } + + LOGGER.fine("setDateFormat <="); + } + + @Override + public void setLengthUnit(TrafficIncidentsListener listener, LengthUnit lengthUnit) { + LOGGER.fine("setLengthUnit => lengthUnit = " + lengthUnit); + + Byte lengthUnitId = (byte) lengthUnit.getValue(); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setLengthUnit:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setLengthUnitReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetLengthUnit", callbackHandler, lengthUnitId); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetLengthUnit", lengthUnitId); + } + + LOGGER.fine("setLengthUnit <="); + } + + @Override + public void setWeightUnit(TrafficIncidentsListener listener, WeightUnit weightUnit) { + LOGGER.fine("setWeightUnit => weightUnit = " + weightUnit); + + Byte weightUnitId = (byte) weightUnit.getValue(); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setWeightUnit:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setWeightUnitReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetWeightUnit", callbackHandler, weightUnitId); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetWeightUnit", weightUnitId); + } + + LOGGER.fine("setWeightUnit <="); + } + + @Override + public void getApplicability(TrafficIncidentsListener listener) { + LOGGER.fine("getApplicability => listener = " + listener); + + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(String filterExpression) { + LOGGER.fine("getApplicability:handle => filterExpression = " + filterExpression); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.getApplicabilityReply(filterExpression); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetApplicability", callbackHandler); + + LOGGER.fine("getApplicability <="); + } + + @Override + public void setApplicability(TrafficIncidentsListener listener, String filterExpression) { + LOGGER.fine("setApplicability => filterExpression = " + filterExpression); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("setApplicability:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.setApplicabilityReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "SetApplicability", callbackHandler, filterExpression); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "SetApplicability", filterExpression); + } + + LOGGER.fine("setApplicability <="); + } + + @Override + public void reserveIconSetIds(TrafficIncidentsListener listener, int numberOfIds) { + LOGGER.fine("reserveIconSetIds => listener = " + listener + ", numberOfIds = " + numberOfIds); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List iconSetIds) { + LOGGER.fine("reserveIconSetIds:handle => iconSetIds = " + iconSetIds); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + EList eListIconSetIds = new BasicEList<>(iconSetIds); + listener.reserveIconSetIdsReply(eListIconSetIds); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "ReserveIconSetIds", callbackHandler, (Integer) numberOfIds); + + LOGGER.fine("reserveIconSetIds <="); + } + + @Override + public void freeIconSetIds(TrafficIncidentsListener listener, EList iconSetIds) { + LOGGER.fine("freeIconSetIds => iconSetIds = " + iconSetIds); + + List listIconSetIds = new ArrayList<>(iconSetIds); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("freeIconSetIds:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.freeIconSetIdsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "FreeIconSetIds", callbackHandler, listIconSetIds); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "FreeIconSetIds", listIconSetIds); + } + + LOGGER.fine("freeIconSetIds <="); + } + + @Override + public void getIconSets(TrafficIncidentsListener listener) { + LOGGER.fine("getIconSets => listener = " + listener); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List iconSetStructs) { + LOGGER.fine("getIconSets:handle => iconSetStructs = " + iconSetStructs); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + + EList iconSets = new BasicEList<>(); + for (IconSetStruct iconSetStruct: iconSetStructs) { + IconSet iconSet = StructUtil.iconSetStructToIconSet(iconSetStruct); + iconSets.add(iconSet); + } + LOGGER.fine("iconSets => " + iconSets); + listener.getIconSetsReply(iconSets); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetIconSets", callbackHandler); + + LOGGER.fine("getIconSets <="); + } + + @Override + public void addIconSetDefinitions(TrafficIncidentsListener listener, EList iconSets) { + LOGGER.fine("addIconSetDefinitions => iconSets = " + iconSets); + + List iconSetStructs = new ArrayList<>(); + for (IconSet iconSet: iconSets) { + IconSetStruct iconSetStruct = StructUtil.iconSetToIconSetStruct(iconSet); + iconSetStructs.add(iconSetStruct); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addIconSetDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addIconSetDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "AddIconSetDefinitions", callbackHandler, iconSetStructs); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "AddIconSetDefinitions", iconSetStructs); + } + + LOGGER.fine("addIconSetDefinitions <="); + } + + @Override + public void removeIconSetDefinitions(TrafficIncidentsListener listener, EList iconSetIds) { + LOGGER.fine("removeIconSetDefinitions => iconSetIds = " + iconSetIds); + + List listIconSetIds = new ArrayList<>(iconSetIds); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeIconSetDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeIconSetDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveIconSetDefinitions", callbackHandler, listIconSetIds); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveIconSetDefinitions", listIconSetIds); + } + + LOGGER.fine("removeIconSetDefinitions <="); + } + + @Override + public void getIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + LOGGER.fine("getIconDefinitions => listener = " + listener + ", iconInfos" + iconInfos); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List iconDefinitionStructs) { + LOGGER.fine("getIconDefinitions:handle => icondefinitionStructs = " + iconDefinitionStructs); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + + EList iconDefinitions = new BasicEList(); + for (IconDefinitionStruct iconDefinitionStruct: iconDefinitionStructs) { + IconDefinition iconDefinition = StructUtil.iconDefinitionStructToIconDefinition(iconDefinitionStruct); + iconDefinitions.add(iconDefinition); + } + LOGGER.fine("iconDefinitions => " + iconDefinitions); + listener.getIconDefinitionsReply(iconDefinitions); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + List iconInfoStructs = new ArrayList<>(); + for (IconInfo iconInfo: iconInfos) { + IconInfoStruct iconInfoStruct = StructUtil.iconInfoToIconInfoStruct(iconInfo); + LOGGER.fine("iconInfoStruct = " + iconInfoStruct.iconId + ", " + iconInfoStruct.iconSetId); + iconInfoStructs.add(iconInfoStruct); + } + if (iconInfoStructs.size() == 0) { + IconInfoStruct iconInfoStruct = new IconInfoStruct(-1, -1); + LOGGER.fine("Added iconInfoStruct = " + iconInfoStruct.iconId + ", " + iconInfoStruct.iconSetId); + iconInfoStructs.add(iconInfoStruct); + } + conn.callWithCallback(trafficIncidentsDBus, "GetIconDefinitions", callbackHandler, iconInfoStructs); + + LOGGER.fine("getIconDefinitions <="); + } + + @Override + public void addIconDefinitions(TrafficIncidentsListener listener, EList iconDefinitions) { + + LOGGER.fine("addIconDefinitions => iconDefinitions = " + iconDefinitions); + + List iconDefinitionStructs = new ArrayList<>(); + for (IconDefinition iconDefinition: iconDefinitions) { + IconDefinitionStruct iconDefinitionStruct = StructUtil.iconDefinitionToIconDefinitionStruct(iconDefinition); + iconDefinitionStructs.add(iconDefinitionStruct); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addIconDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addIconDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "AddIconDefinitions", callbackHandler, iconDefinitionStructs); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "AddIconDefinitions", iconDefinitionStructs); + } + + LOGGER.fine("addIconDefinitions <="); + } + + @Override + public void removeIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + LOGGER.fine("removeIconDefinitions => iconInfos = " + iconInfos); + + List iconInfoStructs = new ArrayList<>(); + for (IconInfo iconInfo: iconInfos) { + IconInfoStruct iconInfoStruct = StructUtil.iconInfoToIconInfoStruct(iconInfo); + iconInfoStructs.add(iconInfoStruct); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeIconDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeIconDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveIconDefinitions", callbackHandler, iconInfoStructs); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveIconDefinitions", iconInfoStructs); + } + + LOGGER.fine("removeIconDefinitions <="); + } + + @Override + public void reserveCategoryIds(TrafficIncidentsListener listener, int numberOfIds) { + LOGGER.fine("reserveCategoryIds => listener = " + listener + ", numberOfIds = " + numberOfIds); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List categoryIds) { + LOGGER.fine("reserveCategoryIds:handle => categoryIds = " + categoryIds); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + EList eListCategoryIds = new BasicEList<>(categoryIds); + listener.reserveCategoryIdsReply(eListCategoryIds); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "ReserveCategoryIds", callbackHandler, (Integer) numberOfIds); + + LOGGER.fine("reserveCategoryIds <="); + } + + @Override + public void freeCategoryIds(TrafficIncidentsListener listener, EList categoryIds) { + LOGGER.fine("freeCategoryIds => categoryIds = " + categoryIds); + + List listCategoryIds = new ArrayList<>(categoryIds); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("freeCategoryIds:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.freeCategoryIdsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "FreeCategoryIds", callbackHandler, listCategoryIds); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "FreeCategoryIds", listCategoryIds); + } + + LOGGER.fine("freeCategoryIds <="); + } + + @Override + public void getCategoryDefinitions(TrafficIncidentsListener listener) { + LOGGER.info("getCategoryDefinitions => listener = " + listener); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List categoryDefinitionStructs) { + LOGGER.info("getCategoryDefinitions:handle => categoryDefinitionStructs = " + categoryDefinitionStructs); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + + EList categoryDefinitions = new BasicEList<>(); + for (CategoryDefinitionStruct categoryDefinitionStruct: categoryDefinitionStructs) { + CategoryDefinition categoryDefinition = StructUtil.categoryDefinitionStructToCategoryDefinition(categoryDefinitionStruct); + categoryDefinitions.add(categoryDefinition); + } + LOGGER.info("categoryDefinitions => " + categoryDefinitions); + listener.getCategoryDefinitionsReply(categoryDefinitions); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetCategoryDefinitions", callbackHandler); + + LOGGER.info("getCategoryDefinitions <="); + } + + @Override + public void addCategoryDefinitions(TrafficIncidentsListener listener, EList categoryDefinitions) { + LOGGER.info("addCategoryDefinitions => categoryDefinitions = " + categoryDefinitions); + + List categoryDefinitionStructs = new ArrayList<>(); + for (CategoryDefinition categoryDefinition: categoryDefinitions) { + CategoryDefinitionStruct categoryDefinitionStruct = StructUtil.categoryDefinitionToCategoryDefinitionStruct(categoryDefinition); + categoryDefinitionStructs.add(categoryDefinitionStruct); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addCategoryDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addCategoryDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "AddCategoryDefinitions", callbackHandler, categoryDefinitionStructs); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "AddCategoryDefinitions", categoryDefinitionStructs); + } + + LOGGER.info("addCategoryDefinitions <="); + } + + @Override + public void removeCategoryDefinitions(TrafficIncidentsListener listener, EList categoryIds) { + LOGGER.fine("removeCategoryDefinitions => categoryIds = " + categoryIds); + + List listCategoryIds = new ArrayList<>(categoryIds); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeCategoryDefinitions:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeCategoryDefinitionsReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveCategoryDefinitions", callbackHandler, listCategoryIds); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveCategoryDefinitions", listCategoryIds); + } + + LOGGER.fine("removeCategoryDefinitions <="); + } + + @Override + public void getTrafficIncidentIds(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds) { + LOGGER.fine("getTrafficIncidentIds => listener = " + listener + ", warningLevels = " + warningLevels + ", categoryIds = " + categoryIds); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List trafficIncidentIds) { + LOGGER.fine("getTrafficIncidentIds:handle => trafficIncidentids = " + trafficIncidentIds); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + EList eListTrafficIncidentIds = new BasicEList<>(trafficIncidentIds); + listener.getTrafficIncidentIdsReply(eListTrafficIncidentIds); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + List warningLevelIds = new ArrayList<>(); + for (WarningLevel warningLevel: warningLevels) { + Byte warningLevelId = (byte) warningLevel.getValue(); + warningLevelIds.add(warningLevelId); + } + conn.callWithCallback(trafficIncidentsDBus, "GetTrafficIncidentIds", callbackHandler, warningLevelIds, categoryIds); + + LOGGER.fine("getTrafficIncidentIds <="); + } + + @Override + public void getTrafficIncidentIdsInAreas(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, EList areas) { + LOGGER.fine("getTrafficIncidentIdsInAreas => listener = " + listener + ", warningLevels = " + warningLevels + ", categoryIds = " + categoryIds + ", areas = " + areas); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List trafficIncidentIds) { + LOGGER.fine("getTrafficIncidentIdsInAreas:handle => trafficIncidentIds = " + trafficIncidentIds); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + EList eListTrafficIncidentIds = new BasicEList<>(trafficIncidentIds); + listener.getTrafficIncidentIdsReply(eListTrafficIncidentIds); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + List warningLevelIds = new ArrayList<>(); + for (WarningLevel warningLevel: warningLevels) { + Byte warningLevelId = (byte) warningLevel.getValue(); + warningLevelIds.add(warningLevelId); + } + List rectangularAreaStructs = new ArrayList<>(); + for (RectangularArea rectangularArea: areas) { + RectangularAreaStruct rectangularAreaStruct = StructUtil.rectangularAreaToRectangularAreaStruct(rectangularArea); + rectangularAreaStructs.add(rectangularAreaStruct); + } + conn.callWithCallback(trafficIncidentsDBus, "GetTrafficIncidentIdsInAreas", callbackHandler, warningLevelIds, categoryIds, rectangularAreaStructs); + + LOGGER.fine("getTrafficIncidentIdsInAreas <="); + } + + @Override + public void getTrafficIncidents(TrafficIncidentsListener listener, EList trafficIncidentIds, boolean includeTextFields) { + LOGGER.info("getTrafficIncidents => listener = " + listener + ", trafficIncidentIds = " + trafficIncidentIds + ", includeTextFields = " + includeTextFields); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List trafficIncidentStructs) { + LOGGER.info("getTrafficIncidents:handle => trafficIncidentStructs = " + trafficIncidentStructs); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + + EList trafficIncidents = new BasicEList<>(); + for (TrafficIncidentStruct trafficIncidentStruct: trafficIncidentStructs) { + TrafficIncident trafficIncident = StructUtil.trafficIncidentStructToTrafficIncident(trafficIncidentStruct); + trafficIncidents.add(trafficIncident); + } + LOGGER.info("trafficIncidents = " + trafficIncidents); + listener.getTrafficIncidentsReply(trafficIncidents); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "GetTrafficIncidents", callbackHandler, trafficIncidentIds, includeTextFields); + + LOGGER.info("getTrafficIncidents <="); + } + + @Override + public void getTrafficIncidentsFields(TrafficIncidentsListener listener, EList trafficIncidentIds, EList trafficIncidentFields) { + LOGGER.fine("getTrafficIncidentsFields => listener = " + listener + ", trafficIncidentIds = " + trafficIncidentIds + ", trafficIncidentFields = " + trafficIncidentFields); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List trafficIncidentStructs) { + LOGGER.fine("getTrafficIncidentsFields:handle => trafficIncidentStructs = " + trafficIncidentStructs); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + + EList trafficIncidents = new BasicEList<>(); + for (TrafficIncidentStruct trafficIncidentStruct: trafficIncidentStructs) { + TrafficIncident trafficIncident = StructUtil.trafficIncidentStructToTrafficIncident(trafficIncidentStruct); + trafficIncidents.add(trafficIncident); + } + LOGGER.fine("trafficIncidents = " + trafficIncidents); + listener.getTrafficIncidentsReply(trafficIncidents); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + List trafficIncidentFieldIds = new ArrayList<>(); + for (TrafficIncidentField trafficIncidentField: trafficIncidentFields) { + Byte trafficIncidentFieldId = (Byte) (byte) trafficIncidentField.getValue(); + trafficIncidentFieldIds.add(trafficIncidentFieldId); + } + LOGGER.info("trafficIncidentFieldIds = " + trafficIncidentFieldIds); + conn.callWithCallback(trafficIncidentsDBus, "GetTrafficIncidentsFields", callbackHandler, trafficIncidentIds, trafficIncidentFieldIds); + + LOGGER.fine("getTrafficIncidentsFields <="); + } + + @Override + public void getTexts(TrafficIncidentsListener listener, EList trafficIncidentIds, TextDetailLevel textDetailLevel) { + LOGGER.fine("getTexts => listener = " + listener + ", trafficIncidentIds = " + trafficIncidentIds + ", textDetailLevel = " + textDetailLevel); + + CallbackHandler> callbackHandler = new CallbackHandler>() { + @Override + public void handle(List texts) { + LOGGER.fine("getTexts:handle => texts = " + texts); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + EList eListTexts = new BasicEList<>(texts); + listener.getTextsReply(eListTexts); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + Integer textDetailLevelId = textDetailLevel.getValue(); + conn.callWithCallback(trafficIncidentsDBus, "GetTexts", callbackHandler, trafficIncidentIds, textDetailLevelId); + + LOGGER.fine("getTexts <="); + } + + @Override + public void addTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener) { + LOGGER.fine("addTrafficIncidentsStatusListener => listener = " + listener + ", trafficIncidentsStatusListener = " + trafficIncidentsStatusListener); + + trafficIncidentsStatusListeners.add(trafficIncidentsStatusListener); + + if (trafficIncidentsStatusListeners.size() == 1) { + // First listener added, so notify the TrafficIncidentsService that we are listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addTrafficIncidentsStatusListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addTrafficIncidentsStatusListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "AddTrafficIncidentsStatusListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "AddTrafficIncidentsStatusListener"); + } + } else { + if (listener != null) { + listener.addTrafficIncidentsStatusListenerReply(); + } + } + + LOGGER.fine("addTrafficIncidentsStatusListener <="); + } + + @Override + public void removeTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener) { + LOGGER.fine("removeTrafficIncidentsStatusListener => listener = " + listener + ", trafficIncidentsStatusListener = " + trafficIncidentsStatusListener); + + trafficIncidentsStatusListeners.remove(trafficIncidentsStatusListener); + + if (trafficIncidentsStatusListeners.isEmpty()) { + // Last listener removed, so notify the TrafficIncidentsService that we are no longer listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeTrafficIncidentsStatusListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeTrafficIncidentsStatusListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveTrafficIncidentsStatusListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveTrafficIncidentsStatusListener"); + } + } else { + if (listener != null) { + listener.removeTrafficIncidentsStatusListenerReply(); + } + } + + LOGGER.fine("removeTrafficIncidentsStatusListener <="); + } + + @Override + public void addFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener) { + LOGGER.fine("addFeedInformationListener => listener = " + listener + ", feedInformationListener = " + feedInformationListener); + + feedInformationListeners.add(feedInformationListener); + + if (feedInformationListeners.size() == 1) { + // First listener added, so notify the TrafficIncidentsService that we are listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addFeedInformationListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addFeedInformationListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "AddFeedInformationListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "AddFeedInformationListener"); + } + } else { + if (listener != null) { + listener.addFeedInformationListenerReply(); + } + } + + LOGGER.fine("addFeedInformationListener <="); + } + + @Override + public void removeFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener) { + LOGGER.fine("removeFeedInformationListener => listener = " + listener + ", feedInformationListener = " + feedInformationListener); + + feedInformationListeners.remove(feedInformationListener); + + if (feedInformationListeners.isEmpty()) { + // Last listener removed, so notify the TrafficIncidentsService that we are no longer listening. + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeFeedInformationListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeFeedInformationListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveFeedInformationListener", callbackHandler); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveFeedInformationListener"); + } + } else { + if (listener != null) { + listener.removeFeedInformationListenerReply(); + } + } + + LOGGER.fine("removeFeedInformationListener <="); + } + + @Override + public void addUpdateListener(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, + TrafficIncidentsListener updatesListener) { + LOGGER.info("addUpdateListener => listener = " + listener + ", warningLevels = " + warningLevels + ", categoryIds = " + categoryIds + + ", updatesListener = " + updatesListener); + + if(updatesListeners.containsValue(updatesListener)) { + throw new IllegalArgumentException("Listener already exists"); + } + + Integer listenerId = generateListenerId(updatesListeners); + LOGGER.info("addUpdateListener: listenerId = " + listenerId); + updatesListeners.put(listenerId, updatesListener); + + List warningLevelIds = new ArrayList<>(); + for (WarningLevel warningLevel: warningLevels) { + Byte warningLevelId = (Byte) (byte) warningLevel.getValue(); + warningLevelIds.add(warningLevelId); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addUpdateListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addUpdateListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + LOGGER.info("Going to send addUpdateListener D-Bus request (with Callback)"); + conn.callWithCallback(trafficIncidentsDBus, "AddUpdateListener", callbackHandler, listenerId, warningLevelIds, categoryIds); + } else { + LOGGER.info("Going to send addUpdateListener D-Bus request (fire and forget)"); + conn.callMethodAsync(trafficIncidentsDBus, "AddUpdateListener", listenerId, warningLevelIds, categoryIds); + } + + LOGGER.info("addUpdateListener <="); + } + + @Override + public void removeUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updatesListener) { + LOGGER.fine("removeUpdateListener => listener = " + listener + ", updatesListener = " + updatesListener); + + Integer listenerId = null; + for (Integer key: updatesListeners.keySet()) { + if (updatesListeners.get(key).equals(updatesListener)) { + listenerId = key; + break; + } + } + + if (listenerId == null) { + throw new IllegalArgumentException("Unknown updatesListener"); + } + + updatesListeners.remove(listenerId); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeUpdateListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeUpdateListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveUpdateListener", callbackHandler, listenerId); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveUpdateListener", listenerId); + } + + LOGGER.fine("removeUpdateListener <="); + } + + @Override + public void addAreasUpdateListener(TrafficIncidentsListener listener, + EList warningLevels, EList categoryIds, EList areas, + TrafficIncidentsListener areasUpdateListener) { + LOGGER.fine("addAreasUpdateListener => listener = " + listener + + ", warningLevels = " + warningLevels + ", categoryIds = " + categoryIds + + ", areas = " + areas + ", areasUpdateListener" + areasUpdateListener); + + if(updatesInAreasListeners.containsValue(areasUpdateListener)) { + throw new IllegalArgumentException("Listener already exists"); + } + + Integer listenerId = generateListenerId(updatesInAreasListeners); + updatesInAreasListeners.put(listenerId, areasUpdateListener); + + List warningLevelIds = new ArrayList<>(); + for (WarningLevel warningLevel: warningLevels) { + Byte warningLevelId = (Byte) (byte) warningLevel.getValue(); + warningLevelIds.add(warningLevelId); + } + List areaStructs = new ArrayList<>(); + for (RectangularArea rectangularArea: areas) { + RectangularAreaStruct rectangularAreaStruct = StructUtil.rectangularAreaToRectangularAreaStruct(rectangularArea); + areaStructs.add(rectangularAreaStruct); + } + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("addAreasUpdateListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.addAreasUpdateListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + LOGGER.info("Going to send addAreasUpdateListener D-Bus request (with Callback)"); + conn.callWithCallback(trafficIncidentsDBus, "AddAreasUpdateListener", callbackHandler, listenerId, warningLevelIds, categoryIds, areaStructs); + } else { + LOGGER.info("Going to send addAreasUpdateListener D-Bus request (fire and forget)"); + conn.callMethodAsync(trafficIncidentsDBus, "AddAreasUpdateListener", listenerId, warningLevelIds, categoryIds, areaStructs); + } + + LOGGER.fine("addAreasUpdateListener <="); + } + + @Override + public void removeAreasUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener areasUpdateListener) { + LOGGER.fine("removeAreasUpdateListener => listener = " + listener + ", areasUpdateListener = " + areasUpdateListener); + + Integer listenerId = null; + for (Integer key: updatesInAreasListeners.keySet()) { + if (updatesInAreasListeners.get(key).equals(areasUpdateListener)) { + listenerId = key; + break; + } + } + + if (listenerId == null) { + throw new IllegalArgumentException("Unknown areasUpdateListener"); + } + + updatesInAreasListeners.remove(listenerId); + + if (listener != null) { + CallbackHandler callbackHandler = new CallbackHandler() { + @Override + public void handle(Integer dummyReturnValue) { + LOGGER.info("removeAreasUpdateListener:handle => dummyReturnValue = " + dummyReturnValue); + TrafficIncidentsListener listener = callsInProgress.remove(this); + if (listener == null) { + throw new RuntimeException("No entry for callbackHandler found"); + } + + listener.removeAreasUpdateListenerReply(); + } + + @Override + public void handleError(DBusExecutionException e) { + LOGGER.severe(e.getMessage()); + e.printStackTrace(); + } + + }; + + callsInProgress.put(callbackHandler, listener); + conn.callWithCallback(trafficIncidentsDBus, "RemoveAreasUpdateListener", callbackHandler, listenerId); + } else { + conn.callMethodAsync(trafficIncidentsDBus, "RemoveAreasUpdateListener", listenerId); + } + + LOGGER.fine("removeAreasUpdateListener <="); + } + + private Integer generateListenerId(Map currentListeners) { + Set currentIds = currentListeners.keySet(); + + for (int id = firstListenerId; id < Integer.MAX_VALUE; id++) { + if (!currentIds.contains(id)) { + return id; + } + } + + throw new RuntimeException("UpdateListenerId overflow."); + } + + class TrafficIncidentsStatusSignalHandler implements DBusSigHandler { + public void handle(TrafficIncidentsDBus.TrafficIncidentsStatus status) { + LOGGER.fine("TrafficIncidentsStatusSignalHandler => path = " + status.getPath()); + + TrafficIncidentFeedStatus trafficIncidentFeedStatus = null; + if (status.trafficIncidentFeedStatus != 0) { + trafficIncidentFeedStatus = TrafficIncidentFeedStatus.get(status.trafficIncidentFeedStatus); + } + + TrafficIncidentsStatus trafficIncidentsStatus = null; + if (status.trafficIncidentsStatus != 0) { + trafficIncidentsStatus = TrafficIncidentsStatus.get(status.trafficIncidentsStatus); + } + + if (trafficIncidentsStatusListeners.isEmpty()) { + LOGGER.info("TrafficIncidentsStatusSignalHandler: No listener registered"); + } else { + for (TrafficIncidentsListener listener: trafficIncidentsStatusListeners) { + listener.trafficIncidentsStatus(trafficIncidentFeedStatus, trafficIncidentsStatus); + } + } + } + } + + class FeedInformationSignalHandler implements DBusSigHandler { + public void handle(TrafficIncidentsDBus.FeedInformation info) { + LOGGER.fine("TrafficIncidentsStatusSignalHandler => path = " + info.getPath()); + + EList feedsInformation = new BasicEList<>(); + List feedsInformationStructs = info.feedsInformation; + + for (FeedInformationStruct feedInformationStruct: feedsInformationStructs) { + FeedInformation feedInformation = StructUtil.feedInformationStructToFeedInformation(feedInformationStruct); + feedsInformation.add(feedInformation); + } + + if (feedInformationListeners.isEmpty()) { + LOGGER.info("FeedInformationSignalHandler: No listener registered"); + } else { + for (TrafficIncidentsListener listener: feedInformationListeners) { + listener.feedInformation(feedsInformation); + } + } + } + } + + class UpdatesSignalHandler implements DBusSigHandler { + public void handle(TrafficIncidentsDBus.Updates updates) { + LOGGER.info("UpdatesSignalHandler => path = " + updates.getPath()); + EList unchangedTrafficIncidentIds = new BasicEList<>(); + EList changedTrafficIncidentIds = new BasicEList<>(); + EList newTrafficIncidentIds = new BasicEList<>(); + EList deletedTrafficIncidentIds = new BasicEList<>(); + + for (Integer id: updates.unchangedTrafficIncidentIds) { + unchangedTrafficIncidentIds.add(id); + } + + for (Integer id: updates.changedTrafficIncidentIds) { + changedTrafficIncidentIds.add(id); + } + + for (Integer id: updates.newTrafficIncidentIds) { + newTrafficIncidentIds.add(id); + } + + for (Integer id: updates.deletedTrafficIncidentIds) { + deletedTrafficIncidentIds.add(id); + } + + int listenerId = updates.listenerId; + LOGGER.info("UpdatesSignalHandler: listenerId = " + listenerId); + + TrafficIncidentsListener listener = updatesListeners.get(listenerId); + + if (listener != null) { + LOGGER.info("UpdatesSignalHandler: calling updates on listener"); + listener.updates(unchangedTrafficIncidentIds, changedTrafficIncidentIds, newTrafficIncidentIds, deletedTrafficIncidentIds); + } else { + LOGGER.severe("UpdatesSignalHandler: Signal received for listenerId that is not in use at this node, listenerId = " + listenerId); + } + + LOGGER.info("UpdatesSignalHandler <="); + } + } + + + class UpdatesInAreasSignalHandler implements DBusSigHandler { + public void handle(TrafficIncidentsDBus.UpdatesInAreas updatesInAreas) { + LOGGER.fine("UpdatesInAreasSignalHandler => path = " + updatesInAreas.getPath()); + EList areas = new BasicEList<>(); + + for (RectangularAreaStruct rectangularAreaStruct: updatesInAreas.areas) { + RectangularArea rectangularArea = StructUtil.rectangularAreaStructToRectangularArea(rectangularAreaStruct); + areas.add(rectangularArea); + } + + int listenerId = updatesInAreas.listenerId; + LOGGER.fine("listenerId = " + listenerId); + + TrafficIncidentsListener listener = updatesInAreasListeners.get(listenerId); + + if (listener != null) { + listener.updatesInAreas(areas); + } else { + LOGGER.severe("UpdatesInAreasSignalHandler: Signal received for listenerId that is not in use at this node, listenerId = " + listenerId); + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsListenerProxy.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsListenerProxy.java new file mode 100755 index 0000000..f415194 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.dbuswrapper/src/main/java/org/genivi/trafficincidentsservice/trafficincidents/dbus/impl/TrafficIncidentsListenerProxy.java @@ -0,0 +1,131 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.dbus.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.EList; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.exceptions.DBusException; +import org.genivi.common.RectangularArea; +import org.genivi.trafficincidentsservice.DefaultTrafficIncidentsListener; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.RectangularAreaStruct; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentsDBus; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentsDBus.Updates; +import org.genivi.trafficincidentsservice.trafficincidents.dbus.TrafficIncidentsDBus.UpdatesInAreas; + +public class TrafficIncidentsListenerProxy extends DefaultTrafficIncidentsListener { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentsListenerProxy.class.getName()); + + private DBusConnection conn; + private Integer listenerId; + private String destination; + + public TrafficIncidentsListenerProxy(String destination, Integer listenerId) { + this.listenerId = listenerId; + this.destination = destination; + + try { + conn = DBusConnection.getConnection(DBusConnection.SESSION); + } catch (DBusException e) { + e.printStackTrace(); + } + + LOGGER.setLevel(Level.SEVERE); + } + + + @Override + public void updates(EList eListUnchangedTrafficIncidentIds, + EList eListChangedTrafficIncidentIds, EList eListNewTrafficIncidentIds, + EList eListDeletedTrafficIncidentIds) { + LOGGER.info("TrafficIncidentsListenerProxy:updates => eListUnchangedTrafficIncidentIds = " + eListUnchangedTrafficIncidentIds + + ", eListChangedTrafficIncidentIds = " + eListChangedTrafficIncidentIds + + ", eListNewTrafficIncidentIds = " + eListNewTrafficIncidentIds + + ", eListDeletedTrafficIncidentIds = " + eListDeletedTrafficIncidentIds); + + sendSignalUpdates(listenerId, eListUnchangedTrafficIncidentIds, eListChangedTrafficIncidentIds, eListNewTrafficIncidentIds, eListDeletedTrafficIncidentIds); + } + + @Override + public void updatesInAreas(EList areas) { + LOGGER.info("TrafficIncidentsListenerProxy:updatesInAreas => areas = " + areas); + sendSignalUpdatesInAreas(listenerId, areas); + } + + public Integer getListenerId() { + return listenerId; + } + + public String getDestination() { + return destination; + } + + public void sendSignalUpdates(Integer listenerId, EList eListUnchangedTrafficIncidentIds, EList eListChangedTrafficIncidentIds, EList eListNewTrafficIncidentIds, EList eListDeletedTrafficIncidentIds) { + List unchangedTrafficIncidentIds = new ArrayList<>(); + for (Integer id: eListUnchangedTrafficIncidentIds) { + unchangedTrafficIncidentIds.add(id); + } + + List changedTrafficIncidentIds = new ArrayList<>(); + for (Integer id: eListChangedTrafficIncidentIds) { + changedTrafficIncidentIds.add(id); + } + + List newTrafficIncidentIds = new ArrayList<>(); + for (Integer id: eListNewTrafficIncidentIds) { + newTrafficIncidentIds.add(id); + } + + List deletedTrafficIncidentIds = new ArrayList<>(); + for (Integer id: eListDeletedTrafficIncidentIds) { + deletedTrafficIncidentIds.add(id); + } + + try { + String path = addDestinationInfoToPath(); + Updates updates = new TrafficIncidentsDBus.Updates(path, listenerId, unchangedTrafficIncidentIds, changedTrafficIncidentIds, newTrafficIncidentIds, deletedTrafficIncidentIds); + LOGGER.info("going to send Updates signal to: " + destination); + conn.sendSignal(updates); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + public void sendSignalUpdatesInAreas(Integer listenerId, EList areas) { + List areaStructs = new ArrayList<>(); + + for (RectangularArea area: areas) { + RectangularAreaStruct areaStruct = StructUtil.rectangularAreaToRectangularAreaStruct(area); + areaStructs.add(areaStruct); + } + + LOGGER.info("going to send UpdatesInAreas signal to: " + destination); + + try { + String path = addDestinationInfoToPath(); + UpdatesInAreas updatesInAreas = new TrafficIncidentsDBus.UpdatesInAreas(path, listenerId, areaStructs); + conn.sendSignal(updatesInAreas); + } catch (DBusException e) { + e.printStackTrace(); + } + } + + String addDestinationInfoToPath() { + String destinationPatched = destination.replaceAll(":", "/p"); + destinationPatched = destinationPatched.replaceAll("\\.", "/p"); + String path = "/java" + destinationPatched + "id" + listenerId; + path = path + "&" + destination; + LOGGER.info("addDestinationInfoToPath: path (2) = " + path); + + return path; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.classpath new file mode 100755 index 0000000..841f9a5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.project new file mode 100755 index 0000000..9c2e226 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/.project @@ -0,0 +1,25 @@ + + + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + This project contains the data model for Traffic Incidents in the TrafficIncidentFeed interface. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.locref-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..dedfc4e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.trafficinfo.xtrafficincident;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident, + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl, + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.util +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.genivi.basetypes-model, + org.genivi.locref-model;visibility:=reexport, + org.genivi.trafficinfo.trafficincidenttables;visibility:=reexport diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/ReadMe.confluence new file mode 100755 index 0000000..9bc1bc0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/ReadMe.confluence @@ -0,0 +1,3 @@ +This project defines the TrafficIncident data model as used in the TrafficIncidentFeed interface. + +XTrafficIncident.ecorediag, in de model folder, provides a good overview of the structure of a TrafficIncident. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/build.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecore b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecore new file mode 100755 index 0000000..01a452f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecore @@ -0,0 +1,139 @@ + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecorediag b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecorediag new file mode 100755 index 0000000..b38fe1a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.ecorediag @@ -0,0 +1,529 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.genmodel b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.genmodel new file mode 100755 index 0000000..6db91e7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/model/XTrafficIncident.genmodel @@ -0,0 +1,64 @@ + + + XTrafficIncident.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.properties new file mode 100755 index 0000000..d4e01b4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = TrafficIncident Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.xml new file mode 100755 index 0000000..1f5f3c8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/plugin.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/pom.xml new file mode 100755 index 0000000..a658a38 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice.trafficincidentfeed + trafficincidentfeed-trafficincident-model + jar + 1.0-SNAPSHOT + Traffic Incident data model for the TrafficIncidentFeed interface + This project contains the data model for Traffic Incidents in the TrafficIncidentFeed interface. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi + basetypes-model + + + org.genivi + locref-model + + + org.genivi.trafficincidentsservice + trafficincidenttables-model + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Advice.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Advice.java new file mode 100755 index 0000000..2fcf0e4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Advice.java @@ -0,0 +1,224 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.LocalizedString; + +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; + +/** + * + * A representation of the model object 'Advice'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice Main Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice Sub Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getApplicability Applicability}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getAdvice() + * @model + * @generated + */ +public interface Advice extends EObject { + /** + * Returns the value of the 'Main Advice' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode}. + * + *

+ * If the meaning of the 'Main Advice' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Main Advice' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see #isSetMainAdvice() + * @see #unsetMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getAdvice_MainAdvice() + * @model unsettable="true" + * @generated + */ + AdviceCode getMainAdvice(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice Main Advice}' attribute. + * + * + * @param value the new value of the 'Main Advice' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see #isSetMainAdvice() + * @see #unsetMainAdvice() + * @see #getMainAdvice() + * @generated + */ + void setMainAdvice(AdviceCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice Main Advice}' attribute. + * + * + * @see #isSetMainAdvice() + * @see #getMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @generated + */ + void unsetMainAdvice(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice Main Advice}' attribute is set. + * + * + * @return whether the value of the 'Main Advice' attribute is set. + * @see #unsetMainAdvice() + * @see #getMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @generated + */ + boolean isSetMainAdvice(); + + /** + * Returns the value of the 'Sub Advice' attribute. + * + * + * + * The actual value of this atttribute depends on the adviceCode. So based on the adviceCode it has to be cast to the related enum. + * + * @return the value of the 'Sub Advice' attribute. + * @see #isSetSubAdvice() + * @see #unsetSubAdvice() + * @see #setSubAdvice(Object) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getAdvice_SubAdvice() + * @model unsettable="true" + * @generated + */ + Object getSubAdvice(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice Sub Advice}' attribute. + * + * + * @param value the new value of the 'Sub Advice' attribute. + * @see #isSetSubAdvice() + * @see #unsetSubAdvice() + * @see #getSubAdvice() + * @generated + */ + void setSubAdvice(Object value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice Sub Advice}' attribute. + * + * + * @see #isSetSubAdvice() + * @see #getSubAdvice() + * @see #setSubAdvice(Object) + * @generated + */ + void unsetSubAdvice(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice Sub Advice}' attribute is set. + * + * + * @return whether the value of the 'Sub Advice' attribute is set. + * @see #unsetSubAdvice() + * @see #getSubAdvice() + * @see #setSubAdvice(Object) + * @generated + */ + boolean isSetSubAdvice(); + + /** + * Returns the value of the 'Free Text' containment reference list. + * The list contents are of type {@link org.genivi.common.LocalizedString}. + * + *

+ * If the meaning of the 'Free Text' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Free Text' containment reference list. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getAdvice_FreeText() + * @model containment="true" unsettable="true" + * @generated + */ + EList getFreeText(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getFreeText Free Text}' containment reference list. + * + * + * @see #isSetFreeText() + * @see #getFreeText() + * @generated + */ + void unsetFreeText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getFreeText Free Text}' containment reference list is set. + * + * + * @return whether the value of the 'Free Text' containment reference list is set. + * @see #unsetFreeText() + * @see #getFreeText() + * @generated + */ + boolean isSetFreeText(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see #isSetApplicability() + * @see #unsetApplicability() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getAdvice_Applicability() + * @model containment="true" unsettable="true" + * @generated + */ + EList getApplicability(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getApplicability Applicability}' containment reference list. + * + * + * @see #isSetApplicability() + * @see #getApplicability() + * @generated + */ + void unsetApplicability(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getApplicability Applicability}' containment reference list is set. + * + * + * @return whether the value of the 'Applicability' containment reference list is set. + * @see #unsetApplicability() + * @see #getApplicability() + * @generated + */ + boolean isSetApplicability(); + +} // Advice diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Applicability.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Applicability.java new file mode 100755 index 0000000..ecdc99a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Applicability.java @@ -0,0 +1,129 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; + +/** + * + * A representation of the model object 'Applicability'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType Vehicle Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getApplicability() + * @model + * @generated + */ +public interface Applicability extends EObject { + /** + * Returns the value of the 'Vehicle Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType}. + * + *

+ * If the meaning of the 'Vehicle Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Vehicle Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see #isSetVehicleType() + * @see #unsetVehicleType() + * @see #setVehicleType(VehicleType) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getApplicability_VehicleType() + * @model unsettable="true" + * @generated + */ + VehicleType getVehicleType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute. + * + * + * @param value the new value of the 'Vehicle Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see #isSetVehicleType() + * @see #unsetVehicleType() + * @see #getVehicleType() + * @generated + */ + void setVehicleType(VehicleType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute. + * + * + * @see #isSetVehicleType() + * @see #getVehicleType() + * @see #setVehicleType(VehicleType) + * @generated + */ + void unsetVehicleType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute is set. + * + * + * @return whether the value of the 'Vehicle Type' attribute is set. + * @see #unsetVehicleType() + * @see #getVehicleType() + * @see #setVehicleType(VehicleType) + * @generated + */ + boolean isSetVehicleType(); + + /** + * Returns the value of the 'Vehicle Related Restrictions' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction}. + * + *

+ * If the meaning of the 'Vehicle Related Restrictions' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Vehicle Related Restrictions' containment reference list. + * @see #isSetVehicleRelatedRestrictions() + * @see #unsetVehicleRelatedRestrictions() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getApplicability_VehicleRelatedRestrictions() + * @model containment="true" unsettable="true" + * @generated + */ + EList getVehicleRelatedRestrictions(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}' containment reference list. + * + * + * @see #isSetVehicleRelatedRestrictions() + * @see #getVehicleRelatedRestrictions() + * @generated + */ + void unsetVehicleRelatedRestrictions(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}' containment reference list is set. + * + * + * @return whether the value of the 'Vehicle Related Restrictions' containment reference list is set. + * @see #unsetVehicleRelatedRestrictions() + * @see #getVehicleRelatedRestrictions() + * @generated + */ + boolean isSetVehicleRelatedRestrictions(); + +} // Applicability diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Cause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Cause.java new file mode 100755 index 0000000..82482e6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/Cause.java @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; + +/** + * + * A representation of the model object 'Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause Main Cause}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getCause() + * @model + * @generated + */ +public interface Cause extends EObject { + /** + * Returns the value of the 'Main Cause' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode}. + * + *

+ * If the meaning of the 'Main Cause' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Main Cause' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see #isSetMainCause() + * @see #unsetMainCause() + * @see #setMainCause(CauseCode) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getCause_MainCause() + * @model unsettable="true" + * @generated + */ + CauseCode getMainCause(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause Main Cause}' attribute. + * + * + * @param value the new value of the 'Main Cause' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see #isSetMainCause() + * @see #unsetMainCause() + * @see #getMainCause() + * @generated + */ + void setMainCause(CauseCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause Main Cause}' attribute. + * + * + * @see #isSetMainCause() + * @see #getMainCause() + * @see #setMainCause(CauseCode) + * @generated + */ + void unsetMainCause(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause Main Cause}' attribute is set. + * + * + * @return whether the value of the 'Main Cause' attribute is set. + * @see #unsetMainCause() + * @see #getMainCause() + * @see #setMainCause(CauseCode) + * @generated + */ + boolean isSetMainCause(); + +} // Cause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/DirectCause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/DirectCause.java new file mode 100755 index 0000000..7cd8f94 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/DirectCause.java @@ -0,0 +1,398 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.genivi.common.LocalizedString; + +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * + * A representation of the model object 'Direct Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel Warning Level}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause Sub Cause}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset Cause Offset}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause() + * @model + * @generated + */ +public interface DirectCause extends Cause { + /** + * Returns the value of the 'Warning Level' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel}. + * + *

+ * If the meaning of the 'Warning Level' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Warning Level' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see #isSetWarningLevel() + * @see #unsetWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_WarningLevel() + * @model unsettable="true" required="true" + * @generated + */ + WarningLevel getWarningLevel(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute. + * + * + * @param value the new value of the 'Warning Level' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see #isSetWarningLevel() + * @see #unsetWarningLevel() + * @see #getWarningLevel() + * @generated + */ + void setWarningLevel(WarningLevel value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute. + * + * + * @see #isSetWarningLevel() + * @see #getWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @generated + */ + void unsetWarningLevel(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute is set. + * + * + * @return whether the value of the 'Warning Level' attribute is set. + * @see #unsetWarningLevel() + * @see #getWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @generated + */ + boolean isSetWarningLevel(); + + /** + * Returns the value of the 'Unverified Information' attribute. + * + *

+ * If the meaning of the 'Unverified Information' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Unverified Information' attribute. + * @see #isSetUnverifiedInformation() + * @see #unsetUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_UnverifiedInformation() + * @model unsettable="true" required="true" + * @generated + */ + boolean isUnverifiedInformation(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute. + * + * + * @param value the new value of the 'Unverified Information' attribute. + * @see #isSetUnverifiedInformation() + * @see #unsetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @generated + */ + void setUnverifiedInformation(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute. + * + * + * @see #isSetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @generated + */ + void unsetUnverifiedInformation(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute is set. + * + * + * @return whether the value of the 'Unverified Information' attribute is set. + * @see #unsetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @generated + */ + boolean isSetUnverifiedInformation(); + + /** + * Returns the value of the 'Sub Cause' attribute. + * + * + * + * The actual value of this atttribute depends on the mainCause. So based on the mainCause it has to be cast to the related enum. + * + * @return the value of the 'Sub Cause' attribute. + * @see #isSetSubCause() + * @see #unsetSubCause() + * @see #setSubCause(Object) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_SubCause() + * @model unsettable="true" + * @generated + */ + Object getSubCause(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause Sub Cause}' attribute. + * + * + * @param value the new value of the 'Sub Cause' attribute. + * @see #isSetSubCause() + * @see #unsetSubCause() + * @see #getSubCause() + * @generated + */ + void setSubCause(Object value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause Sub Cause}' attribute. + * + * + * @see #isSetSubCause() + * @see #getSubCause() + * @see #setSubCause(Object) + * @generated + */ + void unsetSubCause(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause Sub Cause}' attribute is set. + * + * + * @return whether the value of the 'Sub Cause' attribute is set. + * @see #unsetSubCause() + * @see #getSubCause() + * @see #setSubCause(Object) + * @generated + */ + boolean isSetSubCause(); + + /** + * Returns the value of the 'Length Affected' attribute. + * + *

+ * If the meaning of the 'Length Affected' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #setLengthAffected(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_LengthAffected() + * @model unsettable="true" + * @generated + */ + Integer getLengthAffected(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute. + * + * + * @param value the new value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @generated + */ + void setLengthAffected(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute. + * + * + * @see #isSetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + void unsetLengthAffected(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute is set. + * + * + * @return whether the value of the 'Length Affected' attribute is set. + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + boolean isSetLengthAffected(); + + /** + * Returns the value of the 'Lane Restrictions' containment reference. + * + *

+ * If the meaning of the 'Lane Restrictions' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Lane Restrictions' containment reference. + * @see #isSetLaneRestrictions() + * @see #unsetLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_LaneRestrictions() + * @model containment="true" unsettable="true" + * @generated + */ + LaneRestrictions getLaneRestrictions(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference. + * + * + * @param value the new value of the 'Lane Restrictions' containment reference. + * @see #isSetLaneRestrictions() + * @see #unsetLaneRestrictions() + * @see #getLaneRestrictions() + * @generated + */ + void setLaneRestrictions(LaneRestrictions value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference. + * + * + * @see #isSetLaneRestrictions() + * @see #getLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @generated + */ + void unsetLaneRestrictions(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference is set. + * + * + * @return whether the value of the 'Lane Restrictions' containment reference is set. + * @see #unsetLaneRestrictions() + * @see #getLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @generated + */ + boolean isSetLaneRestrictions(); + + /** + * Returns the value of the 'Free Text' containment reference list. + * The list contents are of type {@link org.genivi.common.LocalizedString}. + * + *

+ * If the meaning of the 'Free Text' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Free Text' containment reference list. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_FreeText() + * @model containment="true" unsettable="true" + * @generated + */ + EList getFreeText(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getFreeText Free Text}' containment reference list. + * + * + * @see #isSetFreeText() + * @see #getFreeText() + * @generated + */ + void unsetFreeText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getFreeText Free Text}' containment reference list is set. + * + * + * @return whether the value of the 'Free Text' containment reference list is set. + * @see #unsetFreeText() + * @see #getFreeText() + * @generated + */ + boolean isSetFreeText(); + + /** + * Returns the value of the 'Cause Offset' attribute. + * + *

+ * If the meaning of the 'Cause Offset' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Cause Offset' attribute. + * @see #isSetCauseOffset() + * @see #unsetCauseOffset() + * @see #setCauseOffset(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getDirectCause_CauseOffset() + * @model unsettable="true" + * @generated + */ + Integer getCauseOffset(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute. + * + * + * @param value the new value of the 'Cause Offset' attribute. + * @see #isSetCauseOffset() + * @see #unsetCauseOffset() + * @see #getCauseOffset() + * @generated + */ + void setCauseOffset(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute. + * + * + * @see #isSetCauseOffset() + * @see #getCauseOffset() + * @see #setCauseOffset(Integer) + * @generated + */ + void unsetCauseOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute is set. + * + * + * @return whether the value of the 'Cause Offset' attribute is set. + * @see #unsetCauseOffset() + * @see #getCauseOffset() + * @see #setCauseOffset(Integer) + * @generated + */ + boolean isSetCauseOffset(); + +} // DirectCause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LaneRestrictions.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LaneRestrictions.java new file mode 100755 index 0000000..856d61b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LaneRestrictions.java @@ -0,0 +1,141 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; + +/** + * + * A representation of the model object 'Lane Restrictions'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getLaneRestrictions() + * @model + * @generated + */ +public interface LaneRestrictions extends EObject { + /** + * Returns the value of the 'Lane Restriction Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType}. + * + *

+ * If the meaning of the 'Lane Restriction Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Lane Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see #isSetLaneRestrictionType() + * @see #unsetLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getLaneRestrictions_LaneRestrictionType() + * @model unsettable="true" + * @generated + */ + LaneRestrictionType getLaneRestrictionType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute. + * + * + * @param value the new value of the 'Lane Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see #isSetLaneRestrictionType() + * @see #unsetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @generated + */ + void setLaneRestrictionType(LaneRestrictionType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute. + * + * + * @see #isSetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @generated + */ + void unsetLaneRestrictionType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute is set. + * + * + * @return whether the value of the 'Lane Restriction Type' attribute is set. + * @see #unsetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @generated + */ + boolean isSetLaneRestrictionType(); + + /** + * Returns the value of the 'Number Of Lanes' attribute. + * + *

+ * If the meaning of the 'Number Of Lanes' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Number Of Lanes' attribute. + * @see #isSetNumberOfLanes() + * @see #unsetNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getLaneRestrictions_NumberOfLanes() + * @model unsettable="true" + * @generated + */ + Integer getNumberOfLanes(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute. + * + * + * @param value the new value of the 'Number Of Lanes' attribute. + * @see #isSetNumberOfLanes() + * @see #unsetNumberOfLanes() + * @see #getNumberOfLanes() + * @generated + */ + void setNumberOfLanes(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute. + * + * + * @see #isSetNumberOfLanes() + * @see #getNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @generated + */ + void unsetNumberOfLanes(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute is set. + * + * + * @return whether the value of the 'Number Of Lanes' attribute is set. + * @see #unsetNumberOfLanes() + * @see #getNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @generated + */ + boolean isSetNumberOfLanes(); + +} // LaneRestrictions diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LinkedCause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LinkedCause.java new file mode 100755 index 0000000..1c60e45 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/LinkedCause.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + + +/** + * + * A representation of the model object 'Linked Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getLinkedCause() + * @model + * @generated + */ +public interface LinkedCause extends Cause { + /** + * Returns the value of the 'Cause Traffic Incident Id' attribute. + * + * + * + * There can be a LinkedCause for which the linked TrafficIncident isn't available (to the application) yet. Therefore this atttibute is optional. + * + * @return the value of the 'Cause Traffic Incident Id' attribute. + * @see #isSetCauseTrafficIncidentId() + * @see #unsetCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(String) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getLinkedCause_CauseTrafficIncidentId() + * @model unsettable="true" + * @generated + */ + String getCauseTrafficIncidentId(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute. + * + * + * @param value the new value of the 'Cause Traffic Incident Id' attribute. + * @see #isSetCauseTrafficIncidentId() + * @see #unsetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @generated + */ + void setCauseTrafficIncidentId(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute. + * + * + * @see #isSetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(String) + * @generated + */ + void unsetCauseTrafficIncidentId(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute is set. + * + * + * @return whether the value of the 'Cause Traffic Incident Id' attribute is set. + * @see #unsetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(String) + * @generated + */ + boolean isSetCauseTrafficIncidentId(); + +} // LinkedCause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimit.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimit.java new file mode 100755 index 0000000..d8714e7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimit.java @@ -0,0 +1,145 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Temporary Speed Limit'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections Temporary Speed Limit Sections}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset Offset}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getApplicability Applicability}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimit() + * @model + * @generated + */ +public interface TemporarySpeedLimit extends EObject { + /** + * Returns the value of the 'Temporary Speed Limit Sections' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection}. + * + *

+ * If the meaning of the 'Temporary Speed Limit Sections' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Temporary Speed Limit Sections' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimit_TemporarySpeedLimitSections() + * @model containment="true" required="true" + * @generated + */ + EList getTemporarySpeedLimitSections(); + + /** + * Returns the value of the 'Units MPH' attribute. + * + *

+ * If the meaning of the 'Units MPH' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Units MPH' attribute. + * @see #setUnitsMPH(boolean) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimit_UnitsMPH() + * @model required="true" + * @generated + */ + boolean isUnitsMPH(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}' attribute. + * + * + * @param value the new value of the 'Units MPH' attribute. + * @see #isUnitsMPH() + * @generated + */ + void setUnitsMPH(boolean value); + + /** + * Returns the value of the 'Offset' attribute. + * + *

+ * If the meaning of the 'Offset' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Offset' attribute. + * @see #isSetOffset() + * @see #unsetOffset() + * @see #setOffset(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimit_Offset() + * @model unsettable="true" + * @generated + */ + Integer getOffset(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute. + * + * + * @param value the new value of the 'Offset' attribute. + * @see #isSetOffset() + * @see #unsetOffset() + * @see #getOffset() + * @generated + */ + void setOffset(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute. + * + * + * @see #isSetOffset() + * @see #getOffset() + * @see #setOffset(Integer) + * @generated + */ + void unsetOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute is set. + * + * + * @return whether the value of the 'Offset' attribute is set. + * @see #unsetOffset() + * @see #getOffset() + * @see #setOffset(Integer) + * @generated + */ + boolean isSetOffset(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimit_Applicability() + * @model containment="true" + * @generated + */ + EList getApplicability(); + +} // TemporarySpeedLimit diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimitSection.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimitSection.java new file mode 100755 index 0000000..c106369 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TemporarySpeedLimitSection.java @@ -0,0 +1,190 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Temporary Speed Limit Section'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimitSection() + * @model + * @generated + */ +public interface TemporarySpeedLimitSection extends EObject { + /** + * Returns the value of the 'Speed Limit Value' attribute. + * + *

+ * If the meaning of the 'Speed Limit Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Value' attribute. + * @see #isSetSpeedLimitValue() + * @see #unsetSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimitSection_SpeedLimitValue() + * @model unsettable="true" required="true" + * @generated + */ + short getSpeedLimitValue(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute. + * + * + * @param value the new value of the 'Speed Limit Value' attribute. + * @see #isSetSpeedLimitValue() + * @see #unsetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @generated + */ + void setSpeedLimitValue(short value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute. + * + * + * @see #isSetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @generated + */ + void unsetSpeedLimitValue(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Value' attribute is set. + * @see #unsetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @generated + */ + boolean isSetSpeedLimitValue(); + + /** + * Returns the value of the 'Speed Limit Value Wet' attribute. + * + *

+ * If the meaning of the 'Speed Limit Value Wet' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Value Wet' attribute. + * @see #isSetSpeedLimitValueWet() + * @see #unsetSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimitSection_SpeedLimitValueWet() + * @model unsettable="true" + * @generated + */ + short getSpeedLimitValueWet(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute. + * + * + * @param value the new value of the 'Speed Limit Value Wet' attribute. + * @see #isSetSpeedLimitValueWet() + * @see #unsetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @generated + */ + void setSpeedLimitValueWet(short value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute. + * + * + * @see #isSetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @generated + */ + void unsetSpeedLimitValueWet(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Value Wet' attribute is set. + * @see #unsetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @generated + */ + boolean isSetSpeedLimitValueWet(); + + /** + * Returns the value of the 'Speed Limit Length' attribute. + * + *

+ * If the meaning of the 'Speed Limit Length' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Length' attribute. + * @see #isSetSpeedLimitLength() + * @see #unsetSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTemporarySpeedLimitSection_SpeedLimitLength() + * @model unsettable="true" + * @generated + */ + Integer getSpeedLimitLength(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute. + * + * + * @param value the new value of the 'Speed Limit Length' attribute. + * @see #isSetSpeedLimitLength() + * @see #unsetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @generated + */ + void setSpeedLimitLength(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute. + * + * + * @see #isSetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @generated + */ + void unsetSpeedLimitLength(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Length' attribute is set. + * @see #unsetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @generated + */ + boolean isSetSpeedLimitLength(); + +} // TemporarySpeedLimitSection diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TrafficIncident.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TrafficIncident.java new file mode 100755 index 0000000..21085f3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/TrafficIncident.java @@ -0,0 +1,886 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import java.util.Date; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.locref.LocationReference; + +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; + +/** + * + * A representation of the model object 'Traffic Incident'. + * + * + * + * See http://vos.intra.local/display/GENIVI/GENIVI+Traffic+Information+-+Traffic+Incident+Definition for definitions of the meanings of the attributes. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode Effect Code}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime Start Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime Stop Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency Tendency}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay Delay}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getCauses Causes}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAdvices Advices}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime Expiration Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime Update Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference Location Reference}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTemporarySpeedLimit Temporary Speed Limit}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident() + * @model + * @generated + */ +public interface TrafficIncident extends EObject { + /** + * Returns the value of the 'Effect Code' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode}. + * + *

+ * If the meaning of the 'Effect Code' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Effect Code' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see #isSetEffectCode() + * @see #unsetEffectCode() + * @see #setEffectCode(EffectCode) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_EffectCode() + * @model unsettable="true" required="true" + * @generated + */ + EffectCode getEffectCode(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute. + * + * + * @param value the new value of the 'Effect Code' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see #isSetEffectCode() + * @see #unsetEffectCode() + * @see #getEffectCode() + * @generated + */ + void setEffectCode(EffectCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute. + * + * + * @see #isSetEffectCode() + * @see #getEffectCode() + * @see #setEffectCode(EffectCode) + * @generated + */ + void unsetEffectCode(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute is set. + * + * + * @return whether the value of the 'Effect Code' attribute is set. + * @see #unsetEffectCode() + * @see #getEffectCode() + * @see #setEffectCode(EffectCode) + * @generated + */ + boolean isSetEffectCode(); + + /** + * Returns the value of the 'Start Time' attribute. + * + *

+ * If the meaning of the 'Start Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Start Time' attribute. + * @see #isSetStartTime() + * @see #unsetStartTime() + * @see #setStartTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_StartTime() + * @model unsettable="true" + * @generated + */ + Date getStartTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime Start Time}' attribute. + * + * + * @param value the new value of the 'Start Time' attribute. + * @see #isSetStartTime() + * @see #unsetStartTime() + * @see #getStartTime() + * @generated + */ + void setStartTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime Start Time}' attribute. + * + * + * @see #isSetStartTime() + * @see #getStartTime() + * @see #setStartTime(Date) + * @generated + */ + void unsetStartTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime Start Time}' attribute is set. + * + * + * @return whether the value of the 'Start Time' attribute is set. + * @see #unsetStartTime() + * @see #getStartTime() + * @see #setStartTime(Date) + * @generated + */ + boolean isSetStartTime(); + + /** + * Returns the value of the 'Stop Time' attribute. + * + *

+ * If the meaning of the 'Stop Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Stop Time' attribute. + * @see #isSetStopTime() + * @see #unsetStopTime() + * @see #setStopTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_StopTime() + * @model unsettable="true" + * @generated + */ + Date getStopTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute. + * + * + * @param value the new value of the 'Stop Time' attribute. + * @see #isSetStopTime() + * @see #unsetStopTime() + * @see #getStopTime() + * @generated + */ + void setStopTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute. + * + * + * @see #isSetStopTime() + * @see #getStopTime() + * @see #setStopTime(Date) + * @generated + */ + void unsetStopTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute is set. + * + * + * @return whether the value of the 'Stop Time' attribute is set. + * @see #unsetStopTime() + * @see #getStopTime() + * @see #setStopTime(Date) + * @generated + */ + boolean isSetStopTime(); + + /** + * Returns the value of the 'Tendency' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.Tendency}. + * + *

+ * If the meaning of the 'Tendency' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Tendency' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see #isSetTendency() + * @see #unsetTendency() + * @see #setTendency(Tendency) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_Tendency() + * @model unsettable="true" + * @generated + */ + Tendency getTendency(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency Tendency}' attribute. + * + * + * @param value the new value of the 'Tendency' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see #isSetTendency() + * @see #unsetTendency() + * @see #getTendency() + * @generated + */ + void setTendency(Tendency value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency Tendency}' attribute. + * + * + * @see #isSetTendency() + * @see #getTendency() + * @see #setTendency(Tendency) + * @generated + */ + void unsetTendency(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency Tendency}' attribute is set. + * + * + * @return whether the value of the 'Tendency' attribute is set. + * @see #unsetTendency() + * @see #getTendency() + * @see #setTendency(Tendency) + * @generated + */ + boolean isSetTendency(); + + /** + * Returns the value of the 'Length Affected' attribute. + * + *

+ * If the meaning of the 'Length Affected' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #setLengthAffected(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_LengthAffected() + * @model unsettable="true" + * @generated + */ + Integer getLengthAffected(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute. + * + * + * @param value the new value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @generated + */ + void setLengthAffected(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute. + * + * + * @see #isSetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + void unsetLengthAffected(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute is set. + * + * + * @return whether the value of the 'Length Affected' attribute is set. + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + boolean isSetLengthAffected(); + + /** + * Returns the value of the 'Average Speed Absolute' attribute. + * + *

+ * If the meaning of the 'Average Speed Absolute' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Average Speed Absolute' attribute. + * @see #isSetAverageSpeedAbsolute() + * @see #unsetAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_AverageSpeedAbsolute() + * @model unsettable="true" + * @generated + */ + Integer getAverageSpeedAbsolute(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute. + * + * + * @param value the new value of the 'Average Speed Absolute' attribute. + * @see #isSetAverageSpeedAbsolute() + * @see #unsetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @generated + */ + void setAverageSpeedAbsolute(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute. + * + * + * @see #isSetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @generated + */ + void unsetAverageSpeedAbsolute(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute is set. + * + * + * @return whether the value of the 'Average Speed Absolute' attribute is set. + * @see #unsetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @generated + */ + boolean isSetAverageSpeedAbsolute(); + + /** + * Returns the value of the 'Delay' attribute. + * + *

+ * If the meaning of the 'Delay' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Delay' attribute. + * @see #isSetDelay() + * @see #unsetDelay() + * @see #setDelay(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_Delay() + * @model unsettable="true" + * @generated + */ + Integer getDelay(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay Delay}' attribute. + * + * + * @param value the new value of the 'Delay' attribute. + * @see #isSetDelay() + * @see #unsetDelay() + * @see #getDelay() + * @generated + */ + void setDelay(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay Delay}' attribute. + * + * + * @see #isSetDelay() + * @see #getDelay() + * @see #setDelay(Integer) + * @generated + */ + void unsetDelay(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay Delay}' attribute is set. + * + * + * @return whether the value of the 'Delay' attribute is set. + * @see #unsetDelay() + * @see #getDelay() + * @see #setDelay(Integer) + * @generated + */ + boolean isSetDelay(); + + /** + * Returns the value of the 'Segment Speed Limit' attribute. + * + *

+ * If the meaning of the 'Segment Speed Limit' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Segment Speed Limit' attribute. + * @see #isSetSegmentSpeedLimit() + * @see #unsetSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_SegmentSpeedLimit() + * @model unsettable="true" + * @generated + */ + Integer getSegmentSpeedLimit(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute. + * + * + * @param value the new value of the 'Segment Speed Limit' attribute. + * @see #isSetSegmentSpeedLimit() + * @see #unsetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @generated + */ + void setSegmentSpeedLimit(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute. + * + * + * @see #isSetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @generated + */ + void unsetSegmentSpeedLimit(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute is set. + * + * + * @return whether the value of the 'Segment Speed Limit' attribute is set. + * @see #unsetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @generated + */ + boolean isSetSegmentSpeedLimit(); + + /** + * Returns the value of the 'Causes' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause}. + * + *

+ * If the meaning of the 'Causes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Causes' containment reference list. + * @see #isSetCauses() + * @see #unsetCauses() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_Causes() + * @model containment="true" unsettable="true" + * @generated + */ + EList getCauses(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getCauses Causes}' containment reference list. + * + * + * @see #isSetCauses() + * @see #getCauses() + * @generated + */ + void unsetCauses(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getCauses Causes}' containment reference list is set. + * + * + * @return whether the value of the 'Causes' containment reference list is set. + * @see #unsetCauses() + * @see #getCauses() + * @generated + */ + boolean isSetCauses(); + + /** + * Returns the value of the 'Advices' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice}. + * + *

+ * If the meaning of the 'Advices' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Advices' containment reference list. + * @see #isSetAdvices() + * @see #unsetAdvices() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_Advices() + * @model containment="true" unsettable="true" + * @generated + */ + EList getAdvices(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAdvices Advices}' containment reference list. + * + * + * @see #isSetAdvices() + * @see #getAdvices() + * @generated + */ + void unsetAdvices(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAdvices Advices}' containment reference list is set. + * + * + * @return whether the value of the 'Advices' containment reference list is set. + * @see #unsetAdvices() + * @see #getAdvices() + * @generated + */ + boolean isSetAdvices(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see #isSetApplicability() + * @see #unsetApplicability() + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_Applicability() + * @model containment="true" unsettable="true" + * @generated + */ + EList getApplicability(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getApplicability Applicability}' containment reference list. + * + * + * @see #isSetApplicability() + * @see #getApplicability() + * @generated + */ + void unsetApplicability(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getApplicability Applicability}' containment reference list is set. + * + * + * @return whether the value of the 'Applicability' containment reference list is set. + * @see #unsetApplicability() + * @see #getApplicability() + * @generated + */ + boolean isSetApplicability(); + + /** + * Returns the value of the 'Traffic Incident Id' attribute. + * + *

+ * If the meaning of the 'Traffic Incident Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Traffic Incident Id' attribute. + * @see #isSetTrafficIncidentId() + * @see #unsetTrafficIncidentId() + * @see #setTrafficIncidentId(String) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_TrafficIncidentId() + * @model unsettable="true" + * @generated + */ + String getTrafficIncidentId(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute. + * + * + * @param value the new value of the 'Traffic Incident Id' attribute. + * @see #isSetTrafficIncidentId() + * @see #unsetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @generated + */ + void setTrafficIncidentId(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute. + * + * + * @see #isSetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @see #setTrafficIncidentId(String) + * @generated + */ + void unsetTrafficIncidentId(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute is set. + * + * + * @return whether the value of the 'Traffic Incident Id' attribute is set. + * @see #unsetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @see #setTrafficIncidentId(String) + * @generated + */ + boolean isSetTrafficIncidentId(); + + /** + * Returns the value of the 'Expected Speed Absolute' attribute. + * + *

+ * If the meaning of the 'Expected Speed Absolute' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expected Speed Absolute' attribute. + * @see #isSetExpectedSpeedAbsolute() + * @see #unsetExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_ExpectedSpeedAbsolute() + * @model unsettable="true" + * @generated + */ + Integer getExpectedSpeedAbsolute(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute. + * + * + * @param value the new value of the 'Expected Speed Absolute' attribute. + * @see #isSetExpectedSpeedAbsolute() + * @see #unsetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @generated + */ + void setExpectedSpeedAbsolute(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute. + * + * + * @see #isSetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @generated + */ + void unsetExpectedSpeedAbsolute(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute is set. + * + * + * @return whether the value of the 'Expected Speed Absolute' attribute is set. + * @see #unsetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @generated + */ + boolean isSetExpectedSpeedAbsolute(); + + /** + * Returns the value of the 'Expiration Time' attribute. + * + *

+ * If the meaning of the 'Expiration Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expiration Time' attribute. + * @see #isSetExpirationTime() + * @see #unsetExpirationTime() + * @see #setExpirationTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_ExpirationTime() + * @model unsettable="true" + * @generated + */ + Date getExpirationTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime Expiration Time}' attribute. + * + * + * @param value the new value of the 'Expiration Time' attribute. + * @see #isSetExpirationTime() + * @see #unsetExpirationTime() + * @see #getExpirationTime() + * @generated + */ + void setExpirationTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime Expiration Time}' attribute. + * + * + * @see #isSetExpirationTime() + * @see #getExpirationTime() + * @see #setExpirationTime(Date) + * @generated + */ + void unsetExpirationTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime Expiration Time}' attribute is set. + * + * + * @return whether the value of the 'Expiration Time' attribute is set. + * @see #unsetExpirationTime() + * @see #getExpirationTime() + * @see #setExpirationTime(Date) + * @generated + */ + boolean isSetExpirationTime(); + + /** + * Returns the value of the 'Update Time' attribute. + * + *

+ * If the meaning of the 'Update Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Update Time' attribute. + * @see #isSetUpdateTime() + * @see #unsetUpdateTime() + * @see #setUpdateTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_UpdateTime() + * @model unsettable="true" + * @generated + */ + Date getUpdateTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime Update Time}' attribute. + * + * + * @param value the new value of the 'Update Time' attribute. + * @see #isSetUpdateTime() + * @see #unsetUpdateTime() + * @see #getUpdateTime() + * @generated + */ + void setUpdateTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime Update Time}' attribute. + * + * + * @see #isSetUpdateTime() + * @see #getUpdateTime() + * @see #setUpdateTime(Date) + * @generated + */ + void unsetUpdateTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime Update Time}' attribute is set. + * + * + * @return whether the value of the 'Update Time' attribute is set. + * @see #unsetUpdateTime() + * @see #getUpdateTime() + * @see #setUpdateTime(Date) + * @generated + */ + boolean isSetUpdateTime(); + + /** + * Returns the value of the 'Location Reference' containment reference. + * + *

+ * If the meaning of the 'Location Reference' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location Reference' containment reference. + * @see #isSetLocationReference() + * @see #unsetLocationReference() + * @see #setLocationReference(LocationReference) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_LocationReference() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + LocationReference getLocationReference(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference Location Reference}' containment reference. + * + * + * @param value the new value of the 'Location Reference' containment reference. + * @see #isSetLocationReference() + * @see #unsetLocationReference() + * @see #getLocationReference() + * @generated + */ + void setLocationReference(LocationReference value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference Location Reference}' containment reference. + * + * + * @see #isSetLocationReference() + * @see #getLocationReference() + * @see #setLocationReference(LocationReference) + * @generated + */ + void unsetLocationReference(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference Location Reference}' containment reference is set. + * + * + * @return whether the value of the 'Location Reference' containment reference is set. + * @see #unsetLocationReference() + * @see #getLocationReference() + * @see #setLocationReference(LocationReference) + * @generated + */ + boolean isSetLocationReference(); + + /** + * Returns the value of the 'Temporary Speed Limit' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit}. + * + *

+ * If the meaning of the 'Temporary Speed Limit' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Temporary Speed Limit' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getTrafficIncident_TemporarySpeedLimit() + * @model containment="true" + * @generated + */ + EList getTemporarySpeedLimit(); + +} // TrafficIncident diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/VehicleRelatedRestriction.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/VehicleRelatedRestriction.java new file mode 100755 index 0000000..a0a5930 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/VehicleRelatedRestriction.java @@ -0,0 +1,197 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.locref.LocationReference; + +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; + +/** + * + * A representation of the model object 'Vehicle Related Restriction'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference Restriction Location Reference}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getVehicleRelatedRestriction() + * @model + * @generated + */ +public interface VehicleRelatedRestriction extends EObject { + /** + * Returns the value of the 'Restriction Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType}. + * + *

+ * If the meaning of the 'Restriction Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see #isSetRestrictionType() + * @see #unsetRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getVehicleRelatedRestriction_RestrictionType() + * @model unsettable="true" required="true" + * @generated + */ + RestrictionType getRestrictionType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute. + * + * + * @param value the new value of the 'Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see #isSetRestrictionType() + * @see #unsetRestrictionType() + * @see #getRestrictionType() + * @generated + */ + void setRestrictionType(RestrictionType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute. + * + * + * @see #isSetRestrictionType() + * @see #getRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @generated + */ + void unsetRestrictionType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute is set. + * + * + * @return whether the value of the 'Restriction Type' attribute is set. + * @see #unsetRestrictionType() + * @see #getRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @generated + */ + boolean isSetRestrictionType(); + + /** + * Returns the value of the 'Restriction Value' attribute. + * + *

+ * If the meaning of the 'Restriction Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Value' attribute. + * @see #isSetRestrictionValue() + * @see #unsetRestrictionValue() + * @see #setRestrictionValue(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getVehicleRelatedRestriction_RestrictionValue() + * @model unsettable="true" + * @generated + */ + Integer getRestrictionValue(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute. + * + * + * @param value the new value of the 'Restriction Value' attribute. + * @see #isSetRestrictionValue() + * @see #unsetRestrictionValue() + * @see #getRestrictionValue() + * @generated + */ + void setRestrictionValue(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute. + * + * + * @see #isSetRestrictionValue() + * @see #getRestrictionValue() + * @see #setRestrictionValue(Integer) + * @generated + */ + void unsetRestrictionValue(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute is set. + * + * + * @return whether the value of the 'Restriction Value' attribute is set. + * @see #unsetRestrictionValue() + * @see #getRestrictionValue() + * @see #setRestrictionValue(Integer) + * @generated + */ + boolean isSetRestrictionValue(); + + /** + * Returns the value of the 'Restriction Location Reference' containment reference. + * + *

+ * If the meaning of the 'Restriction Location Reference' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Location Reference' containment reference. + * @see #isSetRestrictionLocationReference() + * @see #unsetRestrictionLocationReference() + * @see #setRestrictionLocationReference(LocationReference) + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#getVehicleRelatedRestriction_RestrictionLocationReference() + * @model containment="true" unsettable="true" + * @generated + */ + LocationReference getRestrictionLocationReference(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference Restriction Location Reference}' containment reference. + * + * + * @param value the new value of the 'Restriction Location Reference' containment reference. + * @see #isSetRestrictionLocationReference() + * @see #unsetRestrictionLocationReference() + * @see #getRestrictionLocationReference() + * @generated + */ + void setRestrictionLocationReference(LocationReference value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference Restriction Location Reference}' containment reference. + * + * + * @see #isSetRestrictionLocationReference() + * @see #getRestrictionLocationReference() + * @see #setRestrictionLocationReference(LocationReference) + * @generated + */ + void unsetRestrictionLocationReference(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference Restriction Location Reference}' containment reference is set. + * + * + * @return whether the value of the 'Restriction Location Reference' containment reference is set. + * @see #unsetRestrictionLocationReference() + * @see #getRestrictionLocationReference() + * @see #setRestrictionLocationReference(LocationReference) + * @generated + */ + boolean isSetRestrictionLocationReference(); + +} // VehicleRelatedRestriction diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentFactory.java new file mode 100755 index 0000000..368d8f4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentFactory.java @@ -0,0 +1,128 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage + * @generated + */ +public interface XTrafficIncidentFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + XTrafficIncidentFactory eINSTANCE = org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentFactoryImpl.init(); + + /** + * Returns a new object of class 'Traffic Incident'. + * + * + * @return a new object of class 'Traffic Incident'. + * @generated + */ + TrafficIncident createTrafficIncident(); + + /** + * Returns a new object of class 'Cause'. + * + * + * @return a new object of class 'Cause'. + * @generated + */ + Cause createCause(); + + /** + * Returns a new object of class 'Linked Cause'. + * + * + * @return a new object of class 'Linked Cause'. + * @generated + */ + LinkedCause createLinkedCause(); + + /** + * Returns a new object of class 'Direct Cause'. + * + * + * @return a new object of class 'Direct Cause'. + * @generated + */ + DirectCause createDirectCause(); + + /** + * Returns a new object of class 'Lane Restrictions'. + * + * + * @return a new object of class 'Lane Restrictions'. + * @generated + */ + LaneRestrictions createLaneRestrictions(); + + /** + * Returns a new object of class 'Advice'. + * + * + * @return a new object of class 'Advice'. + * @generated + */ + Advice createAdvice(); + + /** + * Returns a new object of class 'Applicability'. + * + * + * @return a new object of class 'Applicability'. + * @generated + */ + Applicability createApplicability(); + + /** + * Returns a new object of class 'Vehicle Related Restriction'. + * + * + * @return a new object of class 'Vehicle Related Restriction'. + * @generated + */ + VehicleRelatedRestriction createVehicleRelatedRestriction(); + + /** + * Returns a new object of class 'Temporary Speed Limit Section'. + * + * + * @return a new object of class 'Temporary Speed Limit Section'. + * @generated + */ + TemporarySpeedLimitSection createTemporarySpeedLimitSection(); + + /** + * Returns a new object of class 'Temporary Speed Limit'. + * + * + * @return a new object of class 'Temporary Speed Limit'. + * @generated + */ + TemporarySpeedLimit createTemporarySpeedLimit(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + XTrafficIncidentPackage getXTrafficIncidentPackage(); + +} //XTrafficIncidentFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentPackage.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentPackage.java new file mode 100755 index 0000000..41c774c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/XTrafficIncidentPackage.java @@ -0,0 +1,1730 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface XTrafficIncidentPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "trafficincident"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.xtrafficinfo"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "TrafficIncident"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + XTrafficIncidentPackage eINSTANCE = org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl Traffic Incident}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTrafficIncident() + * @generated + */ + int TRAFFIC_INCIDENT = 0; + + /** + * The feature id for the 'Effect Code' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EFFECT_CODE = 0; + + /** + * The feature id for the 'Start Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__START_TIME = 1; + + /** + * The feature id for the 'Stop Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__STOP_TIME = 2; + + /** + * The feature id for the 'Tendency' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TENDENCY = 3; + + /** + * The feature id for the 'Length Affected' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LENGTH_AFFECTED = 4; + + /** + * The feature id for the 'Average Speed Absolute' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE = 5; + + /** + * The feature id for the 'Delay' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__DELAY = 6; + + /** + * The feature id for the 'Segment Speed Limit' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT = 7; + + /** + * The feature id for the 'Causes' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__CAUSES = 8; + + /** + * The feature id for the 'Advices' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__ADVICES = 9; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__APPLICABILITY = 10; + + /** + * The feature id for the 'Traffic Incident Id' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID = 11; + + /** + * The feature id for the 'Expected Speed Absolute' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE = 12; + + /** + * The feature id for the 'Expiration Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EXPIRATION_TIME = 13; + + /** + * The feature id for the 'Update Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__UPDATE_TIME = 14; + + /** + * The feature id for the 'Location Reference' containment reference. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LOCATION_REFERENCE = 15; + + /** + * The feature id for the 'Temporary Speed Limit' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT = 16; + + /** + * The number of structural features of the 'Traffic Incident' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT_FEATURE_COUNT = 17; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.CauseImpl Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.CauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getCause() + * @generated + */ + int CAUSE = 1; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int CAUSE__MAIN_CAUSE = 0; + + /** + * The number of structural features of the 'Cause' class. + * + * + * @generated + * @ordered + */ + int CAUSE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LinkedCauseImpl Linked Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LinkedCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getLinkedCause() + * @generated + */ + int LINKED_CAUSE = 2; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE__MAIN_CAUSE = CAUSE__MAIN_CAUSE; + + /** + * The feature id for the 'Cause Traffic Incident Id' attribute. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID = CAUSE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Linked Cause' class. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE_FEATURE_COUNT = CAUSE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl Direct Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getDirectCause() + * @generated + */ + int DIRECT_CAUSE = 3; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__MAIN_CAUSE = CAUSE__MAIN_CAUSE; + + /** + * The feature id for the 'Warning Level' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__WARNING_LEVEL = CAUSE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Unverified Information' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__UNVERIFIED_INFORMATION = CAUSE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Sub Cause' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__SUB_CAUSE = CAUSE_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Length Affected' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__LENGTH_AFFECTED = CAUSE_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Lane Restrictions' containment reference. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__LANE_RESTRICTIONS = CAUSE_FEATURE_COUNT + 4; + + /** + * The feature id for the 'Free Text' containment reference list. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__FREE_TEXT = CAUSE_FEATURE_COUNT + 5; + + /** + * The feature id for the 'Cause Offset' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__CAUSE_OFFSET = CAUSE_FEATURE_COUNT + 6; + + /** + * The number of structural features of the 'Direct Cause' class. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE_FEATURE_COUNT = CAUSE_FEATURE_COUNT + 7; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl Lane Restrictions}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getLaneRestrictions() + * @generated + */ + int LANE_RESTRICTIONS = 4; + + /** + * The feature id for the 'Lane Restriction Type' attribute. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE = 0; + + /** + * The feature id for the 'Number Of Lanes' attribute. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS__NUMBER_OF_LANES = 1; + + /** + * The number of structural features of the 'Lane Restrictions' class. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl Advice}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getAdvice() + * @generated + */ + int ADVICE = 5; + + /** + * The feature id for the 'Main Advice' attribute. + * + * + * @generated + * @ordered + */ + int ADVICE__MAIN_ADVICE = 0; + + /** + * The feature id for the 'Sub Advice' attribute. + * + * + * @generated + * @ordered + */ + int ADVICE__SUB_ADVICE = 1; + + /** + * The feature id for the 'Free Text' containment reference list. + * + * + * @generated + * @ordered + */ + int ADVICE__FREE_TEXT = 2; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int ADVICE__APPLICABILITY = 3; + + /** + * The number of structural features of the 'Advice' class. + * + * + * @generated + * @ordered + */ + int ADVICE_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl Applicability}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getApplicability() + * @generated + */ + int APPLICABILITY = 6; + + /** + * The feature id for the 'Vehicle Type' attribute. + * + * + * @generated + * @ordered + */ + int APPLICABILITY__VEHICLE_TYPE = 0; + + /** + * The feature id for the 'Vehicle Related Restrictions' containment reference list. + * + * + * @generated + * @ordered + */ + int APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS = 1; + + /** + * The number of structural features of the 'Applicability' class. + * + * + * @generated + * @ordered + */ + int APPLICABILITY_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl Vehicle Related Restriction}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getVehicleRelatedRestriction() + * @generated + */ + int VEHICLE_RELATED_RESTRICTION = 7; + + /** + * The feature id for the 'Restriction Type' attribute. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE = 0; + + /** + * The feature id for the 'Restriction Value' attribute. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE = 1; + + /** + * The feature id for the 'Restriction Location Reference' containment reference. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE = 2; + + /** + * The number of structural features of the 'Vehicle Related Restriction' class. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION_FEATURE_COUNT = 3; + + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl Temporary Speed Limit Section}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTemporarySpeedLimitSection() + * @generated + */ + int TEMPORARY_SPEED_LIMIT_SECTION = 8; + + /** + * The feature id for the 'Speed Limit Value' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE = 0; + + /** + * The feature id for the 'Speed Limit Value Wet' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET = 1; + + /** + * The feature id for the 'Speed Limit Length' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH = 2; + + /** + * The number of structural features of the 'Temporary Speed Limit Section' class. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION_FEATURE_COUNT = 3; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl Temporary Speed Limit}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTemporarySpeedLimit() + * @generated + */ + int TEMPORARY_SPEED_LIMIT = 9; + + /** + * The feature id for the 'Temporary Speed Limit Sections' containment reference list. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS = 0; + + /** + * The feature id for the 'Units MPH' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__UNITS_MPH = 1; + + /** + * The feature id for the 'Offset' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__OFFSET = 2; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__APPLICABILITY = 3; + + /** + * The number of structural features of the 'Temporary Speed Limit' class. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_FEATURE_COUNT = 4; + + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident Traffic Incident}'. + * + * + * @return the meta object for class 'Traffic Incident'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident + * @generated + */ + EClass getTrafficIncident(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode Effect Code}'. + * + * + * @return the meta object for the attribute 'Effect Code'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getEffectCode() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_EffectCode(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime Start Time}'. + * + * + * @return the meta object for the attribute 'Start Time'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStartTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_StartTime(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime Stop Time}'. + * + * + * @return the meta object for the attribute 'Stop Time'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getStopTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_StopTime(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency Tendency}'. + * + * + * @return the meta object for the attribute 'Tendency'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTendency() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_Tendency(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected Length Affected}'. + * + * + * @return the meta object for the attribute 'Length Affected'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLengthAffected() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_LengthAffected(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}'. + * + * + * @return the meta object for the attribute 'Average Speed Absolute'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAverageSpeedAbsolute() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_AverageSpeedAbsolute(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay Delay}'. + * + * + * @return the meta object for the attribute 'Delay'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getDelay() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_Delay(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}'. + * + * + * @return the meta object for the attribute 'Segment Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getSegmentSpeedLimit() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_SegmentSpeedLimit(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getCauses Causes}'. + * + * + * @return the meta object for the containment reference list 'Causes'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getCauses() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Causes(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAdvices Advices}'. + * + * + * @return the meta object for the containment reference list 'Advices'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getAdvices() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Advices(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getApplicability() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Applicability(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}'. + * + * + * @return the meta object for the attribute 'Traffic Incident Id'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTrafficIncidentId() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_TrafficIncidentId(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}'. + * + * + * @return the meta object for the attribute 'Expected Speed Absolute'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpectedSpeedAbsolute() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_ExpectedSpeedAbsolute(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime Expiration Time}'. + * + * + * @return the meta object for the attribute 'Expiration Time'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getExpirationTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_ExpirationTime(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime Update Time}'. + * + * + * @return the meta object for the attribute 'Update Time'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getUpdateTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_UpdateTime(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference Location Reference}'. + * + * + * @return the meta object for the containment reference 'Location Reference'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getLocationReference() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_LocationReference(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTemporarySpeedLimit Temporary Speed Limit}'. + * + * + * @return the meta object for the containment reference list 'Temporary Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident#getTemporarySpeedLimit() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_TemporarySpeedLimit(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause Cause}'. + * + * + * @return the meta object for class 'Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause + * @generated + */ + EClass getCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause Main Cause}'. + * + * + * @return the meta object for the attribute 'Main Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause#getMainCause() + * @see #getCause() + * @generated + */ + EAttribute getCause_MainCause(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause Linked Cause}'. + * + * + * @return the meta object for class 'Linked Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause + * @generated + */ + EClass getLinkedCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}'. + * + * + * @return the meta object for the attribute 'Cause Traffic Incident Id'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause#getCauseTrafficIncidentId() + * @see #getLinkedCause() + * @generated + */ + EAttribute getLinkedCause_CauseTrafficIncidentId(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause Direct Cause}'. + * + * + * @return the meta object for class 'Direct Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause + * @generated + */ + EClass getDirectCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel Warning Level}'. + * + * + * @return the meta object for the attribute 'Warning Level'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getWarningLevel() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_WarningLevel(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}'. + * + * + * @return the meta object for the attribute 'Unverified Information'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#isUnverifiedInformation() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_UnverifiedInformation(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause Sub Cause}'. + * + * + * @return the meta object for the attribute 'Sub Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getSubCause() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_SubCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected Length Affected}'. + * + * + * @return the meta object for the attribute 'Length Affected'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLengthAffected() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_LengthAffected(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}'. + * + * + * @return the meta object for the containment reference 'Lane Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getLaneRestrictions() + * @see #getDirectCause() + * @generated + */ + EReference getDirectCause_LaneRestrictions(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getFreeText Free Text}'. + * + * + * @return the meta object for the containment reference list 'Free Text'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getFreeText() + * @see #getDirectCause() + * @generated + */ + EReference getDirectCause_FreeText(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset Cause Offset}'. + * + * + * @return the meta object for the attribute 'Cause Offset'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause#getCauseOffset() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_CauseOffset(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions Lane Restrictions}'. + * + * + * @return the meta object for class 'Lane Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions + * @generated + */ + EClass getLaneRestrictions(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}'. + * + * + * @return the meta object for the attribute 'Lane Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getLaneRestrictionType() + * @see #getLaneRestrictions() + * @generated + */ + EAttribute getLaneRestrictions_LaneRestrictionType(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}'. + * + * + * @return the meta object for the attribute 'Number Of Lanes'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions#getNumberOfLanes() + * @see #getLaneRestrictions() + * @generated + */ + EAttribute getLaneRestrictions_NumberOfLanes(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice Advice}'. + * + * + * @return the meta object for class 'Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice + * @generated + */ + EClass getAdvice(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice Main Advice}'. + * + * + * @return the meta object for the attribute 'Main Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getMainAdvice() + * @see #getAdvice() + * @generated + */ + EAttribute getAdvice_MainAdvice(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice Sub Advice}'. + * + * + * @return the meta object for the attribute 'Sub Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getSubAdvice() + * @see #getAdvice() + * @generated + */ + EAttribute getAdvice_SubAdvice(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getFreeText Free Text}'. + * + * + * @return the meta object for the containment reference list 'Free Text'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getFreeText() + * @see #getAdvice() + * @generated + */ + EReference getAdvice_FreeText(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice#getApplicability() + * @see #getAdvice() + * @generated + */ + EReference getAdvice_Applicability(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability Applicability}'. + * + * + * @return the meta object for class 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability + * @generated + */ + EClass getApplicability(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType Vehicle Type}'. + * + * + * @return the meta object for the attribute 'Vehicle Type'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleType() + * @see #getApplicability() + * @generated + */ + EAttribute getApplicability_VehicleType(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}'. + * + * + * @return the meta object for the containment reference list 'Vehicle Related Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability#getVehicleRelatedRestrictions() + * @see #getApplicability() + * @generated + */ + EReference getApplicability_VehicleRelatedRestrictions(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction Vehicle Related Restriction}'. + * + * + * @return the meta object for class 'Vehicle Related Restriction'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction + * @generated + */ + EClass getVehicleRelatedRestriction(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}'. + * + * + * @return the meta object for the attribute 'Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionType() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EAttribute getVehicleRelatedRestriction_RestrictionType(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}'. + * + * + * @return the meta object for the attribute 'Restriction Value'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionValue() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EAttribute getVehicleRelatedRestriction_RestrictionValue(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference Restriction Location Reference}'. + * + * + * @return the meta object for the containment reference 'Restriction Location Reference'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction#getRestrictionLocationReference() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EReference getVehicleRelatedRestriction_RestrictionLocationReference(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection Temporary Speed Limit Section}'. + * + * + * @return the meta object for class 'Temporary Speed Limit Section'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection + * @generated + */ + EClass getTemporarySpeedLimitSection(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}'. + * + * + * @return the meta object for the attribute 'Speed Limit Value'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitValue(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}'. + * + * + * @return the meta object for the attribute 'Speed Limit Value Wet'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitValueWet(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}'. + * + * + * @return the meta object for the attribute 'Speed Limit Length'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitLength(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit Temporary Speed Limit}'. + * + * + * @return the meta object for class 'Temporary Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit + * @generated + */ + EClass getTemporarySpeedLimit(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections Temporary Speed Limit Sections}'. + * + * + * @return the meta object for the containment reference list 'Temporary Speed Limit Sections'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections() + * @see #getTemporarySpeedLimit() + * @generated + */ + EReference getTemporarySpeedLimit_TemporarySpeedLimitSections(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}'. + * + * + * @return the meta object for the attribute 'Units MPH'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#isUnitsMPH() + * @see #getTemporarySpeedLimit() + * @generated + */ + EAttribute getTemporarySpeedLimit_UnitsMPH(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset Offset}'. + * + * + * @return the meta object for the attribute 'Offset'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getOffset() + * @see #getTemporarySpeedLimit() + * @generated + */ + EAttribute getTemporarySpeedLimit_Offset(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit#getApplicability() + * @see #getTemporarySpeedLimit() + * @generated + */ + EReference getTemporarySpeedLimit_Applicability(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + XTrafficIncidentFactory getXTrafficIncidentFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl Traffic Incident}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTrafficIncident() + * @generated + */ + EClass TRAFFIC_INCIDENT = eINSTANCE.getTrafficIncident(); + + /** + * The meta object literal for the 'Effect Code' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EFFECT_CODE = eINSTANCE.getTrafficIncident_EffectCode(); + + /** + * The meta object literal for the 'Start Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__START_TIME = eINSTANCE.getTrafficIncident_StartTime(); + + /** + * The meta object literal for the 'Stop Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__STOP_TIME = eINSTANCE.getTrafficIncident_StopTime(); + + /** + * The meta object literal for the 'Tendency' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__TENDENCY = eINSTANCE.getTrafficIncident_Tendency(); + + /** + * The meta object literal for the 'Length Affected' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__LENGTH_AFFECTED = eINSTANCE.getTrafficIncident_LengthAffected(); + + /** + * The meta object literal for the 'Average Speed Absolute' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE = eINSTANCE.getTrafficIncident_AverageSpeedAbsolute(); + + /** + * The meta object literal for the 'Delay' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__DELAY = eINSTANCE.getTrafficIncident_Delay(); + + /** + * The meta object literal for the 'Segment Speed Limit' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT = eINSTANCE.getTrafficIncident_SegmentSpeedLimit(); + + /** + * The meta object literal for the 'Causes' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__CAUSES = eINSTANCE.getTrafficIncident_Causes(); + + /** + * The meta object literal for the 'Advices' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__ADVICES = eINSTANCE.getTrafficIncident_Advices(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__APPLICABILITY = eINSTANCE.getTrafficIncident_Applicability(); + + /** + * The meta object literal for the 'Traffic Incident Id' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID = eINSTANCE.getTrafficIncident_TrafficIncidentId(); + + /** + * The meta object literal for the 'Expected Speed Absolute' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE = eINSTANCE.getTrafficIncident_ExpectedSpeedAbsolute(); + + /** + * The meta object literal for the 'Expiration Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EXPIRATION_TIME = eINSTANCE.getTrafficIncident_ExpirationTime(); + + /** + * The meta object literal for the 'Update Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__UPDATE_TIME = eINSTANCE.getTrafficIncident_UpdateTime(); + + /** + * The meta object literal for the 'Location Reference' containment reference feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__LOCATION_REFERENCE = eINSTANCE.getTrafficIncident_LocationReference(); + + /** + * The meta object literal for the 'Temporary Speed Limit' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT = eINSTANCE.getTrafficIncident_TemporarySpeedLimit(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.CauseImpl Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.CauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getCause() + * @generated + */ + EClass CAUSE = eINSTANCE.getCause(); + + /** + * The meta object literal for the 'Main Cause' attribute feature. + * + * + * @generated + */ + EAttribute CAUSE__MAIN_CAUSE = eINSTANCE.getCause_MainCause(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LinkedCauseImpl Linked Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LinkedCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getLinkedCause() + * @generated + */ + EClass LINKED_CAUSE = eINSTANCE.getLinkedCause(); + + /** + * The meta object literal for the 'Cause Traffic Incident Id' attribute feature. + * + * + * @generated + */ + EAttribute LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID = eINSTANCE.getLinkedCause_CauseTrafficIncidentId(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl Direct Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getDirectCause() + * @generated + */ + EClass DIRECT_CAUSE = eINSTANCE.getDirectCause(); + + /** + * The meta object literal for the 'Warning Level' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__WARNING_LEVEL = eINSTANCE.getDirectCause_WarningLevel(); + + /** + * The meta object literal for the 'Unverified Information' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__UNVERIFIED_INFORMATION = eINSTANCE.getDirectCause_UnverifiedInformation(); + + /** + * The meta object literal for the 'Sub Cause' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__SUB_CAUSE = eINSTANCE.getDirectCause_SubCause(); + + /** + * The meta object literal for the 'Length Affected' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__LENGTH_AFFECTED = eINSTANCE.getDirectCause_LengthAffected(); + + /** + * The meta object literal for the 'Lane Restrictions' containment reference feature. + * + * + * @generated + */ + EReference DIRECT_CAUSE__LANE_RESTRICTIONS = eINSTANCE.getDirectCause_LaneRestrictions(); + + /** + * The meta object literal for the 'Free Text' containment reference list feature. + * + * + * @generated + */ + EReference DIRECT_CAUSE__FREE_TEXT = eINSTANCE.getDirectCause_FreeText(); + + /** + * The meta object literal for the 'Cause Offset' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__CAUSE_OFFSET = eINSTANCE.getDirectCause_CauseOffset(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl Lane Restrictions}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getLaneRestrictions() + * @generated + */ + EClass LANE_RESTRICTIONS = eINSTANCE.getLaneRestrictions(); + + /** + * The meta object literal for the 'Lane Restriction Type' attribute feature. + * + * + * @generated + */ + EAttribute LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE = eINSTANCE.getLaneRestrictions_LaneRestrictionType(); + + /** + * The meta object literal for the 'Number Of Lanes' attribute feature. + * + * + * @generated + */ + EAttribute LANE_RESTRICTIONS__NUMBER_OF_LANES = eINSTANCE.getLaneRestrictions_NumberOfLanes(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl Advice}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getAdvice() + * @generated + */ + EClass ADVICE = eINSTANCE.getAdvice(); + + /** + * The meta object literal for the 'Main Advice' attribute feature. + * + * + * @generated + */ + EAttribute ADVICE__MAIN_ADVICE = eINSTANCE.getAdvice_MainAdvice(); + + /** + * The meta object literal for the 'Sub Advice' attribute feature. + * + * + * @generated + */ + EAttribute ADVICE__SUB_ADVICE = eINSTANCE.getAdvice_SubAdvice(); + + /** + * The meta object literal for the 'Free Text' containment reference list feature. + * + * + * @generated + */ + EReference ADVICE__FREE_TEXT = eINSTANCE.getAdvice_FreeText(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference ADVICE__APPLICABILITY = eINSTANCE.getAdvice_Applicability(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl Applicability}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getApplicability() + * @generated + */ + EClass APPLICABILITY = eINSTANCE.getApplicability(); + + /** + * The meta object literal for the 'Vehicle Type' attribute feature. + * + * + * @generated + */ + EAttribute APPLICABILITY__VEHICLE_TYPE = eINSTANCE.getApplicability_VehicleType(); + + /** + * The meta object literal for the 'Vehicle Related Restrictions' containment reference list feature. + * + * + * @generated + */ + EReference APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS = eINSTANCE.getApplicability_VehicleRelatedRestrictions(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl Vehicle Related Restriction}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getVehicleRelatedRestriction() + * @generated + */ + EClass VEHICLE_RELATED_RESTRICTION = eINSTANCE.getVehicleRelatedRestriction(); + + /** + * The meta object literal for the 'Restriction Type' attribute feature. + * + * + * @generated + */ + EAttribute VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE = eINSTANCE.getVehicleRelatedRestriction_RestrictionType(); + + /** + * The meta object literal for the 'Restriction Value' attribute feature. + * + * + * @generated + */ + EAttribute VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE = eINSTANCE.getVehicleRelatedRestriction_RestrictionValue(); + + /** + * The meta object literal for the 'Restriction Location Reference' containment reference feature. + * + * + * @generated + */ + EReference VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE = eINSTANCE.getVehicleRelatedRestriction_RestrictionLocationReference(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl Temporary Speed Limit Section}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTemporarySpeedLimitSection() + * @generated + */ + EClass TEMPORARY_SPEED_LIMIT_SECTION = eINSTANCE.getTemporarySpeedLimitSection(); + + /** + * The meta object literal for the 'Speed Limit Value' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitValue(); + + /** + * The meta object literal for the 'Speed Limit Value Wet' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitValueWet(); + + /** + * The meta object literal for the 'Speed Limit Length' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitLength(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl Temporary Speed Limit}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.XTrafficIncidentPackageImpl#getTemporarySpeedLimit() + * @generated + */ + EClass TEMPORARY_SPEED_LIMIT = eINSTANCE.getTemporarySpeedLimit(); + + /** + * The meta object literal for the 'Temporary Speed Limit Sections' containment reference list feature. + * + * + * @generated + */ + EReference TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS = eINSTANCE.getTemporarySpeedLimit_TemporarySpeedLimitSections(); + + /** + * The meta object literal for the 'Units MPH' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT__UNITS_MPH = eINSTANCE.getTemporarySpeedLimit_UnitsMPH(); + + /** + * The meta object literal for the 'Offset' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT__OFFSET = eINSTANCE.getTemporarySpeedLimit_Offset(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference TEMPORARY_SPEED_LIMIT__APPLICABILITY = eINSTANCE.getTemporarySpeedLimit_Applicability(); + + } + +} //XTrafficIncidentPackage diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/AdviceImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/AdviceImpl.java new file mode 100755 index 0000000..fc188b3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/AdviceImpl.java @@ -0,0 +1,425 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.common.LocalizedString; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; + + +/** + * + * An implementation of the model object 'Advice'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl#getMainAdvice Main Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl#getSubAdvice Sub Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.AdviceImpl#getApplicability Applicability}
  • + *
+ *

+ * + * @generated + */ +public class AdviceImpl extends EObjectImpl implements Advice { + /** + * The default value of the '{@link #getMainAdvice() Main Advice}' attribute. + * + * + * @see #getMainAdvice() + * @generated + * @ordered + */ + protected static final AdviceCode MAIN_ADVICE_EDEFAULT = AdviceCode.DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE; + + /** + * The cached value of the '{@link #getMainAdvice() Main Advice}' attribute. + * + * + * @see #getMainAdvice() + * @generated + * @ordered + */ + protected AdviceCode mainAdvice = MAIN_ADVICE_EDEFAULT; + + /** + * This is true if the Main Advice attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean mainAdviceESet; + + /** + * The default value of the '{@link #getSubAdvice() Sub Advice}' attribute. + * + * + * @see #getSubAdvice() + * @generated + * @ordered + */ + protected static final Object SUB_ADVICE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSubAdvice() Sub Advice}' attribute. + * + * + * @see #getSubAdvice() + * @generated + * @ordered + */ + protected Object subAdvice = SUB_ADVICE_EDEFAULT; + + /** + * This is true if the Sub Advice attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean subAdviceESet; + + /** + * The cached value of the '{@link #getFreeText() Free Text}' containment reference list. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected EList freeText; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * + * + * @generated + */ + protected AdviceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.ADVICE; + } + + /** + * + * + * @generated + */ + public AdviceCode getMainAdvice() { + return mainAdvice; + } + + /** + * + * + * @generated + */ + public void setMainAdvice(AdviceCode newMainAdvice) { + AdviceCode oldMainAdvice = mainAdvice; + mainAdvice = newMainAdvice == null ? MAIN_ADVICE_EDEFAULT : newMainAdvice; + boolean oldMainAdviceESet = mainAdviceESet; + mainAdviceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.ADVICE__MAIN_ADVICE, oldMainAdvice, mainAdvice, !oldMainAdviceESet)); + } + + /** + * + * + * @generated + */ + public void unsetMainAdvice() { + AdviceCode oldMainAdvice = mainAdvice; + boolean oldMainAdviceESet = mainAdviceESet; + mainAdvice = MAIN_ADVICE_EDEFAULT; + mainAdviceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.ADVICE__MAIN_ADVICE, oldMainAdvice, MAIN_ADVICE_EDEFAULT, oldMainAdviceESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMainAdvice() { + return mainAdviceESet; + } + + /** + * + * + * @generated + */ + public Object getSubAdvice() { + return subAdvice; + } + + /** + * + * + * @generated + */ + public void setSubAdvice(Object newSubAdvice) { + Object oldSubAdvice = subAdvice; + subAdvice = newSubAdvice; + boolean oldSubAdviceESet = subAdviceESet; + subAdviceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.ADVICE__SUB_ADVICE, oldSubAdvice, subAdvice, !oldSubAdviceESet)); + } + + /** + * + * + * @generated + */ + public void unsetSubAdvice() { + Object oldSubAdvice = subAdvice; + boolean oldSubAdviceESet = subAdviceESet; + subAdvice = SUB_ADVICE_EDEFAULT; + subAdviceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.ADVICE__SUB_ADVICE, oldSubAdvice, SUB_ADVICE_EDEFAULT, oldSubAdviceESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSubAdvice() { + return subAdviceESet; + } + + /** + * + * + * @generated + */ + public EList getFreeText() { + if (freeText == null) { + freeText = new EObjectContainmentEList.Unsettable(LocalizedString.class, this, XTrafficIncidentPackage.ADVICE__FREE_TEXT); + } + return freeText; + } + + /** + * + * + * @generated + */ + public void unsetFreeText() { + if (freeText != null) ((InternalEList.Unsettable)freeText).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetFreeText() { + return freeText != null && ((InternalEList.Unsettable)freeText).isSet(); + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList.Unsettable(Applicability.class, this, XTrafficIncidentPackage.ADVICE__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + public void unsetApplicability() { + if (applicability != null) ((InternalEList.Unsettable)applicability).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetApplicability() { + return applicability != null && ((InternalEList.Unsettable)applicability).isSet(); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.ADVICE__FREE_TEXT: + return ((InternalEList)getFreeText()).basicRemove(otherEnd, msgs); + case XTrafficIncidentPackage.ADVICE__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.ADVICE__MAIN_ADVICE: + return getMainAdvice(); + case XTrafficIncidentPackage.ADVICE__SUB_ADVICE: + return getSubAdvice(); + case XTrafficIncidentPackage.ADVICE__FREE_TEXT: + return getFreeText(); + case XTrafficIncidentPackage.ADVICE__APPLICABILITY: + return getApplicability(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.ADVICE__MAIN_ADVICE: + setMainAdvice((AdviceCode)newValue); + return; + case XTrafficIncidentPackage.ADVICE__SUB_ADVICE: + setSubAdvice(newValue); + return; + case XTrafficIncidentPackage.ADVICE__FREE_TEXT: + getFreeText().clear(); + getFreeText().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.ADVICE__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.ADVICE__MAIN_ADVICE: + unsetMainAdvice(); + return; + case XTrafficIncidentPackage.ADVICE__SUB_ADVICE: + unsetSubAdvice(); + return; + case XTrafficIncidentPackage.ADVICE__FREE_TEXT: + unsetFreeText(); + return; + case XTrafficIncidentPackage.ADVICE__APPLICABILITY: + unsetApplicability(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.ADVICE__MAIN_ADVICE: + return isSetMainAdvice(); + case XTrafficIncidentPackage.ADVICE__SUB_ADVICE: + return isSetSubAdvice(); + case XTrafficIncidentPackage.ADVICE__FREE_TEXT: + return isSetFreeText(); + case XTrafficIncidentPackage.ADVICE__APPLICABILITY: + return isSetApplicability(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mainAdvice: "); + if (mainAdviceESet) result.append(mainAdvice); else result.append(""); + result.append(", subAdvice: "); + if (subAdviceESet) result.append(subAdvice); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //AdviceImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/ApplicabilityImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/ApplicabilityImpl.java new file mode 100755 index 0000000..178b1ff --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/ApplicabilityImpl.java @@ -0,0 +1,281 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; + + +/** + * + * An implementation of the model object 'Applicability'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl#getVehicleType Vehicle Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.ApplicabilityImpl#getVehicleRelatedRestrictions Vehicle Related Restrictions}
  • + *
+ *

+ * + * @generated + */ +public class ApplicabilityImpl extends EObjectImpl implements Applicability { + /** + * The default value of the '{@link #getVehicleType() Vehicle Type}' attribute. + * + * + * @see #getVehicleType() + * @generated + * @ordered + */ + protected static final VehicleType VEHICLE_TYPE_EDEFAULT = VehicleType.CAR; + + /** + * The cached value of the '{@link #getVehicleType() Vehicle Type}' attribute. + * + * + * @see #getVehicleType() + * @generated + * @ordered + */ + protected VehicleType vehicleType = VEHICLE_TYPE_EDEFAULT; + + /** + * This is true if the Vehicle Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean vehicleTypeESet; + + /** + * The cached value of the '{@link #getVehicleRelatedRestrictions() Vehicle Related Restrictions}' containment reference list. + * + * + * @see #getVehicleRelatedRestrictions() + * @generated + * @ordered + */ + protected EList vehicleRelatedRestrictions; + + /** + * + * + * @generated + */ + protected ApplicabilityImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.APPLICABILITY; + } + + /** + * + * + * @generated + */ + public VehicleType getVehicleType() { + return vehicleType; + } + + /** + * + * + * @generated + */ + public void setVehicleType(VehicleType newVehicleType) { + VehicleType oldVehicleType = vehicleType; + vehicleType = newVehicleType == null ? VEHICLE_TYPE_EDEFAULT : newVehicleType; + boolean oldVehicleTypeESet = vehicleTypeESet; + vehicleTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE, oldVehicleType, vehicleType, !oldVehicleTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetVehicleType() { + VehicleType oldVehicleType = vehicleType; + boolean oldVehicleTypeESet = vehicleTypeESet; + vehicleType = VEHICLE_TYPE_EDEFAULT; + vehicleTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE, oldVehicleType, VEHICLE_TYPE_EDEFAULT, oldVehicleTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetVehicleType() { + return vehicleTypeESet; + } + + /** + * + * + * @generated + */ + public EList getVehicleRelatedRestrictions() { + if (vehicleRelatedRestrictions == null) { + vehicleRelatedRestrictions = new EObjectContainmentEList.Unsettable(VehicleRelatedRestriction.class, this, XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS); + } + return vehicleRelatedRestrictions; + } + + /** + * + * + * @generated + */ + public void unsetVehicleRelatedRestrictions() { + if (vehicleRelatedRestrictions != null) ((InternalEList.Unsettable)vehicleRelatedRestrictions).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetVehicleRelatedRestrictions() { + return vehicleRelatedRestrictions != null && ((InternalEList.Unsettable)vehicleRelatedRestrictions).isSet(); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return ((InternalEList)getVehicleRelatedRestrictions()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE: + return getVehicleType(); + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return getVehicleRelatedRestrictions(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE: + setVehicleType((VehicleType)newValue); + return; + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + getVehicleRelatedRestrictions().clear(); + getVehicleRelatedRestrictions().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE: + unsetVehicleType(); + return; + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + unsetVehicleRelatedRestrictions(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_TYPE: + return isSetVehicleType(); + case XTrafficIncidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return isSetVehicleRelatedRestrictions(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (vehicleType: "); + if (vehicleTypeESet) result.append(vehicleType); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //ApplicabilityImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/CauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/CauseImpl.java new file mode 100755 index 0000000..3eec292 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/CauseImpl.java @@ -0,0 +1,204 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; + + +/** + * + * An implementation of the model object 'Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.CauseImpl#getMainCause Main Cause}
  • + *
+ *

+ * + * @generated + */ +public class CauseImpl extends EObjectImpl implements Cause { + /** + * The default value of the '{@link #getMainCause() Main Cause}' attribute. + * + * + * @see #getMainCause() + * @generated + * @ordered + */ + protected static final CauseCode MAIN_CAUSE_EDEFAULT = CauseCode.TRAFFIC_CONGESTION; + + /** + * The cached value of the '{@link #getMainCause() Main Cause}' attribute. + * + * + * @see #getMainCause() + * @generated + * @ordered + */ + protected CauseCode mainCause = MAIN_CAUSE_EDEFAULT; + + /** + * This is true if the Main Cause attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean mainCauseESet; + + /** + * + * + * @generated + */ + protected CauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.CAUSE; + } + + /** + * + * + * @generated + */ + public CauseCode getMainCause() { + return mainCause; + } + + /** + * + * + * @generated + */ + public void setMainCause(CauseCode newMainCause) { + CauseCode oldMainCause = mainCause; + mainCause = newMainCause == null ? MAIN_CAUSE_EDEFAULT : newMainCause; + boolean oldMainCauseESet = mainCauseESet; + mainCauseESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.CAUSE__MAIN_CAUSE, oldMainCause, mainCause, !oldMainCauseESet)); + } + + /** + * + * + * @generated + */ + public void unsetMainCause() { + CauseCode oldMainCause = mainCause; + boolean oldMainCauseESet = mainCauseESet; + mainCause = MAIN_CAUSE_EDEFAULT; + mainCauseESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.CAUSE__MAIN_CAUSE, oldMainCause, MAIN_CAUSE_EDEFAULT, oldMainCauseESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMainCause() { + return mainCauseESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.CAUSE__MAIN_CAUSE: + return getMainCause(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.CAUSE__MAIN_CAUSE: + setMainCause((CauseCode)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.CAUSE__MAIN_CAUSE: + unsetMainCause(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.CAUSE__MAIN_CAUSE: + return isSetMainCause(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mainCause: "); + if (mainCauseESet) result.append(mainCause); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //CauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/DirectCauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/DirectCauseImpl.java new file mode 100755 index 0000000..b74af4f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/DirectCauseImpl.java @@ -0,0 +1,761 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.common.LocalizedString; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + + +/** + * + * An implementation of the model object 'Direct Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getWarningLevel Warning Level}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#isUnverifiedInformation Unverified Information}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getSubCause Sub Cause}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getLaneRestrictions Lane Restrictions}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.DirectCauseImpl#getCauseOffset Cause Offset}
  • + *
+ *

+ * + * @generated + */ +public class DirectCauseImpl extends CauseImpl implements DirectCause { + /** + * The default value of the '{@link #getWarningLevel() Warning Level}' attribute. + * + * + * @see #getWarningLevel() + * @generated + * @ordered + */ + protected static final WarningLevel WARNING_LEVEL_EDEFAULT = WarningLevel.INFORMATIVE; + + /** + * The cached value of the '{@link #getWarningLevel() Warning Level}' attribute. + * + * + * @see #getWarningLevel() + * @generated + * @ordered + */ + protected WarningLevel warningLevel = WARNING_LEVEL_EDEFAULT; + + /** + * This is true if the Warning Level attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean warningLevelESet; + + /** + * The default value of the '{@link #isUnverifiedInformation() Unverified Information}' attribute. + * + * + * @see #isUnverifiedInformation() + * @generated + * @ordered + */ + protected static final boolean UNVERIFIED_INFORMATION_EDEFAULT = false; + + /** + * The cached value of the '{@link #isUnverifiedInformation() Unverified Information}' attribute. + * + * + * @see #isUnverifiedInformation() + * @generated + * @ordered + */ + protected boolean unverifiedInformation = UNVERIFIED_INFORMATION_EDEFAULT; + + /** + * This is true if the Unverified Information attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean unverifiedInformationESet; + + /** + * The default value of the '{@link #getSubCause() Sub Cause}' attribute. + * + * + * @see #getSubCause() + * @generated + * @ordered + */ + protected static final Object SUB_CAUSE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSubCause() Sub Cause}' attribute. + * + * + * @see #getSubCause() + * @generated + * @ordered + */ + protected Object subCause = SUB_CAUSE_EDEFAULT; + + /** + * This is true if the Sub Cause attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean subCauseESet; + + /** + * The default value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected static final Integer LENGTH_AFFECTED_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected Integer lengthAffected = LENGTH_AFFECTED_EDEFAULT; + + /** + * This is true if the Length Affected attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean lengthAffectedESet; + + /** + * The cached value of the '{@link #getLaneRestrictions() Lane Restrictions}' containment reference. + * + * + * @see #getLaneRestrictions() + * @generated + * @ordered + */ + protected LaneRestrictions laneRestrictions; + + /** + * This is true if the Lane Restrictions containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean laneRestrictionsESet; + + /** + * The cached value of the '{@link #getFreeText() Free Text}' containment reference list. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected EList freeText; + + /** + * The default value of the '{@link #getCauseOffset() Cause Offset}' attribute. + * + * + * @see #getCauseOffset() + * @generated + * @ordered + */ + protected static final Integer CAUSE_OFFSET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCauseOffset() Cause Offset}' attribute. + * + * + * @see #getCauseOffset() + * @generated + * @ordered + */ + protected Integer causeOffset = CAUSE_OFFSET_EDEFAULT; + + /** + * This is true if the Cause Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean causeOffsetESet; + + /** + * + * + * @generated + */ + protected DirectCauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.DIRECT_CAUSE; + } + + /** + * + * + * @generated + */ + public WarningLevel getWarningLevel() { + return warningLevel; + } + + /** + * + * + * @generated + */ + public void setWarningLevel(WarningLevel newWarningLevel) { + WarningLevel oldWarningLevel = warningLevel; + warningLevel = newWarningLevel == null ? WARNING_LEVEL_EDEFAULT : newWarningLevel; + boolean oldWarningLevelESet = warningLevelESet; + warningLevelESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL, oldWarningLevel, warningLevel, !oldWarningLevelESet)); + } + + /** + * + * + * @generated + */ + public void unsetWarningLevel() { + WarningLevel oldWarningLevel = warningLevel; + boolean oldWarningLevelESet = warningLevelESet; + warningLevel = WARNING_LEVEL_EDEFAULT; + warningLevelESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL, oldWarningLevel, WARNING_LEVEL_EDEFAULT, oldWarningLevelESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetWarningLevel() { + return warningLevelESet; + } + + /** + * + * + * @generated + */ + public boolean isUnverifiedInformation() { + return unverifiedInformation; + } + + /** + * + * + * @generated + */ + public void setUnverifiedInformation(boolean newUnverifiedInformation) { + boolean oldUnverifiedInformation = unverifiedInformation; + unverifiedInformation = newUnverifiedInformation; + boolean oldUnverifiedInformationESet = unverifiedInformationESet; + unverifiedInformationESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION, oldUnverifiedInformation, unverifiedInformation, !oldUnverifiedInformationESet)); + } + + /** + * + * + * @generated + */ + public void unsetUnverifiedInformation() { + boolean oldUnverifiedInformation = unverifiedInformation; + boolean oldUnverifiedInformationESet = unverifiedInformationESet; + unverifiedInformation = UNVERIFIED_INFORMATION_EDEFAULT; + unverifiedInformationESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION, oldUnverifiedInformation, UNVERIFIED_INFORMATION_EDEFAULT, oldUnverifiedInformationESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetUnverifiedInformation() { + return unverifiedInformationESet; + } + + /** + * + * + * @generated + */ + public Object getSubCause() { + return subCause; + } + + /** + * + * + * @generated + */ + public void setSubCause(Object newSubCause) { + Object oldSubCause = subCause; + subCause = newSubCause; + boolean oldSubCauseESet = subCauseESet; + subCauseESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE, oldSubCause, subCause, !oldSubCauseESet)); + } + + /** + * + * + * @generated + */ + public void unsetSubCause() { + Object oldSubCause = subCause; + boolean oldSubCauseESet = subCauseESet; + subCause = SUB_CAUSE_EDEFAULT; + subCauseESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE, oldSubCause, SUB_CAUSE_EDEFAULT, oldSubCauseESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSubCause() { + return subCauseESet; + } + + /** + * + * + * @generated + */ + public Integer getLengthAffected() { + return lengthAffected; + } + + /** + * + * + * @generated + */ + public void setLengthAffected(Integer newLengthAffected) { + Integer oldLengthAffected = lengthAffected; + lengthAffected = newLengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffectedESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED, oldLengthAffected, lengthAffected, !oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public void unsetLengthAffected() { + Integer oldLengthAffected = lengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffected = LENGTH_AFFECTED_EDEFAULT; + lengthAffectedESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED, oldLengthAffected, LENGTH_AFFECTED_EDEFAULT, oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLengthAffected() { + return lengthAffectedESet; + } + + /** + * + * + * @generated + */ + public LaneRestrictions getLaneRestrictions() { + return laneRestrictions; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLaneRestrictions(LaneRestrictions newLaneRestrictions, NotificationChain msgs) { + LaneRestrictions oldLaneRestrictions = laneRestrictions; + laneRestrictions = newLaneRestrictions; + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, oldLaneRestrictions, newLaneRestrictions, !oldLaneRestrictionsESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLaneRestrictions(LaneRestrictions newLaneRestrictions) { + if (newLaneRestrictions != laneRestrictions) { + NotificationChain msgs = null; + if (laneRestrictions != null) + msgs = ((InternalEObject)laneRestrictions).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + if (newLaneRestrictions != null) + msgs = ((InternalEObject)newLaneRestrictions).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + msgs = basicSetLaneRestrictions(newLaneRestrictions, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, newLaneRestrictions, newLaneRestrictions, !oldLaneRestrictionsESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLaneRestrictions(NotificationChain msgs) { + LaneRestrictions oldLaneRestrictions = laneRestrictions; + laneRestrictions = null; + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, oldLaneRestrictions, null, oldLaneRestrictionsESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLaneRestrictions() { + if (laneRestrictions != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)laneRestrictions).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + msgs = basicUnsetLaneRestrictions(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, null, oldLaneRestrictionsESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLaneRestrictions() { + return laneRestrictionsESet; + } + + /** + * + * + * @generated + */ + public EList getFreeText() { + if (freeText == null) { + freeText = new EObjectContainmentEList.Unsettable(LocalizedString.class, this, XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT); + } + return freeText; + } + + /** + * + * + * @generated + */ + public void unsetFreeText() { + if (freeText != null) ((InternalEList.Unsettable)freeText).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetFreeText() { + return freeText != null && ((InternalEList.Unsettable)freeText).isSet(); + } + + /** + * + * + * @generated + */ + public Integer getCauseOffset() { + return causeOffset; + } + + /** + * + * + * @generated + */ + public void setCauseOffset(Integer newCauseOffset) { + Integer oldCauseOffset = causeOffset; + causeOffset = newCauseOffset; + boolean oldCauseOffsetESet = causeOffsetESet; + causeOffsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET, oldCauseOffset, causeOffset, !oldCauseOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetCauseOffset() { + Integer oldCauseOffset = causeOffset; + boolean oldCauseOffsetESet = causeOffsetESet; + causeOffset = CAUSE_OFFSET_EDEFAULT; + causeOffsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET, oldCauseOffset, CAUSE_OFFSET_EDEFAULT, oldCauseOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCauseOffset() { + return causeOffsetESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return basicUnsetLaneRestrictions(msgs); + case XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT: + return ((InternalEList)getFreeText()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + return getWarningLevel(); + case XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + return isUnverifiedInformation(); + case XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE: + return getSubCause(); + case XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + return getLengthAffected(); + case XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return getLaneRestrictions(); + case XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT: + return getFreeText(); + case XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + return getCauseOffset(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + setWarningLevel((WarningLevel)newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + setUnverifiedInformation((Boolean)newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE: + setSubCause(newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + setLengthAffected((Integer)newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + setLaneRestrictions((LaneRestrictions)newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT: + getFreeText().clear(); + getFreeText().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + setCauseOffset((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + unsetWarningLevel(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + unsetUnverifiedInformation(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE: + unsetSubCause(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + unsetLengthAffected(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + unsetLaneRestrictions(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT: + unsetFreeText(); + return; + case XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + unsetCauseOffset(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + return isSetWarningLevel(); + case XTrafficIncidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + return isSetUnverifiedInformation(); + case XTrafficIncidentPackage.DIRECT_CAUSE__SUB_CAUSE: + return isSetSubCause(); + case XTrafficIncidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + return isSetLengthAffected(); + case XTrafficIncidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return isSetLaneRestrictions(); + case XTrafficIncidentPackage.DIRECT_CAUSE__FREE_TEXT: + return isSetFreeText(); + case XTrafficIncidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + return isSetCauseOffset(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (warningLevel: "); + if (warningLevelESet) result.append(warningLevel); else result.append(""); + result.append(", unverifiedInformation: "); + if (unverifiedInformationESet) result.append(unverifiedInformation); else result.append(""); + result.append(", subCause: "); + if (subCauseESet) result.append(subCause); else result.append(""); + result.append(", lengthAffected: "); + if (lengthAffectedESet) result.append(lengthAffected); else result.append(""); + result.append(", causeOffset: "); + if (causeOffsetESet) result.append(causeOffset); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //DirectCauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LaneRestrictionsImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LaneRestrictionsImpl.java new file mode 100755 index 0000000..67178a7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LaneRestrictionsImpl.java @@ -0,0 +1,292 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; + + +/** + * + * An implementation of the model object 'Lane Restrictions'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl#getLaneRestrictionType Lane Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LaneRestrictionsImpl#getNumberOfLanes Number Of Lanes}
  • + *
+ *

+ * + * @generated + */ +public class LaneRestrictionsImpl extends EObjectImpl implements LaneRestrictions { + /** + * The default value of the '{@link #getLaneRestrictionType() Lane Restriction Type}' attribute. + * + * + * @see #getLaneRestrictionType() + * @generated + * @ordered + */ + protected static final LaneRestrictionType LANE_RESTRICTION_TYPE_EDEFAULT = LaneRestrictionType.LANES_CLOSED; + + /** + * The cached value of the '{@link #getLaneRestrictionType() Lane Restriction Type}' attribute. + * + * + * @see #getLaneRestrictionType() + * @generated + * @ordered + */ + protected LaneRestrictionType laneRestrictionType = LANE_RESTRICTION_TYPE_EDEFAULT; + + /** + * This is true if the Lane Restriction Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean laneRestrictionTypeESet; + + /** + * The default value of the '{@link #getNumberOfLanes() Number Of Lanes}' attribute. + * + * + * @see #getNumberOfLanes() + * @generated + * @ordered + */ + protected static final Integer NUMBER_OF_LANES_EDEFAULT = null; + + /** + * The cached value of the '{@link #getNumberOfLanes() Number Of Lanes}' attribute. + * + * + * @see #getNumberOfLanes() + * @generated + * @ordered + */ + protected Integer numberOfLanes = NUMBER_OF_LANES_EDEFAULT; + + /** + * This is true if the Number Of Lanes attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean numberOfLanesESet; + + /** + * + * + * @generated + */ + protected LaneRestrictionsImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.LANE_RESTRICTIONS; + } + + /** + * + * + * @generated + */ + public LaneRestrictionType getLaneRestrictionType() { + return laneRestrictionType; + } + + /** + * + * + * @generated + */ + public void setLaneRestrictionType(LaneRestrictionType newLaneRestrictionType) { + LaneRestrictionType oldLaneRestrictionType = laneRestrictionType; + laneRestrictionType = newLaneRestrictionType == null ? LANE_RESTRICTION_TYPE_EDEFAULT : newLaneRestrictionType; + boolean oldLaneRestrictionTypeESet = laneRestrictionTypeESet; + laneRestrictionTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE, oldLaneRestrictionType, laneRestrictionType, !oldLaneRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetLaneRestrictionType() { + LaneRestrictionType oldLaneRestrictionType = laneRestrictionType; + boolean oldLaneRestrictionTypeESet = laneRestrictionTypeESet; + laneRestrictionType = LANE_RESTRICTION_TYPE_EDEFAULT; + laneRestrictionTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE, oldLaneRestrictionType, LANE_RESTRICTION_TYPE_EDEFAULT, oldLaneRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLaneRestrictionType() { + return laneRestrictionTypeESet; + } + + /** + * + * + * @generated + */ + public Integer getNumberOfLanes() { + return numberOfLanes; + } + + /** + * + * + * @generated + */ + public void setNumberOfLanes(Integer newNumberOfLanes) { + Integer oldNumberOfLanes = numberOfLanes; + numberOfLanes = newNumberOfLanes; + boolean oldNumberOfLanesESet = numberOfLanesESet; + numberOfLanesESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES, oldNumberOfLanes, numberOfLanes, !oldNumberOfLanesESet)); + } + + /** + * + * + * @generated + */ + public void unsetNumberOfLanes() { + Integer oldNumberOfLanes = numberOfLanes; + boolean oldNumberOfLanesESet = numberOfLanesESet; + numberOfLanes = NUMBER_OF_LANES_EDEFAULT; + numberOfLanesESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES, oldNumberOfLanes, NUMBER_OF_LANES_EDEFAULT, oldNumberOfLanesESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNumberOfLanes() { + return numberOfLanesESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + return getLaneRestrictionType(); + case XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + return getNumberOfLanes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + setLaneRestrictionType((LaneRestrictionType)newValue); + return; + case XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + setNumberOfLanes((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + unsetLaneRestrictionType(); + return; + case XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + unsetNumberOfLanes(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + return isSetLaneRestrictionType(); + case XTrafficIncidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + return isSetNumberOfLanes(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (laneRestrictionType: "); + if (laneRestrictionTypeESet) result.append(laneRestrictionType); else result.append(""); + result.append(", numberOfLanes: "); + if (numberOfLanesESet) result.append(numberOfLanes); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LaneRestrictionsImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LinkedCauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LinkedCauseImpl.java new file mode 100755 index 0000000..27c0c13 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/LinkedCauseImpl.java @@ -0,0 +1,201 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; + +/** + * + * An implementation of the model object 'Linked Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.LinkedCauseImpl#getCauseTrafficIncidentId Cause Traffic Incident Id}
  • + *
+ *

+ * + * @generated + */ +public class LinkedCauseImpl extends CauseImpl implements LinkedCause { + /** + * The default value of the '{@link #getCauseTrafficIncidentId() Cause Traffic Incident Id}' attribute. + * + * + * @see #getCauseTrafficIncidentId() + * @generated + * @ordered + */ + protected static final String CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCauseTrafficIncidentId() Cause Traffic Incident Id}' attribute. + * + * + * @see #getCauseTrafficIncidentId() + * @generated + * @ordered + */ + protected String causeTrafficIncidentId = CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT; + + /** + * This is true if the Cause Traffic Incident Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean causeTrafficIncidentIdESet; + + /** + * + * + * @generated + */ + protected LinkedCauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.LINKED_CAUSE; + } + + /** + * + * + * @generated + */ + public String getCauseTrafficIncidentId() { + return causeTrafficIncidentId; + } + + /** + * + * + * @generated + */ + public void setCauseTrafficIncidentId(String newCauseTrafficIncidentId) { + String oldCauseTrafficIncidentId = causeTrafficIncidentId; + causeTrafficIncidentId = newCauseTrafficIncidentId; + boolean oldCauseTrafficIncidentIdESet = causeTrafficIncidentIdESet; + causeTrafficIncidentIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID, oldCauseTrafficIncidentId, causeTrafficIncidentId, !oldCauseTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetCauseTrafficIncidentId() { + String oldCauseTrafficIncidentId = causeTrafficIncidentId; + boolean oldCauseTrafficIncidentIdESet = causeTrafficIncidentIdESet; + causeTrafficIncidentId = CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT; + causeTrafficIncidentIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID, oldCauseTrafficIncidentId, CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT, oldCauseTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCauseTrafficIncidentId() { + return causeTrafficIncidentIdESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + return getCauseTrafficIncidentId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + setCauseTrafficIncidentId((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + unsetCauseTrafficIncidentId(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + return isSetCauseTrafficIncidentId(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (causeTrafficIncidentId: "); + if (causeTrafficIncidentIdESet) result.append(causeTrafficIncidentId); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LinkedCauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitImpl.java new file mode 100755 index 0000000..730d2eb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitImpl.java @@ -0,0 +1,352 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; + +/** + * + * An implementation of the model object 'Temporary Speed Limit'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl#getTemporarySpeedLimitSections Temporary Speed Limit Sections}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl#isUnitsMPH Units MPH}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl#getOffset Offset}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitImpl#getApplicability Applicability}
  • + *
+ *

+ * + * @generated + */ +public class TemporarySpeedLimitImpl extends EObjectImpl implements TemporarySpeedLimit { + /** + * The cached value of the '{@link #getTemporarySpeedLimitSections() Temporary Speed Limit Sections}' containment reference list. + * + * + * @see #getTemporarySpeedLimitSections() + * @generated + * @ordered + */ + protected EList temporarySpeedLimitSections; + + /** + * The default value of the '{@link #isUnitsMPH() Units MPH}' attribute. + * + * + * @see #isUnitsMPH() + * @generated + * @ordered + */ + protected static final boolean UNITS_MPH_EDEFAULT = false; + + /** + * The cached value of the '{@link #isUnitsMPH() Units MPH}' attribute. + * + * + * @see #isUnitsMPH() + * @generated + * @ordered + */ + protected boolean unitsMPH = UNITS_MPH_EDEFAULT; + + /** + * The default value of the '{@link #getOffset() Offset}' attribute. + * + * + * @see #getOffset() + * @generated + * @ordered + */ + protected static final Integer OFFSET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getOffset() Offset}' attribute. + * + * + * @see #getOffset() + * @generated + * @ordered + */ + protected Integer offset = OFFSET_EDEFAULT; + + /** + * This is true if the Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean offsetESet; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * + * + * @generated + */ + protected TemporarySpeedLimitImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.TEMPORARY_SPEED_LIMIT; + } + + /** + * + * + * @generated + */ + public EList getTemporarySpeedLimitSections() { + if (temporarySpeedLimitSections == null) { + temporarySpeedLimitSections = new EObjectContainmentEList(TemporarySpeedLimitSection.class, this, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS); + } + return temporarySpeedLimitSections; + } + + /** + * + * + * @generated + */ + public boolean isUnitsMPH() { + return unitsMPH; + } + + /** + * + * + * @generated + */ + public void setUnitsMPH(boolean newUnitsMPH) { + boolean oldUnitsMPH = unitsMPH; + unitsMPH = newUnitsMPH; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH, oldUnitsMPH, unitsMPH)); + } + + /** + * + * + * @generated + */ + public Integer getOffset() { + return offset; + } + + /** + * + * + * @generated + */ + public void setOffset(Integer newOffset) { + Integer oldOffset = offset; + offset = newOffset; + boolean oldOffsetESet = offsetESet; + offsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET, oldOffset, offset, !oldOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetOffset() { + Integer oldOffset = offset; + boolean oldOffsetESet = offsetESet; + offset = OFFSET_EDEFAULT; + offsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET, oldOffset, OFFSET_EDEFAULT, oldOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetOffset() { + return offsetESet; + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList(Applicability.class, this, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return ((InternalEList)getTemporarySpeedLimitSections()).basicRemove(otherEnd, msgs); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return getTemporarySpeedLimitSections(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + return isUnitsMPH(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + return getOffset(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return getApplicability(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + getTemporarySpeedLimitSections().clear(); + getTemporarySpeedLimitSections().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + setUnitsMPH((Boolean)newValue); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + setOffset((Integer)newValue); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + getTemporarySpeedLimitSections().clear(); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + setUnitsMPH(UNITS_MPH_EDEFAULT); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + unsetOffset(); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + getApplicability().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return temporarySpeedLimitSections != null && !temporarySpeedLimitSections.isEmpty(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + return unitsMPH != UNITS_MPH_EDEFAULT; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + return isSetOffset(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return applicability != null && !applicability.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (unitsMPH: "); + result.append(unitsMPH); + result.append(", offset: "); + if (offsetESet) result.append(offset); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TemporarySpeedLimitImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitSectionImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitSectionImpl.java new file mode 100755 index 0000000..f47ba74 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TemporarySpeedLimitSectionImpl.java @@ -0,0 +1,378 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; + +/** + * + * An implementation of the model object 'Temporary Speed Limit Section'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitValue Speed Limit Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitValueWet Speed Limit Value Wet}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitLength Speed Limit Length}
  • + *
+ *

+ * + * @generated + */ +public class TemporarySpeedLimitSectionImpl extends EObjectImpl implements TemporarySpeedLimitSection { + /** + * The default value of the '{@link #getSpeedLimitValue() Speed Limit Value}' attribute. + * + * + * @see #getSpeedLimitValue() + * @generated + * @ordered + */ + protected static final short SPEED_LIMIT_VALUE_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getSpeedLimitValue() Speed Limit Value}' attribute. + * + * + * @see #getSpeedLimitValue() + * @generated + * @ordered + */ + protected short speedLimitValue = SPEED_LIMIT_VALUE_EDEFAULT; + + /** + * This is true if the Speed Limit Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitValueESet; + + /** + * The default value of the '{@link #getSpeedLimitValueWet() Speed Limit Value Wet}' attribute. + * + * + * @see #getSpeedLimitValueWet() + * @generated + * @ordered + */ + protected static final short SPEED_LIMIT_VALUE_WET_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getSpeedLimitValueWet() Speed Limit Value Wet}' attribute. + * + * + * @see #getSpeedLimitValueWet() + * @generated + * @ordered + */ + protected short speedLimitValueWet = SPEED_LIMIT_VALUE_WET_EDEFAULT; + + /** + * This is true if the Speed Limit Value Wet attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitValueWetESet; + + /** + * The default value of the '{@link #getSpeedLimitLength() Speed Limit Length}' attribute. + * + * + * @see #getSpeedLimitLength() + * @generated + * @ordered + */ + protected static final Integer SPEED_LIMIT_LENGTH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSpeedLimitLength() Speed Limit Length}' attribute. + * + * + * @see #getSpeedLimitLength() + * @generated + * @ordered + */ + protected Integer speedLimitLength = SPEED_LIMIT_LENGTH_EDEFAULT; + + /** + * This is true if the Speed Limit Length attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitLengthESet; + + /** + * + * + * @generated + */ + protected TemporarySpeedLimitSectionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.TEMPORARY_SPEED_LIMIT_SECTION; + } + + /** + * + * + * @generated + */ + public short getSpeedLimitValue() { + return speedLimitValue; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitValue(short newSpeedLimitValue) { + short oldSpeedLimitValue = speedLimitValue; + speedLimitValue = newSpeedLimitValue; + boolean oldSpeedLimitValueESet = speedLimitValueESet; + speedLimitValueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE, oldSpeedLimitValue, speedLimitValue, !oldSpeedLimitValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitValue() { + short oldSpeedLimitValue = speedLimitValue; + boolean oldSpeedLimitValueESet = speedLimitValueESet; + speedLimitValue = SPEED_LIMIT_VALUE_EDEFAULT; + speedLimitValueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE, oldSpeedLimitValue, SPEED_LIMIT_VALUE_EDEFAULT, oldSpeedLimitValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitValue() { + return speedLimitValueESet; + } + + /** + * + * + * @generated + */ + public short getSpeedLimitValueWet() { + return speedLimitValueWet; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitValueWet(short newSpeedLimitValueWet) { + short oldSpeedLimitValueWet = speedLimitValueWet; + speedLimitValueWet = newSpeedLimitValueWet; + boolean oldSpeedLimitValueWetESet = speedLimitValueWetESet; + speedLimitValueWetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET, oldSpeedLimitValueWet, speedLimitValueWet, !oldSpeedLimitValueWetESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitValueWet() { + short oldSpeedLimitValueWet = speedLimitValueWet; + boolean oldSpeedLimitValueWetESet = speedLimitValueWetESet; + speedLimitValueWet = SPEED_LIMIT_VALUE_WET_EDEFAULT; + speedLimitValueWetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET, oldSpeedLimitValueWet, SPEED_LIMIT_VALUE_WET_EDEFAULT, oldSpeedLimitValueWetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitValueWet() { + return speedLimitValueWetESet; + } + + /** + * + * + * @generated + */ + public Integer getSpeedLimitLength() { + return speedLimitLength; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitLength(Integer newSpeedLimitLength) { + Integer oldSpeedLimitLength = speedLimitLength; + speedLimitLength = newSpeedLimitLength; + boolean oldSpeedLimitLengthESet = speedLimitLengthESet; + speedLimitLengthESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH, oldSpeedLimitLength, speedLimitLength, !oldSpeedLimitLengthESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitLength() { + Integer oldSpeedLimitLength = speedLimitLength; + boolean oldSpeedLimitLengthESet = speedLimitLengthESet; + speedLimitLength = SPEED_LIMIT_LENGTH_EDEFAULT; + speedLimitLengthESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH, oldSpeedLimitLength, SPEED_LIMIT_LENGTH_EDEFAULT, oldSpeedLimitLengthESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitLength() { + return speedLimitLengthESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + return getSpeedLimitValue(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + return getSpeedLimitValueWet(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + return getSpeedLimitLength(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + setSpeedLimitValue((Short)newValue); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + setSpeedLimitValueWet((Short)newValue); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + setSpeedLimitLength((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + unsetSpeedLimitValue(); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + unsetSpeedLimitValueWet(); + return; + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + unsetSpeedLimitLength(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + return isSetSpeedLimitValue(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + return isSetSpeedLimitValueWet(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + return isSetSpeedLimitLength(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (speedLimitValue: "); + if (speedLimitValueESet) result.append(speedLimitValue); else result.append(""); + result.append(", speedLimitValueWet: "); + if (speedLimitValueWetESet) result.append(speedLimitValueWet); else result.append(""); + result.append(", speedLimitLength: "); + if (speedLimitLengthESet) result.append(speedLimitLength); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TemporarySpeedLimitSectionImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TrafficIncidentImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TrafficIncidentImpl.java new file mode 100755 index 0000000..70acf9e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/TrafficIncidentImpl.java @@ -0,0 +1,1527 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import java.util.Collection; +import java.util.Date; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.locref.LocationReference; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; + + +/** + * + * An implementation of the model object 'Traffic Incident'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getEffectCode Effect Code}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getStartTime Start Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getStopTime Stop Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getTendency Tendency}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getAverageSpeedAbsolute Average Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getDelay Delay}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getSegmentSpeedLimit Segment Speed Limit}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getCauses Causes}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getAdvices Advices}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getTrafficIncidentId Traffic Incident Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getExpectedSpeedAbsolute Expected Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getExpirationTime Expiration Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getUpdateTime Update Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getLocationReference Location Reference}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.TrafficIncidentImpl#getTemporarySpeedLimit Temporary Speed Limit}
  • + *
+ *

+ * + * @generated + */ +public class TrafficIncidentImpl extends EObjectImpl implements TrafficIncident { + /** + * The default value of the '{@link #getEffectCode() Effect Code}' attribute. + * + * + * @see #getEffectCode() + * @generated + * @ordered + */ + protected static final EffectCode EFFECT_CODE_EDEFAULT = EffectCode.TRAFFIC_FLOW_UNKNOWN; + + /** + * The cached value of the '{@link #getEffectCode() Effect Code}' attribute. + * + * + * @see #getEffectCode() + * @generated + * @ordered + */ + protected EffectCode effectCode = EFFECT_CODE_EDEFAULT; + + /** + * This is true if the Effect Code attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean effectCodeESet; + + /** + * The default value of the '{@link #getStartTime() Start Time}' attribute. + * + * + * @see #getStartTime() + * @generated + * @ordered + */ + protected static final Date START_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStartTime() Start Time}' attribute. + * + * + * @see #getStartTime() + * @generated + * @ordered + */ + protected Date startTime = START_TIME_EDEFAULT; + + /** + * This is true if the Start Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean startTimeESet; + + /** + * The default value of the '{@link #getStopTime() Stop Time}' attribute. + * + * + * @see #getStopTime() + * @generated + * @ordered + */ + protected static final Date STOP_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStopTime() Stop Time}' attribute. + * + * + * @see #getStopTime() + * @generated + * @ordered + */ + protected Date stopTime = STOP_TIME_EDEFAULT; + + /** + * This is true if the Stop Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean stopTimeESet; + + /** + * The default value of the '{@link #getTendency() Tendency}' attribute. + * + * + * @see #getTendency() + * @generated + * @ordered + */ + protected static final Tendency TENDENCY_EDEFAULT = Tendency.SLIGHTLY_INCREASING; + + /** + * The cached value of the '{@link #getTendency() Tendency}' attribute. + * + * + * @see #getTendency() + * @generated + * @ordered + */ + protected Tendency tendency = TENDENCY_EDEFAULT; + + /** + * This is true if the Tendency attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean tendencyESet; + + /** + * The default value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected static final Integer LENGTH_AFFECTED_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected Integer lengthAffected = LENGTH_AFFECTED_EDEFAULT; + + /** + * This is true if the Length Affected attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean lengthAffectedESet; + + /** + * The default value of the '{@link #getAverageSpeedAbsolute() Average Speed Absolute}' attribute. + * + * + * @see #getAverageSpeedAbsolute() + * @generated + * @ordered + */ + protected static final Integer AVERAGE_SPEED_ABSOLUTE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getAverageSpeedAbsolute() Average Speed Absolute}' attribute. + * + * + * @see #getAverageSpeedAbsolute() + * @generated + * @ordered + */ + protected Integer averageSpeedAbsolute = AVERAGE_SPEED_ABSOLUTE_EDEFAULT; + + /** + * This is true if the Average Speed Absolute attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean averageSpeedAbsoluteESet; + + /** + * The default value of the '{@link #getDelay() Delay}' attribute. + * + * + * @see #getDelay() + * @generated + * @ordered + */ + protected static final Integer DELAY_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDelay() Delay}' attribute. + * + * + * @see #getDelay() + * @generated + * @ordered + */ + protected Integer delay = DELAY_EDEFAULT; + + /** + * This is true if the Delay attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean delayESet; + + /** + * The default value of the '{@link #getSegmentSpeedLimit() Segment Speed Limit}' attribute. + * + * + * @see #getSegmentSpeedLimit() + * @generated + * @ordered + */ + protected static final Integer SEGMENT_SPEED_LIMIT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSegmentSpeedLimit() Segment Speed Limit}' attribute. + * + * + * @see #getSegmentSpeedLimit() + * @generated + * @ordered + */ + protected Integer segmentSpeedLimit = SEGMENT_SPEED_LIMIT_EDEFAULT; + + /** + * This is true if the Segment Speed Limit attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean segmentSpeedLimitESet; + + /** + * The cached value of the '{@link #getCauses() Causes}' containment reference list. + * + * + * @see #getCauses() + * @generated + * @ordered + */ + protected EList causes; + + /** + * The cached value of the '{@link #getAdvices() Advices}' containment reference list. + * + * + * @see #getAdvices() + * @generated + * @ordered + */ + protected EList advices; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * The default value of the '{@link #getTrafficIncidentId() Traffic Incident Id}' attribute. + * + * + * @see #getTrafficIncidentId() + * @generated + * @ordered + */ + protected static final String TRAFFIC_INCIDENT_ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getTrafficIncidentId() Traffic Incident Id}' attribute. + * + * + * @see #getTrafficIncidentId() + * @generated + * @ordered + */ + protected String trafficIncidentId = TRAFFIC_INCIDENT_ID_EDEFAULT; + + /** + * This is true if the Traffic Incident Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean trafficIncidentIdESet; + + /** + * The default value of the '{@link #getExpectedSpeedAbsolute() Expected Speed Absolute}' attribute. + * + * + * @see #getExpectedSpeedAbsolute() + * @generated + * @ordered + */ + protected static final Integer EXPECTED_SPEED_ABSOLUTE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getExpectedSpeedAbsolute() Expected Speed Absolute}' attribute. + * + * + * @see #getExpectedSpeedAbsolute() + * @generated + * @ordered + */ + protected Integer expectedSpeedAbsolute = EXPECTED_SPEED_ABSOLUTE_EDEFAULT; + + /** + * This is true if the Expected Speed Absolute attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean expectedSpeedAbsoluteESet; + + /** + * The default value of the '{@link #getExpirationTime() Expiration Time}' attribute. + * + * + * @see #getExpirationTime() + * @generated + * @ordered + */ + protected static final Date EXPIRATION_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getExpirationTime() Expiration Time}' attribute. + * + * + * @see #getExpirationTime() + * @generated + * @ordered + */ + protected Date expirationTime = EXPIRATION_TIME_EDEFAULT; + + /** + * This is true if the Expiration Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean expirationTimeESet; + + /** + * The default value of the '{@link #getUpdateTime() Update Time}' attribute. + * + * + * @see #getUpdateTime() + * @generated + * @ordered + */ + protected static final Date UPDATE_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getUpdateTime() Update Time}' attribute. + * + * + * @see #getUpdateTime() + * @generated + * @ordered + */ + protected Date updateTime = UPDATE_TIME_EDEFAULT; + + /** + * This is true if the Update Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean updateTimeESet; + + /** + * The cached value of the '{@link #getLocationReference() Location Reference}' containment reference. + * + * + * @see #getLocationReference() + * @generated + * @ordered + */ + protected LocationReference locationReference; + + /** + * This is true if the Location Reference containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean locationReferenceESet; + + /** + * The cached value of the '{@link #getTemporarySpeedLimit() Temporary Speed Limit}' containment reference list. + * + * + * @see #getTemporarySpeedLimit() + * @generated + * @ordered + */ + protected EList temporarySpeedLimit; + + /** + * + * + * @generated + */ + protected TrafficIncidentImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.TRAFFIC_INCIDENT; + } + + /** + * + * + * @generated + */ + public EffectCode getEffectCode() { + return effectCode; + } + + /** + * + * + * @generated + */ + public void setEffectCode(EffectCode newEffectCode) { + EffectCode oldEffectCode = effectCode; + effectCode = newEffectCode == null ? EFFECT_CODE_EDEFAULT : newEffectCode; + boolean oldEffectCodeESet = effectCodeESet; + effectCodeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE, oldEffectCode, effectCode, !oldEffectCodeESet)); + } + + /** + * + * + * @generated + */ + public void unsetEffectCode() { + EffectCode oldEffectCode = effectCode; + boolean oldEffectCodeESet = effectCodeESet; + effectCode = EFFECT_CODE_EDEFAULT; + effectCodeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE, oldEffectCode, EFFECT_CODE_EDEFAULT, oldEffectCodeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetEffectCode() { + return effectCodeESet; + } + + /** + * + * + * @generated + */ + public Date getStartTime() { + return startTime; + } + + /** + * + * + * @generated + */ + public void setStartTime(Date newStartTime) { + Date oldStartTime = startTime; + startTime = newStartTime; + boolean oldStartTimeESet = startTimeESet; + startTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME, oldStartTime, startTime, !oldStartTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetStartTime() { + Date oldStartTime = startTime; + boolean oldStartTimeESet = startTimeESet; + startTime = START_TIME_EDEFAULT; + startTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME, oldStartTime, START_TIME_EDEFAULT, oldStartTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetStartTime() { + return startTimeESet; + } + + /** + * + * + * @generated + */ + public Date getStopTime() { + return stopTime; + } + + /** + * + * + * @generated + */ + public void setStopTime(Date newStopTime) { + Date oldStopTime = stopTime; + stopTime = newStopTime; + boolean oldStopTimeESet = stopTimeESet; + stopTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME, oldStopTime, stopTime, !oldStopTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetStopTime() { + Date oldStopTime = stopTime; + boolean oldStopTimeESet = stopTimeESet; + stopTime = STOP_TIME_EDEFAULT; + stopTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME, oldStopTime, STOP_TIME_EDEFAULT, oldStopTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetStopTime() { + return stopTimeESet; + } + + /** + * + * + * @generated + */ + public Tendency getTendency() { + return tendency; + } + + /** + * + * + * @generated + */ + public void setTendency(Tendency newTendency) { + Tendency oldTendency = tendency; + tendency = newTendency == null ? TENDENCY_EDEFAULT : newTendency; + boolean oldTendencyESet = tendencyESet; + tendencyESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY, oldTendency, tendency, !oldTendencyESet)); + } + + /** + * + * + * @generated + */ + public void unsetTendency() { + Tendency oldTendency = tendency; + boolean oldTendencyESet = tendencyESet; + tendency = TENDENCY_EDEFAULT; + tendencyESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY, oldTendency, TENDENCY_EDEFAULT, oldTendencyESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTendency() { + return tendencyESet; + } + + /** + * + * + * @generated + */ + public Integer getLengthAffected() { + return lengthAffected; + } + + /** + * + * + * @generated + */ + public void setLengthAffected(Integer newLengthAffected) { + Integer oldLengthAffected = lengthAffected; + lengthAffected = newLengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffectedESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED, oldLengthAffected, lengthAffected, !oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public void unsetLengthAffected() { + Integer oldLengthAffected = lengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffected = LENGTH_AFFECTED_EDEFAULT; + lengthAffectedESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED, oldLengthAffected, LENGTH_AFFECTED_EDEFAULT, oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLengthAffected() { + return lengthAffectedESet; + } + + /** + * + * + * @generated + */ + public Integer getAverageSpeedAbsolute() { + return averageSpeedAbsolute; + } + + /** + * + * + * @generated + */ + public void setAverageSpeedAbsolute(Integer newAverageSpeedAbsolute) { + Integer oldAverageSpeedAbsolute = averageSpeedAbsolute; + averageSpeedAbsolute = newAverageSpeedAbsolute; + boolean oldAverageSpeedAbsoluteESet = averageSpeedAbsoluteESet; + averageSpeedAbsoluteESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE, oldAverageSpeedAbsolute, averageSpeedAbsolute, !oldAverageSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public void unsetAverageSpeedAbsolute() { + Integer oldAverageSpeedAbsolute = averageSpeedAbsolute; + boolean oldAverageSpeedAbsoluteESet = averageSpeedAbsoluteESet; + averageSpeedAbsolute = AVERAGE_SPEED_ABSOLUTE_EDEFAULT; + averageSpeedAbsoluteESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE, oldAverageSpeedAbsolute, AVERAGE_SPEED_ABSOLUTE_EDEFAULT, oldAverageSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetAverageSpeedAbsolute() { + return averageSpeedAbsoluteESet; + } + + /** + * + * + * @generated + */ + public Integer getDelay() { + return delay; + } + + /** + * + * + * @generated + */ + public void setDelay(Integer newDelay) { + Integer oldDelay = delay; + delay = newDelay; + boolean oldDelayESet = delayESet; + delayESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY, oldDelay, delay, !oldDelayESet)); + } + + /** + * + * + * @generated + */ + public void unsetDelay() { + Integer oldDelay = delay; + boolean oldDelayESet = delayESet; + delay = DELAY_EDEFAULT; + delayESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY, oldDelay, DELAY_EDEFAULT, oldDelayESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDelay() { + return delayESet; + } + + /** + * + * + * @generated + */ + public Integer getSegmentSpeedLimit() { + return segmentSpeedLimit; + } + + /** + * + * + * @generated + */ + public void setSegmentSpeedLimit(Integer newSegmentSpeedLimit) { + Integer oldSegmentSpeedLimit = segmentSpeedLimit; + segmentSpeedLimit = newSegmentSpeedLimit; + boolean oldSegmentSpeedLimitESet = segmentSpeedLimitESet; + segmentSpeedLimitESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT, oldSegmentSpeedLimit, segmentSpeedLimit, !oldSegmentSpeedLimitESet)); + } + + /** + * + * + * @generated + */ + public void unsetSegmentSpeedLimit() { + Integer oldSegmentSpeedLimit = segmentSpeedLimit; + boolean oldSegmentSpeedLimitESet = segmentSpeedLimitESet; + segmentSpeedLimit = SEGMENT_SPEED_LIMIT_EDEFAULT; + segmentSpeedLimitESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT, oldSegmentSpeedLimit, SEGMENT_SPEED_LIMIT_EDEFAULT, oldSegmentSpeedLimitESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSegmentSpeedLimit() { + return segmentSpeedLimitESet; + } + + /** + * + * + * @generated + */ + public EList getCauses() { + if (causes == null) { + causes = new EObjectContainmentEList.Unsettable(Cause.class, this, XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES); + } + return causes; + } + + /** + * + * + * @generated + */ + public void unsetCauses() { + if (causes != null) ((InternalEList.Unsettable)causes).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetCauses() { + return causes != null && ((InternalEList.Unsettable)causes).isSet(); + } + + /** + * + * + * @generated + */ + public EList getAdvices() { + if (advices == null) { + advices = new EObjectContainmentEList.Unsettable(Advice.class, this, XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES); + } + return advices; + } + + /** + * + * + * @generated + */ + public void unsetAdvices() { + if (advices != null) ((InternalEList.Unsettable)advices).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetAdvices() { + return advices != null && ((InternalEList.Unsettable)advices).isSet(); + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList.Unsettable(Applicability.class, this, XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + public void unsetApplicability() { + if (applicability != null) ((InternalEList.Unsettable)applicability).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetApplicability() { + return applicability != null && ((InternalEList.Unsettable)applicability).isSet(); + } + + /** + * + * + * @generated + */ + public String getTrafficIncidentId() { + return trafficIncidentId; + } + + /** + * + * + * @generated + */ + public void setTrafficIncidentId(String newTrafficIncidentId) { + String oldTrafficIncidentId = trafficIncidentId; + trafficIncidentId = newTrafficIncidentId; + boolean oldTrafficIncidentIdESet = trafficIncidentIdESet; + trafficIncidentIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID, oldTrafficIncidentId, trafficIncidentId, !oldTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetTrafficIncidentId() { + String oldTrafficIncidentId = trafficIncidentId; + boolean oldTrafficIncidentIdESet = trafficIncidentIdESet; + trafficIncidentId = TRAFFIC_INCIDENT_ID_EDEFAULT; + trafficIncidentIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID, oldTrafficIncidentId, TRAFFIC_INCIDENT_ID_EDEFAULT, oldTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTrafficIncidentId() { + return trafficIncidentIdESet; + } + + /** + * + * + * @generated + */ + public Integer getExpectedSpeedAbsolute() { + return expectedSpeedAbsolute; + } + + /** + * + * + * @generated + */ + public void setExpectedSpeedAbsolute(Integer newExpectedSpeedAbsolute) { + Integer oldExpectedSpeedAbsolute = expectedSpeedAbsolute; + expectedSpeedAbsolute = newExpectedSpeedAbsolute; + boolean oldExpectedSpeedAbsoluteESet = expectedSpeedAbsoluteESet; + expectedSpeedAbsoluteESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE, oldExpectedSpeedAbsolute, expectedSpeedAbsolute, !oldExpectedSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public void unsetExpectedSpeedAbsolute() { + Integer oldExpectedSpeedAbsolute = expectedSpeedAbsolute; + boolean oldExpectedSpeedAbsoluteESet = expectedSpeedAbsoluteESet; + expectedSpeedAbsolute = EXPECTED_SPEED_ABSOLUTE_EDEFAULT; + expectedSpeedAbsoluteESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE, oldExpectedSpeedAbsolute, EXPECTED_SPEED_ABSOLUTE_EDEFAULT, oldExpectedSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetExpectedSpeedAbsolute() { + return expectedSpeedAbsoluteESet; + } + + /** + * + * + * @generated + */ + public Date getExpirationTime() { + return expirationTime; + } + + /** + * + * + * @generated + */ + public void setExpirationTime(Date newExpirationTime) { + Date oldExpirationTime = expirationTime; + expirationTime = newExpirationTime; + boolean oldExpirationTimeESet = expirationTimeESet; + expirationTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME, oldExpirationTime, expirationTime, !oldExpirationTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetExpirationTime() { + Date oldExpirationTime = expirationTime; + boolean oldExpirationTimeESet = expirationTimeESet; + expirationTime = EXPIRATION_TIME_EDEFAULT; + expirationTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME, oldExpirationTime, EXPIRATION_TIME_EDEFAULT, oldExpirationTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetExpirationTime() { + return expirationTimeESet; + } + + /** + * + * + * @generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * + * + * @generated + */ + public void setUpdateTime(Date newUpdateTime) { + Date oldUpdateTime = updateTime; + updateTime = newUpdateTime; + boolean oldUpdateTimeESet = updateTimeESet; + updateTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME, oldUpdateTime, updateTime, !oldUpdateTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetUpdateTime() { + Date oldUpdateTime = updateTime; + boolean oldUpdateTimeESet = updateTimeESet; + updateTime = UPDATE_TIME_EDEFAULT; + updateTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME, oldUpdateTime, UPDATE_TIME_EDEFAULT, oldUpdateTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetUpdateTime() { + return updateTimeESet; + } + + /** + * + * + * @generated + */ + public LocationReference getLocationReference() { + return locationReference; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLocationReference(LocationReference newLocationReference, NotificationChain msgs) { + LocationReference oldLocationReference = locationReference; + locationReference = newLocationReference; + boolean oldLocationReferenceESet = locationReferenceESet; + locationReferenceESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, oldLocationReference, newLocationReference, !oldLocationReferenceESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLocationReference(LocationReference newLocationReference) { + if (newLocationReference != locationReference) { + NotificationChain msgs = null; + if (locationReference != null) + msgs = ((InternalEObject)locationReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, null, msgs); + if (newLocationReference != null) + msgs = ((InternalEObject)newLocationReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, null, msgs); + msgs = basicSetLocationReference(newLocationReference, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationReferenceESet = locationReferenceESet; + locationReferenceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, newLocationReference, newLocationReference, !oldLocationReferenceESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLocationReference(NotificationChain msgs) { + LocationReference oldLocationReference = locationReference; + locationReference = null; + boolean oldLocationReferenceESet = locationReferenceESet; + locationReferenceESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, oldLocationReference, null, oldLocationReferenceESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLocationReference() { + if (locationReference != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)locationReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, null, msgs); + msgs = basicUnsetLocationReference(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationReferenceESet = locationReferenceESet; + locationReferenceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE, null, null, oldLocationReferenceESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLocationReference() { + return locationReferenceESet; + } + + /** + * + * + * @generated + */ + public EList getTemporarySpeedLimit() { + if (temporarySpeedLimit == null) { + temporarySpeedLimit = new EObjectContainmentEList(TemporarySpeedLimit.class, this, XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT); + } + return temporarySpeedLimit; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES: + return ((InternalEList)getCauses()).basicRemove(otherEnd, msgs); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES: + return ((InternalEList)getAdvices()).basicRemove(otherEnd, msgs); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE: + return basicUnsetLocationReference(msgs); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return ((InternalEList)getTemporarySpeedLimit()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + return getEffectCode(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME: + return getStartTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + return getStopTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY: + return getTendency(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + return getLengthAffected(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + return getAverageSpeedAbsolute(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY: + return getDelay(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + return getSegmentSpeedLimit(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES: + return getCauses(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES: + return getAdvices(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return getApplicability(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + return getTrafficIncidentId(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + return getExpectedSpeedAbsolute(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME: + return getExpirationTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME: + return getUpdateTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE: + return getLocationReference(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return getTemporarySpeedLimit(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + setEffectCode((EffectCode)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME: + setStartTime((Date)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + setStopTime((Date)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY: + setTendency((Tendency)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + setLengthAffected((Integer)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + setAverageSpeedAbsolute((Integer)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY: + setDelay((Integer)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + setSegmentSpeedLimit((Integer)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES: + getCauses().clear(); + getCauses().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES: + getAdvices().clear(); + getAdvices().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + setTrafficIncidentId((String)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + setExpectedSpeedAbsolute((Integer)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME: + setExpirationTime((Date)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME: + setUpdateTime((Date)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE: + setLocationReference((LocationReference)newValue); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + getTemporarySpeedLimit().clear(); + getTemporarySpeedLimit().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + unsetEffectCode(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME: + unsetStartTime(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + unsetStopTime(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY: + unsetTendency(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + unsetLengthAffected(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + unsetAverageSpeedAbsolute(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY: + unsetDelay(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + unsetSegmentSpeedLimit(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES: + unsetCauses(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES: + unsetAdvices(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + unsetApplicability(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + unsetTrafficIncidentId(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + unsetExpectedSpeedAbsolute(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME: + unsetExpirationTime(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME: + unsetUpdateTime(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE: + unsetLocationReference(); + return; + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + getTemporarySpeedLimit().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + return isSetEffectCode(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__START_TIME: + return isSetStartTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + return isSetStopTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TENDENCY: + return isSetTendency(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + return isSetLengthAffected(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + return isSetAverageSpeedAbsolute(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__DELAY: + return isSetDelay(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + return isSetSegmentSpeedLimit(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__CAUSES: + return isSetCauses(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__ADVICES: + return isSetAdvices(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return isSetApplicability(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + return isSetTrafficIncidentId(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + return isSetExpectedSpeedAbsolute(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__EXPIRATION_TIME: + return isSetExpirationTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__UPDATE_TIME: + return isSetUpdateTime(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__LOCATION_REFERENCE: + return isSetLocationReference(); + case XTrafficIncidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return temporarySpeedLimit != null && !temporarySpeedLimit.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (effectCode: "); + if (effectCodeESet) result.append(effectCode); else result.append(""); + result.append(", startTime: "); + if (startTimeESet) result.append(startTime); else result.append(""); + result.append(", stopTime: "); + if (stopTimeESet) result.append(stopTime); else result.append(""); + result.append(", tendency: "); + if (tendencyESet) result.append(tendency); else result.append(""); + result.append(", lengthAffected: "); + if (lengthAffectedESet) result.append(lengthAffected); else result.append(""); + result.append(", averageSpeedAbsolute: "); + if (averageSpeedAbsoluteESet) result.append(averageSpeedAbsolute); else result.append(""); + result.append(", delay: "); + if (delayESet) result.append(delay); else result.append(""); + result.append(", segmentSpeedLimit: "); + if (segmentSpeedLimitESet) result.append(segmentSpeedLimit); else result.append(""); + result.append(", trafficIncidentId: "); + if (trafficIncidentIdESet) result.append(trafficIncidentId); else result.append(""); + result.append(", expectedSpeedAbsolute: "); + if (expectedSpeedAbsoluteESet) result.append(expectedSpeedAbsolute); else result.append(""); + result.append(", expirationTime: "); + if (expirationTimeESet) result.append(expirationTime); else result.append(""); + result.append(", updateTime: "); + if (updateTimeESet) result.append(updateTime); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TrafficIncidentImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/VehicleRelatedRestrictionImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/VehicleRelatedRestrictionImpl.java new file mode 100755 index 0000000..d6500de --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/VehicleRelatedRestrictionImpl.java @@ -0,0 +1,435 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.locref.LocationReference; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; + + +/** + * + * An implementation of the model object 'Vehicle Related Restriction'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionType Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionValue Restriction Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionLocationReference Restriction Location Reference}
  • + *
+ *

+ * + * @generated + */ +public class VehicleRelatedRestrictionImpl extends EObjectImpl implements VehicleRelatedRestriction { + /** + * The default value of the '{@link #getRestrictionType() Restriction Type}' attribute. + * + * + * @see #getRestrictionType() + * @generated + * @ordered + */ + protected static final RestrictionType RESTRICTION_TYPE_EDEFAULT = RestrictionType.WIDTH_LESS_THAN; + + /** + * The cached value of the '{@link #getRestrictionType() Restriction Type}' attribute. + * + * + * @see #getRestrictionType() + * @generated + * @ordered + */ + protected RestrictionType restrictionType = RESTRICTION_TYPE_EDEFAULT; + + /** + * This is true if the Restriction Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionTypeESet; + + /** + * The default value of the '{@link #getRestrictionValue() Restriction Value}' attribute. + * + * + * @see #getRestrictionValue() + * @generated + * @ordered + */ + protected static final Integer RESTRICTION_VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getRestrictionValue() Restriction Value}' attribute. + * + * + * @see #getRestrictionValue() + * @generated + * @ordered + */ + protected Integer restrictionValue = RESTRICTION_VALUE_EDEFAULT; + + /** + * This is true if the Restriction Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionValueESet; + + /** + * The cached value of the '{@link #getRestrictionLocationReference() Restriction Location Reference}' containment reference. + * + * + * @see #getRestrictionLocationReference() + * @generated + * @ordered + */ + protected LocationReference restrictionLocationReference; + + /** + * This is true if the Restriction Location Reference containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionLocationReferenceESet; + + /** + * + * + * @generated + */ + protected VehicleRelatedRestrictionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return XTrafficIncidentPackage.Literals.VEHICLE_RELATED_RESTRICTION; + } + + /** + * + * + * @generated + */ + public RestrictionType getRestrictionType() { + return restrictionType; + } + + /** + * + * + * @generated + */ + public void setRestrictionType(RestrictionType newRestrictionType) { + RestrictionType oldRestrictionType = restrictionType; + restrictionType = newRestrictionType == null ? RESTRICTION_TYPE_EDEFAULT : newRestrictionType; + boolean oldRestrictionTypeESet = restrictionTypeESet; + restrictionTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE, oldRestrictionType, restrictionType, !oldRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetRestrictionType() { + RestrictionType oldRestrictionType = restrictionType; + boolean oldRestrictionTypeESet = restrictionTypeESet; + restrictionType = RESTRICTION_TYPE_EDEFAULT; + restrictionTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE, oldRestrictionType, RESTRICTION_TYPE_EDEFAULT, oldRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionType() { + return restrictionTypeESet; + } + + /** + * + * + * @generated + */ + public Integer getRestrictionValue() { + return restrictionValue; + } + + /** + * + * + * @generated + */ + public void setRestrictionValue(Integer newRestrictionValue) { + Integer oldRestrictionValue = restrictionValue; + restrictionValue = newRestrictionValue; + boolean oldRestrictionValueESet = restrictionValueESet; + restrictionValueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE, oldRestrictionValue, restrictionValue, !oldRestrictionValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetRestrictionValue() { + Integer oldRestrictionValue = restrictionValue; + boolean oldRestrictionValueESet = restrictionValueESet; + restrictionValue = RESTRICTION_VALUE_EDEFAULT; + restrictionValueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE, oldRestrictionValue, RESTRICTION_VALUE_EDEFAULT, oldRestrictionValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionValue() { + return restrictionValueESet; + } + + /** + * + * + * @generated + */ + public LocationReference getRestrictionLocationReference() { + return restrictionLocationReference; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetRestrictionLocationReference(LocationReference newRestrictionLocationReference, NotificationChain msgs) { + LocationReference oldRestrictionLocationReference = restrictionLocationReference; + restrictionLocationReference = newRestrictionLocationReference; + boolean oldRestrictionLocationReferenceESet = restrictionLocationReferenceESet; + restrictionLocationReferenceESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, oldRestrictionLocationReference, newRestrictionLocationReference, !oldRestrictionLocationReferenceESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setRestrictionLocationReference(LocationReference newRestrictionLocationReference) { + if (newRestrictionLocationReference != restrictionLocationReference) { + NotificationChain msgs = null; + if (restrictionLocationReference != null) + msgs = ((InternalEObject)restrictionLocationReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, null, msgs); + if (newRestrictionLocationReference != null) + msgs = ((InternalEObject)newRestrictionLocationReference).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, null, msgs); + msgs = basicSetRestrictionLocationReference(newRestrictionLocationReference, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRestrictionLocationReferenceESet = restrictionLocationReferenceESet; + restrictionLocationReferenceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, newRestrictionLocationReference, newRestrictionLocationReference, !oldRestrictionLocationReferenceESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetRestrictionLocationReference(NotificationChain msgs) { + LocationReference oldRestrictionLocationReference = restrictionLocationReference; + restrictionLocationReference = null; + boolean oldRestrictionLocationReferenceESet = restrictionLocationReferenceESet; + restrictionLocationReferenceESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, oldRestrictionLocationReference, null, oldRestrictionLocationReferenceESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetRestrictionLocationReference() { + if (restrictionLocationReference != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)restrictionLocationReference).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, null, msgs); + msgs = basicUnsetRestrictionLocationReference(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRestrictionLocationReferenceESet = restrictionLocationReferenceESet; + restrictionLocationReferenceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE, null, null, oldRestrictionLocationReferenceESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionLocationReference() { + return restrictionLocationReferenceESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE: + return basicUnsetRestrictionLocationReference(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + return getRestrictionType(); + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + return getRestrictionValue(); + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE: + return getRestrictionLocationReference(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + setRestrictionType((RestrictionType)newValue); + return; + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + setRestrictionValue((Integer)newValue); + return; + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE: + setRestrictionLocationReference((LocationReference)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + unsetRestrictionType(); + return; + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + unsetRestrictionValue(); + return; + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE: + unsetRestrictionLocationReference(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + return isSetRestrictionType(); + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + return isSetRestrictionValue(); + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE: + return isSetRestrictionLocationReference(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (restrictionType: "); + if (restrictionTypeESet) result.append(restrictionType); else result.append(""); + result.append(", restrictionValue: "); + if (restrictionValueESet) result.append(restrictionValue); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //VehicleRelatedRestrictionImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentFactoryImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentFactoryImpl.java new file mode 100755 index 0000000..de95e95 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentFactoryImpl.java @@ -0,0 +1,199 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class XTrafficIncidentFactoryImpl extends EFactoryImpl implements XTrafficIncidentFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static XTrafficIncidentFactory init() { + try { + XTrafficIncidentFactory theXTrafficIncidentFactory = (XTrafficIncidentFactory)EPackage.Registry.INSTANCE.getEFactory(XTrafficIncidentPackage.eNS_URI); + if (theXTrafficIncidentFactory != null) { + return theXTrafficIncidentFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new XTrafficIncidentFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public XTrafficIncidentFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT: return createTrafficIncident(); + case XTrafficIncidentPackage.CAUSE: return createCause(); + case XTrafficIncidentPackage.LINKED_CAUSE: return createLinkedCause(); + case XTrafficIncidentPackage.DIRECT_CAUSE: return createDirectCause(); + case XTrafficIncidentPackage.LANE_RESTRICTIONS: return createLaneRestrictions(); + case XTrafficIncidentPackage.ADVICE: return createAdvice(); + case XTrafficIncidentPackage.APPLICABILITY: return createApplicability(); + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION: return createVehicleRelatedRestriction(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION: return createTemporarySpeedLimitSection(); + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT: return createTemporarySpeedLimit(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public TrafficIncident createTrafficIncident() { + TrafficIncidentImpl trafficIncident = new TrafficIncidentImpl(); + return trafficIncident; + } + + /** + * + * + * @generated + */ + public Cause createCause() { + CauseImpl cause = new CauseImpl(); + return cause; + } + + /** + * + * + * @generated + */ + public LinkedCause createLinkedCause() { + LinkedCauseImpl linkedCause = new LinkedCauseImpl(); + return linkedCause; + } + + /** + * + * + * @generated + */ + public DirectCause createDirectCause() { + DirectCauseImpl directCause = new DirectCauseImpl(); + return directCause; + } + + /** + * + * + * @generated + */ + public LaneRestrictions createLaneRestrictions() { + LaneRestrictionsImpl laneRestrictions = new LaneRestrictionsImpl(); + return laneRestrictions; + } + + /** + * + * + * @generated + */ + public Advice createAdvice() { + AdviceImpl advice = new AdviceImpl(); + return advice; + } + + /** + * + * + * @generated + */ + public Applicability createApplicability() { + ApplicabilityImpl applicability = new ApplicabilityImpl(); + return applicability; + } + + /** + * + * + * @generated + */ + public VehicleRelatedRestriction createVehicleRelatedRestriction() { + VehicleRelatedRestrictionImpl vehicleRelatedRestriction = new VehicleRelatedRestrictionImpl(); + return vehicleRelatedRestriction; + } + + /** + * + * + * @generated + */ + public TemporarySpeedLimitSection createTemporarySpeedLimitSection() { + TemporarySpeedLimitSectionImpl temporarySpeedLimitSection = new TemporarySpeedLimitSectionImpl(); + return temporarySpeedLimitSection; + } + + /** + * + * + * @generated + */ + public TemporarySpeedLimit createTemporarySpeedLimit() { + TemporarySpeedLimitImpl temporarySpeedLimit = new TemporarySpeedLimitImpl(); + return temporarySpeedLimit; + } + + /** + * + * + * @generated + */ + public XTrafficIncidentPackage getXTrafficIncidentPackage() { + return (XTrafficIncidentPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static XTrafficIncidentPackage getPackage() { + return XTrafficIncidentPackage.eINSTANCE; + } + +} //XTrafficIncidentFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentPackageImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentPackageImpl.java new file mode 100755 index 0000000..9a3f712 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/impl/XTrafficIncidentPackageImpl.java @@ -0,0 +1,882 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.common.CommonPackage; + +import org.genivi.locref.locrefPackage; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentFactory; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage; + + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class XTrafficIncidentPackageImpl extends EPackageImpl implements XTrafficIncidentPackage { + /** + * + * + * @generated + */ + private EClass trafficIncidentEClass = null; + + /** + * + * + * @generated + */ + private EClass causeEClass = null; + + /** + * + * + * @generated + */ + private EClass linkedCauseEClass = null; + + /** + * + * + * @generated + */ + private EClass directCauseEClass = null; + + /** + * + * + * @generated + */ + private EClass laneRestrictionsEClass = null; + + /** + * + * + * @generated + */ + private EClass adviceEClass = null; + + /** + * + * + * @generated + */ + private EClass applicabilityEClass = null; + + /** + * + * + * @generated + */ + private EClass vehicleRelatedRestrictionEClass = null; + + /** + * + * + * @generated + */ + private EClass temporarySpeedLimitSectionEClass = null; + + /** + * + * + * @generated + */ + private EClass temporarySpeedLimitEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage#eNS_URI + * @see #init() + * @generated + */ + private XTrafficIncidentPackageImpl() { + super(eNS_URI, XTrafficIncidentFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link XTrafficIncidentPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static XTrafficIncidentPackage init() { + if (isInited) return (XTrafficIncidentPackage)EPackage.Registry.INSTANCE.getEPackage(XTrafficIncidentPackage.eNS_URI); + + // Obtain or create and register package + XTrafficIncidentPackageImpl theXTrafficIncidentPackage = (XTrafficIncidentPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof XTrafficIncidentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new XTrafficIncidentPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + locrefPackage.eINSTANCE.eClass(); + trafficincidenttablesPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + theXTrafficIncidentPackage.createPackageContents(); + + // Initialize created meta-data + theXTrafficIncidentPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + theXTrafficIncidentPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(XTrafficIncidentPackage.eNS_URI, theXTrafficIncidentPackage); + return theXTrafficIncidentPackage; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncident() { + return trafficIncidentEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_EffectCode() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_StartTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_StopTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_Tendency() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_LengthAffected() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_AverageSpeedAbsolute() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_Delay() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_SegmentSpeedLimit() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(7); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Causes() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(8); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Advices() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(9); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Applicability() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(10); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_TrafficIncidentId() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(11); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_ExpectedSpeedAbsolute() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(12); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_ExpirationTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(13); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_UpdateTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(14); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_LocationReference() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(15); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_TemporarySpeedLimit() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(16); + } + + /** + * + * + * @generated + */ + public EClass getCause() { + return causeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getCause_MainCause() { + return (EAttribute)causeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getLinkedCause() { + return linkedCauseEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLinkedCause_CauseTrafficIncidentId() { + return (EAttribute)linkedCauseEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getDirectCause() { + return directCauseEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_WarningLevel() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_UnverifiedInformation() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_SubCause() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_LengthAffected() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getDirectCause_LaneRestrictions() { + return (EReference)directCauseEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EReference getDirectCause_FreeText() { + return (EReference)directCauseEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_CauseOffset() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + public EClass getLaneRestrictions() { + return laneRestrictionsEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLaneRestrictions_LaneRestrictionType() { + return (EAttribute)laneRestrictionsEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLaneRestrictions_NumberOfLanes() { + return (EAttribute)laneRestrictionsEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getAdvice() { + return adviceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getAdvice_MainAdvice() { + return (EAttribute)adviceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getAdvice_SubAdvice() { + return (EAttribute)adviceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getAdvice_FreeText() { + return (EReference)adviceEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getAdvice_Applicability() { + return (EReference)adviceEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getApplicability() { + return applicabilityEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getApplicability_VehicleType() { + return (EAttribute)applicabilityEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getApplicability_VehicleRelatedRestrictions() { + return (EReference)applicabilityEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getVehicleRelatedRestriction() { + return vehicleRelatedRestrictionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getVehicleRelatedRestriction_RestrictionType() { + return (EAttribute)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getVehicleRelatedRestriction_RestrictionValue() { + return (EAttribute)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getVehicleRelatedRestriction_RestrictionLocationReference() { + return (EReference)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getTemporarySpeedLimitSection() { + return temporarySpeedLimitSectionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitValue() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitValueWet() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitLength() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getTemporarySpeedLimit() { + return temporarySpeedLimitEClass; + } + + /** + * + * + * @generated + */ + public EReference getTemporarySpeedLimit_TemporarySpeedLimitSections() { + return (EReference)temporarySpeedLimitEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimit_UnitsMPH() { + return (EAttribute)temporarySpeedLimitEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimit_Offset() { + return (EAttribute)temporarySpeedLimitEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getTemporarySpeedLimit_Applicability() { + return (EReference)temporarySpeedLimitEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public XTrafficIncidentFactory getXTrafficIncidentFactory() { + return (XTrafficIncidentFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + trafficIncidentEClass = createEClass(TRAFFIC_INCIDENT); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EFFECT_CODE); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__START_TIME); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__STOP_TIME); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__TENDENCY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__LENGTH_AFFECTED); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__DELAY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__CAUSES); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__ADVICES); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__APPLICABILITY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EXPIRATION_TIME); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__UPDATE_TIME); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__LOCATION_REFERENCE); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT); + + causeEClass = createEClass(CAUSE); + createEAttribute(causeEClass, CAUSE__MAIN_CAUSE); + + linkedCauseEClass = createEClass(LINKED_CAUSE); + createEAttribute(linkedCauseEClass, LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID); + + directCauseEClass = createEClass(DIRECT_CAUSE); + createEAttribute(directCauseEClass, DIRECT_CAUSE__WARNING_LEVEL); + createEAttribute(directCauseEClass, DIRECT_CAUSE__UNVERIFIED_INFORMATION); + createEAttribute(directCauseEClass, DIRECT_CAUSE__SUB_CAUSE); + createEAttribute(directCauseEClass, DIRECT_CAUSE__LENGTH_AFFECTED); + createEReference(directCauseEClass, DIRECT_CAUSE__LANE_RESTRICTIONS); + createEReference(directCauseEClass, DIRECT_CAUSE__FREE_TEXT); + createEAttribute(directCauseEClass, DIRECT_CAUSE__CAUSE_OFFSET); + + laneRestrictionsEClass = createEClass(LANE_RESTRICTIONS); + createEAttribute(laneRestrictionsEClass, LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE); + createEAttribute(laneRestrictionsEClass, LANE_RESTRICTIONS__NUMBER_OF_LANES); + + adviceEClass = createEClass(ADVICE); + createEAttribute(adviceEClass, ADVICE__MAIN_ADVICE); + createEAttribute(adviceEClass, ADVICE__SUB_ADVICE); + createEReference(adviceEClass, ADVICE__FREE_TEXT); + createEReference(adviceEClass, ADVICE__APPLICABILITY); + + applicabilityEClass = createEClass(APPLICABILITY); + createEAttribute(applicabilityEClass, APPLICABILITY__VEHICLE_TYPE); + createEReference(applicabilityEClass, APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS); + + vehicleRelatedRestrictionEClass = createEClass(VEHICLE_RELATED_RESTRICTION); + createEAttribute(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE); + createEAttribute(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE); + createEReference(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION_REFERENCE); + + temporarySpeedLimitSectionEClass = createEClass(TEMPORARY_SPEED_LIMIT_SECTION); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH); + + temporarySpeedLimitEClass = createEClass(TEMPORARY_SPEED_LIMIT); + createEReference(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS); + createEAttribute(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__UNITS_MPH); + createEAttribute(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__OFFSET); + createEReference(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__APPLICABILITY); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + trafficincidenttablesPackage thetrafficincidenttablesPackage = (trafficincidenttablesPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidenttablesPackage.eNS_URI); + locrefPackage thelocrefPackage = (locrefPackage)EPackage.Registry.INSTANCE.getEPackage(locrefPackage.eNS_URI); + CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + linkedCauseEClass.getESuperTypes().add(this.getCause()); + directCauseEClass.getESuperTypes().add(this.getCause()); + + // Initialize classes and features; add operations and parameters + initEClass(trafficIncidentEClass, TrafficIncident.class, "TrafficIncident", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTrafficIncident_EffectCode(), thetrafficincidenttablesPackage.getEffectCode(), "effectCode", null, 1, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_StartTime(), ecorePackage.getEDate(), "startTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_StopTime(), ecorePackage.getEDate(), "stopTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_Tendency(), thetrafficincidenttablesPackage.getTendency(), "tendency", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_LengthAffected(), ecorePackage.getEIntegerObject(), "lengthAffected", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_AverageSpeedAbsolute(), ecorePackage.getEIntegerObject(), "averageSpeedAbsolute", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_Delay(), ecorePackage.getEIntegerObject(), "delay", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_SegmentSpeedLimit(), ecorePackage.getEIntegerObject(), "segmentSpeedLimit", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Causes(), this.getCause(), null, "causes", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Advices(), this.getAdvice(), null, "advices", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_TrafficIncidentId(), ecorePackage.getEString(), "trafficIncidentId", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_ExpectedSpeedAbsolute(), ecorePackage.getEIntegerObject(), "expectedSpeedAbsolute", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_ExpirationTime(), ecorePackage.getEDate(), "expirationTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_UpdateTime(), ecorePackage.getEDate(), "updateTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_LocationReference(), thelocrefPackage.getLocationReference(), null, "locationReference", null, 1, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_TemporarySpeedLimit(), this.getTemporarySpeedLimit(), null, "temporarySpeedLimit", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(causeEClass, Cause.class, "Cause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCause_MainCause(), thetrafficincidenttablesPackage.getCauseCode(), "mainCause", null, 0, 1, Cause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(linkedCauseEClass, LinkedCause.class, "LinkedCause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLinkedCause_CauseTrafficIncidentId(), ecorePackage.getEString(), "causeTrafficIncidentId", null, 0, 1, LinkedCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(directCauseEClass, DirectCause.class, "DirectCause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDirectCause_WarningLevel(), thetrafficincidenttablesPackage.getWarningLevel(), "warningLevel", null, 1, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_UnverifiedInformation(), ecorePackage.getEBoolean(), "unverifiedInformation", null, 1, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_SubCause(), ecorePackage.getEJavaObject(), "subCause", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_LengthAffected(), ecorePackage.getEIntegerObject(), "lengthAffected", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDirectCause_LaneRestrictions(), this.getLaneRestrictions(), null, "laneRestrictions", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDirectCause_FreeText(), theCommonPackage.getLocalizedString(), null, "freeText", null, 0, -1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_CauseOffset(), ecorePackage.getEIntegerObject(), "causeOffset", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(laneRestrictionsEClass, LaneRestrictions.class, "LaneRestrictions", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLaneRestrictions_LaneRestrictionType(), thetrafficincidenttablesPackage.getLaneRestrictionType(), "laneRestrictionType", null, 0, 1, LaneRestrictions.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLaneRestrictions_NumberOfLanes(), ecorePackage.getEIntegerObject(), "numberOfLanes", null, 0, 1, LaneRestrictions.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(adviceEClass, Advice.class, "Advice", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getAdvice_MainAdvice(), thetrafficincidenttablesPackage.getAdviceCode(), "mainAdvice", null, 0, 1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAdvice_SubAdvice(), ecorePackage.getEJavaObject(), "subAdvice", null, 0, 1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAdvice_FreeText(), theCommonPackage.getLocalizedString(), null, "freeText", null, 0, -1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAdvice_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(applicabilityEClass, Applicability.class, "Applicability", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getApplicability_VehicleType(), thetrafficincidenttablesPackage.getVehicleType(), "vehicleType", null, 0, 1, Applicability.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getApplicability_VehicleRelatedRestrictions(), this.getVehicleRelatedRestriction(), null, "vehicleRelatedRestrictions", null, 0, -1, Applicability.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(vehicleRelatedRestrictionEClass, VehicleRelatedRestriction.class, "VehicleRelatedRestriction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getVehicleRelatedRestriction_RestrictionType(), thetrafficincidenttablesPackage.getRestrictionType(), "restrictionType", null, 1, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVehicleRelatedRestriction_RestrictionValue(), ecorePackage.getEIntegerObject(), "restrictionValue", null, 0, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getVehicleRelatedRestriction_RestrictionLocationReference(), thelocrefPackage.getLocationReference(), null, "restrictionLocationReference", null, 0, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(temporarySpeedLimitSectionEClass, TemporarySpeedLimitSection.class, "TemporarySpeedLimitSection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitValue(), ecorePackage.getEShort(), "speedLimitValue", null, 1, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitValueWet(), ecorePackage.getEShort(), "speedLimitValueWet", null, 0, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitLength(), ecorePackage.getEIntegerObject(), "speedLimitLength", null, 0, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(temporarySpeedLimitEClass, TemporarySpeedLimit.class, "TemporarySpeedLimit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTemporarySpeedLimit_TemporarySpeedLimitSections(), this.getTemporarySpeedLimitSection(), null, "temporarySpeedLimitSections", null, 1, -1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimit_UnitsMPH(), ecorePackage.getEBoolean(), "unitsMPH", null, 1, 1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimit_Offset(), ecorePackage.getEIntegerObject(), "offset", null, 0, 1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTemporarySpeedLimit_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //XTrafficIncidentPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentAdapterFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentAdapterFactory.java new file mode 100755 index 0000000..a0f4b15 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentAdapterFactory.java @@ -0,0 +1,287 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage + * @generated + */ +public class XTrafficIncidentAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static XTrafficIncidentPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public XTrafficIncidentAdapterFactory() { + if (modelPackage == null) { + modelPackage = XTrafficIncidentPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected XTrafficIncidentSwitch modelSwitch = + new XTrafficIncidentSwitch() { + @Override + public Adapter caseTrafficIncident(TrafficIncident object) { + return createTrafficIncidentAdapter(); + } + @Override + public Adapter caseCause(Cause object) { + return createCauseAdapter(); + } + @Override + public Adapter caseLinkedCause(LinkedCause object) { + return createLinkedCauseAdapter(); + } + @Override + public Adapter caseDirectCause(DirectCause object) { + return createDirectCauseAdapter(); + } + @Override + public Adapter caseLaneRestrictions(LaneRestrictions object) { + return createLaneRestrictionsAdapter(); + } + @Override + public Adapter caseAdvice(Advice object) { + return createAdviceAdapter(); + } + @Override + public Adapter caseApplicability(Applicability object) { + return createApplicabilityAdapter(); + } + @Override + public Adapter caseVehicleRelatedRestriction(VehicleRelatedRestriction object) { + return createVehicleRelatedRestrictionAdapter(); + } + @Override + public Adapter caseTemporarySpeedLimitSection(TemporarySpeedLimitSection object) { + return createTemporarySpeedLimitSectionAdapter(); + } + @Override + public Adapter caseTemporarySpeedLimit(TemporarySpeedLimit object) { + return createTemporarySpeedLimitAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident Traffic Incident}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident + * @generated + */ + public Adapter createTrafficIncidentAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause + * @generated + */ + public Adapter createCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause Linked Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause + * @generated + */ + public Adapter createLinkedCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause Direct Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause + * @generated + */ + public Adapter createDirectCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions Lane Restrictions}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions + * @generated + */ + public Adapter createLaneRestrictionsAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice Advice}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice + * @generated + */ + public Adapter createAdviceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability Applicability}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability + * @generated + */ + public Adapter createApplicabilityAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction Vehicle Related Restriction}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction + * @generated + */ + public Adapter createVehicleRelatedRestrictionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection Temporary Speed Limit Section}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimitSection + * @generated + */ + public Adapter createTemporarySpeedLimitSectionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit Temporary Speed Limit}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TemporarySpeedLimit + * @generated + */ + public Adapter createTemporarySpeedLimitAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //XTrafficIncidentAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentSwitch.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentSwitch.java new file mode 100755 index 0000000..1899ea2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidentfeed/trafficincident/util/XTrafficIncidentSwitch.java @@ -0,0 +1,306 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage + * @generated + */ +public class XTrafficIncidentSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static XTrafficIncidentPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public XTrafficIncidentSwitch() { + if (modelPackage == null) { + modelPackage = XTrafficIncidentPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case XTrafficIncidentPackage.TRAFFIC_INCIDENT: { + TrafficIncident trafficIncident = (TrafficIncident)theEObject; + T result = caseTrafficIncident(trafficIncident); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.CAUSE: { + Cause cause = (Cause)theEObject; + T result = caseCause(cause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.LINKED_CAUSE: { + LinkedCause linkedCause = (LinkedCause)theEObject; + T result = caseLinkedCause(linkedCause); + if (result == null) result = caseCause(linkedCause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.DIRECT_CAUSE: { + DirectCause directCause = (DirectCause)theEObject; + T result = caseDirectCause(directCause); + if (result == null) result = caseCause(directCause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.LANE_RESTRICTIONS: { + LaneRestrictions laneRestrictions = (LaneRestrictions)theEObject; + T result = caseLaneRestrictions(laneRestrictions); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.ADVICE: { + Advice advice = (Advice)theEObject; + T result = caseAdvice(advice); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.APPLICABILITY: { + Applicability applicability = (Applicability)theEObject; + T result = caseApplicability(applicability); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.VEHICLE_RELATED_RESTRICTION: { + VehicleRelatedRestriction vehicleRelatedRestriction = (VehicleRelatedRestriction)theEObject; + T result = caseVehicleRelatedRestriction(vehicleRelatedRestriction); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT_SECTION: { + TemporarySpeedLimitSection temporarySpeedLimitSection = (TemporarySpeedLimitSection)theEObject; + T result = caseTemporarySpeedLimitSection(temporarySpeedLimitSection); + if (result == null) result = defaultCase(theEObject); + return result; + } + case XTrafficIncidentPackage.TEMPORARY_SPEED_LIMIT: { + TemporarySpeedLimit temporarySpeedLimit = (TemporarySpeedLimit)theEObject; + T result = caseTemporarySpeedLimit(temporarySpeedLimit); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incident'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incident'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncident(TrafficIncident object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCause(Cause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Linked Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Linked Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLinkedCause(LinkedCause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Direct Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Direct Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDirectCause(DirectCause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Lane Restrictions'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Lane Restrictions'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLaneRestrictions(LaneRestrictions object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Advice'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Advice'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAdvice(Advice object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Applicability'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Applicability'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseApplicability(Applicability object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Vehicle Related Restriction'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Vehicle Related Restriction'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseVehicleRelatedRestriction(VehicleRelatedRestriction object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Temporary Speed Limit Section'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Temporary Speed Limit Section'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTemporarySpeedLimitSection(TemporarySpeedLimitSection object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Temporary Speed Limit'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Temporary Speed Limit'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTemporarySpeedLimit(TemporarySpeedLimit object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //XTrafficIncidentSwitch diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.classpath new file mode 100755 index 0000000..17405e2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.project new file mode 100755 index 0000000..a8a9e4c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/.project @@ -0,0 +1,24 @@ + + + org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + This project contains the data model for Traffic Incidents in the TrafficIncidents interface. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..662a5bf --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.trafficinfo.trafficincident;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.trafficincidentsservice.trafficincidents.trafficincident, + org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl, + org.genivi.trafficincidentsservice.trafficincidents.trafficincident.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.genivi.basetypes-model;visibility:=reexport, + org.genivi.trafficinfo.trafficincidenttables;resolution:=optional;visibility:=reexport +Bundle-ActivationPolicy: lazy diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/ReadMe.confluence new file mode 100755 index 0000000..e45b904 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/ReadMe.confluence @@ -0,0 +1,3 @@ +This project defines the TrafficIncident data model as used in the TrafficIncidents interface. + +TrafficIncident.ecorediag, in de model folder, provides a good overview of the structure of a TrafficIncident. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/build.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecore b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecore new file mode 100755 index 0000000..301cb8b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecore @@ -0,0 +1,150 @@ + + + +

+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecorediag b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecorediag new file mode 100755 index 0000000..00845a3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.ecorediag @@ -0,0 +1,568 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.genmodel b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.genmodel new file mode 100755 index 0000000..20e336a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/model/TrafficIncident.genmodel @@ -0,0 +1,70 @@ + + + TrafficIncident.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.properties new file mode 100755 index 0000000..d4e01b4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = TrafficIncident Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.xml new file mode 100755 index 0000000..2a7709e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/plugin.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/pom.xml new file mode 100755 index 0000000..ed4d264 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice.trafficincidents + trafficincidents-trafficincident-model + jar + 1.0-SNAPSHOT + Traffic Incident data model for the TrafficIncidents interface + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi + basetypes-model + + + org.genivi.trafficincidentsservice + trafficincidenttables-model + + + + src + + This project contains the data model for Traffic Incidents in the TrafficIncidents interface. + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Advice.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Advice.java new file mode 100755 index 0000000..1b8a751 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Advice.java @@ -0,0 +1,236 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; + +/** + * + * A representation of the model object 'Advice'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice Main Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice Sub Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText Free Text}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getAdvice() + * @model + * @generated + */ +public interface Advice extends EObject { + /** + * Returns the value of the 'Main Advice' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode}. + * + *

+ * If the meaning of the 'Main Advice' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Main Advice' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see #isSetMainAdvice() + * @see #unsetMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getAdvice_MainAdvice() + * @model unsettable="true" + * @generated + */ + AdviceCode getMainAdvice(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice Main Advice}' attribute. + * + * + * @param value the new value of the 'Main Advice' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see #isSetMainAdvice() + * @see #unsetMainAdvice() + * @see #getMainAdvice() + * @generated + */ + void setMainAdvice(AdviceCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice Main Advice}' attribute. + * + * + * @see #isSetMainAdvice() + * @see #getMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @generated + */ + void unsetMainAdvice(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice Main Advice}' attribute is set. + * + * + * @return whether the value of the 'Main Advice' attribute is set. + * @see #unsetMainAdvice() + * @see #getMainAdvice() + * @see #setMainAdvice(AdviceCode) + * @generated + */ + boolean isSetMainAdvice(); + + /** + * Returns the value of the 'Sub Advice' attribute. + * + * + * + * The actual value of this atttribute depends on the adviceCode. So based on the adviceCode it has to be cast to the related enum. + * + * @return the value of the 'Sub Advice' attribute. + * @see #isSetSubAdvice() + * @see #unsetSubAdvice() + * @see #setSubAdvice(Object) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getAdvice_SubAdvice() + * @model unsettable="true" + * @generated + */ + Object getSubAdvice(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice Sub Advice}' attribute. + * + * + * @param value the new value of the 'Sub Advice' attribute. + * @see #isSetSubAdvice() + * @see #unsetSubAdvice() + * @see #getSubAdvice() + * @generated + */ + void setSubAdvice(Object value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice Sub Advice}' attribute. + * + * + * @see #isSetSubAdvice() + * @see #getSubAdvice() + * @see #setSubAdvice(Object) + * @generated + */ + void unsetSubAdvice(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice Sub Advice}' attribute is set. + * + * + * @return whether the value of the 'Sub Advice' attribute is set. + * @see #unsetSubAdvice() + * @see #getSubAdvice() + * @see #setSubAdvice(Object) + * @generated + */ + boolean isSetSubAdvice(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see #isSetApplicability() + * @see #unsetApplicability() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getAdvice_Applicability() + * @model containment="true" unsettable="true" + * @generated + */ + EList getApplicability(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getApplicability Applicability}' containment reference list. + * + * + * @see #isSetApplicability() + * @see #getApplicability() + * @generated + */ + void unsetApplicability(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getApplicability Applicability}' containment reference list is set. + * + * + * @return whether the value of the 'Applicability' containment reference list is set. + * @see #unsetApplicability() + * @see #getApplicability() + * @generated + */ + boolean isSetApplicability(); + + /** + * Returns the value of the 'Free Text' attribute. + * + *

+ * If the meaning of the 'Free Text' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Free Text' attribute. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see #setFreeText(String) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getAdvice_FreeText() + * @model unsettable="true" + * @generated + */ + String getFreeText(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText Free Text}' attribute. + * + * + * @param value the new value of the 'Free Text' attribute. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see #getFreeText() + * @generated + */ + void setFreeText(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText Free Text}' attribute. + * + * + * @see #isSetFreeText() + * @see #getFreeText() + * @see #setFreeText(String) + * @generated + */ + void unsetFreeText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText Free Text}' attribute is set. + * + * + * @return whether the value of the 'Free Text' attribute is set. + * @see #unsetFreeText() + * @see #getFreeText() + * @see #setFreeText(String) + * @generated + */ + boolean isSetFreeText(); + +} // Advice diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Applicability.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Applicability.java new file mode 100755 index 0000000..60cbb30 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Applicability.java @@ -0,0 +1,129 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; + +/** + * + * A representation of the model object 'Applicability'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType Vehicle Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getApplicability() + * @model + * @generated + */ +public interface Applicability extends EObject { + /** + * Returns the value of the 'Vehicle Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType}. + * + *

+ * If the meaning of the 'Vehicle Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Vehicle Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see #isSetVehicleType() + * @see #unsetVehicleType() + * @see #setVehicleType(VehicleType) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getApplicability_VehicleType() + * @model unsettable="true" + * @generated + */ + VehicleType getVehicleType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute. + * + * + * @param value the new value of the 'Vehicle Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see #isSetVehicleType() + * @see #unsetVehicleType() + * @see #getVehicleType() + * @generated + */ + void setVehicleType(VehicleType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute. + * + * + * @see #isSetVehicleType() + * @see #getVehicleType() + * @see #setVehicleType(VehicleType) + * @generated + */ + void unsetVehicleType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType Vehicle Type}' attribute is set. + * + * + * @return whether the value of the 'Vehicle Type' attribute is set. + * @see #unsetVehicleType() + * @see #getVehicleType() + * @see #setVehicleType(VehicleType) + * @generated + */ + boolean isSetVehicleType(); + + /** + * Returns the value of the 'Vehicle Related Restrictions' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction}. + * + *

+ * If the meaning of the 'Vehicle Related Restrictions' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Vehicle Related Restrictions' containment reference list. + * @see #isSetVehicleRelatedRestrictions() + * @see #unsetVehicleRelatedRestrictions() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getApplicability_VehicleRelatedRestrictions() + * @model containment="true" unsettable="true" + * @generated + */ + EList getVehicleRelatedRestrictions(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}' containment reference list. + * + * + * @see #isSetVehicleRelatedRestrictions() + * @see #getVehicleRelatedRestrictions() + * @generated + */ + void unsetVehicleRelatedRestrictions(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}' containment reference list is set. + * + * + * @return whether the value of the 'Vehicle Related Restrictions' containment reference list is set. + * @see #unsetVehicleRelatedRestrictions() + * @see #getVehicleRelatedRestrictions() + * @generated + */ + boolean isSetVehicleRelatedRestrictions(); + +} // Applicability diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Cause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Cause.java new file mode 100755 index 0000000..e9f2401 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/Cause.java @@ -0,0 +1,87 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; + +/** + * + * A representation of the model object 'Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause Main Cause}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getCause() + * @model + * @generated + */ +public interface Cause extends EObject { + /** + * Returns the value of the 'Main Cause' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode}. + * + *

+ * If the meaning of the 'Main Cause' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Main Cause' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see #isSetMainCause() + * @see #unsetMainCause() + * @see #setMainCause(CauseCode) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getCause_MainCause() + * @model unsettable="true" + * @generated + */ + CauseCode getMainCause(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause Main Cause}' attribute. + * + * + * @param value the new value of the 'Main Cause' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see #isSetMainCause() + * @see #unsetMainCause() + * @see #getMainCause() + * @generated + */ + void setMainCause(CauseCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause Main Cause}' attribute. + * + * + * @see #isSetMainCause() + * @see #getMainCause() + * @see #setMainCause(CauseCode) + * @generated + */ + void unsetMainCause(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause Main Cause}' attribute is set. + * + * + * @return whether the value of the 'Main Cause' attribute is set. + * @see #unsetMainCause() + * @see #getMainCause() + * @see #setMainCause(CauseCode) + * @generated + */ + boolean isSetMainCause(); + +} // Cause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/DirectCause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/DirectCause.java new file mode 100755 index 0000000..f811f23 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/DirectCause.java @@ -0,0 +1,408 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * + * A representation of the model object 'Direct Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel Warning Level}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause Sub Cause}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset Cause Offset}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause() + * @model + * @generated + */ +public interface DirectCause extends Cause { + /** + * Returns the value of the 'Warning Level' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel}. + * + *

+ * If the meaning of the 'Warning Level' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Warning Level' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see #isSetWarningLevel() + * @see #unsetWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_WarningLevel() + * @model unsettable="true" required="true" + * @generated + */ + WarningLevel getWarningLevel(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute. + * + * + * @param value the new value of the 'Warning Level' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see #isSetWarningLevel() + * @see #unsetWarningLevel() + * @see #getWarningLevel() + * @generated + */ + void setWarningLevel(WarningLevel value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute. + * + * + * @see #isSetWarningLevel() + * @see #getWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @generated + */ + void unsetWarningLevel(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel Warning Level}' attribute is set. + * + * + * @return whether the value of the 'Warning Level' attribute is set. + * @see #unsetWarningLevel() + * @see #getWarningLevel() + * @see #setWarningLevel(WarningLevel) + * @generated + */ + boolean isSetWarningLevel(); + + /** + * Returns the value of the 'Unverified Information' attribute. + * + *

+ * If the meaning of the 'Unverified Information' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Unverified Information' attribute. + * @see #isSetUnverifiedInformation() + * @see #unsetUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_UnverifiedInformation() + * @model unsettable="true" required="true" + * @generated + */ + boolean isUnverifiedInformation(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute. + * + * + * @param value the new value of the 'Unverified Information' attribute. + * @see #isSetUnverifiedInformation() + * @see #unsetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @generated + */ + void setUnverifiedInformation(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute. + * + * + * @see #isSetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @generated + */ + void unsetUnverifiedInformation(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}' attribute is set. + * + * + * @return whether the value of the 'Unverified Information' attribute is set. + * @see #unsetUnverifiedInformation() + * @see #isUnverifiedInformation() + * @see #setUnverifiedInformation(boolean) + * @generated + */ + boolean isSetUnverifiedInformation(); + + /** + * Returns the value of the 'Sub Cause' attribute. + * + * + * + * The actual value of this atttribute depends on the mainCause. So based on the mainCause it has to be cast to the related enum. + * + * @return the value of the 'Sub Cause' attribute. + * @see #isSetSubCause() + * @see #unsetSubCause() + * @see #setSubCause(Object) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_SubCause() + * @model unsettable="true" + * @generated + */ + Object getSubCause(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause Sub Cause}' attribute. + * + * + * @param value the new value of the 'Sub Cause' attribute. + * @see #isSetSubCause() + * @see #unsetSubCause() + * @see #getSubCause() + * @generated + */ + void setSubCause(Object value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause Sub Cause}' attribute. + * + * + * @see #isSetSubCause() + * @see #getSubCause() + * @see #setSubCause(Object) + * @generated + */ + void unsetSubCause(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause Sub Cause}' attribute is set. + * + * + * @return whether the value of the 'Sub Cause' attribute is set. + * @see #unsetSubCause() + * @see #getSubCause() + * @see #setSubCause(Object) + * @generated + */ + boolean isSetSubCause(); + + /** + * Returns the value of the 'Length Affected' attribute. + * + *

+ * If the meaning of the 'Length Affected' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #setLengthAffected(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_LengthAffected() + * @model unsettable="true" + * @generated + */ + Integer getLengthAffected(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute. + * + * + * @param value the new value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @generated + */ + void setLengthAffected(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute. + * + * + * @see #isSetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + void unsetLengthAffected(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected Length Affected}' attribute is set. + * + * + * @return whether the value of the 'Length Affected' attribute is set. + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + boolean isSetLengthAffected(); + + /** + * Returns the value of the 'Lane Restrictions' containment reference. + * + *

+ * If the meaning of the 'Lane Restrictions' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Lane Restrictions' containment reference. + * @see #isSetLaneRestrictions() + * @see #unsetLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_LaneRestrictions() + * @model containment="true" unsettable="true" + * @generated + */ + LaneRestrictions getLaneRestrictions(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference. + * + * + * @param value the new value of the 'Lane Restrictions' containment reference. + * @see #isSetLaneRestrictions() + * @see #unsetLaneRestrictions() + * @see #getLaneRestrictions() + * @generated + */ + void setLaneRestrictions(LaneRestrictions value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference. + * + * + * @see #isSetLaneRestrictions() + * @see #getLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @generated + */ + void unsetLaneRestrictions(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}' containment reference is set. + * + * + * @return whether the value of the 'Lane Restrictions' containment reference is set. + * @see #unsetLaneRestrictions() + * @see #getLaneRestrictions() + * @see #setLaneRestrictions(LaneRestrictions) + * @generated + */ + boolean isSetLaneRestrictions(); + + /** + * Returns the value of the 'Free Text' attribute. + * + *

+ * If the meaning of the 'Free Text' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Free Text' attribute. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see #setFreeText(String) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_FreeText() + * @model unsettable="true" + * @generated + */ + String getFreeText(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText Free Text}' attribute. + * + * + * @param value the new value of the 'Free Text' attribute. + * @see #isSetFreeText() + * @see #unsetFreeText() + * @see #getFreeText() + * @generated + */ + void setFreeText(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText Free Text}' attribute. + * + * + * @see #isSetFreeText() + * @see #getFreeText() + * @see #setFreeText(String) + * @generated + */ + void unsetFreeText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText Free Text}' attribute is set. + * + * + * @return whether the value of the 'Free Text' attribute is set. + * @see #unsetFreeText() + * @see #getFreeText() + * @see #setFreeText(String) + * @generated + */ + boolean isSetFreeText(); + + /** + * Returns the value of the 'Cause Offset' attribute. + * + *

+ * If the meaning of the 'Cause Offset' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Cause Offset' attribute. + * @see #isSetCauseOffset() + * @see #unsetCauseOffset() + * @see #setCauseOffset(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getDirectCause_CauseOffset() + * @model unsettable="true" + * @generated + */ + Integer getCauseOffset(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute. + * + * + * @param value the new value of the 'Cause Offset' attribute. + * @see #isSetCauseOffset() + * @see #unsetCauseOffset() + * @see #getCauseOffset() + * @generated + */ + void setCauseOffset(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute. + * + * + * @see #isSetCauseOffset() + * @see #getCauseOffset() + * @see #setCauseOffset(Integer) + * @generated + */ + void unsetCauseOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset Cause Offset}' attribute is set. + * + * + * @return whether the value of the 'Cause Offset' attribute is set. + * @see #unsetCauseOffset() + * @see #getCauseOffset() + * @see #setCauseOffset(Integer) + * @generated + */ + boolean isSetCauseOffset(); + +} // DirectCause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LaneRestrictions.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LaneRestrictions.java new file mode 100755 index 0000000..b912851 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LaneRestrictions.java @@ -0,0 +1,141 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; + +/** + * + * A representation of the model object 'Lane Restrictions'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getLaneRestrictions() + * @model + * @generated + */ +public interface LaneRestrictions extends EObject { + /** + * Returns the value of the 'Lane Restriction Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType}. + * + *

+ * If the meaning of the 'Lane Restriction Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Lane Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see #isSetLaneRestrictionType() + * @see #unsetLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getLaneRestrictions_LaneRestrictionType() + * @model unsettable="true" + * @generated + */ + LaneRestrictionType getLaneRestrictionType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute. + * + * + * @param value the new value of the 'Lane Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see #isSetLaneRestrictionType() + * @see #unsetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @generated + */ + void setLaneRestrictionType(LaneRestrictionType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute. + * + * + * @see #isSetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @generated + */ + void unsetLaneRestrictionType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}' attribute is set. + * + * + * @return whether the value of the 'Lane Restriction Type' attribute is set. + * @see #unsetLaneRestrictionType() + * @see #getLaneRestrictionType() + * @see #setLaneRestrictionType(LaneRestrictionType) + * @generated + */ + boolean isSetLaneRestrictionType(); + + /** + * Returns the value of the 'Number Of Lanes' attribute. + * + *

+ * If the meaning of the 'Number Of Lanes' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Number Of Lanes' attribute. + * @see #isSetNumberOfLanes() + * @see #unsetNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getLaneRestrictions_NumberOfLanes() + * @model unsettable="true" + * @generated + */ + Integer getNumberOfLanes(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute. + * + * + * @param value the new value of the 'Number Of Lanes' attribute. + * @see #isSetNumberOfLanes() + * @see #unsetNumberOfLanes() + * @see #getNumberOfLanes() + * @generated + */ + void setNumberOfLanes(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute. + * + * + * @see #isSetNumberOfLanes() + * @see #getNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @generated + */ + void unsetNumberOfLanes(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}' attribute is set. + * + * + * @return whether the value of the 'Number Of Lanes' attribute is set. + * @see #unsetNumberOfLanes() + * @see #getNumberOfLanes() + * @see #setNumberOfLanes(Integer) + * @generated + */ + boolean isSetNumberOfLanes(); + +} // LaneRestrictions diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LinkedCause.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LinkedCause.java new file mode 100755 index 0000000..cb8efa0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/LinkedCause.java @@ -0,0 +1,80 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + + +/** + * + * A representation of the model object 'Linked Cause'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getLinkedCause() + * @model + * @generated + */ +public interface LinkedCause extends Cause { + /** + * Returns the value of the 'Cause Traffic Incident Id' attribute. + * + * + * + * There can be a LinkedCause for which the linked TrafficIncident isn't available (to the application) yet. Therefore this atttibute is optional. + * + * @return the value of the 'Cause Traffic Incident Id' attribute. + * @see #isSetCauseTrafficIncidentId() + * @see #unsetCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getLinkedCause_CauseTrafficIncidentId() + * @model unsettable="true" + * @generated + */ + Integer getCauseTrafficIncidentId(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute. + * + * + * @param value the new value of the 'Cause Traffic Incident Id' attribute. + * @see #isSetCauseTrafficIncidentId() + * @see #unsetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @generated + */ + void setCauseTrafficIncidentId(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute. + * + * + * @see #isSetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(Integer) + * @generated + */ + void unsetCauseTrafficIncidentId(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}' attribute is set. + * + * + * @return whether the value of the 'Cause Traffic Incident Id' attribute is set. + * @see #unsetCauseTrafficIncidentId() + * @see #getCauseTrafficIncidentId() + * @see #setCauseTrafficIncidentId(Integer) + * @generated + */ + boolean isSetCauseTrafficIncidentId(); + +} // LinkedCause diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimit.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimit.java new file mode 100755 index 0000000..57e0a8e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimit.java @@ -0,0 +1,172 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Temporary Speed Limit'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections Temporary Speed Limit Sections}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset Offset}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getApplicability Applicability}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimit() + * @model + * @generated + */ +public interface TemporarySpeedLimit extends EObject { + /** + * Returns the value of the 'Temporary Speed Limit Sections' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection}. + * + *

+ * If the meaning of the 'Temporary Speed Limit Sections' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Temporary Speed Limit Sections' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimit_TemporarySpeedLimitSections() + * @model containment="true" required="true" + * @generated + */ + EList getTemporarySpeedLimitSections(); + + /** + * Returns the value of the 'Units MPH' attribute. + * + *

+ * If the meaning of the 'Units MPH' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Units MPH' attribute. + * @see #isSetUnitsMPH() + * @see #unsetUnitsMPH() + * @see #setUnitsMPH(boolean) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimit_UnitsMPH() + * @model unsettable="true" required="true" + * @generated + */ + boolean isUnitsMPH(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}' attribute. + * + * + * @param value the new value of the 'Units MPH' attribute. + * @see #isSetUnitsMPH() + * @see #unsetUnitsMPH() + * @see #isUnitsMPH() + * @generated + */ + void setUnitsMPH(boolean value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}' attribute. + * + * + * @see #isSetUnitsMPH() + * @see #isUnitsMPH() + * @see #setUnitsMPH(boolean) + * @generated + */ + void unsetUnitsMPH(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}' attribute is set. + * + * + * @return whether the value of the 'Units MPH' attribute is set. + * @see #unsetUnitsMPH() + * @see #isUnitsMPH() + * @see #setUnitsMPH(boolean) + * @generated + */ + boolean isSetUnitsMPH(); + + /** + * Returns the value of the 'Offset' attribute. + * + *

+ * If the meaning of the 'Offset' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Offset' attribute. + * @see #isSetOffset() + * @see #unsetOffset() + * @see #setOffset(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimit_Offset() + * @model unsettable="true" + * @generated + */ + Integer getOffset(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute. + * + * + * @param value the new value of the 'Offset' attribute. + * @see #isSetOffset() + * @see #unsetOffset() + * @see #getOffset() + * @generated + */ + void setOffset(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute. + * + * + * @see #isSetOffset() + * @see #getOffset() + * @see #setOffset(Integer) + * @generated + */ + void unsetOffset(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset Offset}' attribute is set. + * + * + * @return whether the value of the 'Offset' attribute is set. + * @see #unsetOffset() + * @see #getOffset() + * @see #setOffset(Integer) + * @generated + */ + boolean isSetOffset(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimit_Applicability() + * @model containment="true" + * @generated + */ + EList getApplicability(); + +} // TemporarySpeedLimit diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimitSection.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimitSection.java new file mode 100755 index 0000000..655f32e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TemporarySpeedLimitSection.java @@ -0,0 +1,190 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Temporary Speed Limit Section'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimitSection() + * @model + * @generated + */ +public interface TemporarySpeedLimitSection extends EObject { + /** + * Returns the value of the 'Speed Limit Value' attribute. + * + *

+ * If the meaning of the 'Speed Limit Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Value' attribute. + * @see #isSetSpeedLimitValue() + * @see #unsetSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimitSection_SpeedLimitValue() + * @model unsettable="true" required="true" + * @generated + */ + short getSpeedLimitValue(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute. + * + * + * @param value the new value of the 'Speed Limit Value' attribute. + * @see #isSetSpeedLimitValue() + * @see #unsetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @generated + */ + void setSpeedLimitValue(short value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute. + * + * + * @see #isSetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @generated + */ + void unsetSpeedLimitValue(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Value' attribute is set. + * @see #unsetSpeedLimitValue() + * @see #getSpeedLimitValue() + * @see #setSpeedLimitValue(short) + * @generated + */ + boolean isSetSpeedLimitValue(); + + /** + * Returns the value of the 'Speed Limit Value Wet' attribute. + * + *

+ * If the meaning of the 'Speed Limit Value Wet' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Value Wet' attribute. + * @see #isSetSpeedLimitValueWet() + * @see #unsetSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimitSection_SpeedLimitValueWet() + * @model unsettable="true" + * @generated + */ + short getSpeedLimitValueWet(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute. + * + * + * @param value the new value of the 'Speed Limit Value Wet' attribute. + * @see #isSetSpeedLimitValueWet() + * @see #unsetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @generated + */ + void setSpeedLimitValueWet(short value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute. + * + * + * @see #isSetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @generated + */ + void unsetSpeedLimitValueWet(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Value Wet' attribute is set. + * @see #unsetSpeedLimitValueWet() + * @see #getSpeedLimitValueWet() + * @see #setSpeedLimitValueWet(short) + * @generated + */ + boolean isSetSpeedLimitValueWet(); + + /** + * Returns the value of the 'Speed Limit Length' attribute. + * + *

+ * If the meaning of the 'Speed Limit Length' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Speed Limit Length' attribute. + * @see #isSetSpeedLimitLength() + * @see #unsetSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTemporarySpeedLimitSection_SpeedLimitLength() + * @model unsettable="true" + * @generated + */ + Integer getSpeedLimitLength(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute. + * + * + * @param value the new value of the 'Speed Limit Length' attribute. + * @see #isSetSpeedLimitLength() + * @see #unsetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @generated + */ + void setSpeedLimitLength(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute. + * + * + * @see #isSetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @generated + */ + void unsetSpeedLimitLength(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}' attribute is set. + * + * + * @return whether the value of the 'Speed Limit Length' attribute is set. + * @see #unsetSpeedLimitLength() + * @see #getSpeedLimitLength() + * @see #setSpeedLimitLength(Integer) + * @generated + */ + boolean isSetSpeedLimitLength(); + +} // TemporarySpeedLimitSection diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TrafficIncident.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TrafficIncident.java new file mode 100755 index 0000000..f4970d7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/TrafficIncident.java @@ -0,0 +1,1107 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import java.util.Date; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.RectangularArea; + +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; + +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; + +/** + * + * A representation of the model object 'Traffic Incident'. + * + * + * + * See http://vos.intra.local/display/GENIVI/GENIVI+Traffic+Information+-+Traffic+Incident+Definition for definitions of the meanings of the attributes. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode Effect Code}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText Effect Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime Start Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime Stop Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency Tendency}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText Tendency Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay Delay}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauses Causes}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation Location}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdvices Advices}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo Location Info}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauseTexts Cause Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicabilityTexts Applicability Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdviceTexts Advice Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCategoryIds Category Ids}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationBoundingBox Location Bounding Box}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTemporarySpeedLimit Temporary Speed Limit}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident() + * @model + * @generated + */ +public interface TrafficIncident extends EObject { + /** + * Returns the value of the 'Effect Code' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode}. + * + *

+ * If the meaning of the 'Effect Code' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Effect Code' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see #isSetEffectCode() + * @see #unsetEffectCode() + * @see #setEffectCode(EffectCode) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_EffectCode() + * @model unsettable="true" required="true" + * @generated + */ + EffectCode getEffectCode(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute. + * + * + * @param value the new value of the 'Effect Code' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see #isSetEffectCode() + * @see #unsetEffectCode() + * @see #getEffectCode() + * @generated + */ + void setEffectCode(EffectCode value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute. + * + * + * @see #isSetEffectCode() + * @see #getEffectCode() + * @see #setEffectCode(EffectCode) + * @generated + */ + void unsetEffectCode(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode Effect Code}' attribute is set. + * + * + * @return whether the value of the 'Effect Code' attribute is set. + * @see #unsetEffectCode() + * @see #getEffectCode() + * @see #setEffectCode(EffectCode) + * @generated + */ + boolean isSetEffectCode(); + + /** + * Returns the value of the 'Effect Text' attribute. + * + *

+ * If the meaning of the 'Effect Text' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Effect Text' attribute. + * @see #isSetEffectText() + * @see #unsetEffectText() + * @see #setEffectText(String) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_EffectText() + * @model unsettable="true" + * @generated + */ + String getEffectText(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText Effect Text}' attribute. + * + * + * @param value the new value of the 'Effect Text' attribute. + * @see #isSetEffectText() + * @see #unsetEffectText() + * @see #getEffectText() + * @generated + */ + void setEffectText(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText Effect Text}' attribute. + * + * + * @see #isSetEffectText() + * @see #getEffectText() + * @see #setEffectText(String) + * @generated + */ + void unsetEffectText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText Effect Text}' attribute is set. + * + * + * @return whether the value of the 'Effect Text' attribute is set. + * @see #unsetEffectText() + * @see #getEffectText() + * @see #setEffectText(String) + * @generated + */ + boolean isSetEffectText(); + + /** + * Returns the value of the 'Start Time' attribute. + * + *

+ * If the meaning of the 'Start Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Start Time' attribute. + * @see #isSetStartTime() + * @see #unsetStartTime() + * @see #setStartTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_StartTime() + * @model unsettable="true" + * @generated + */ + Date getStartTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime Start Time}' attribute. + * + * + * @param value the new value of the 'Start Time' attribute. + * @see #isSetStartTime() + * @see #unsetStartTime() + * @see #getStartTime() + * @generated + */ + void setStartTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime Start Time}' attribute. + * + * + * @see #isSetStartTime() + * @see #getStartTime() + * @see #setStartTime(Date) + * @generated + */ + void unsetStartTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime Start Time}' attribute is set. + * + * + * @return whether the value of the 'Start Time' attribute is set. + * @see #unsetStartTime() + * @see #getStartTime() + * @see #setStartTime(Date) + * @generated + */ + boolean isSetStartTime(); + + /** + * Returns the value of the 'Stop Time' attribute. + * + *

+ * If the meaning of the 'Stop Time' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Stop Time' attribute. + * @see #isSetStopTime() + * @see #unsetStopTime() + * @see #setStopTime(Date) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_StopTime() + * @model unsettable="true" + * @generated + */ + Date getStopTime(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute. + * + * + * @param value the new value of the 'Stop Time' attribute. + * @see #isSetStopTime() + * @see #unsetStopTime() + * @see #getStopTime() + * @generated + */ + void setStopTime(Date value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute. + * + * + * @see #isSetStopTime() + * @see #getStopTime() + * @see #setStopTime(Date) + * @generated + */ + void unsetStopTime(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime Stop Time}' attribute is set. + * + * + * @return whether the value of the 'Stop Time' attribute is set. + * @see #unsetStopTime() + * @see #getStopTime() + * @see #setStopTime(Date) + * @generated + */ + boolean isSetStopTime(); + + /** + * Returns the value of the 'Tendency' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.Tendency}. + * + *

+ * If the meaning of the 'Tendency' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Tendency' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see #isSetTendency() + * @see #unsetTendency() + * @see #setTendency(Tendency) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Tendency() + * @model unsettable="true" + * @generated + */ + Tendency getTendency(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency Tendency}' attribute. + * + * + * @param value the new value of the 'Tendency' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see #isSetTendency() + * @see #unsetTendency() + * @see #getTendency() + * @generated + */ + void setTendency(Tendency value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency Tendency}' attribute. + * + * + * @see #isSetTendency() + * @see #getTendency() + * @see #setTendency(Tendency) + * @generated + */ + void unsetTendency(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency Tendency}' attribute is set. + * + * + * @return whether the value of the 'Tendency' attribute is set. + * @see #unsetTendency() + * @see #getTendency() + * @see #setTendency(Tendency) + * @generated + */ + boolean isSetTendency(); + + /** + * Returns the value of the 'Tendency Text' attribute. + * + *

+ * If the meaning of the 'Tendency Text' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Tendency Text' attribute. + * @see #isSetTendencyText() + * @see #unsetTendencyText() + * @see #setTendencyText(String) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_TendencyText() + * @model unsettable="true" + * @generated + */ + String getTendencyText(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText Tendency Text}' attribute. + * + * + * @param value the new value of the 'Tendency Text' attribute. + * @see #isSetTendencyText() + * @see #unsetTendencyText() + * @see #getTendencyText() + * @generated + */ + void setTendencyText(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText Tendency Text}' attribute. + * + * + * @see #isSetTendencyText() + * @see #getTendencyText() + * @see #setTendencyText(String) + * @generated + */ + void unsetTendencyText(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText Tendency Text}' attribute is set. + * + * + * @return whether the value of the 'Tendency Text' attribute is set. + * @see #unsetTendencyText() + * @see #getTendencyText() + * @see #setTendencyText(String) + * @generated + */ + boolean isSetTendencyText(); + + /** + * Returns the value of the 'Length Affected' attribute. + * + *

+ * If the meaning of the 'Length Affected' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #setLengthAffected(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_LengthAffected() + * @model unsettable="true" + * @generated + */ + Integer getLengthAffected(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute. + * + * + * @param value the new value of the 'Length Affected' attribute. + * @see #isSetLengthAffected() + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @generated + */ + void setLengthAffected(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute. + * + * + * @see #isSetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + void unsetLengthAffected(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected Length Affected}' attribute is set. + * + * + * @return whether the value of the 'Length Affected' attribute is set. + * @see #unsetLengthAffected() + * @see #getLengthAffected() + * @see #setLengthAffected(Integer) + * @generated + */ + boolean isSetLengthAffected(); + + /** + * Returns the value of the 'Average Speed Absolute' attribute. + * + *

+ * If the meaning of the 'Average Speed Absolute' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Average Speed Absolute' attribute. + * @see #isSetAverageSpeedAbsolute() + * @see #unsetAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_AverageSpeedAbsolute() + * @model unsettable="true" + * @generated + */ + Integer getAverageSpeedAbsolute(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute. + * + * + * @param value the new value of the 'Average Speed Absolute' attribute. + * @see #isSetAverageSpeedAbsolute() + * @see #unsetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @generated + */ + void setAverageSpeedAbsolute(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute. + * + * + * @see #isSetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @generated + */ + void unsetAverageSpeedAbsolute(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}' attribute is set. + * + * + * @return whether the value of the 'Average Speed Absolute' attribute is set. + * @see #unsetAverageSpeedAbsolute() + * @see #getAverageSpeedAbsolute() + * @see #setAverageSpeedAbsolute(Integer) + * @generated + */ + boolean isSetAverageSpeedAbsolute(); + + /** + * Returns the value of the 'Delay' attribute. + * + *

+ * If the meaning of the 'Delay' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Delay' attribute. + * @see #isSetDelay() + * @see #unsetDelay() + * @see #setDelay(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Delay() + * @model unsettable="true" + * @generated + */ + Integer getDelay(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay Delay}' attribute. + * + * + * @param value the new value of the 'Delay' attribute. + * @see #isSetDelay() + * @see #unsetDelay() + * @see #getDelay() + * @generated + */ + void setDelay(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay Delay}' attribute. + * + * + * @see #isSetDelay() + * @see #getDelay() + * @see #setDelay(Integer) + * @generated + */ + void unsetDelay(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay Delay}' attribute is set. + * + * + * @return whether the value of the 'Delay' attribute is set. + * @see #unsetDelay() + * @see #getDelay() + * @see #setDelay(Integer) + * @generated + */ + boolean isSetDelay(); + + /** + * Returns the value of the 'Segment Speed Limit' attribute. + * + *

+ * If the meaning of the 'Segment Speed Limit' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Segment Speed Limit' attribute. + * @see #isSetSegmentSpeedLimit() + * @see #unsetSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_SegmentSpeedLimit() + * @model unsettable="true" + * @generated + */ + Integer getSegmentSpeedLimit(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute. + * + * + * @param value the new value of the 'Segment Speed Limit' attribute. + * @see #isSetSegmentSpeedLimit() + * @see #unsetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @generated + */ + void setSegmentSpeedLimit(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute. + * + * + * @see #isSetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @generated + */ + void unsetSegmentSpeedLimit(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}' attribute is set. + * + * + * @return whether the value of the 'Segment Speed Limit' attribute is set. + * @see #unsetSegmentSpeedLimit() + * @see #getSegmentSpeedLimit() + * @see #setSegmentSpeedLimit(Integer) + * @generated + */ + boolean isSetSegmentSpeedLimit(); + + /** + * Returns the value of the 'Causes' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause}. + * + *

+ * If the meaning of the 'Causes' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Causes' containment reference list. + * @see #isSetCauses() + * @see #unsetCauses() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Causes() + * @model containment="true" unsettable="true" + * @generated + */ + EList getCauses(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauses Causes}' containment reference list. + * + * + * @see #isSetCauses() + * @see #getCauses() + * @generated + */ + void unsetCauses(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauses Causes}' containment reference list is set. + * + * + * @return whether the value of the 'Causes' containment reference list is set. + * @see #unsetCauses() + * @see #getCauses() + * @generated + */ + boolean isSetCauses(); + + /** + * Returns the value of the 'Location' containment reference. + * + *

+ * If the meaning of the 'Location' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location' containment reference. + * @see #isSetLocation() + * @see #unsetLocation() + * @see #setLocation(Location) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Location() + * @model containment="true" unsettable="true" required="true" + * @generated + */ + Location getLocation(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation Location}' containment reference. + * + * + * @param value the new value of the 'Location' containment reference. + * @see #isSetLocation() + * @see #unsetLocation() + * @see #getLocation() + * @generated + */ + void setLocation(Location value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation Location}' containment reference. + * + * + * @see #isSetLocation() + * @see #getLocation() + * @see #setLocation(Location) + * @generated + */ + void unsetLocation(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation Location}' containment reference is set. + * + * + * @return whether the value of the 'Location' containment reference is set. + * @see #unsetLocation() + * @see #getLocation() + * @see #setLocation(Location) + * @generated + */ + boolean isSetLocation(); + + /** + * Returns the value of the 'Advices' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice}. + * + *

+ * If the meaning of the 'Advices' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Advices' containment reference list. + * @see #isSetAdvices() + * @see #unsetAdvices() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Advices() + * @model containment="true" unsettable="true" + * @generated + */ + EList getAdvices(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdvices Advices}' containment reference list. + * + * + * @see #isSetAdvices() + * @see #getAdvices() + * @generated + */ + void unsetAdvices(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdvices Advices}' containment reference list is set. + * + * + * @return whether the value of the 'Advices' containment reference list is set. + * @see #unsetAdvices() + * @see #getAdvices() + * @generated + */ + boolean isSetAdvices(); + + /** + * Returns the value of the 'Applicability' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability}. + * + *

+ * If the meaning of the 'Applicability' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability' containment reference list. + * @see #isSetApplicability() + * @see #unsetApplicability() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_Applicability() + * @model containment="true" unsettable="true" + * @generated + */ + EList getApplicability(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicability Applicability}' containment reference list. + * + * + * @see #isSetApplicability() + * @see #getApplicability() + * @generated + */ + void unsetApplicability(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicability Applicability}' containment reference list is set. + * + * + * @return whether the value of the 'Applicability' containment reference list is set. + * @see #unsetApplicability() + * @see #getApplicability() + * @generated + */ + boolean isSetApplicability(); + + /** + * Returns the value of the 'Traffic Incident Id' attribute. + * + *

+ * If the meaning of the 'Traffic Incident Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Traffic Incident Id' attribute. + * @see #isSetTrafficIncidentId() + * @see #unsetTrafficIncidentId() + * @see #setTrafficIncidentId(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_TrafficIncidentId() + * @model unsettable="true" + * @generated + */ + Integer getTrafficIncidentId(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute. + * + * + * @param value the new value of the 'Traffic Incident Id' attribute. + * @see #isSetTrafficIncidentId() + * @see #unsetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @generated + */ + void setTrafficIncidentId(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute. + * + * + * @see #isSetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @see #setTrafficIncidentId(Integer) + * @generated + */ + void unsetTrafficIncidentId(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}' attribute is set. + * + * + * @return whether the value of the 'Traffic Incident Id' attribute is set. + * @see #unsetTrafficIncidentId() + * @see #getTrafficIncidentId() + * @see #setTrafficIncidentId(Integer) + * @generated + */ + boolean isSetTrafficIncidentId(); + + /** + * Returns the value of the 'Location Info' containment reference. + * + *

+ * If the meaning of the 'Location Info' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location Info' containment reference. + * @see #isSetLocationInfo() + * @see #unsetLocationInfo() + * @see #setLocationInfo(LocationInfo) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_LocationInfo() + * @model containment="true" unsettable="true" + * @generated + */ + LocationInfo getLocationInfo(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo Location Info}' containment reference. + * + * + * @param value the new value of the 'Location Info' containment reference. + * @see #isSetLocationInfo() + * @see #unsetLocationInfo() + * @see #getLocationInfo() + * @generated + */ + void setLocationInfo(LocationInfo value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo Location Info}' containment reference. + * + * + * @see #isSetLocationInfo() + * @see #getLocationInfo() + * @see #setLocationInfo(LocationInfo) + * @generated + */ + void unsetLocationInfo(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo Location Info}' containment reference is set. + * + * + * @return whether the value of the 'Location Info' containment reference is set. + * @see #unsetLocationInfo() + * @see #getLocationInfo() + * @see #setLocationInfo(LocationInfo) + * @generated + */ + boolean isSetLocationInfo(); + + /** + * Returns the value of the 'Cause Texts' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Cause Texts' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Cause Texts' attribute list. + * @see #isSetCauseTexts() + * @see #unsetCauseTexts() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_CauseTexts() + * @model unsettable="true" + * @generated + */ + EList getCauseTexts(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauseTexts Cause Texts}' attribute list. + * + * + * @see #isSetCauseTexts() + * @see #getCauseTexts() + * @generated + */ + void unsetCauseTexts(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauseTexts Cause Texts}' attribute list is set. + * + * + * @return whether the value of the 'Cause Texts' attribute list is set. + * @see #unsetCauseTexts() + * @see #getCauseTexts() + * @generated + */ + boolean isSetCauseTexts(); + + /** + * Returns the value of the 'Applicability Texts' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Applicability Texts' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Applicability Texts' attribute list. + * @see #isSetApplicabilityTexts() + * @see #unsetApplicabilityTexts() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_ApplicabilityTexts() + * @model unsettable="true" + * @generated + */ + EList getApplicabilityTexts(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicabilityTexts Applicability Texts}' attribute list. + * + * + * @see #isSetApplicabilityTexts() + * @see #getApplicabilityTexts() + * @generated + */ + void unsetApplicabilityTexts(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicabilityTexts Applicability Texts}' attribute list is set. + * + * + * @return whether the value of the 'Applicability Texts' attribute list is set. + * @see #unsetApplicabilityTexts() + * @see #getApplicabilityTexts() + * @generated + */ + boolean isSetApplicabilityTexts(); + + /** + * Returns the value of the 'Advice Texts' attribute list. + * The list contents are of type {@link java.lang.String}. + * + *

+ * If the meaning of the 'Advice Texts' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Advice Texts' attribute list. + * @see #isSetAdviceTexts() + * @see #unsetAdviceTexts() + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_AdviceTexts() + * @model unsettable="true" + * @generated + */ + EList getAdviceTexts(); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdviceTexts Advice Texts}' attribute list. + * + * + * @see #isSetAdviceTexts() + * @see #getAdviceTexts() + * @generated + */ + void unsetAdviceTexts(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdviceTexts Advice Texts}' attribute list is set. + * + * + * @return whether the value of the 'Advice Texts' attribute list is set. + * @see #unsetAdviceTexts() + * @see #getAdviceTexts() + * @generated + */ + boolean isSetAdviceTexts(); + + /** + * Returns the value of the 'Category Ids' attribute list. + * The list contents are of type {@link java.lang.Integer}. + * + *

+ * If the meaning of the 'Category Ids' attribute list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Category Ids' attribute list. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_CategoryIds() + * @model + * @generated + */ + EList getCategoryIds(); + + /** + * Returns the value of the 'Location Bounding Box' containment reference. + * + *

+ * If the meaning of the 'Location Bounding Box' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Location Bounding Box' containment reference. + * @see #setLocationBoundingBox(RectangularArea) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_LocationBoundingBox() + * @model containment="true" required="true" + * @generated + */ + RectangularArea getLocationBoundingBox(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationBoundingBox Location Bounding Box}' containment reference. + * + * + * @param value the new value of the 'Location Bounding Box' containment reference. + * @see #getLocationBoundingBox() + * @generated + */ + void setLocationBoundingBox(RectangularArea value); + + /** + * Returns the value of the 'Expected Speed Absolute' attribute. + * + *

+ * If the meaning of the 'Expected Speed Absolute' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expected Speed Absolute' attribute. + * @see #isSetExpectedSpeedAbsolute() + * @see #unsetExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_ExpectedSpeedAbsolute() + * @model unsettable="true" + * @generated + */ + Integer getExpectedSpeedAbsolute(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute. + * + * + * @param value the new value of the 'Expected Speed Absolute' attribute. + * @see #isSetExpectedSpeedAbsolute() + * @see #unsetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @generated + */ + void setExpectedSpeedAbsolute(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute. + * + * + * @see #isSetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @generated + */ + void unsetExpectedSpeedAbsolute(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}' attribute is set. + * + * + * @return whether the value of the 'Expected Speed Absolute' attribute is set. + * @see #unsetExpectedSpeedAbsolute() + * @see #getExpectedSpeedAbsolute() + * @see #setExpectedSpeedAbsolute(Integer) + * @generated + */ + boolean isSetExpectedSpeedAbsolute(); + + /** + * Returns the value of the 'Temporary Speed Limit' containment reference list. + * The list contents are of type {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit}. + * + *

+ * If the meaning of the 'Temporary Speed Limit' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Temporary Speed Limit' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getTrafficIncident_TemporarySpeedLimit() + * @model containment="true" + * @generated + */ + EList getTemporarySpeedLimit(); + +} // TrafficIncident diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/VehicleRelatedRestriction.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/VehicleRelatedRestriction.java new file mode 100755 index 0000000..d22357b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/VehicleRelatedRestriction.java @@ -0,0 +1,197 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.location.Location; + +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; + +/** + * + * A representation of the model object 'Vehicle Related Restriction'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation Restriction Location}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getVehicleRelatedRestriction() + * @model + * @generated + */ +public interface VehicleRelatedRestriction extends EObject { + /** + * Returns the value of the 'Restriction Type' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType}. + * + *

+ * If the meaning of the 'Restriction Type' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see #isSetRestrictionType() + * @see #unsetRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getVehicleRelatedRestriction_RestrictionType() + * @model unsettable="true" required="true" + * @generated + */ + RestrictionType getRestrictionType(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute. + * + * + * @param value the new value of the 'Restriction Type' attribute. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see #isSetRestrictionType() + * @see #unsetRestrictionType() + * @see #getRestrictionType() + * @generated + */ + void setRestrictionType(RestrictionType value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute. + * + * + * @see #isSetRestrictionType() + * @see #getRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @generated + */ + void unsetRestrictionType(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}' attribute is set. + * + * + * @return whether the value of the 'Restriction Type' attribute is set. + * @see #unsetRestrictionType() + * @see #getRestrictionType() + * @see #setRestrictionType(RestrictionType) + * @generated + */ + boolean isSetRestrictionType(); + + /** + * Returns the value of the 'Restriction Value' attribute. + * + *

+ * If the meaning of the 'Restriction Value' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Value' attribute. + * @see #isSetRestrictionValue() + * @see #unsetRestrictionValue() + * @see #setRestrictionValue(Integer) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getVehicleRelatedRestriction_RestrictionValue() + * @model unsettable="true" + * @generated + */ + Integer getRestrictionValue(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute. + * + * + * @param value the new value of the 'Restriction Value' attribute. + * @see #isSetRestrictionValue() + * @see #unsetRestrictionValue() + * @see #getRestrictionValue() + * @generated + */ + void setRestrictionValue(Integer value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute. + * + * + * @see #isSetRestrictionValue() + * @see #getRestrictionValue() + * @see #setRestrictionValue(Integer) + * @generated + */ + void unsetRestrictionValue(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}' attribute is set. + * + * + * @return whether the value of the 'Restriction Value' attribute is set. + * @see #unsetRestrictionValue() + * @see #getRestrictionValue() + * @see #setRestrictionValue(Integer) + * @generated + */ + boolean isSetRestrictionValue(); + + /** + * Returns the value of the 'Restriction Location' containment reference. + * + *

+ * If the meaning of the 'Restriction Location' containment reference isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Restriction Location' containment reference. + * @see #isSetRestrictionLocation() + * @see #unsetRestrictionLocation() + * @see #setRestrictionLocation(Location) + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#getVehicleRelatedRestriction_RestrictionLocation() + * @model containment="true" unsettable="true" + * @generated + */ + Location getRestrictionLocation(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation Restriction Location}' containment reference. + * + * + * @param value the new value of the 'Restriction Location' containment reference. + * @see #isSetRestrictionLocation() + * @see #unsetRestrictionLocation() + * @see #getRestrictionLocation() + * @generated + */ + void setRestrictionLocation(Location value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation Restriction Location}' containment reference. + * + * + * @see #isSetRestrictionLocation() + * @see #getRestrictionLocation() + * @see #setRestrictionLocation(Location) + * @generated + */ + void unsetRestrictionLocation(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation Restriction Location}' containment reference is set. + * + * + * @return whether the value of the 'Restriction Location' containment reference is set. + * @see #unsetRestrictionLocation() + * @see #getRestrictionLocation() + * @see #setRestrictionLocation(Location) + * @generated + */ + boolean isSetRestrictionLocation(); + +} // VehicleRelatedRestriction diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/AdviceImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/AdviceImpl.java new file mode 100755 index 0000000..a9a6ea4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/AdviceImpl.java @@ -0,0 +1,451 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; + +/** + * + * An implementation of the model object 'Advice'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl#getMainAdvice Main Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl#getSubAdvice Sub Advice}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl#getFreeText Free Text}
  • + *
+ *

+ * + * @generated + */ +public class AdviceImpl extends EObjectImpl implements Advice { + /** + * The default value of the '{@link #getMainAdvice() Main Advice}' attribute. + * + * + * @see #getMainAdvice() + * @generated + * @ordered + */ + protected static final AdviceCode MAIN_ADVICE_EDEFAULT = AdviceCode.DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE; + + /** + * The cached value of the '{@link #getMainAdvice() Main Advice}' attribute. + * + * + * @see #getMainAdvice() + * @generated + * @ordered + */ + protected AdviceCode mainAdvice = MAIN_ADVICE_EDEFAULT; + + /** + * This is true if the Main Advice attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean mainAdviceESet; + + /** + * The default value of the '{@link #getSubAdvice() Sub Advice}' attribute. + * + * + * @see #getSubAdvice() + * @generated + * @ordered + */ + protected static final Object SUB_ADVICE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSubAdvice() Sub Advice}' attribute. + * + * + * @see #getSubAdvice() + * @generated + * @ordered + */ + protected Object subAdvice = SUB_ADVICE_EDEFAULT; + + /** + * This is true if the Sub Advice attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean subAdviceESet; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * The default value of the '{@link #getFreeText() Free Text}' attribute. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected static final String FREE_TEXT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFreeText() Free Text}' attribute. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected String freeText = FREE_TEXT_EDEFAULT; + + /** + * This is true if the Free Text attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean freeTextESet; + + /** + * + * + * @generated + */ + protected AdviceImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.ADVICE; + } + + /** + * + * + * @generated + */ + public AdviceCode getMainAdvice() { + return mainAdvice; + } + + /** + * + * + * @generated + */ + public void setMainAdvice(AdviceCode newMainAdvice) { + AdviceCode oldMainAdvice = mainAdvice; + mainAdvice = newMainAdvice == null ? MAIN_ADVICE_EDEFAULT : newMainAdvice; + boolean oldMainAdviceESet = mainAdviceESet; + mainAdviceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.ADVICE__MAIN_ADVICE, oldMainAdvice, mainAdvice, !oldMainAdviceESet)); + } + + /** + * + * + * @generated + */ + public void unsetMainAdvice() { + AdviceCode oldMainAdvice = mainAdvice; + boolean oldMainAdviceESet = mainAdviceESet; + mainAdvice = MAIN_ADVICE_EDEFAULT; + mainAdviceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.ADVICE__MAIN_ADVICE, oldMainAdvice, MAIN_ADVICE_EDEFAULT, oldMainAdviceESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMainAdvice() { + return mainAdviceESet; + } + + /** + * + * + * @generated + */ + public Object getSubAdvice() { + return subAdvice; + } + + /** + * + * + * @generated + */ + public void setSubAdvice(Object newSubAdvice) { + Object oldSubAdvice = subAdvice; + subAdvice = newSubAdvice; + boolean oldSubAdviceESet = subAdviceESet; + subAdviceESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.ADVICE__SUB_ADVICE, oldSubAdvice, subAdvice, !oldSubAdviceESet)); + } + + /** + * + * + * @generated + */ + public void unsetSubAdvice() { + Object oldSubAdvice = subAdvice; + boolean oldSubAdviceESet = subAdviceESet; + subAdvice = SUB_ADVICE_EDEFAULT; + subAdviceESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.ADVICE__SUB_ADVICE, oldSubAdvice, SUB_ADVICE_EDEFAULT, oldSubAdviceESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSubAdvice() { + return subAdviceESet; + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList.Unsettable(Applicability.class, this, trafficincidentPackage.ADVICE__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + public void unsetApplicability() { + if (applicability != null) ((InternalEList.Unsettable)applicability).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetApplicability() { + return applicability != null && ((InternalEList.Unsettable)applicability).isSet(); + } + + /** + * + * + * @generated + */ + public String getFreeText() { + return freeText; + } + + /** + * + * + * @generated + */ + public void setFreeText(String newFreeText) { + String oldFreeText = freeText; + freeText = newFreeText; + boolean oldFreeTextESet = freeTextESet; + freeTextESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.ADVICE__FREE_TEXT, oldFreeText, freeText, !oldFreeTextESet)); + } + + /** + * + * + * @generated + */ + public void unsetFreeText() { + String oldFreeText = freeText; + boolean oldFreeTextESet = freeTextESet; + freeText = FREE_TEXT_EDEFAULT; + freeTextESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.ADVICE__FREE_TEXT, oldFreeText, FREE_TEXT_EDEFAULT, oldFreeTextESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetFreeText() { + return freeTextESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.ADVICE__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.ADVICE__MAIN_ADVICE: + return getMainAdvice(); + case trafficincidentPackage.ADVICE__SUB_ADVICE: + return getSubAdvice(); + case trafficincidentPackage.ADVICE__APPLICABILITY: + return getApplicability(); + case trafficincidentPackage.ADVICE__FREE_TEXT: + return getFreeText(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.ADVICE__MAIN_ADVICE: + setMainAdvice((AdviceCode)newValue); + return; + case trafficincidentPackage.ADVICE__SUB_ADVICE: + setSubAdvice(newValue); + return; + case trafficincidentPackage.ADVICE__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + case trafficincidentPackage.ADVICE__FREE_TEXT: + setFreeText((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.ADVICE__MAIN_ADVICE: + unsetMainAdvice(); + return; + case trafficincidentPackage.ADVICE__SUB_ADVICE: + unsetSubAdvice(); + return; + case trafficincidentPackage.ADVICE__APPLICABILITY: + unsetApplicability(); + return; + case trafficincidentPackage.ADVICE__FREE_TEXT: + unsetFreeText(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.ADVICE__MAIN_ADVICE: + return isSetMainAdvice(); + case trafficincidentPackage.ADVICE__SUB_ADVICE: + return isSetSubAdvice(); + case trafficincidentPackage.ADVICE__APPLICABILITY: + return isSetApplicability(); + case trafficincidentPackage.ADVICE__FREE_TEXT: + return isSetFreeText(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mainAdvice: "); + if (mainAdviceESet) result.append(mainAdvice); else result.append(""); + result.append(", subAdvice: "); + if (subAdviceESet) result.append(subAdvice); else result.append(""); + result.append(", freeText: "); + if (freeTextESet) result.append(freeText); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //AdviceImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/ApplicabilityImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/ApplicabilityImpl.java new file mode 100755 index 0000000..fb81cf7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/ApplicabilityImpl.java @@ -0,0 +1,275 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; + +/** + * + * An implementation of the model object 'Applicability'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl#getVehicleType Vehicle Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl#getVehicleRelatedRestrictions Vehicle Related Restrictions}
  • + *
+ *

+ * + * @generated + */ +public class ApplicabilityImpl extends EObjectImpl implements Applicability { + /** + * The default value of the '{@link #getVehicleType() Vehicle Type}' attribute. + * + * + * @see #getVehicleType() + * @generated + * @ordered + */ + protected static final VehicleType VEHICLE_TYPE_EDEFAULT = VehicleType.CAR; + + /** + * The cached value of the '{@link #getVehicleType() Vehicle Type}' attribute. + * + * + * @see #getVehicleType() + * @generated + * @ordered + */ + protected VehicleType vehicleType = VEHICLE_TYPE_EDEFAULT; + + /** + * This is true if the Vehicle Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean vehicleTypeESet; + + /** + * The cached value of the '{@link #getVehicleRelatedRestrictions() Vehicle Related Restrictions}' containment reference list. + * + * + * @see #getVehicleRelatedRestrictions() + * @generated + * @ordered + */ + protected EList vehicleRelatedRestrictions; + + /** + * + * + * @generated + */ + protected ApplicabilityImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.APPLICABILITY; + } + + /** + * + * + * @generated + */ + public VehicleType getVehicleType() { + return vehicleType; + } + + /** + * + * + * @generated + */ + public void setVehicleType(VehicleType newVehicleType) { + VehicleType oldVehicleType = vehicleType; + vehicleType = newVehicleType == null ? VEHICLE_TYPE_EDEFAULT : newVehicleType; + boolean oldVehicleTypeESet = vehicleTypeESet; + vehicleTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE, oldVehicleType, vehicleType, !oldVehicleTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetVehicleType() { + VehicleType oldVehicleType = vehicleType; + boolean oldVehicleTypeESet = vehicleTypeESet; + vehicleType = VEHICLE_TYPE_EDEFAULT; + vehicleTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE, oldVehicleType, VEHICLE_TYPE_EDEFAULT, oldVehicleTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetVehicleType() { + return vehicleTypeESet; + } + + /** + * + * + * @generated + */ + public EList getVehicleRelatedRestrictions() { + if (vehicleRelatedRestrictions == null) { + vehicleRelatedRestrictions = new EObjectContainmentEList.Unsettable(VehicleRelatedRestriction.class, this, trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS); + } + return vehicleRelatedRestrictions; + } + + /** + * + * + * @generated + */ + public void unsetVehicleRelatedRestrictions() { + if (vehicleRelatedRestrictions != null) ((InternalEList.Unsettable)vehicleRelatedRestrictions).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetVehicleRelatedRestrictions() { + return vehicleRelatedRestrictions != null && ((InternalEList.Unsettable)vehicleRelatedRestrictions).isSet(); + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return ((InternalEList)getVehicleRelatedRestrictions()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE: + return getVehicleType(); + case trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return getVehicleRelatedRestrictions(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE: + setVehicleType((VehicleType)newValue); + return; + case trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + getVehicleRelatedRestrictions().clear(); + getVehicleRelatedRestrictions().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE: + unsetVehicleType(); + return; + case trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + unsetVehicleRelatedRestrictions(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.APPLICABILITY__VEHICLE_TYPE: + return isSetVehicleType(); + case trafficincidentPackage.APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS: + return isSetVehicleRelatedRestrictions(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (vehicleType: "); + if (vehicleTypeESet) result.append(vehicleType); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //ApplicabilityImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/CauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/CauseImpl.java new file mode 100755 index 0000000..fc0868c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/CauseImpl.java @@ -0,0 +1,200 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; + +/** + * + * An implementation of the model object 'Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.CauseImpl#getMainCause Main Cause}
  • + *
+ *

+ * + * @generated + */ +public class CauseImpl extends EObjectImpl implements Cause { + /** + * The default value of the '{@link #getMainCause() Main Cause}' attribute. + * + * + * @see #getMainCause() + * @generated + * @ordered + */ + protected static final CauseCode MAIN_CAUSE_EDEFAULT = CauseCode.TRAFFIC_CONGESTION; + + /** + * The cached value of the '{@link #getMainCause() Main Cause}' attribute. + * + * + * @see #getMainCause() + * @generated + * @ordered + */ + protected CauseCode mainCause = MAIN_CAUSE_EDEFAULT; + + /** + * This is true if the Main Cause attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean mainCauseESet; + + /** + * + * + * @generated + */ + protected CauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.CAUSE; + } + + /** + * + * + * @generated + */ + public CauseCode getMainCause() { + return mainCause; + } + + /** + * + * + * @generated + */ + public void setMainCause(CauseCode newMainCause) { + CauseCode oldMainCause = mainCause; + mainCause = newMainCause == null ? MAIN_CAUSE_EDEFAULT : newMainCause; + boolean oldMainCauseESet = mainCauseESet; + mainCauseESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.CAUSE__MAIN_CAUSE, oldMainCause, mainCause, !oldMainCauseESet)); + } + + /** + * + * + * @generated + */ + public void unsetMainCause() { + CauseCode oldMainCause = mainCause; + boolean oldMainCauseESet = mainCauseESet; + mainCause = MAIN_CAUSE_EDEFAULT; + mainCauseESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.CAUSE__MAIN_CAUSE, oldMainCause, MAIN_CAUSE_EDEFAULT, oldMainCauseESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetMainCause() { + return mainCauseESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.CAUSE__MAIN_CAUSE: + return getMainCause(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.CAUSE__MAIN_CAUSE: + setMainCause((CauseCode)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.CAUSE__MAIN_CAUSE: + unsetMainCause(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.CAUSE__MAIN_CAUSE: + return isSetMainCause(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (mainCause: "); + if (mainCauseESet) result.append(mainCause); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //CauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/DirectCauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/DirectCauseImpl.java new file mode 100755 index 0000000..79144b9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/DirectCauseImpl.java @@ -0,0 +1,781 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * + * An implementation of the model object 'Direct Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getWarningLevel Warning Level}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#isUnverifiedInformation Unverified Information}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getSubCause Sub Cause}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getLaneRestrictions Lane Restrictions}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getFreeText Free Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl#getCauseOffset Cause Offset}
  • + *
+ *

+ * + * @generated + */ +public class DirectCauseImpl extends CauseImpl implements DirectCause { + /** + * The default value of the '{@link #getWarningLevel() Warning Level}' attribute. + * + * + * @see #getWarningLevel() + * @generated + * @ordered + */ + protected static final WarningLevel WARNING_LEVEL_EDEFAULT = WarningLevel.INFORMATIVE; + + /** + * The cached value of the '{@link #getWarningLevel() Warning Level}' attribute. + * + * + * @see #getWarningLevel() + * @generated + * @ordered + */ + protected WarningLevel warningLevel = WARNING_LEVEL_EDEFAULT; + + /** + * This is true if the Warning Level attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean warningLevelESet; + + /** + * The default value of the '{@link #isUnverifiedInformation() Unverified Information}' attribute. + * + * + * @see #isUnverifiedInformation() + * @generated + * @ordered + */ + protected static final boolean UNVERIFIED_INFORMATION_EDEFAULT = false; + + /** + * The cached value of the '{@link #isUnverifiedInformation() Unverified Information}' attribute. + * + * + * @see #isUnverifiedInformation() + * @generated + * @ordered + */ + protected boolean unverifiedInformation = UNVERIFIED_INFORMATION_EDEFAULT; + + /** + * This is true if the Unverified Information attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean unverifiedInformationESet; + + /** + * The default value of the '{@link #getSubCause() Sub Cause}' attribute. + * + * + * @see #getSubCause() + * @generated + * @ordered + */ + protected static final Object SUB_CAUSE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSubCause() Sub Cause}' attribute. + * + * + * @see #getSubCause() + * @generated + * @ordered + */ + protected Object subCause = SUB_CAUSE_EDEFAULT; + + /** + * This is true if the Sub Cause attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean subCauseESet; + + /** + * The default value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected static final Integer LENGTH_AFFECTED_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected Integer lengthAffected = LENGTH_AFFECTED_EDEFAULT; + + /** + * This is true if the Length Affected attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean lengthAffectedESet; + + /** + * The cached value of the '{@link #getLaneRestrictions() Lane Restrictions}' containment reference. + * + * + * @see #getLaneRestrictions() + * @generated + * @ordered + */ + protected LaneRestrictions laneRestrictions; + + /** + * This is true if the Lane Restrictions containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean laneRestrictionsESet; + + /** + * The default value of the '{@link #getFreeText() Free Text}' attribute. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected static final String FREE_TEXT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getFreeText() Free Text}' attribute. + * + * + * @see #getFreeText() + * @generated + * @ordered + */ + protected String freeText = FREE_TEXT_EDEFAULT; + + /** + * This is true if the Free Text attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean freeTextESet; + + /** + * The default value of the '{@link #getCauseOffset() Cause Offset}' attribute. + * + * + * @see #getCauseOffset() + * @generated + * @ordered + */ + protected static final Integer CAUSE_OFFSET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCauseOffset() Cause Offset}' attribute. + * + * + * @see #getCauseOffset() + * @generated + * @ordered + */ + protected Integer causeOffset = CAUSE_OFFSET_EDEFAULT; + + /** + * This is true if the Cause Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean causeOffsetESet; + + /** + * + * + * @generated + */ + protected DirectCauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.DIRECT_CAUSE; + } + + /** + * + * + * @generated + */ + public WarningLevel getWarningLevel() { + return warningLevel; + } + + /** + * + * + * @generated + */ + public void setWarningLevel(WarningLevel newWarningLevel) { + WarningLevel oldWarningLevel = warningLevel; + warningLevel = newWarningLevel == null ? WARNING_LEVEL_EDEFAULT : newWarningLevel; + boolean oldWarningLevelESet = warningLevelESet; + warningLevelESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL, oldWarningLevel, warningLevel, !oldWarningLevelESet)); + } + + /** + * + * + * @generated + */ + public void unsetWarningLevel() { + WarningLevel oldWarningLevel = warningLevel; + boolean oldWarningLevelESet = warningLevelESet; + warningLevel = WARNING_LEVEL_EDEFAULT; + warningLevelESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL, oldWarningLevel, WARNING_LEVEL_EDEFAULT, oldWarningLevelESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetWarningLevel() { + return warningLevelESet; + } + + /** + * + * + * @generated + */ + public boolean isUnverifiedInformation() { + return unverifiedInformation; + } + + /** + * + * + * @generated + */ + public void setUnverifiedInformation(boolean newUnverifiedInformation) { + boolean oldUnverifiedInformation = unverifiedInformation; + unverifiedInformation = newUnverifiedInformation; + boolean oldUnverifiedInformationESet = unverifiedInformationESet; + unverifiedInformationESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION, oldUnverifiedInformation, unverifiedInformation, !oldUnverifiedInformationESet)); + } + + /** + * + * + * @generated + */ + public void unsetUnverifiedInformation() { + boolean oldUnverifiedInformation = unverifiedInformation; + boolean oldUnverifiedInformationESet = unverifiedInformationESet; + unverifiedInformation = UNVERIFIED_INFORMATION_EDEFAULT; + unverifiedInformationESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION, oldUnverifiedInformation, UNVERIFIED_INFORMATION_EDEFAULT, oldUnverifiedInformationESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetUnverifiedInformation() { + return unverifiedInformationESet; + } + + /** + * + * + * @generated + */ + public Object getSubCause() { + return subCause; + } + + /** + * + * + * @generated + */ + public void setSubCause(Object newSubCause) { + Object oldSubCause = subCause; + subCause = newSubCause; + boolean oldSubCauseESet = subCauseESet; + subCauseESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE, oldSubCause, subCause, !oldSubCauseESet)); + } + + /** + * + * + * @generated + */ + public void unsetSubCause() { + Object oldSubCause = subCause; + boolean oldSubCauseESet = subCauseESet; + subCause = SUB_CAUSE_EDEFAULT; + subCauseESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE, oldSubCause, SUB_CAUSE_EDEFAULT, oldSubCauseESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSubCause() { + return subCauseESet; + } + + /** + * + * + * @generated + */ + public Integer getLengthAffected() { + return lengthAffected; + } + + /** + * + * + * @generated + */ + public void setLengthAffected(Integer newLengthAffected) { + Integer oldLengthAffected = lengthAffected; + lengthAffected = newLengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffectedESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED, oldLengthAffected, lengthAffected, !oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public void unsetLengthAffected() { + Integer oldLengthAffected = lengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffected = LENGTH_AFFECTED_EDEFAULT; + lengthAffectedESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED, oldLengthAffected, LENGTH_AFFECTED_EDEFAULT, oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLengthAffected() { + return lengthAffectedESet; + } + + /** + * + * + * @generated + */ + public LaneRestrictions getLaneRestrictions() { + return laneRestrictions; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLaneRestrictions(LaneRestrictions newLaneRestrictions, NotificationChain msgs) { + LaneRestrictions oldLaneRestrictions = laneRestrictions; + laneRestrictions = newLaneRestrictions; + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, oldLaneRestrictions, newLaneRestrictions, !oldLaneRestrictionsESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLaneRestrictions(LaneRestrictions newLaneRestrictions) { + if (newLaneRestrictions != laneRestrictions) { + NotificationChain msgs = null; + if (laneRestrictions != null) + msgs = ((InternalEObject)laneRestrictions).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + if (newLaneRestrictions != null) + msgs = ((InternalEObject)newLaneRestrictions).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + msgs = basicSetLaneRestrictions(newLaneRestrictions, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, newLaneRestrictions, newLaneRestrictions, !oldLaneRestrictionsESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLaneRestrictions(NotificationChain msgs) { + LaneRestrictions oldLaneRestrictions = laneRestrictions; + laneRestrictions = null; + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, oldLaneRestrictions, null, oldLaneRestrictionsESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLaneRestrictions() { + if (laneRestrictions != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)laneRestrictions).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, msgs); + msgs = basicUnsetLaneRestrictions(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLaneRestrictionsESet = laneRestrictionsESet; + laneRestrictionsESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS, null, null, oldLaneRestrictionsESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLaneRestrictions() { + return laneRestrictionsESet; + } + + /** + * + * + * @generated + */ + public String getFreeText() { + return freeText; + } + + /** + * + * + * @generated + */ + public void setFreeText(String newFreeText) { + String oldFreeText = freeText; + freeText = newFreeText; + boolean oldFreeTextESet = freeTextESet; + freeTextESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT, oldFreeText, freeText, !oldFreeTextESet)); + } + + /** + * + * + * @generated + */ + public void unsetFreeText() { + String oldFreeText = freeText; + boolean oldFreeTextESet = freeTextESet; + freeText = FREE_TEXT_EDEFAULT; + freeTextESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT, oldFreeText, FREE_TEXT_EDEFAULT, oldFreeTextESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetFreeText() { + return freeTextESet; + } + + /** + * + * + * @generated + */ + public Integer getCauseOffset() { + return causeOffset; + } + + /** + * + * + * @generated + */ + public void setCauseOffset(Integer newCauseOffset) { + Integer oldCauseOffset = causeOffset; + causeOffset = newCauseOffset; + boolean oldCauseOffsetESet = causeOffsetESet; + causeOffsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET, oldCauseOffset, causeOffset, !oldCauseOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetCauseOffset() { + Integer oldCauseOffset = causeOffset; + boolean oldCauseOffsetESet = causeOffsetESet; + causeOffset = CAUSE_OFFSET_EDEFAULT; + causeOffsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET, oldCauseOffset, CAUSE_OFFSET_EDEFAULT, oldCauseOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCauseOffset() { + return causeOffsetESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return basicUnsetLaneRestrictions(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + return getWarningLevel(); + case trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + return isUnverifiedInformation(); + case trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE: + return getSubCause(); + case trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + return getLengthAffected(); + case trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return getLaneRestrictions(); + case trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT: + return getFreeText(); + case trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + return getCauseOffset(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + setWarningLevel((WarningLevel)newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + setUnverifiedInformation((Boolean)newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE: + setSubCause(newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + setLengthAffected((Integer)newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + setLaneRestrictions((LaneRestrictions)newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT: + setFreeText((String)newValue); + return; + case trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + setCauseOffset((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + unsetWarningLevel(); + return; + case trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + unsetUnverifiedInformation(); + return; + case trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE: + unsetSubCause(); + return; + case trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + unsetLengthAffected(); + return; + case trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + unsetLaneRestrictions(); + return; + case trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT: + unsetFreeText(); + return; + case trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + unsetCauseOffset(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.DIRECT_CAUSE__WARNING_LEVEL: + return isSetWarningLevel(); + case trafficincidentPackage.DIRECT_CAUSE__UNVERIFIED_INFORMATION: + return isSetUnverifiedInformation(); + case trafficincidentPackage.DIRECT_CAUSE__SUB_CAUSE: + return isSetSubCause(); + case trafficincidentPackage.DIRECT_CAUSE__LENGTH_AFFECTED: + return isSetLengthAffected(); + case trafficincidentPackage.DIRECT_CAUSE__LANE_RESTRICTIONS: + return isSetLaneRestrictions(); + case trafficincidentPackage.DIRECT_CAUSE__FREE_TEXT: + return isSetFreeText(); + case trafficincidentPackage.DIRECT_CAUSE__CAUSE_OFFSET: + return isSetCauseOffset(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (warningLevel: "); + if (warningLevelESet) result.append(warningLevel); else result.append(""); + result.append(", unverifiedInformation: "); + if (unverifiedInformationESet) result.append(unverifiedInformation); else result.append(""); + result.append(", subCause: "); + if (subCauseESet) result.append(subCause); else result.append(""); + result.append(", lengthAffected: "); + if (lengthAffectedESet) result.append(lengthAffected); else result.append(""); + result.append(", freeText: "); + if (freeTextESet) result.append(freeText); else result.append(""); + result.append(", causeOffset: "); + if (causeOffsetESet) result.append(causeOffset); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //DirectCauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LaneRestrictionsImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LaneRestrictionsImpl.java new file mode 100755 index 0000000..008201e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LaneRestrictionsImpl.java @@ -0,0 +1,288 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; + +/** + * + * An implementation of the model object 'Lane Restrictions'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl#getLaneRestrictionType Lane Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl#getNumberOfLanes Number Of Lanes}
  • + *
+ *

+ * + * @generated + */ +public class LaneRestrictionsImpl extends EObjectImpl implements LaneRestrictions { + /** + * The default value of the '{@link #getLaneRestrictionType() Lane Restriction Type}' attribute. + * + * + * @see #getLaneRestrictionType() + * @generated + * @ordered + */ + protected static final LaneRestrictionType LANE_RESTRICTION_TYPE_EDEFAULT = LaneRestrictionType.LANES_CLOSED; + + /** + * The cached value of the '{@link #getLaneRestrictionType() Lane Restriction Type}' attribute. + * + * + * @see #getLaneRestrictionType() + * @generated + * @ordered + */ + protected LaneRestrictionType laneRestrictionType = LANE_RESTRICTION_TYPE_EDEFAULT; + + /** + * This is true if the Lane Restriction Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean laneRestrictionTypeESet; + + /** + * The default value of the '{@link #getNumberOfLanes() Number Of Lanes}' attribute. + * + * + * @see #getNumberOfLanes() + * @generated + * @ordered + */ + protected static final Integer NUMBER_OF_LANES_EDEFAULT = null; + + /** + * The cached value of the '{@link #getNumberOfLanes() Number Of Lanes}' attribute. + * + * + * @see #getNumberOfLanes() + * @generated + * @ordered + */ + protected Integer numberOfLanes = NUMBER_OF_LANES_EDEFAULT; + + /** + * This is true if the Number Of Lanes attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean numberOfLanesESet; + + /** + * + * + * @generated + */ + protected LaneRestrictionsImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.LANE_RESTRICTIONS; + } + + /** + * + * + * @generated + */ + public LaneRestrictionType getLaneRestrictionType() { + return laneRestrictionType; + } + + /** + * + * + * @generated + */ + public void setLaneRestrictionType(LaneRestrictionType newLaneRestrictionType) { + LaneRestrictionType oldLaneRestrictionType = laneRestrictionType; + laneRestrictionType = newLaneRestrictionType == null ? LANE_RESTRICTION_TYPE_EDEFAULT : newLaneRestrictionType; + boolean oldLaneRestrictionTypeESet = laneRestrictionTypeESet; + laneRestrictionTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE, oldLaneRestrictionType, laneRestrictionType, !oldLaneRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetLaneRestrictionType() { + LaneRestrictionType oldLaneRestrictionType = laneRestrictionType; + boolean oldLaneRestrictionTypeESet = laneRestrictionTypeESet; + laneRestrictionType = LANE_RESTRICTION_TYPE_EDEFAULT; + laneRestrictionTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE, oldLaneRestrictionType, LANE_RESTRICTION_TYPE_EDEFAULT, oldLaneRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLaneRestrictionType() { + return laneRestrictionTypeESet; + } + + /** + * + * + * @generated + */ + public Integer getNumberOfLanes() { + return numberOfLanes; + } + + /** + * + * + * @generated + */ + public void setNumberOfLanes(Integer newNumberOfLanes) { + Integer oldNumberOfLanes = numberOfLanes; + numberOfLanes = newNumberOfLanes; + boolean oldNumberOfLanesESet = numberOfLanesESet; + numberOfLanesESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES, oldNumberOfLanes, numberOfLanes, !oldNumberOfLanesESet)); + } + + /** + * + * + * @generated + */ + public void unsetNumberOfLanes() { + Integer oldNumberOfLanes = numberOfLanes; + boolean oldNumberOfLanesESet = numberOfLanesESet; + numberOfLanes = NUMBER_OF_LANES_EDEFAULT; + numberOfLanesESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES, oldNumberOfLanes, NUMBER_OF_LANES_EDEFAULT, oldNumberOfLanesESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetNumberOfLanes() { + return numberOfLanesESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + return getLaneRestrictionType(); + case trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + return getNumberOfLanes(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + setLaneRestrictionType((LaneRestrictionType)newValue); + return; + case trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + setNumberOfLanes((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + unsetLaneRestrictionType(); + return; + case trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + unsetNumberOfLanes(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE: + return isSetLaneRestrictionType(); + case trafficincidentPackage.LANE_RESTRICTIONS__NUMBER_OF_LANES: + return isSetNumberOfLanes(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (laneRestrictionType: "); + if (laneRestrictionTypeESet) result.append(laneRestrictionType); else result.append(""); + result.append(", numberOfLanes: "); + if (numberOfLanesESet) result.append(numberOfLanes); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LaneRestrictionsImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LinkedCauseImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LinkedCauseImpl.java new file mode 100755 index 0000000..fa3bd5d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/LinkedCauseImpl.java @@ -0,0 +1,198 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; + +/** + * + * An implementation of the model object 'Linked Cause'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LinkedCauseImpl#getCauseTrafficIncidentId Cause Traffic Incident Id}
  • + *
+ *

+ * + * @generated + */ +public class LinkedCauseImpl extends CauseImpl implements LinkedCause { + /** + * The default value of the '{@link #getCauseTrafficIncidentId() Cause Traffic Incident Id}' attribute. + * + * + * @see #getCauseTrafficIncidentId() + * @generated + * @ordered + */ + protected static final Integer CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCauseTrafficIncidentId() Cause Traffic Incident Id}' attribute. + * + * + * @see #getCauseTrafficIncidentId() + * @generated + * @ordered + */ + protected Integer causeTrafficIncidentId = CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT; + + /** + * This is true if the Cause Traffic Incident Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean causeTrafficIncidentIdESet; + + /** + * + * + * @generated + */ + protected LinkedCauseImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.LINKED_CAUSE; + } + + /** + * + * + * @generated + */ + public Integer getCauseTrafficIncidentId() { + return causeTrafficIncidentId; + } + + /** + * + * + * @generated + */ + public void setCauseTrafficIncidentId(Integer newCauseTrafficIncidentId) { + Integer oldCauseTrafficIncidentId = causeTrafficIncidentId; + causeTrafficIncidentId = newCauseTrafficIncidentId; + boolean oldCauseTrafficIncidentIdESet = causeTrafficIncidentIdESet; + causeTrafficIncidentIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID, oldCauseTrafficIncidentId, causeTrafficIncidentId, !oldCauseTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetCauseTrafficIncidentId() { + Integer oldCauseTrafficIncidentId = causeTrafficIncidentId; + boolean oldCauseTrafficIncidentIdESet = causeTrafficIncidentIdESet; + causeTrafficIncidentId = CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT; + causeTrafficIncidentIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID, oldCauseTrafficIncidentId, CAUSE_TRAFFIC_INCIDENT_ID_EDEFAULT, oldCauseTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCauseTrafficIncidentId() { + return causeTrafficIncidentIdESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + return getCauseTrafficIncidentId(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + setCauseTrafficIncidentId((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + unsetCauseTrafficIncidentId(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID: + return isSetCauseTrafficIncidentId(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (causeTrafficIncidentId: "); + if (causeTrafficIncidentIdESet) result.append(causeTrafficIncidentId); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //LinkedCauseImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitImpl.java new file mode 100755 index 0000000..1bc26bc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitImpl.java @@ -0,0 +1,386 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; + +/** + * + * An implementation of the model object 'Temporary Speed Limit'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl#getTemporarySpeedLimitSections Temporary Speed Limit Sections}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl#isUnitsMPH Units MPH}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl#getOffset Offset}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl#getApplicability Applicability}
  • + *
+ *

+ * + * @generated + */ +public class TemporarySpeedLimitImpl extends EObjectImpl implements TemporarySpeedLimit { + /** + * The cached value of the '{@link #getTemporarySpeedLimitSections() Temporary Speed Limit Sections}' containment reference list. + * + * + * @see #getTemporarySpeedLimitSections() + * @generated + * @ordered + */ + protected EList temporarySpeedLimitSections; + + /** + * The default value of the '{@link #isUnitsMPH() Units MPH}' attribute. + * + * + * @see #isUnitsMPH() + * @generated + * @ordered + */ + protected static final boolean UNITS_MPH_EDEFAULT = false; + + /** + * The cached value of the '{@link #isUnitsMPH() Units MPH}' attribute. + * + * + * @see #isUnitsMPH() + * @generated + * @ordered + */ + protected boolean unitsMPH = UNITS_MPH_EDEFAULT; + + /** + * This is true if the Units MPH attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean unitsMPHESet; + + /** + * The default value of the '{@link #getOffset() Offset}' attribute. + * + * + * @see #getOffset() + * @generated + * @ordered + */ + protected static final Integer OFFSET_EDEFAULT = null; + + /** + * The cached value of the '{@link #getOffset() Offset}' attribute. + * + * + * @see #getOffset() + * @generated + * @ordered + */ + protected Integer offset = OFFSET_EDEFAULT; + + /** + * This is true if the Offset attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean offsetESet; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * + * + * @generated + */ + protected TemporarySpeedLimitImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.TEMPORARY_SPEED_LIMIT; + } + + /** + * + * + * @generated + */ + public EList getTemporarySpeedLimitSections() { + if (temporarySpeedLimitSections == null) { + temporarySpeedLimitSections = new EObjectContainmentEList(TemporarySpeedLimitSection.class, this, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS); + } + return temporarySpeedLimitSections; + } + + /** + * + * + * @generated + */ + public boolean isUnitsMPH() { + return unitsMPH; + } + + /** + * + * + * @generated + */ + public void setUnitsMPH(boolean newUnitsMPH) { + boolean oldUnitsMPH = unitsMPH; + unitsMPH = newUnitsMPH; + boolean oldUnitsMPHESet = unitsMPHESet; + unitsMPHESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH, oldUnitsMPH, unitsMPH, !oldUnitsMPHESet)); + } + + /** + * + * + * @generated + */ + public void unsetUnitsMPH() { + boolean oldUnitsMPH = unitsMPH; + boolean oldUnitsMPHESet = unitsMPHESet; + unitsMPH = UNITS_MPH_EDEFAULT; + unitsMPHESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH, oldUnitsMPH, UNITS_MPH_EDEFAULT, oldUnitsMPHESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetUnitsMPH() { + return unitsMPHESet; + } + + /** + * + * + * @generated + */ + public Integer getOffset() { + return offset; + } + + /** + * + * + * @generated + */ + public void setOffset(Integer newOffset) { + Integer oldOffset = offset; + offset = newOffset; + boolean oldOffsetESet = offsetESet; + offsetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET, oldOffset, offset, !oldOffsetESet)); + } + + /** + * + * + * @generated + */ + public void unsetOffset() { + Integer oldOffset = offset; + boolean oldOffsetESet = offsetESet; + offset = OFFSET_EDEFAULT; + offsetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET, oldOffset, OFFSET_EDEFAULT, oldOffsetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetOffset() { + return offsetESet; + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList(Applicability.class, this, trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return ((InternalEList)getTemporarySpeedLimitSections()).basicRemove(otherEnd, msgs); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return getTemporarySpeedLimitSections(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + return isUnitsMPH(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + return getOffset(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return getApplicability(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + getTemporarySpeedLimitSections().clear(); + getTemporarySpeedLimitSections().addAll((Collection)newValue); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + setUnitsMPH((Boolean)newValue); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + setOffset((Integer)newValue); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + getTemporarySpeedLimitSections().clear(); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + unsetUnitsMPH(); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + unsetOffset(); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + getApplicability().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS: + return temporarySpeedLimitSections != null && !temporarySpeedLimitSections.isEmpty(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__UNITS_MPH: + return isSetUnitsMPH(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__OFFSET: + return isSetOffset(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT__APPLICABILITY: + return applicability != null && !applicability.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (unitsMPH: "); + if (unitsMPHESet) result.append(unitsMPH); else result.append(""); + result.append(", offset: "); + if (offsetESet) result.append(offset); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TemporarySpeedLimitImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitSectionImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitSectionImpl.java new file mode 100755 index 0000000..29b6107 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TemporarySpeedLimitSectionImpl.java @@ -0,0 +1,378 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; + +/** + * + * An implementation of the model object 'Temporary Speed Limit Section'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitValue Speed Limit Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitValueWet Speed Limit Value Wet}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl#getSpeedLimitLength Speed Limit Length}
  • + *
+ *

+ * + * @generated + */ +public class TemporarySpeedLimitSectionImpl extends EObjectImpl implements TemporarySpeedLimitSection { + /** + * The default value of the '{@link #getSpeedLimitValue() Speed Limit Value}' attribute. + * + * + * @see #getSpeedLimitValue() + * @generated + * @ordered + */ + protected static final short SPEED_LIMIT_VALUE_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getSpeedLimitValue() Speed Limit Value}' attribute. + * + * + * @see #getSpeedLimitValue() + * @generated + * @ordered + */ + protected short speedLimitValue = SPEED_LIMIT_VALUE_EDEFAULT; + + /** + * This is true if the Speed Limit Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitValueESet; + + /** + * The default value of the '{@link #getSpeedLimitValueWet() Speed Limit Value Wet}' attribute. + * + * + * @see #getSpeedLimitValueWet() + * @generated + * @ordered + */ + protected static final short SPEED_LIMIT_VALUE_WET_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getSpeedLimitValueWet() Speed Limit Value Wet}' attribute. + * + * + * @see #getSpeedLimitValueWet() + * @generated + * @ordered + */ + protected short speedLimitValueWet = SPEED_LIMIT_VALUE_WET_EDEFAULT; + + /** + * This is true if the Speed Limit Value Wet attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitValueWetESet; + + /** + * The default value of the '{@link #getSpeedLimitLength() Speed Limit Length}' attribute. + * + * + * @see #getSpeedLimitLength() + * @generated + * @ordered + */ + protected static final Integer SPEED_LIMIT_LENGTH_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSpeedLimitLength() Speed Limit Length}' attribute. + * + * + * @see #getSpeedLimitLength() + * @generated + * @ordered + */ + protected Integer speedLimitLength = SPEED_LIMIT_LENGTH_EDEFAULT; + + /** + * This is true if the Speed Limit Length attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean speedLimitLengthESet; + + /** + * + * + * @generated + */ + protected TemporarySpeedLimitSectionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.TEMPORARY_SPEED_LIMIT_SECTION; + } + + /** + * + * + * @generated + */ + public short getSpeedLimitValue() { + return speedLimitValue; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitValue(short newSpeedLimitValue) { + short oldSpeedLimitValue = speedLimitValue; + speedLimitValue = newSpeedLimitValue; + boolean oldSpeedLimitValueESet = speedLimitValueESet; + speedLimitValueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE, oldSpeedLimitValue, speedLimitValue, !oldSpeedLimitValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitValue() { + short oldSpeedLimitValue = speedLimitValue; + boolean oldSpeedLimitValueESet = speedLimitValueESet; + speedLimitValue = SPEED_LIMIT_VALUE_EDEFAULT; + speedLimitValueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE, oldSpeedLimitValue, SPEED_LIMIT_VALUE_EDEFAULT, oldSpeedLimitValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitValue() { + return speedLimitValueESet; + } + + /** + * + * + * @generated + */ + public short getSpeedLimitValueWet() { + return speedLimitValueWet; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitValueWet(short newSpeedLimitValueWet) { + short oldSpeedLimitValueWet = speedLimitValueWet; + speedLimitValueWet = newSpeedLimitValueWet; + boolean oldSpeedLimitValueWetESet = speedLimitValueWetESet; + speedLimitValueWetESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET, oldSpeedLimitValueWet, speedLimitValueWet, !oldSpeedLimitValueWetESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitValueWet() { + short oldSpeedLimitValueWet = speedLimitValueWet; + boolean oldSpeedLimitValueWetESet = speedLimitValueWetESet; + speedLimitValueWet = SPEED_LIMIT_VALUE_WET_EDEFAULT; + speedLimitValueWetESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET, oldSpeedLimitValueWet, SPEED_LIMIT_VALUE_WET_EDEFAULT, oldSpeedLimitValueWetESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitValueWet() { + return speedLimitValueWetESet; + } + + /** + * + * + * @generated + */ + public Integer getSpeedLimitLength() { + return speedLimitLength; + } + + /** + * + * + * @generated + */ + public void setSpeedLimitLength(Integer newSpeedLimitLength) { + Integer oldSpeedLimitLength = speedLimitLength; + speedLimitLength = newSpeedLimitLength; + boolean oldSpeedLimitLengthESet = speedLimitLengthESet; + speedLimitLengthESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH, oldSpeedLimitLength, speedLimitLength, !oldSpeedLimitLengthESet)); + } + + /** + * + * + * @generated + */ + public void unsetSpeedLimitLength() { + Integer oldSpeedLimitLength = speedLimitLength; + boolean oldSpeedLimitLengthESet = speedLimitLengthESet; + speedLimitLength = SPEED_LIMIT_LENGTH_EDEFAULT; + speedLimitLengthESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH, oldSpeedLimitLength, SPEED_LIMIT_LENGTH_EDEFAULT, oldSpeedLimitLengthESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSpeedLimitLength() { + return speedLimitLengthESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + return getSpeedLimitValue(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + return getSpeedLimitValueWet(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + return getSpeedLimitLength(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + setSpeedLimitValue((Short)newValue); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + setSpeedLimitValueWet((Short)newValue); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + setSpeedLimitLength((Integer)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + unsetSpeedLimitValue(); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + unsetSpeedLimitValueWet(); + return; + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + unsetSpeedLimitLength(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE: + return isSetSpeedLimitValue(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET: + return isSetSpeedLimitValueWet(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH: + return isSetSpeedLimitLength(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (speedLimitValue: "); + if (speedLimitValueESet) result.append(speedLimitValue); else result.append(""); + result.append(", speedLimitValueWet: "); + if (speedLimitValueWetESet) result.append(speedLimitValueWet); else result.append(""); + result.append(", speedLimitLength: "); + if (speedLimitLengthESet) result.append(speedLimitLength); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TemporarySpeedLimitSectionImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TrafficIncidentImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TrafficIncidentImpl.java new file mode 100755 index 0000000..575baa5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/TrafficIncidentImpl.java @@ -0,0 +1,1914 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import java.util.Collection; +import java.util.Date; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.genivi.common.RectangularArea; +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; + +/** + * + * An implementation of the model object 'Traffic Incident'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getEffectCode Effect Code}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getEffectText Effect Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getStartTime Start Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getStopTime Stop Time}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getTendency Tendency}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getTendencyText Tendency Text}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getLengthAffected Length Affected}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getAverageSpeedAbsolute Average Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getDelay Delay}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getSegmentSpeedLimit Segment Speed Limit}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getCauses Causes}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getLocation Location}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getAdvices Advices}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getApplicability Applicability}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getTrafficIncidentId Traffic Incident Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getLocationInfo Location Info}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getCauseTexts Cause Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getApplicabilityTexts Applicability Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getAdviceTexts Advice Texts}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getCategoryIds Category Ids}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getLocationBoundingBox Location Bounding Box}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getExpectedSpeedAbsolute Expected Speed Absolute}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl#getTemporarySpeedLimit Temporary Speed Limit}
  • + *
+ *

+ * + * @generated + */ +public class TrafficIncidentImpl extends EObjectImpl implements TrafficIncident { + /** + * The default value of the '{@link #getEffectCode() Effect Code}' attribute. + * + * + * @see #getEffectCode() + * @generated + * @ordered + */ + protected static final EffectCode EFFECT_CODE_EDEFAULT = EffectCode.TRAFFIC_FLOW_UNKNOWN; + + /** + * The cached value of the '{@link #getEffectCode() Effect Code}' attribute. + * + * + * @see #getEffectCode() + * @generated + * @ordered + */ + protected EffectCode effectCode = EFFECT_CODE_EDEFAULT; + + /** + * This is true if the Effect Code attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean effectCodeESet; + + /** + * The default value of the '{@link #getEffectText() Effect Text}' attribute. + * + * + * @see #getEffectText() + * @generated + * @ordered + */ + protected static final String EFFECT_TEXT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getEffectText() Effect Text}' attribute. + * + * + * @see #getEffectText() + * @generated + * @ordered + */ + protected String effectText = EFFECT_TEXT_EDEFAULT; + + /** + * This is true if the Effect Text attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean effectTextESet; + + /** + * The default value of the '{@link #getStartTime() Start Time}' attribute. + * + * + * @see #getStartTime() + * @generated + * @ordered + */ + protected static final Date START_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStartTime() Start Time}' attribute. + * + * + * @see #getStartTime() + * @generated + * @ordered + */ + protected Date startTime = START_TIME_EDEFAULT; + + /** + * This is true if the Start Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean startTimeESet; + + /** + * The default value of the '{@link #getStopTime() Stop Time}' attribute. + * + * + * @see #getStopTime() + * @generated + * @ordered + */ + protected static final Date STOP_TIME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getStopTime() Stop Time}' attribute. + * + * + * @see #getStopTime() + * @generated + * @ordered + */ + protected Date stopTime = STOP_TIME_EDEFAULT; + + /** + * This is true if the Stop Time attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean stopTimeESet; + + /** + * The default value of the '{@link #getTendency() Tendency}' attribute. + * + * + * @see #getTendency() + * @generated + * @ordered + */ + protected static final Tendency TENDENCY_EDEFAULT = Tendency.SLIGHTLY_INCREASING; + + /** + * The cached value of the '{@link #getTendency() Tendency}' attribute. + * + * + * @see #getTendency() + * @generated + * @ordered + */ + protected Tendency tendency = TENDENCY_EDEFAULT; + + /** + * This is true if the Tendency attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean tendencyESet; + + /** + * The default value of the '{@link #getTendencyText() Tendency Text}' attribute. + * + * + * @see #getTendencyText() + * @generated + * @ordered + */ + protected static final String TENDENCY_TEXT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getTendencyText() Tendency Text}' attribute. + * + * + * @see #getTendencyText() + * @generated + * @ordered + */ + protected String tendencyText = TENDENCY_TEXT_EDEFAULT; + + /** + * This is true if the Tendency Text attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean tendencyTextESet; + + /** + * The default value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected static final Integer LENGTH_AFFECTED_EDEFAULT = null; + + /** + * The cached value of the '{@link #getLengthAffected() Length Affected}' attribute. + * + * + * @see #getLengthAffected() + * @generated + * @ordered + */ + protected Integer lengthAffected = LENGTH_AFFECTED_EDEFAULT; + + /** + * This is true if the Length Affected attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean lengthAffectedESet; + + /** + * The default value of the '{@link #getAverageSpeedAbsolute() Average Speed Absolute}' attribute. + * + * + * @see #getAverageSpeedAbsolute() + * @generated + * @ordered + */ + protected static final Integer AVERAGE_SPEED_ABSOLUTE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getAverageSpeedAbsolute() Average Speed Absolute}' attribute. + * + * + * @see #getAverageSpeedAbsolute() + * @generated + * @ordered + */ + protected Integer averageSpeedAbsolute = AVERAGE_SPEED_ABSOLUTE_EDEFAULT; + + /** + * This is true if the Average Speed Absolute attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean averageSpeedAbsoluteESet; + + /** + * The default value of the '{@link #getDelay() Delay}' attribute. + * + * + * @see #getDelay() + * @generated + * @ordered + */ + protected static final Integer DELAY_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDelay() Delay}' attribute. + * + * + * @see #getDelay() + * @generated + * @ordered + */ + protected Integer delay = DELAY_EDEFAULT; + + /** + * This is true if the Delay attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean delayESet; + + /** + * The default value of the '{@link #getSegmentSpeedLimit() Segment Speed Limit}' attribute. + * + * + * @see #getSegmentSpeedLimit() + * @generated + * @ordered + */ + protected static final Integer SEGMENT_SPEED_LIMIT_EDEFAULT = null; + + /** + * The cached value of the '{@link #getSegmentSpeedLimit() Segment Speed Limit}' attribute. + * + * + * @see #getSegmentSpeedLimit() + * @generated + * @ordered + */ + protected Integer segmentSpeedLimit = SEGMENT_SPEED_LIMIT_EDEFAULT; + + /** + * This is true if the Segment Speed Limit attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean segmentSpeedLimitESet; + + /** + * The cached value of the '{@link #getCauses() Causes}' containment reference list. + * + * + * @see #getCauses() + * @generated + * @ordered + */ + protected EList causes; + + /** + * The cached value of the '{@link #getLocation() Location}' containment reference. + * + * + * @see #getLocation() + * @generated + * @ordered + */ + protected Location location; + + /** + * This is true if the Location containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean locationESet; + + /** + * The cached value of the '{@link #getAdvices() Advices}' containment reference list. + * + * + * @see #getAdvices() + * @generated + * @ordered + */ + protected EList advices; + + /** + * The cached value of the '{@link #getApplicability() Applicability}' containment reference list. + * + * + * @see #getApplicability() + * @generated + * @ordered + */ + protected EList applicability; + + /** + * The default value of the '{@link #getTrafficIncidentId() Traffic Incident Id}' attribute. + * + * + * @see #getTrafficIncidentId() + * @generated + * @ordered + */ + protected static final Integer TRAFFIC_INCIDENT_ID_EDEFAULT = null; + + /** + * The cached value of the '{@link #getTrafficIncidentId() Traffic Incident Id}' attribute. + * + * + * @see #getTrafficIncidentId() + * @generated + * @ordered + */ + protected Integer trafficIncidentId = TRAFFIC_INCIDENT_ID_EDEFAULT; + + /** + * This is true if the Traffic Incident Id attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean trafficIncidentIdESet; + + /** + * The cached value of the '{@link #getLocationInfo() Location Info}' containment reference. + * + * + * @see #getLocationInfo() + * @generated + * @ordered + */ + protected LocationInfo locationInfo; + + /** + * This is true if the Location Info containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean locationInfoESet; + + /** + * The cached value of the '{@link #getCauseTexts() Cause Texts}' attribute list. + * + * + * @see #getCauseTexts() + * @generated + * @ordered + */ + protected EList causeTexts; + + /** + * The cached value of the '{@link #getApplicabilityTexts() Applicability Texts}' attribute list. + * + * + * @see #getApplicabilityTexts() + * @generated + * @ordered + */ + protected EList applicabilityTexts; + + /** + * The cached value of the '{@link #getAdviceTexts() Advice Texts}' attribute list. + * + * + * @see #getAdviceTexts() + * @generated + * @ordered + */ + protected EList adviceTexts; + + /** + * The cached value of the '{@link #getCategoryIds() Category Ids}' attribute list. + * + * + * @see #getCategoryIds() + * @generated + * @ordered + */ + protected EList categoryIds; + + /** + * The cached value of the '{@link #getLocationBoundingBox() Location Bounding Box}' containment reference. + * + * + * @see #getLocationBoundingBox() + * @generated + * @ordered + */ + protected RectangularArea locationBoundingBox; + + /** + * The default value of the '{@link #getExpectedSpeedAbsolute() Expected Speed Absolute}' attribute. + * + * + * @see #getExpectedSpeedAbsolute() + * @generated + * @ordered + */ + protected static final Integer EXPECTED_SPEED_ABSOLUTE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getExpectedSpeedAbsolute() Expected Speed Absolute}' attribute. + * + * + * @see #getExpectedSpeedAbsolute() + * @generated + * @ordered + */ + protected Integer expectedSpeedAbsolute = EXPECTED_SPEED_ABSOLUTE_EDEFAULT; + + /** + * This is true if the Expected Speed Absolute attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean expectedSpeedAbsoluteESet; + + /** + * The cached value of the '{@link #getTemporarySpeedLimit() Temporary Speed Limit}' containment reference list. + * + * + * @see #getTemporarySpeedLimit() + * @generated + * @ordered + */ + protected EList temporarySpeedLimit; + + /** + * + * + * @generated + */ + protected TrafficIncidentImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.TRAFFIC_INCIDENT; + } + + /** + * + * + * @generated + */ + public EffectCode getEffectCode() { + return effectCode; + } + + /** + * + * + * @generated + */ + public void setEffectCode(EffectCode newEffectCode) { + EffectCode oldEffectCode = effectCode; + effectCode = newEffectCode == null ? EFFECT_CODE_EDEFAULT : newEffectCode; + boolean oldEffectCodeESet = effectCodeESet; + effectCodeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE, oldEffectCode, effectCode, !oldEffectCodeESet)); + } + + /** + * + * + * @generated + */ + public void unsetEffectCode() { + EffectCode oldEffectCode = effectCode; + boolean oldEffectCodeESet = effectCodeESet; + effectCode = EFFECT_CODE_EDEFAULT; + effectCodeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE, oldEffectCode, EFFECT_CODE_EDEFAULT, oldEffectCodeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetEffectCode() { + return effectCodeESet; + } + + /** + * + * + * @generated + */ + public String getEffectText() { + return effectText; + } + + /** + * + * + * @generated + */ + public void setEffectText(String newEffectText) { + String oldEffectText = effectText; + effectText = newEffectText; + boolean oldEffectTextESet = effectTextESet; + effectTextESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT, oldEffectText, effectText, !oldEffectTextESet)); + } + + /** + * + * + * @generated + */ + public void unsetEffectText() { + String oldEffectText = effectText; + boolean oldEffectTextESet = effectTextESet; + effectText = EFFECT_TEXT_EDEFAULT; + effectTextESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT, oldEffectText, EFFECT_TEXT_EDEFAULT, oldEffectTextESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetEffectText() { + return effectTextESet; + } + + /** + * + * + * @generated + */ + public Date getStartTime() { + return startTime; + } + + /** + * + * + * @generated + */ + public void setStartTime(Date newStartTime) { + Date oldStartTime = startTime; + startTime = newStartTime; + boolean oldStartTimeESet = startTimeESet; + startTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME, oldStartTime, startTime, !oldStartTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetStartTime() { + Date oldStartTime = startTime; + boolean oldStartTimeESet = startTimeESet; + startTime = START_TIME_EDEFAULT; + startTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME, oldStartTime, START_TIME_EDEFAULT, oldStartTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetStartTime() { + return startTimeESet; + } + + /** + * + * + * @generated + */ + public Date getStopTime() { + return stopTime; + } + + /** + * + * + * @generated + */ + public void setStopTime(Date newStopTime) { + Date oldStopTime = stopTime; + stopTime = newStopTime; + boolean oldStopTimeESet = stopTimeESet; + stopTimeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME, oldStopTime, stopTime, !oldStopTimeESet)); + } + + /** + * + * + * @generated + */ + public void unsetStopTime() { + Date oldStopTime = stopTime; + boolean oldStopTimeESet = stopTimeESet; + stopTime = STOP_TIME_EDEFAULT; + stopTimeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME, oldStopTime, STOP_TIME_EDEFAULT, oldStopTimeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetStopTime() { + return stopTimeESet; + } + + /** + * + * + * @generated + */ + public Tendency getTendency() { + return tendency; + } + + /** + * + * + * @generated + */ + public void setTendency(Tendency newTendency) { + Tendency oldTendency = tendency; + tendency = newTendency == null ? TENDENCY_EDEFAULT : newTendency; + boolean oldTendencyESet = tendencyESet; + tendencyESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY, oldTendency, tendency, !oldTendencyESet)); + } + + /** + * + * + * @generated + */ + public void unsetTendency() { + Tendency oldTendency = tendency; + boolean oldTendencyESet = tendencyESet; + tendency = TENDENCY_EDEFAULT; + tendencyESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY, oldTendency, TENDENCY_EDEFAULT, oldTendencyESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTendency() { + return tendencyESet; + } + + /** + * + * + * @generated + */ + public String getTendencyText() { + return tendencyText; + } + + /** + * + * + * @generated + */ + public void setTendencyText(String newTendencyText) { + String oldTendencyText = tendencyText; + tendencyText = newTendencyText; + boolean oldTendencyTextESet = tendencyTextESet; + tendencyTextESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT, oldTendencyText, tendencyText, !oldTendencyTextESet)); + } + + /** + * + * + * @generated + */ + public void unsetTendencyText() { + String oldTendencyText = tendencyText; + boolean oldTendencyTextESet = tendencyTextESet; + tendencyText = TENDENCY_TEXT_EDEFAULT; + tendencyTextESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT, oldTendencyText, TENDENCY_TEXT_EDEFAULT, oldTendencyTextESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTendencyText() { + return tendencyTextESet; + } + + /** + * + * + * @generated + */ + public Integer getLengthAffected() { + return lengthAffected; + } + + /** + * + * + * @generated + */ + public void setLengthAffected(Integer newLengthAffected) { + Integer oldLengthAffected = lengthAffected; + lengthAffected = newLengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffectedESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED, oldLengthAffected, lengthAffected, !oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public void unsetLengthAffected() { + Integer oldLengthAffected = lengthAffected; + boolean oldLengthAffectedESet = lengthAffectedESet; + lengthAffected = LENGTH_AFFECTED_EDEFAULT; + lengthAffectedESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED, oldLengthAffected, LENGTH_AFFECTED_EDEFAULT, oldLengthAffectedESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetLengthAffected() { + return lengthAffectedESet; + } + + /** + * + * + * @generated + */ + public Integer getAverageSpeedAbsolute() { + return averageSpeedAbsolute; + } + + /** + * + * + * @generated + */ + public void setAverageSpeedAbsolute(Integer newAverageSpeedAbsolute) { + Integer oldAverageSpeedAbsolute = averageSpeedAbsolute; + averageSpeedAbsolute = newAverageSpeedAbsolute; + boolean oldAverageSpeedAbsoluteESet = averageSpeedAbsoluteESet; + averageSpeedAbsoluteESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE, oldAverageSpeedAbsolute, averageSpeedAbsolute, !oldAverageSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public void unsetAverageSpeedAbsolute() { + Integer oldAverageSpeedAbsolute = averageSpeedAbsolute; + boolean oldAverageSpeedAbsoluteESet = averageSpeedAbsoluteESet; + averageSpeedAbsolute = AVERAGE_SPEED_ABSOLUTE_EDEFAULT; + averageSpeedAbsoluteESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE, oldAverageSpeedAbsolute, AVERAGE_SPEED_ABSOLUTE_EDEFAULT, oldAverageSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetAverageSpeedAbsolute() { + return averageSpeedAbsoluteESet; + } + + /** + * + * + * @generated + */ + public Integer getDelay() { + return delay; + } + + /** + * + * + * @generated + */ + public void setDelay(Integer newDelay) { + Integer oldDelay = delay; + delay = newDelay; + boolean oldDelayESet = delayESet; + delayESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__DELAY, oldDelay, delay, !oldDelayESet)); + } + + /** + * + * + * @generated + */ + public void unsetDelay() { + Integer oldDelay = delay; + boolean oldDelayESet = delayESet; + delay = DELAY_EDEFAULT; + delayESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__DELAY, oldDelay, DELAY_EDEFAULT, oldDelayESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDelay() { + return delayESet; + } + + /** + * + * + * @generated + */ + public Integer getSegmentSpeedLimit() { + return segmentSpeedLimit; + } + + /** + * + * + * @generated + */ + public void setSegmentSpeedLimit(Integer newSegmentSpeedLimit) { + Integer oldSegmentSpeedLimit = segmentSpeedLimit; + segmentSpeedLimit = newSegmentSpeedLimit; + boolean oldSegmentSpeedLimitESet = segmentSpeedLimitESet; + segmentSpeedLimitESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT, oldSegmentSpeedLimit, segmentSpeedLimit, !oldSegmentSpeedLimitESet)); + } + + /** + * + * + * @generated + */ + public void unsetSegmentSpeedLimit() { + Integer oldSegmentSpeedLimit = segmentSpeedLimit; + boolean oldSegmentSpeedLimitESet = segmentSpeedLimitESet; + segmentSpeedLimit = SEGMENT_SPEED_LIMIT_EDEFAULT; + segmentSpeedLimitESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT, oldSegmentSpeedLimit, SEGMENT_SPEED_LIMIT_EDEFAULT, oldSegmentSpeedLimitESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetSegmentSpeedLimit() { + return segmentSpeedLimitESet; + } + + /** + * + * + * @generated + */ + public EList getCauses() { + if (causes == null) { + causes = new EObjectContainmentEList.Unsettable(Cause.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES); + } + return causes; + } + + /** + * + * + * @generated + */ + public void unsetCauses() { + if (causes != null) ((InternalEList.Unsettable)causes).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetCauses() { + return causes != null && ((InternalEList.Unsettable)causes).isSet(); + } + + /** + * + * + * @generated + */ + public Location getLocation() { + return location; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLocation(Location newLocation, NotificationChain msgs) { + Location oldLocation = location; + location = newLocation; + boolean oldLocationESet = locationESet; + locationESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, oldLocation, newLocation, !oldLocationESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLocation(Location newLocation) { + if (newLocation != location) { + NotificationChain msgs = null; + if (location != null) + msgs = ((InternalEObject)location).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, null, msgs); + if (newLocation != null) + msgs = ((InternalEObject)newLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, null, msgs); + msgs = basicSetLocation(newLocation, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationESet = locationESet; + locationESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, newLocation, newLocation, !oldLocationESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLocation(NotificationChain msgs) { + Location oldLocation = location; + location = null; + boolean oldLocationESet = locationESet; + locationESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, oldLocation, null, oldLocationESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLocation() { + if (location != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)location).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, null, msgs); + msgs = basicUnsetLocation(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationESet = locationESet; + locationESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION, null, null, oldLocationESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLocation() { + return locationESet; + } + + /** + * + * + * @generated + */ + public EList getAdvices() { + if (advices == null) { + advices = new EObjectContainmentEList.Unsettable(Advice.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES); + } + return advices; + } + + /** + * + * + * @generated + */ + public void unsetAdvices() { + if (advices != null) ((InternalEList.Unsettable)advices).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetAdvices() { + return advices != null && ((InternalEList.Unsettable)advices).isSet(); + } + + /** + * + * + * @generated + */ + public EList getApplicability() { + if (applicability == null) { + applicability = new EObjectContainmentEList.Unsettable(Applicability.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY); + } + return applicability; + } + + /** + * + * + * @generated + */ + public void unsetApplicability() { + if (applicability != null) ((InternalEList.Unsettable)applicability).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetApplicability() { + return applicability != null && ((InternalEList.Unsettable)applicability).isSet(); + } + + /** + * + * + * @generated + */ + public Integer getTrafficIncidentId() { + return trafficIncidentId; + } + + /** + * + * + * @generated + */ + public void setTrafficIncidentId(Integer newTrafficIncidentId) { + Integer oldTrafficIncidentId = trafficIncidentId; + trafficIncidentId = newTrafficIncidentId; + boolean oldTrafficIncidentIdESet = trafficIncidentIdESet; + trafficIncidentIdESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID, oldTrafficIncidentId, trafficIncidentId, !oldTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public void unsetTrafficIncidentId() { + Integer oldTrafficIncidentId = trafficIncidentId; + boolean oldTrafficIncidentIdESet = trafficIncidentIdESet; + trafficIncidentId = TRAFFIC_INCIDENT_ID_EDEFAULT; + trafficIncidentIdESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID, oldTrafficIncidentId, TRAFFIC_INCIDENT_ID_EDEFAULT, oldTrafficIncidentIdESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTrafficIncidentId() { + return trafficIncidentIdESet; + } + + /** + * + * + * @generated + */ + public LocationInfo getLocationInfo() { + return locationInfo; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLocationInfo(LocationInfo newLocationInfo, NotificationChain msgs) { + LocationInfo oldLocationInfo = locationInfo; + locationInfo = newLocationInfo; + boolean oldLocationInfoESet = locationInfoESet; + locationInfoESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, oldLocationInfo, newLocationInfo, !oldLocationInfoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLocationInfo(LocationInfo newLocationInfo) { + if (newLocationInfo != locationInfo) { + NotificationChain msgs = null; + if (locationInfo != null) + msgs = ((InternalEObject)locationInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, null, msgs); + if (newLocationInfo != null) + msgs = ((InternalEObject)newLocationInfo).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, null, msgs); + msgs = basicSetLocationInfo(newLocationInfo, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationInfoESet = locationInfoESet; + locationInfoESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, newLocationInfo, newLocationInfo, !oldLocationInfoESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetLocationInfo(NotificationChain msgs) { + LocationInfo oldLocationInfo = locationInfo; + locationInfo = null; + boolean oldLocationInfoESet = locationInfoESet; + locationInfoESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, oldLocationInfo, null, oldLocationInfoESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetLocationInfo() { + if (locationInfo != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)locationInfo).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, null, msgs); + msgs = basicUnsetLocationInfo(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldLocationInfoESet = locationInfoESet; + locationInfoESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO, null, null, oldLocationInfoESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetLocationInfo() { + return locationInfoESet; + } + + /** + * + * + * @generated + */ + public EList getCauseTexts() { + if (causeTexts == null) { + causeTexts = new EDataTypeUniqueEList.Unsettable(String.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__CAUSE_TEXTS); + } + return causeTexts; + } + + /** + * + * + * @generated + */ + public void unsetCauseTexts() { + if (causeTexts != null) ((InternalEList.Unsettable)causeTexts).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetCauseTexts() { + return causeTexts != null && ((InternalEList.Unsettable)causeTexts).isSet(); + } + + /** + * + * + * @generated + */ + public EList getApplicabilityTexts() { + if (applicabilityTexts == null) { + applicabilityTexts = new EDataTypeUniqueEList.Unsettable(String.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY_TEXTS); + } + return applicabilityTexts; + } + + /** + * + * + * @generated + */ + public void unsetApplicabilityTexts() { + if (applicabilityTexts != null) ((InternalEList.Unsettable)applicabilityTexts).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetApplicabilityTexts() { + return applicabilityTexts != null && ((InternalEList.Unsettable)applicabilityTexts).isSet(); + } + + /** + * + * + * @generated + */ + public EList getAdviceTexts() { + if (adviceTexts == null) { + adviceTexts = new EDataTypeUniqueEList.Unsettable(String.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__ADVICE_TEXTS); + } + return adviceTexts; + } + + /** + * + * + * @generated + */ + public void unsetAdviceTexts() { + if (adviceTexts != null) ((InternalEList.Unsettable)adviceTexts).unset(); + } + + /** + * + * + * @generated + */ + public boolean isSetAdviceTexts() { + return adviceTexts != null && ((InternalEList.Unsettable)adviceTexts).isSet(); + } + + /** + * + * + * @generated + */ + public EList getCategoryIds() { + if (categoryIds == null) { + categoryIds = new EDataTypeUniqueEList(Integer.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__CATEGORY_IDS); + } + return categoryIds; + } + + /** + * + * + * @generated + */ + public RectangularArea getLocationBoundingBox() { + return locationBoundingBox; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetLocationBoundingBox(RectangularArea newLocationBoundingBox, NotificationChain msgs) { + RectangularArea oldLocationBoundingBox = locationBoundingBox; + locationBoundingBox = newLocationBoundingBox; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX, oldLocationBoundingBox, newLocationBoundingBox); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setLocationBoundingBox(RectangularArea newLocationBoundingBox) { + if (newLocationBoundingBox != locationBoundingBox) { + NotificationChain msgs = null; + if (locationBoundingBox != null) + msgs = ((InternalEObject)locationBoundingBox).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX, null, msgs); + if (newLocationBoundingBox != null) + msgs = ((InternalEObject)newLocationBoundingBox).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX, null, msgs); + msgs = basicSetLocationBoundingBox(newLocationBoundingBox, msgs); + if (msgs != null) msgs.dispatch(); + } + else if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX, newLocationBoundingBox, newLocationBoundingBox)); + } + + /** + * + * + * @generated + */ + public Integer getExpectedSpeedAbsolute() { + return expectedSpeedAbsolute; + } + + /** + * + * + * @generated + */ + public void setExpectedSpeedAbsolute(Integer newExpectedSpeedAbsolute) { + Integer oldExpectedSpeedAbsolute = expectedSpeedAbsolute; + expectedSpeedAbsolute = newExpectedSpeedAbsolute; + boolean oldExpectedSpeedAbsoluteESet = expectedSpeedAbsoluteESet; + expectedSpeedAbsoluteESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE, oldExpectedSpeedAbsolute, expectedSpeedAbsolute, !oldExpectedSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public void unsetExpectedSpeedAbsolute() { + Integer oldExpectedSpeedAbsolute = expectedSpeedAbsolute; + boolean oldExpectedSpeedAbsoluteESet = expectedSpeedAbsoluteESet; + expectedSpeedAbsolute = EXPECTED_SPEED_ABSOLUTE_EDEFAULT; + expectedSpeedAbsoluteESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE, oldExpectedSpeedAbsolute, EXPECTED_SPEED_ABSOLUTE_EDEFAULT, oldExpectedSpeedAbsoluteESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetExpectedSpeedAbsolute() { + return expectedSpeedAbsoluteESet; + } + + /** + * + * + * @generated + */ + public EList getTemporarySpeedLimit() { + if (temporarySpeedLimit == null) { + temporarySpeedLimit = new EObjectContainmentEList(TemporarySpeedLimit.class, this, trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT); + } + return temporarySpeedLimit; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES: + return ((InternalEList)getCauses()).basicRemove(otherEnd, msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION: + return basicUnsetLocation(msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES: + return ((InternalEList)getAdvices()).basicRemove(otherEnd, msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return ((InternalEList)getApplicability()).basicRemove(otherEnd, msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO: + return basicUnsetLocationInfo(msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX: + return basicSetLocationBoundingBox(null, msgs); + case trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return ((InternalEList)getTemporarySpeedLimit()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + return getEffectCode(); + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT: + return getEffectText(); + case trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME: + return getStartTime(); + case trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + return getStopTime(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY: + return getTendency(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT: + return getTendencyText(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + return getLengthAffected(); + case trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + return getAverageSpeedAbsolute(); + case trafficincidentPackage.TRAFFIC_INCIDENT__DELAY: + return getDelay(); + case trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + return getSegmentSpeedLimit(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES: + return getCauses(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION: + return getLocation(); + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES: + return getAdvices(); + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return getApplicability(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + return getTrafficIncidentId(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO: + return getLocationInfo(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSE_TEXTS: + return getCauseTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY_TEXTS: + return getApplicabilityTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICE_TEXTS: + return getAdviceTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CATEGORY_IDS: + return getCategoryIds(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX: + return getLocationBoundingBox(); + case trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + return getExpectedSpeedAbsolute(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return getTemporarySpeedLimit(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + setEffectCode((EffectCode)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT: + setEffectText((String)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME: + setStartTime((Date)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + setStopTime((Date)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY: + setTendency((Tendency)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT: + setTendencyText((String)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + setLengthAffected((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + setAverageSpeedAbsolute((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__DELAY: + setDelay((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + setSegmentSpeedLimit((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES: + getCauses().clear(); + getCauses().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION: + setLocation((Location)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES: + getAdvices().clear(); + getAdvices().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + getApplicability().clear(); + getApplicability().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + setTrafficIncidentId((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO: + setLocationInfo((LocationInfo)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSE_TEXTS: + getCauseTexts().clear(); + getCauseTexts().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY_TEXTS: + getApplicabilityTexts().clear(); + getApplicabilityTexts().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICE_TEXTS: + getAdviceTexts().clear(); + getAdviceTexts().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CATEGORY_IDS: + getCategoryIds().clear(); + getCategoryIds().addAll((Collection)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX: + setLocationBoundingBox((RectangularArea)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + setExpectedSpeedAbsolute((Integer)newValue); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + getTemporarySpeedLimit().clear(); + getTemporarySpeedLimit().addAll((Collection)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + unsetEffectCode(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT: + unsetEffectText(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME: + unsetStartTime(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + unsetStopTime(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY: + unsetTendency(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT: + unsetTendencyText(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + unsetLengthAffected(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + unsetAverageSpeedAbsolute(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__DELAY: + unsetDelay(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + unsetSegmentSpeedLimit(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES: + unsetCauses(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION: + unsetLocation(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES: + unsetAdvices(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + unsetApplicability(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + unsetTrafficIncidentId(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO: + unsetLocationInfo(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSE_TEXTS: + unsetCauseTexts(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY_TEXTS: + unsetApplicabilityTexts(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICE_TEXTS: + unsetAdviceTexts(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__CATEGORY_IDS: + getCategoryIds().clear(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX: + setLocationBoundingBox((RectangularArea)null); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + unsetExpectedSpeedAbsolute(); + return; + case trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + getTemporarySpeedLimit().clear(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_CODE: + return isSetEffectCode(); + case trafficincidentPackage.TRAFFIC_INCIDENT__EFFECT_TEXT: + return isSetEffectText(); + case trafficincidentPackage.TRAFFIC_INCIDENT__START_TIME: + return isSetStartTime(); + case trafficincidentPackage.TRAFFIC_INCIDENT__STOP_TIME: + return isSetStopTime(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY: + return isSetTendency(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TENDENCY_TEXT: + return isSetTendencyText(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LENGTH_AFFECTED: + return isSetLengthAffected(); + case trafficincidentPackage.TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE: + return isSetAverageSpeedAbsolute(); + case trafficincidentPackage.TRAFFIC_INCIDENT__DELAY: + return isSetDelay(); + case trafficincidentPackage.TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT: + return isSetSegmentSpeedLimit(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSES: + return isSetCauses(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION: + return isSetLocation(); + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICES: + return isSetAdvices(); + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY: + return isSetApplicability(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID: + return isSetTrafficIncidentId(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_INFO: + return isSetLocationInfo(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CAUSE_TEXTS: + return isSetCauseTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__APPLICABILITY_TEXTS: + return isSetApplicabilityTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__ADVICE_TEXTS: + return isSetAdviceTexts(); + case trafficincidentPackage.TRAFFIC_INCIDENT__CATEGORY_IDS: + return categoryIds != null && !categoryIds.isEmpty(); + case trafficincidentPackage.TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX: + return locationBoundingBox != null; + case trafficincidentPackage.TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE: + return isSetExpectedSpeedAbsolute(); + case trafficincidentPackage.TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT: + return temporarySpeedLimit != null && !temporarySpeedLimit.isEmpty(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (effectCode: "); + if (effectCodeESet) result.append(effectCode); else result.append(""); + result.append(", effectText: "); + if (effectTextESet) result.append(effectText); else result.append(""); + result.append(", startTime: "); + if (startTimeESet) result.append(startTime); else result.append(""); + result.append(", stopTime: "); + if (stopTimeESet) result.append(stopTime); else result.append(""); + result.append(", tendency: "); + if (tendencyESet) result.append(tendency); else result.append(""); + result.append(", tendencyText: "); + if (tendencyTextESet) result.append(tendencyText); else result.append(""); + result.append(", lengthAffected: "); + if (lengthAffectedESet) result.append(lengthAffected); else result.append(""); + result.append(", averageSpeedAbsolute: "); + if (averageSpeedAbsoluteESet) result.append(averageSpeedAbsolute); else result.append(""); + result.append(", delay: "); + if (delayESet) result.append(delay); else result.append(""); + result.append(", segmentSpeedLimit: "); + if (segmentSpeedLimitESet) result.append(segmentSpeedLimit); else result.append(""); + result.append(", trafficIncidentId: "); + if (trafficIncidentIdESet) result.append(trafficIncidentId); else result.append(""); + result.append(", causeTexts: "); + result.append(causeTexts); + result.append(", applicabilityTexts: "); + result.append(applicabilityTexts); + result.append(", adviceTexts: "); + result.append(adviceTexts); + result.append(", categoryIds: "); + result.append(categoryIds); + result.append(", expectedSpeedAbsolute: "); + if (expectedSpeedAbsoluteESet) result.append(expectedSpeedAbsolute); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //TrafficIncidentImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/VehicleRelatedRestrictionImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/VehicleRelatedRestrictionImpl.java new file mode 100755 index 0000000..cc03f7f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/VehicleRelatedRestrictionImpl.java @@ -0,0 +1,430 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.location.Location; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; + +/** + * + * An implementation of the model object 'Vehicle Related Restriction'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionType Restriction Type}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionValue Restriction Value}
  • + *
  • {@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl#getRestrictionLocation Restriction Location}
  • + *
+ *

+ * + * @generated + */ +public class VehicleRelatedRestrictionImpl extends EObjectImpl implements VehicleRelatedRestriction { + /** + * The default value of the '{@link #getRestrictionType() Restriction Type}' attribute. + * + * + * @see #getRestrictionType() + * @generated + * @ordered + */ + protected static final RestrictionType RESTRICTION_TYPE_EDEFAULT = RestrictionType.WIDTH_LESS_THAN; + + /** + * The cached value of the '{@link #getRestrictionType() Restriction Type}' attribute. + * + * + * @see #getRestrictionType() + * @generated + * @ordered + */ + protected RestrictionType restrictionType = RESTRICTION_TYPE_EDEFAULT; + + /** + * This is true if the Restriction Type attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionTypeESet; + + /** + * The default value of the '{@link #getRestrictionValue() Restriction Value}' attribute. + * + * + * @see #getRestrictionValue() + * @generated + * @ordered + */ + protected static final Integer RESTRICTION_VALUE_EDEFAULT = null; + + /** + * The cached value of the '{@link #getRestrictionValue() Restriction Value}' attribute. + * + * + * @see #getRestrictionValue() + * @generated + * @ordered + */ + protected Integer restrictionValue = RESTRICTION_VALUE_EDEFAULT; + + /** + * This is true if the Restriction Value attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionValueESet; + + /** + * The cached value of the '{@link #getRestrictionLocation() Restriction Location}' containment reference. + * + * + * @see #getRestrictionLocation() + * @generated + * @ordered + */ + protected Location restrictionLocation; + + /** + * This is true if the Restriction Location containment reference has been set. + * + * + * @generated + * @ordered + */ + protected boolean restrictionLocationESet; + + /** + * + * + * @generated + */ + protected VehicleRelatedRestrictionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentPackage.Literals.VEHICLE_RELATED_RESTRICTION; + } + + /** + * + * + * @generated + */ + public RestrictionType getRestrictionType() { + return restrictionType; + } + + /** + * + * + * @generated + */ + public void setRestrictionType(RestrictionType newRestrictionType) { + RestrictionType oldRestrictionType = restrictionType; + restrictionType = newRestrictionType == null ? RESTRICTION_TYPE_EDEFAULT : newRestrictionType; + boolean oldRestrictionTypeESet = restrictionTypeESet; + restrictionTypeESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE, oldRestrictionType, restrictionType, !oldRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public void unsetRestrictionType() { + RestrictionType oldRestrictionType = restrictionType; + boolean oldRestrictionTypeESet = restrictionTypeESet; + restrictionType = RESTRICTION_TYPE_EDEFAULT; + restrictionTypeESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE, oldRestrictionType, RESTRICTION_TYPE_EDEFAULT, oldRestrictionTypeESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionType() { + return restrictionTypeESet; + } + + /** + * + * + * @generated + */ + public Integer getRestrictionValue() { + return restrictionValue; + } + + /** + * + * + * @generated + */ + public void setRestrictionValue(Integer newRestrictionValue) { + Integer oldRestrictionValue = restrictionValue; + restrictionValue = newRestrictionValue; + boolean oldRestrictionValueESet = restrictionValueESet; + restrictionValueESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE, oldRestrictionValue, restrictionValue, !oldRestrictionValueESet)); + } + + /** + * + * + * @generated + */ + public void unsetRestrictionValue() { + Integer oldRestrictionValue = restrictionValue; + boolean oldRestrictionValueESet = restrictionValueESet; + restrictionValue = RESTRICTION_VALUE_EDEFAULT; + restrictionValueESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE, oldRestrictionValue, RESTRICTION_VALUE_EDEFAULT, oldRestrictionValueESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionValue() { + return restrictionValueESet; + } + + /** + * + * + * @generated + */ + public Location getRestrictionLocation() { + return restrictionLocation; + } + + /** + * + * + * @generated + */ + public NotificationChain basicSetRestrictionLocation(Location newRestrictionLocation, NotificationChain msgs) { + Location oldRestrictionLocation = restrictionLocation; + restrictionLocation = newRestrictionLocation; + boolean oldRestrictionLocationESet = restrictionLocationESet; + restrictionLocationESet = true; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, oldRestrictionLocation, newRestrictionLocation, !oldRestrictionLocationESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void setRestrictionLocation(Location newRestrictionLocation) { + if (newRestrictionLocation != restrictionLocation) { + NotificationChain msgs = null; + if (restrictionLocation != null) + msgs = ((InternalEObject)restrictionLocation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, null, msgs); + if (newRestrictionLocation != null) + msgs = ((InternalEObject)newRestrictionLocation).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, null, msgs); + msgs = basicSetRestrictionLocation(newRestrictionLocation, msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRestrictionLocationESet = restrictionLocationESet; + restrictionLocationESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, newRestrictionLocation, newRestrictionLocation, !oldRestrictionLocationESet)); + } + } + + /** + * + * + * @generated + */ + public NotificationChain basicUnsetRestrictionLocation(NotificationChain msgs) { + Location oldRestrictionLocation = restrictionLocation; + restrictionLocation = null; + boolean oldRestrictionLocationESet = restrictionLocationESet; + restrictionLocationESet = false; + if (eNotificationRequired()) { + ENotificationImpl notification = new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, oldRestrictionLocation, null, oldRestrictionLocationESet); + if (msgs == null) msgs = notification; else msgs.add(notification); + } + return msgs; + } + + /** + * + * + * @generated + */ + public void unsetRestrictionLocation() { + if (restrictionLocation != null) { + NotificationChain msgs = null; + msgs = ((InternalEObject)restrictionLocation).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, null, msgs); + msgs = basicUnsetRestrictionLocation(msgs); + if (msgs != null) msgs.dispatch(); + } + else { + boolean oldRestrictionLocationESet = restrictionLocationESet; + restrictionLocationESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION, null, null, oldRestrictionLocationESet)); + } + } + + /** + * + * + * @generated + */ + public boolean isSetRestrictionLocation() { + return restrictionLocationESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION: + return basicUnsetRestrictionLocation(msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + return getRestrictionType(); + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + return getRestrictionValue(); + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION: + return getRestrictionLocation(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + setRestrictionType((RestrictionType)newValue); + return; + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + setRestrictionValue((Integer)newValue); + return; + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION: + setRestrictionLocation((Location)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + unsetRestrictionType(); + return; + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + unsetRestrictionValue(); + return; + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION: + unsetRestrictionLocation(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE: + return isSetRestrictionType(); + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE: + return isSetRestrictionValue(); + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION: + return isSetRestrictionLocation(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (restrictionType: "); + if (restrictionTypeESet) result.append(restrictionType); else result.append(""); + result.append(", restrictionValue: "); + if (restrictionValueESet) result.append(restrictionValue); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //VehicleRelatedRestrictionImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentFactoryImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentFactoryImpl.java new file mode 100755 index 0000000..8a5a424 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentFactoryImpl.java @@ -0,0 +1,199 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class trafficincidentFactoryImpl extends EFactoryImpl implements trafficincidentFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static trafficincidentFactory init() { + try { + trafficincidentFactory thetrafficincidentFactory = (trafficincidentFactory)EPackage.Registry.INSTANCE.getEFactory(trafficincidentPackage.eNS_URI); + if (thetrafficincidentFactory != null) { + return thetrafficincidentFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new trafficincidentFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public trafficincidentFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case trafficincidentPackage.TRAFFIC_INCIDENT: return createTrafficIncident(); + case trafficincidentPackage.CAUSE: return createCause(); + case trafficincidentPackage.LINKED_CAUSE: return createLinkedCause(); + case trafficincidentPackage.DIRECT_CAUSE: return createDirectCause(); + case trafficincidentPackage.LANE_RESTRICTIONS: return createLaneRestrictions(); + case trafficincidentPackage.ADVICE: return createAdvice(); + case trafficincidentPackage.APPLICABILITY: return createApplicability(); + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION: return createVehicleRelatedRestriction(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT: return createTemporarySpeedLimit(); + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION: return createTemporarySpeedLimitSection(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public TrafficIncident createTrafficIncident() { + TrafficIncidentImpl trafficIncident = new TrafficIncidentImpl(); + return trafficIncident; + } + + /** + * + * + * @generated + */ + public Cause createCause() { + CauseImpl cause = new CauseImpl(); + return cause; + } + + /** + * + * + * @generated + */ + public LinkedCause createLinkedCause() { + LinkedCauseImpl linkedCause = new LinkedCauseImpl(); + return linkedCause; + } + + /** + * + * + * @generated + */ + public DirectCause createDirectCause() { + DirectCauseImpl directCause = new DirectCauseImpl(); + return directCause; + } + + /** + * + * + * @generated + */ + public LaneRestrictions createLaneRestrictions() { + LaneRestrictionsImpl laneRestrictions = new LaneRestrictionsImpl(); + return laneRestrictions; + } + + /** + * + * + * @generated + */ + public Advice createAdvice() { + AdviceImpl advice = new AdviceImpl(); + return advice; + } + + /** + * + * + * @generated + */ + public Applicability createApplicability() { + ApplicabilityImpl applicability = new ApplicabilityImpl(); + return applicability; + } + + /** + * + * + * @generated + */ + public VehicleRelatedRestriction createVehicleRelatedRestriction() { + VehicleRelatedRestrictionImpl vehicleRelatedRestriction = new VehicleRelatedRestrictionImpl(); + return vehicleRelatedRestriction; + } + + /** + * + * + * @generated + */ + public TemporarySpeedLimit createTemporarySpeedLimit() { + TemporarySpeedLimitImpl temporarySpeedLimit = new TemporarySpeedLimitImpl(); + return temporarySpeedLimit; + } + + /** + * + * + * @generated + */ + public TemporarySpeedLimitSection createTemporarySpeedLimitSection() { + TemporarySpeedLimitSectionImpl temporarySpeedLimitSection = new TemporarySpeedLimitSectionImpl(); + return temporarySpeedLimitSection; + } + + /** + * + * + * @generated + */ + public trafficincidentPackage gettrafficincidentPackage() { + return (trafficincidentPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static trafficincidentPackage getPackage() { + return trafficincidentPackage.eINSTANCE; + } + +} //trafficincidentFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentPackageImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentPackageImpl.java new file mode 100755 index 0000000..5b7ce77 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/impl/trafficincidentPackageImpl.java @@ -0,0 +1,947 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.common.CommonPackage; + +import org.genivi.location.LocationPackage; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentFactory; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage; + + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class trafficincidentPackageImpl extends EPackageImpl implements trafficincidentPackage { + /** + * + * + * @generated + */ + private EClass trafficIncidentEClass = null; + + /** + * + * + * @generated + */ + private EClass causeEClass = null; + + /** + * + * + * @generated + */ + private EClass linkedCauseEClass = null; + + /** + * + * + * @generated + */ + private EClass directCauseEClass = null; + + /** + * + * + * @generated + */ + private EClass laneRestrictionsEClass = null; + + /** + * + * + * @generated + */ + private EClass adviceEClass = null; + + /** + * + * + * @generated + */ + private EClass applicabilityEClass = null; + + /** + * + * + * @generated + */ + private EClass vehicleRelatedRestrictionEClass = null; + + /** + * + * + * @generated + */ + private EClass temporarySpeedLimitEClass = null; + + /** + * + * + * @generated + */ + private EClass temporarySpeedLimitSectionEClass = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage#eNS_URI + * @see #init() + * @generated + */ + private trafficincidentPackageImpl() { + super(eNS_URI, trafficincidentFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link trafficincidentPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static trafficincidentPackage init() { + if (isInited) return (trafficincidentPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidentPackage.eNS_URI); + + // Obtain or create and register package + trafficincidentPackageImpl thetrafficincidentPackage = (trafficincidentPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof trafficincidentPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new trafficincidentPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + trafficincidenttablesPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thetrafficincidentPackage.createPackageContents(); + + // Initialize created meta-data + thetrafficincidentPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thetrafficincidentPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(trafficincidentPackage.eNS_URI, thetrafficincidentPackage); + return thetrafficincidentPackage; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncident() { + return trafficIncidentEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_EffectCode() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_EffectText() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_StartTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_StopTime() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_Tendency() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_TendencyText() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_LengthAffected() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_AverageSpeedAbsolute() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(7); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_Delay() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(8); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_SegmentSpeedLimit() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(9); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Causes() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(10); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Location() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(11); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Advices() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(12); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_Applicability() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(13); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_TrafficIncidentId() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(14); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_LocationInfo() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(15); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_CauseTexts() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(16); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_ApplicabilityTexts() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(17); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_AdviceTexts() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(18); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_CategoryIds() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(19); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_LocationBoundingBox() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(20); + } + + /** + * + * + * @generated + */ + public EAttribute getTrafficIncident_ExpectedSpeedAbsolute() { + return (EAttribute)trafficIncidentEClass.getEStructuralFeatures().get(21); + } + + /** + * + * + * @generated + */ + public EReference getTrafficIncident_TemporarySpeedLimit() { + return (EReference)trafficIncidentEClass.getEStructuralFeatures().get(22); + } + + /** + * + * + * @generated + */ + public EClass getCause() { + return causeEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getCause_MainCause() { + return (EAttribute)causeEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getLinkedCause() { + return linkedCauseEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLinkedCause_CauseTrafficIncidentId() { + return (EAttribute)linkedCauseEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EClass getDirectCause() { + return directCauseEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_WarningLevel() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_UnverifiedInformation() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_SubCause() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_LengthAffected() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EReference getDirectCause_LaneRestrictions() { + return (EReference)directCauseEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_FreeText() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(5); + } + + /** + * + * + * @generated + */ + public EAttribute getDirectCause_CauseOffset() { + return (EAttribute)directCauseEClass.getEStructuralFeatures().get(6); + } + + /** + * + * + * @generated + */ + public EClass getLaneRestrictions() { + return laneRestrictionsEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getLaneRestrictions_LaneRestrictionType() { + return (EAttribute)laneRestrictionsEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getLaneRestrictions_NumberOfLanes() { + return (EAttribute)laneRestrictionsEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getAdvice() { + return adviceEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getAdvice_MainAdvice() { + return (EAttribute)adviceEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getAdvice_SubAdvice() { + return (EAttribute)adviceEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getAdvice_Applicability() { + return (EReference)adviceEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getAdvice_FreeText() { + return (EAttribute)adviceEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getApplicability() { + return applicabilityEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getApplicability_VehicleType() { + return (EAttribute)applicabilityEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EReference getApplicability_VehicleRelatedRestrictions() { + return (EReference)applicabilityEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EClass getVehicleRelatedRestriction() { + return vehicleRelatedRestrictionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getVehicleRelatedRestriction_RestrictionType() { + return (EAttribute)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getVehicleRelatedRestriction_RestrictionValue() { + return (EAttribute)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getVehicleRelatedRestriction_RestrictionLocation() { + return (EReference)vehicleRelatedRestrictionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EClass getTemporarySpeedLimit() { + return temporarySpeedLimitEClass; + } + + /** + * + * + * @generated + */ + public EReference getTemporarySpeedLimit_TemporarySpeedLimitSections() { + return (EReference)temporarySpeedLimitEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimit_UnitsMPH() { + return (EAttribute)temporarySpeedLimitEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimit_Offset() { + return (EAttribute)temporarySpeedLimitEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EReference getTemporarySpeedLimit_Applicability() { + return (EReference)temporarySpeedLimitEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EClass getTemporarySpeedLimitSection() { + return temporarySpeedLimitSectionEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitValue() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitValueWet() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getTemporarySpeedLimitSection_SpeedLimitLength() { + return (EAttribute)temporarySpeedLimitSectionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public trafficincidentFactory gettrafficincidentFactory() { + return (trafficincidentFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + trafficIncidentEClass = createEClass(TRAFFIC_INCIDENT); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EFFECT_CODE); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EFFECT_TEXT); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__START_TIME); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__STOP_TIME); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__TENDENCY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__TENDENCY_TEXT); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__LENGTH_AFFECTED); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__DELAY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__CAUSES); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__LOCATION); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__ADVICES); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__APPLICABILITY); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__LOCATION_INFO); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__CAUSE_TEXTS); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__APPLICABILITY_TEXTS); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__ADVICE_TEXTS); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__CATEGORY_IDS); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX); + createEAttribute(trafficIncidentEClass, TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE); + createEReference(trafficIncidentEClass, TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT); + + causeEClass = createEClass(CAUSE); + createEAttribute(causeEClass, CAUSE__MAIN_CAUSE); + + linkedCauseEClass = createEClass(LINKED_CAUSE); + createEAttribute(linkedCauseEClass, LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID); + + directCauseEClass = createEClass(DIRECT_CAUSE); + createEAttribute(directCauseEClass, DIRECT_CAUSE__WARNING_LEVEL); + createEAttribute(directCauseEClass, DIRECT_CAUSE__UNVERIFIED_INFORMATION); + createEAttribute(directCauseEClass, DIRECT_CAUSE__SUB_CAUSE); + createEAttribute(directCauseEClass, DIRECT_CAUSE__LENGTH_AFFECTED); + createEReference(directCauseEClass, DIRECT_CAUSE__LANE_RESTRICTIONS); + createEAttribute(directCauseEClass, DIRECT_CAUSE__FREE_TEXT); + createEAttribute(directCauseEClass, DIRECT_CAUSE__CAUSE_OFFSET); + + laneRestrictionsEClass = createEClass(LANE_RESTRICTIONS); + createEAttribute(laneRestrictionsEClass, LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE); + createEAttribute(laneRestrictionsEClass, LANE_RESTRICTIONS__NUMBER_OF_LANES); + + adviceEClass = createEClass(ADVICE); + createEAttribute(adviceEClass, ADVICE__MAIN_ADVICE); + createEAttribute(adviceEClass, ADVICE__SUB_ADVICE); + createEReference(adviceEClass, ADVICE__APPLICABILITY); + createEAttribute(adviceEClass, ADVICE__FREE_TEXT); + + applicabilityEClass = createEClass(APPLICABILITY); + createEAttribute(applicabilityEClass, APPLICABILITY__VEHICLE_TYPE); + createEReference(applicabilityEClass, APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS); + + vehicleRelatedRestrictionEClass = createEClass(VEHICLE_RELATED_RESTRICTION); + createEAttribute(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE); + createEAttribute(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE); + createEReference(vehicleRelatedRestrictionEClass, VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION); + + temporarySpeedLimitEClass = createEClass(TEMPORARY_SPEED_LIMIT); + createEReference(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS); + createEAttribute(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__UNITS_MPH); + createEAttribute(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__OFFSET); + createEReference(temporarySpeedLimitEClass, TEMPORARY_SPEED_LIMIT__APPLICABILITY); + + temporarySpeedLimitSectionEClass = createEClass(TEMPORARY_SPEED_LIMIT_SECTION); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET); + createEAttribute(temporarySpeedLimitSectionEClass, TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + trafficincidenttablesPackage thetrafficincidenttablesPackage = (trafficincidenttablesPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidenttablesPackage.eNS_URI); + LocationPackage theLocationPackage = (LocationPackage)EPackage.Registry.INSTANCE.getEPackage(LocationPackage.eNS_URI); + CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + linkedCauseEClass.getESuperTypes().add(this.getCause()); + directCauseEClass.getESuperTypes().add(this.getCause()); + + // Initialize classes and features; add operations and parameters + initEClass(trafficIncidentEClass, TrafficIncident.class, "TrafficIncident", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTrafficIncident_EffectCode(), thetrafficincidenttablesPackage.getEffectCode(), "effectCode", null, 1, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_EffectText(), ecorePackage.getEString(), "effectText", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_StartTime(), ecorePackage.getEDate(), "startTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_StopTime(), ecorePackage.getEDate(), "stopTime", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_Tendency(), thetrafficincidenttablesPackage.getTendency(), "tendency", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_TendencyText(), ecorePackage.getEString(), "tendencyText", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_LengthAffected(), ecorePackage.getEIntegerObject(), "lengthAffected", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_AverageSpeedAbsolute(), ecorePackage.getEIntegerObject(), "averageSpeedAbsolute", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_Delay(), ecorePackage.getEIntegerObject(), "delay", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_SegmentSpeedLimit(), ecorePackage.getEIntegerObject(), "segmentSpeedLimit", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Causes(), this.getCause(), null, "causes", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Location(), theLocationPackage.getLocation(), null, "location", null, 1, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Advices(), this.getAdvice(), null, "advices", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_TrafficIncidentId(), ecorePackage.getEIntegerObject(), "trafficIncidentId", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_LocationInfo(), theLocationPackage.getLocationInfo(), null, "locationInfo", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_CauseTexts(), ecorePackage.getEString(), "causeTexts", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_ApplicabilityTexts(), ecorePackage.getEString(), "applicabilityTexts", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_AdviceTexts(), ecorePackage.getEString(), "adviceTexts", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_CategoryIds(), ecorePackage.getEIntegerObject(), "categoryIds", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_LocationBoundingBox(), theCommonPackage.getRectangularArea(), null, "locationBoundingBox", null, 1, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTrafficIncident_ExpectedSpeedAbsolute(), ecorePackage.getEIntegerObject(), "expectedSpeedAbsolute", null, 0, 1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTrafficIncident_TemporarySpeedLimit(), this.getTemporarySpeedLimit(), null, "temporarySpeedLimit", null, 0, -1, TrafficIncident.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(causeEClass, Cause.class, "Cause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getCause_MainCause(), thetrafficincidenttablesPackage.getCauseCode(), "mainCause", null, 0, 1, Cause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(linkedCauseEClass, LinkedCause.class, "LinkedCause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLinkedCause_CauseTrafficIncidentId(), ecorePackage.getEIntegerObject(), "causeTrafficIncidentId", null, 0, 1, LinkedCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(directCauseEClass, DirectCause.class, "DirectCause", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getDirectCause_WarningLevel(), thetrafficincidenttablesPackage.getWarningLevel(), "warningLevel", null, 1, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_UnverifiedInformation(), ecorePackage.getEBoolean(), "unverifiedInformation", null, 1, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_SubCause(), ecorePackage.getEJavaObject(), "subCause", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_LengthAffected(), ecorePackage.getEIntegerObject(), "lengthAffected", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getDirectCause_LaneRestrictions(), this.getLaneRestrictions(), null, "laneRestrictions", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_FreeText(), ecorePackage.getEString(), "freeText", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getDirectCause_CauseOffset(), ecorePackage.getEIntegerObject(), "causeOffset", null, 0, 1, DirectCause.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(laneRestrictionsEClass, LaneRestrictions.class, "LaneRestrictions", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getLaneRestrictions_LaneRestrictionType(), thetrafficincidenttablesPackage.getLaneRestrictionType(), "laneRestrictionType", null, 0, 1, LaneRestrictions.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getLaneRestrictions_NumberOfLanes(), ecorePackage.getEIntegerObject(), "numberOfLanes", null, 0, 1, LaneRestrictions.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(adviceEClass, Advice.class, "Advice", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getAdvice_MainAdvice(), thetrafficincidenttablesPackage.getAdviceCode(), "mainAdvice", null, 0, 1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAdvice_SubAdvice(), ecorePackage.getEJavaObject(), "subAdvice", null, 0, 1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getAdvice_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getAdvice_FreeText(), ecorePackage.getEString(), "freeText", null, 0, 1, Advice.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(applicabilityEClass, Applicability.class, "Applicability", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getApplicability_VehicleType(), thetrafficincidenttablesPackage.getVehicleType(), "vehicleType", null, 0, 1, Applicability.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getApplicability_VehicleRelatedRestrictions(), this.getVehicleRelatedRestriction(), null, "vehicleRelatedRestrictions", null, 0, -1, Applicability.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(vehicleRelatedRestrictionEClass, VehicleRelatedRestriction.class, "VehicleRelatedRestriction", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getVehicleRelatedRestriction_RestrictionType(), thetrafficincidenttablesPackage.getRestrictionType(), "restrictionType", null, 1, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getVehicleRelatedRestriction_RestrictionValue(), ecorePackage.getEIntegerObject(), "restrictionValue", null, 0, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getVehicleRelatedRestriction_RestrictionLocation(), theLocationPackage.getLocation(), null, "restrictionLocation", null, 0, 1, VehicleRelatedRestriction.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(temporarySpeedLimitEClass, TemporarySpeedLimit.class, "TemporarySpeedLimit", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getTemporarySpeedLimit_TemporarySpeedLimitSections(), this.getTemporarySpeedLimitSection(), null, "temporarySpeedLimitSections", null, 1, -1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimit_UnitsMPH(), ecorePackage.getEBoolean(), "unitsMPH", null, 1, 1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimit_Offset(), ecorePackage.getEIntegerObject(), "offset", null, 0, 1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTemporarySpeedLimit_Applicability(), this.getApplicability(), null, "applicability", null, 0, -1, TemporarySpeedLimit.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(temporarySpeedLimitSectionEClass, TemporarySpeedLimitSection.class, "TemporarySpeedLimitSection", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitValue(), ecorePackage.getEShort(), "speedLimitValue", null, 1, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitValueWet(), ecorePackage.getEShort(), "speedLimitValueWet", null, 0, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTemporarySpeedLimitSection_SpeedLimitLength(), ecorePackage.getEIntegerObject(), "speedLimitLength", null, 0, 1, TemporarySpeedLimitSection.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //trafficincidentPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentFactory.java new file mode 100755 index 0000000..7c60bd3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentFactory.java @@ -0,0 +1,128 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage + * @generated + */ +public interface trafficincidentFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + trafficincidentFactory eINSTANCE = org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentFactoryImpl.init(); + + /** + * Returns a new object of class 'Traffic Incident'. + * + * + * @return a new object of class 'Traffic Incident'. + * @generated + */ + TrafficIncident createTrafficIncident(); + + /** + * Returns a new object of class 'Cause'. + * + * + * @return a new object of class 'Cause'. + * @generated + */ + Cause createCause(); + + /** + * Returns a new object of class 'Linked Cause'. + * + * + * @return a new object of class 'Linked Cause'. + * @generated + */ + LinkedCause createLinkedCause(); + + /** + * Returns a new object of class 'Direct Cause'. + * + * + * @return a new object of class 'Direct Cause'. + * @generated + */ + DirectCause createDirectCause(); + + /** + * Returns a new object of class 'Lane Restrictions'. + * + * + * @return a new object of class 'Lane Restrictions'. + * @generated + */ + LaneRestrictions createLaneRestrictions(); + + /** + * Returns a new object of class 'Advice'. + * + * + * @return a new object of class 'Advice'. + * @generated + */ + Advice createAdvice(); + + /** + * Returns a new object of class 'Applicability'. + * + * + * @return a new object of class 'Applicability'. + * @generated + */ + Applicability createApplicability(); + + /** + * Returns a new object of class 'Vehicle Related Restriction'. + * + * + * @return a new object of class 'Vehicle Related Restriction'. + * @generated + */ + VehicleRelatedRestriction createVehicleRelatedRestriction(); + + /** + * Returns a new object of class 'Temporary Speed Limit'. + * + * + * @return a new object of class 'Temporary Speed Limit'. + * @generated + */ + TemporarySpeedLimit createTemporarySpeedLimit(); + + /** + * Returns a new object of class 'Temporary Speed Limit Section'. + * + * + * @return a new object of class 'Temporary Speed Limit Section'. + * @generated + */ + TemporarySpeedLimitSection createTemporarySpeedLimitSection(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + trafficincidentPackage gettrafficincidentPackage(); + +} //trafficincidentFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentPackage.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentPackage.java new file mode 100755 index 0000000..ffc6025 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/trafficincidentPackage.java @@ -0,0 +1,1898 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface trafficincidentPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "trafficincident"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.trafficinfo"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "TrafficIncident"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + trafficincidentPackage eINSTANCE = org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl Traffic Incident}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTrafficIncident() + * @generated + */ + int TRAFFIC_INCIDENT = 0; + + /** + * The feature id for the 'Effect Code' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EFFECT_CODE = 0; + + /** + * The feature id for the 'Effect Text' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EFFECT_TEXT = 1; + + /** + * The feature id for the 'Start Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__START_TIME = 2; + + /** + * The feature id for the 'Stop Time' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__STOP_TIME = 3; + + /** + * The feature id for the 'Tendency' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TENDENCY = 4; + + /** + * The feature id for the 'Tendency Text' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TENDENCY_TEXT = 5; + + /** + * The feature id for the 'Length Affected' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LENGTH_AFFECTED = 6; + + /** + * The feature id for the 'Average Speed Absolute' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE = 7; + + /** + * The feature id for the 'Delay' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__DELAY = 8; + + /** + * The feature id for the 'Segment Speed Limit' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT = 9; + + /** + * The feature id for the 'Causes' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__CAUSES = 10; + + /** + * The feature id for the 'Location' containment reference. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LOCATION = 11; + + /** + * The feature id for the 'Advices' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__ADVICES = 12; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__APPLICABILITY = 13; + + /** + * The feature id for the 'Traffic Incident Id' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID = 14; + + /** + * The feature id for the 'Location Info' containment reference. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LOCATION_INFO = 15; + + /** + * The feature id for the 'Cause Texts' attribute list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__CAUSE_TEXTS = 16; + + /** + * The feature id for the 'Applicability Texts' attribute list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__APPLICABILITY_TEXTS = 17; + + /** + * The feature id for the 'Advice Texts' attribute list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__ADVICE_TEXTS = 18; + + /** + * The feature id for the 'Category Ids' attribute list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__CATEGORY_IDS = 19; + + /** + * The feature id for the 'Location Bounding Box' containment reference. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX = 20; + + /** + * The feature id for the 'Expected Speed Absolute' attribute. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE = 21; + + /** + * The feature id for the 'Temporary Speed Limit' containment reference list. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT = 22; + + /** + * The number of structural features of the 'Traffic Incident' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT_FEATURE_COUNT = 23; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.CauseImpl Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.CauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getCause() + * @generated + */ + int CAUSE = 1; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int CAUSE__MAIN_CAUSE = 0; + + /** + * The number of structural features of the 'Cause' class. + * + * + * @generated + * @ordered + */ + int CAUSE_FEATURE_COUNT = 1; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LinkedCauseImpl Linked Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LinkedCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getLinkedCause() + * @generated + */ + int LINKED_CAUSE = 2; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE__MAIN_CAUSE = CAUSE__MAIN_CAUSE; + + /** + * The feature id for the 'Cause Traffic Incident Id' attribute. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID = CAUSE_FEATURE_COUNT + 0; + + /** + * The number of structural features of the 'Linked Cause' class. + * + * + * @generated + * @ordered + */ + int LINKED_CAUSE_FEATURE_COUNT = CAUSE_FEATURE_COUNT + 1; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl Direct Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getDirectCause() + * @generated + */ + int DIRECT_CAUSE = 3; + + /** + * The feature id for the 'Main Cause' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__MAIN_CAUSE = CAUSE__MAIN_CAUSE; + + /** + * The feature id for the 'Warning Level' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__WARNING_LEVEL = CAUSE_FEATURE_COUNT + 0; + + /** + * The feature id for the 'Unverified Information' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__UNVERIFIED_INFORMATION = CAUSE_FEATURE_COUNT + 1; + + /** + * The feature id for the 'Sub Cause' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__SUB_CAUSE = CAUSE_FEATURE_COUNT + 2; + + /** + * The feature id for the 'Length Affected' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__LENGTH_AFFECTED = CAUSE_FEATURE_COUNT + 3; + + /** + * The feature id for the 'Lane Restrictions' containment reference. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__LANE_RESTRICTIONS = CAUSE_FEATURE_COUNT + 4; + + /** + * The feature id for the 'Free Text' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__FREE_TEXT = CAUSE_FEATURE_COUNT + 5; + + /** + * The feature id for the 'Cause Offset' attribute. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE__CAUSE_OFFSET = CAUSE_FEATURE_COUNT + 6; + + /** + * The number of structural features of the 'Direct Cause' class. + * + * + * @generated + * @ordered + */ + int DIRECT_CAUSE_FEATURE_COUNT = CAUSE_FEATURE_COUNT + 7; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl Lane Restrictions}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getLaneRestrictions() + * @generated + */ + int LANE_RESTRICTIONS = 4; + + /** + * The feature id for the 'Lane Restriction Type' attribute. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE = 0; + + /** + * The feature id for the 'Number Of Lanes' attribute. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS__NUMBER_OF_LANES = 1; + + /** + * The number of structural features of the 'Lane Restrictions' class. + * + * + * @generated + * @ordered + */ + int LANE_RESTRICTIONS_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl Advice}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getAdvice() + * @generated + */ + int ADVICE = 5; + + /** + * The feature id for the 'Main Advice' attribute. + * + * + * @generated + * @ordered + */ + int ADVICE__MAIN_ADVICE = 0; + + /** + * The feature id for the 'Sub Advice' attribute. + * + * + * @generated + * @ordered + */ + int ADVICE__SUB_ADVICE = 1; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int ADVICE__APPLICABILITY = 2; + + /** + * The feature id for the 'Free Text' attribute. + * + * + * @generated + * @ordered + */ + int ADVICE__FREE_TEXT = 3; + + /** + * The number of structural features of the 'Advice' class. + * + * + * @generated + * @ordered + */ + int ADVICE_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl Applicability}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getApplicability() + * @generated + */ + int APPLICABILITY = 6; + + /** + * The feature id for the 'Vehicle Type' attribute. + * + * + * @generated + * @ordered + */ + int APPLICABILITY__VEHICLE_TYPE = 0; + + /** + * The feature id for the 'Vehicle Related Restrictions' containment reference list. + * + * + * @generated + * @ordered + */ + int APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS = 1; + + /** + * The number of structural features of the 'Applicability' class. + * + * + * @generated + * @ordered + */ + int APPLICABILITY_FEATURE_COUNT = 2; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl Vehicle Related Restriction}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getVehicleRelatedRestriction() + * @generated + */ + int VEHICLE_RELATED_RESTRICTION = 7; + + /** + * The feature id for the 'Restriction Type' attribute. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE = 0; + + /** + * The feature id for the 'Restriction Value' attribute. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE = 1; + + /** + * The feature id for the 'Restriction Location' containment reference. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION = 2; + + /** + * The number of structural features of the 'Vehicle Related Restriction' class. + * + * + * @generated + * @ordered + */ + int VEHICLE_RELATED_RESTRICTION_FEATURE_COUNT = 3; + + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl Temporary Speed Limit}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTemporarySpeedLimit() + * @generated + */ + int TEMPORARY_SPEED_LIMIT = 8; + + /** + * The feature id for the 'Temporary Speed Limit Sections' containment reference list. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS = 0; + + /** + * The feature id for the 'Units MPH' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__UNITS_MPH = 1; + + /** + * The feature id for the 'Offset' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__OFFSET = 2; + + /** + * The feature id for the 'Applicability' containment reference list. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT__APPLICABILITY = 3; + + /** + * The number of structural features of the 'Temporary Speed Limit' class. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl Temporary Speed Limit Section}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTemporarySpeedLimitSection() + * @generated + */ + int TEMPORARY_SPEED_LIMIT_SECTION = 9; + + /** + * The feature id for the 'Speed Limit Value' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE = 0; + + /** + * The feature id for the 'Speed Limit Value Wet' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET = 1; + + /** + * The feature id for the 'Speed Limit Length' attribute. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH = 2; + + /** + * The number of structural features of the 'Temporary Speed Limit Section' class. + * + * + * @generated + * @ordered + */ + int TEMPORARY_SPEED_LIMIT_SECTION_FEATURE_COUNT = 3; + + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident Traffic Incident}'. + * + * + * @return the meta object for class 'Traffic Incident'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident + * @generated + */ + EClass getTrafficIncident(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode Effect Code}'. + * + * + * @return the meta object for the attribute 'Effect Code'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectCode() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_EffectCode(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText Effect Text}'. + * + * + * @return the meta object for the attribute 'Effect Text'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getEffectText() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_EffectText(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime Start Time}'. + * + * + * @return the meta object for the attribute 'Start Time'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStartTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_StartTime(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime Stop Time}'. + * + * + * @return the meta object for the attribute 'Stop Time'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getStopTime() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_StopTime(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency Tendency}'. + * + * + * @return the meta object for the attribute 'Tendency'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendency() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_Tendency(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText Tendency Text}'. + * + * + * @return the meta object for the attribute 'Tendency Text'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTendencyText() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_TendencyText(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected Length Affected}'. + * + * + * @return the meta object for the attribute 'Length Affected'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLengthAffected() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_LengthAffected(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute Average Speed Absolute}'. + * + * + * @return the meta object for the attribute 'Average Speed Absolute'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAverageSpeedAbsolute() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_AverageSpeedAbsolute(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay Delay}'. + * + * + * @return the meta object for the attribute 'Delay'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getDelay() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_Delay(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit Segment Speed Limit}'. + * + * + * @return the meta object for the attribute 'Segment Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getSegmentSpeedLimit() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_SegmentSpeedLimit(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauses Causes}'. + * + * + * @return the meta object for the containment reference list 'Causes'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauses() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Causes(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation Location}'. + * + * + * @return the meta object for the containment reference 'Location'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocation() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Location(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdvices Advices}'. + * + * + * @return the meta object for the containment reference list 'Advices'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdvices() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Advices(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicability() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_Applicability(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId Traffic Incident Id}'. + * + * + * @return the meta object for the attribute 'Traffic Incident Id'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTrafficIncidentId() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_TrafficIncidentId(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo Location Info}'. + * + * + * @return the meta object for the containment reference 'Location Info'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationInfo() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_LocationInfo(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauseTexts Cause Texts}'. + * + * + * @return the meta object for the attribute list 'Cause Texts'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCauseTexts() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_CauseTexts(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicabilityTexts Applicability Texts}'. + * + * + * @return the meta object for the attribute list 'Applicability Texts'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getApplicabilityTexts() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_ApplicabilityTexts(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdviceTexts Advice Texts}'. + * + * + * @return the meta object for the attribute list 'Advice Texts'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getAdviceTexts() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_AdviceTexts(); + + /** + * Returns the meta object for the attribute list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCategoryIds Category Ids}'. + * + * + * @return the meta object for the attribute list 'Category Ids'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getCategoryIds() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_CategoryIds(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationBoundingBox Location Bounding Box}'. + * + * + * @return the meta object for the containment reference 'Location Bounding Box'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getLocationBoundingBox() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_LocationBoundingBox(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute Expected Speed Absolute}'. + * + * + * @return the meta object for the attribute 'Expected Speed Absolute'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getExpectedSpeedAbsolute() + * @see #getTrafficIncident() + * @generated + */ + EAttribute getTrafficIncident_ExpectedSpeedAbsolute(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTemporarySpeedLimit Temporary Speed Limit}'. + * + * + * @return the meta object for the containment reference list 'Temporary Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident#getTemporarySpeedLimit() + * @see #getTrafficIncident() + * @generated + */ + EReference getTrafficIncident_TemporarySpeedLimit(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause Cause}'. + * + * + * @return the meta object for class 'Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause + * @generated + */ + EClass getCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause Main Cause}'. + * + * + * @return the meta object for the attribute 'Main Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause#getMainCause() + * @see #getCause() + * @generated + */ + EAttribute getCause_MainCause(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause Linked Cause}'. + * + * + * @return the meta object for class 'Linked Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause + * @generated + */ + EClass getLinkedCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId Cause Traffic Incident Id}'. + * + * + * @return the meta object for the attribute 'Cause Traffic Incident Id'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause#getCauseTrafficIncidentId() + * @see #getLinkedCause() + * @generated + */ + EAttribute getLinkedCause_CauseTrafficIncidentId(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause Direct Cause}'. + * + * + * @return the meta object for class 'Direct Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause + * @generated + */ + EClass getDirectCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel Warning Level}'. + * + * + * @return the meta object for the attribute 'Warning Level'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getWarningLevel() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_WarningLevel(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation Unverified Information}'. + * + * + * @return the meta object for the attribute 'Unverified Information'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#isUnverifiedInformation() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_UnverifiedInformation(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause Sub Cause}'. + * + * + * @return the meta object for the attribute 'Sub Cause'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getSubCause() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_SubCause(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected Length Affected}'. + * + * + * @return the meta object for the attribute 'Length Affected'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLengthAffected() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_LengthAffected(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions Lane Restrictions}'. + * + * + * @return the meta object for the containment reference 'Lane Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getLaneRestrictions() + * @see #getDirectCause() + * @generated + */ + EReference getDirectCause_LaneRestrictions(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText Free Text}'. + * + * + * @return the meta object for the attribute 'Free Text'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getFreeText() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_FreeText(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset Cause Offset}'. + * + * + * @return the meta object for the attribute 'Cause Offset'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause#getCauseOffset() + * @see #getDirectCause() + * @generated + */ + EAttribute getDirectCause_CauseOffset(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions Lane Restrictions}'. + * + * + * @return the meta object for class 'Lane Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions + * @generated + */ + EClass getLaneRestrictions(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType Lane Restriction Type}'. + * + * + * @return the meta object for the attribute 'Lane Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getLaneRestrictionType() + * @see #getLaneRestrictions() + * @generated + */ + EAttribute getLaneRestrictions_LaneRestrictionType(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes Number Of Lanes}'. + * + * + * @return the meta object for the attribute 'Number Of Lanes'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions#getNumberOfLanes() + * @see #getLaneRestrictions() + * @generated + */ + EAttribute getLaneRestrictions_NumberOfLanes(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice Advice}'. + * + * + * @return the meta object for class 'Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice + * @generated + */ + EClass getAdvice(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice Main Advice}'. + * + * + * @return the meta object for the attribute 'Main Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getMainAdvice() + * @see #getAdvice() + * @generated + */ + EAttribute getAdvice_MainAdvice(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice Sub Advice}'. + * + * + * @return the meta object for the attribute 'Sub Advice'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getSubAdvice() + * @see #getAdvice() + * @generated + */ + EAttribute getAdvice_SubAdvice(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getApplicability() + * @see #getAdvice() + * @generated + */ + EReference getAdvice_Applicability(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText Free Text}'. + * + * + * @return the meta object for the attribute 'Free Text'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice#getFreeText() + * @see #getAdvice() + * @generated + */ + EAttribute getAdvice_FreeText(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability Applicability}'. + * + * + * @return the meta object for class 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability + * @generated + */ + EClass getApplicability(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType Vehicle Type}'. + * + * + * @return the meta object for the attribute 'Vehicle Type'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleType() + * @see #getApplicability() + * @generated + */ + EAttribute getApplicability_VehicleType(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleRelatedRestrictions Vehicle Related Restrictions}'. + * + * + * @return the meta object for the containment reference list 'Vehicle Related Restrictions'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability#getVehicleRelatedRestrictions() + * @see #getApplicability() + * @generated + */ + EReference getApplicability_VehicleRelatedRestrictions(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction Vehicle Related Restriction}'. + * + * + * @return the meta object for class 'Vehicle Related Restriction'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction + * @generated + */ + EClass getVehicleRelatedRestriction(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType Restriction Type}'. + * + * + * @return the meta object for the attribute 'Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionType() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EAttribute getVehicleRelatedRestriction_RestrictionType(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue Restriction Value}'. + * + * + * @return the meta object for the attribute 'Restriction Value'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionValue() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EAttribute getVehicleRelatedRestriction_RestrictionValue(); + + /** + * Returns the meta object for the containment reference '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation Restriction Location}'. + * + * + * @return the meta object for the containment reference 'Restriction Location'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction#getRestrictionLocation() + * @see #getVehicleRelatedRestriction() + * @generated + */ + EReference getVehicleRelatedRestriction_RestrictionLocation(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit Temporary Speed Limit}'. + * + * + * @return the meta object for class 'Temporary Speed Limit'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit + * @generated + */ + EClass getTemporarySpeedLimit(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections Temporary Speed Limit Sections}'. + * + * + * @return the meta object for the containment reference list 'Temporary Speed Limit Sections'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getTemporarySpeedLimitSections() + * @see #getTemporarySpeedLimit() + * @generated + */ + EReference getTemporarySpeedLimit_TemporarySpeedLimitSections(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH Units MPH}'. + * + * + * @return the meta object for the attribute 'Units MPH'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#isUnitsMPH() + * @see #getTemporarySpeedLimit() + * @generated + */ + EAttribute getTemporarySpeedLimit_UnitsMPH(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset Offset}'. + * + * + * @return the meta object for the attribute 'Offset'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getOffset() + * @see #getTemporarySpeedLimit() + * @generated + */ + EAttribute getTemporarySpeedLimit_Offset(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getApplicability Applicability}'. + * + * + * @return the meta object for the containment reference list 'Applicability'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit#getApplicability() + * @see #getTemporarySpeedLimit() + * @generated + */ + EReference getTemporarySpeedLimit_Applicability(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection Temporary Speed Limit Section}'. + * + * + * @return the meta object for class 'Temporary Speed Limit Section'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection + * @generated + */ + EClass getTemporarySpeedLimitSection(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue Speed Limit Value}'. + * + * + * @return the meta object for the attribute 'Speed Limit Value'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValue() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitValue(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet Speed Limit Value Wet}'. + * + * + * @return the meta object for the attribute 'Speed Limit Value Wet'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitValueWet() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitValueWet(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength Speed Limit Length}'. + * + * + * @return the meta object for the attribute 'Speed Limit Length'. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection#getSpeedLimitLength() + * @see #getTemporarySpeedLimitSection() + * @generated + */ + EAttribute getTemporarySpeedLimitSection_SpeedLimitLength(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + trafficincidentFactory gettrafficincidentFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl Traffic Incident}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TrafficIncidentImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTrafficIncident() + * @generated + */ + EClass TRAFFIC_INCIDENT = eINSTANCE.getTrafficIncident(); + + /** + * The meta object literal for the 'Effect Code' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EFFECT_CODE = eINSTANCE.getTrafficIncident_EffectCode(); + + /** + * The meta object literal for the 'Effect Text' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EFFECT_TEXT = eINSTANCE.getTrafficIncident_EffectText(); + + /** + * The meta object literal for the 'Start Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__START_TIME = eINSTANCE.getTrafficIncident_StartTime(); + + /** + * The meta object literal for the 'Stop Time' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__STOP_TIME = eINSTANCE.getTrafficIncident_StopTime(); + + /** + * The meta object literal for the 'Tendency' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__TENDENCY = eINSTANCE.getTrafficIncident_Tendency(); + + /** + * The meta object literal for the 'Tendency Text' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__TENDENCY_TEXT = eINSTANCE.getTrafficIncident_TendencyText(); + + /** + * The meta object literal for the 'Length Affected' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__LENGTH_AFFECTED = eINSTANCE.getTrafficIncident_LengthAffected(); + + /** + * The meta object literal for the 'Average Speed Absolute' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__AVERAGE_SPEED_ABSOLUTE = eINSTANCE.getTrafficIncident_AverageSpeedAbsolute(); + + /** + * The meta object literal for the 'Delay' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__DELAY = eINSTANCE.getTrafficIncident_Delay(); + + /** + * The meta object literal for the 'Segment Speed Limit' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__SEGMENT_SPEED_LIMIT = eINSTANCE.getTrafficIncident_SegmentSpeedLimit(); + + /** + * The meta object literal for the 'Causes' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__CAUSES = eINSTANCE.getTrafficIncident_Causes(); + + /** + * The meta object literal for the 'Location' containment reference feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__LOCATION = eINSTANCE.getTrafficIncident_Location(); + + /** + * The meta object literal for the 'Advices' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__ADVICES = eINSTANCE.getTrafficIncident_Advices(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__APPLICABILITY = eINSTANCE.getTrafficIncident_Applicability(); + + /** + * The meta object literal for the 'Traffic Incident Id' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__TRAFFIC_INCIDENT_ID = eINSTANCE.getTrafficIncident_TrafficIncidentId(); + + /** + * The meta object literal for the 'Location Info' containment reference feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__LOCATION_INFO = eINSTANCE.getTrafficIncident_LocationInfo(); + + /** + * The meta object literal for the 'Cause Texts' attribute list feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__CAUSE_TEXTS = eINSTANCE.getTrafficIncident_CauseTexts(); + + /** + * The meta object literal for the 'Applicability Texts' attribute list feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__APPLICABILITY_TEXTS = eINSTANCE.getTrafficIncident_ApplicabilityTexts(); + + /** + * The meta object literal for the 'Advice Texts' attribute list feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__ADVICE_TEXTS = eINSTANCE.getTrafficIncident_AdviceTexts(); + + /** + * The meta object literal for the 'Category Ids' attribute list feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__CATEGORY_IDS = eINSTANCE.getTrafficIncident_CategoryIds(); + + /** + * The meta object literal for the 'Location Bounding Box' containment reference feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__LOCATION_BOUNDING_BOX = eINSTANCE.getTrafficIncident_LocationBoundingBox(); + + /** + * The meta object literal for the 'Expected Speed Absolute' attribute feature. + * + * + * @generated + */ + EAttribute TRAFFIC_INCIDENT__EXPECTED_SPEED_ABSOLUTE = eINSTANCE.getTrafficIncident_ExpectedSpeedAbsolute(); + + /** + * The meta object literal for the 'Temporary Speed Limit' containment reference list feature. + * + * + * @generated + */ + EReference TRAFFIC_INCIDENT__TEMPORARY_SPEED_LIMIT = eINSTANCE.getTrafficIncident_TemporarySpeedLimit(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.CauseImpl Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.CauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getCause() + * @generated + */ + EClass CAUSE = eINSTANCE.getCause(); + + /** + * The meta object literal for the 'Main Cause' attribute feature. + * + * + * @generated + */ + EAttribute CAUSE__MAIN_CAUSE = eINSTANCE.getCause_MainCause(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LinkedCauseImpl Linked Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LinkedCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getLinkedCause() + * @generated + */ + EClass LINKED_CAUSE = eINSTANCE.getLinkedCause(); + + /** + * The meta object literal for the 'Cause Traffic Incident Id' attribute feature. + * + * + * @generated + */ + EAttribute LINKED_CAUSE__CAUSE_TRAFFIC_INCIDENT_ID = eINSTANCE.getLinkedCause_CauseTrafficIncidentId(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl Direct Cause}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.DirectCauseImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getDirectCause() + * @generated + */ + EClass DIRECT_CAUSE = eINSTANCE.getDirectCause(); + + /** + * The meta object literal for the 'Warning Level' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__WARNING_LEVEL = eINSTANCE.getDirectCause_WarningLevel(); + + /** + * The meta object literal for the 'Unverified Information' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__UNVERIFIED_INFORMATION = eINSTANCE.getDirectCause_UnverifiedInformation(); + + /** + * The meta object literal for the 'Sub Cause' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__SUB_CAUSE = eINSTANCE.getDirectCause_SubCause(); + + /** + * The meta object literal for the 'Length Affected' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__LENGTH_AFFECTED = eINSTANCE.getDirectCause_LengthAffected(); + + /** + * The meta object literal for the 'Lane Restrictions' containment reference feature. + * + * + * @generated + */ + EReference DIRECT_CAUSE__LANE_RESTRICTIONS = eINSTANCE.getDirectCause_LaneRestrictions(); + + /** + * The meta object literal for the 'Free Text' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__FREE_TEXT = eINSTANCE.getDirectCause_FreeText(); + + /** + * The meta object literal for the 'Cause Offset' attribute feature. + * + * + * @generated + */ + EAttribute DIRECT_CAUSE__CAUSE_OFFSET = eINSTANCE.getDirectCause_CauseOffset(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl Lane Restrictions}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.LaneRestrictionsImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getLaneRestrictions() + * @generated + */ + EClass LANE_RESTRICTIONS = eINSTANCE.getLaneRestrictions(); + + /** + * The meta object literal for the 'Lane Restriction Type' attribute feature. + * + * + * @generated + */ + EAttribute LANE_RESTRICTIONS__LANE_RESTRICTION_TYPE = eINSTANCE.getLaneRestrictions_LaneRestrictionType(); + + /** + * The meta object literal for the 'Number Of Lanes' attribute feature. + * + * + * @generated + */ + EAttribute LANE_RESTRICTIONS__NUMBER_OF_LANES = eINSTANCE.getLaneRestrictions_NumberOfLanes(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl Advice}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.AdviceImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getAdvice() + * @generated + */ + EClass ADVICE = eINSTANCE.getAdvice(); + + /** + * The meta object literal for the 'Main Advice' attribute feature. + * + * + * @generated + */ + EAttribute ADVICE__MAIN_ADVICE = eINSTANCE.getAdvice_MainAdvice(); + + /** + * The meta object literal for the 'Sub Advice' attribute feature. + * + * + * @generated + */ + EAttribute ADVICE__SUB_ADVICE = eINSTANCE.getAdvice_SubAdvice(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference ADVICE__APPLICABILITY = eINSTANCE.getAdvice_Applicability(); + + /** + * The meta object literal for the 'Free Text' attribute feature. + * + * + * @generated + */ + EAttribute ADVICE__FREE_TEXT = eINSTANCE.getAdvice_FreeText(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl Applicability}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.ApplicabilityImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getApplicability() + * @generated + */ + EClass APPLICABILITY = eINSTANCE.getApplicability(); + + /** + * The meta object literal for the 'Vehicle Type' attribute feature. + * + * + * @generated + */ + EAttribute APPLICABILITY__VEHICLE_TYPE = eINSTANCE.getApplicability_VehicleType(); + + /** + * The meta object literal for the 'Vehicle Related Restrictions' containment reference list feature. + * + * + * @generated + */ + EReference APPLICABILITY__VEHICLE_RELATED_RESTRICTIONS = eINSTANCE.getApplicability_VehicleRelatedRestrictions(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl Vehicle Related Restriction}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.VehicleRelatedRestrictionImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getVehicleRelatedRestriction() + * @generated + */ + EClass VEHICLE_RELATED_RESTRICTION = eINSTANCE.getVehicleRelatedRestriction(); + + /** + * The meta object literal for the 'Restriction Type' attribute feature. + * + * + * @generated + */ + EAttribute VEHICLE_RELATED_RESTRICTION__RESTRICTION_TYPE = eINSTANCE.getVehicleRelatedRestriction_RestrictionType(); + + /** + * The meta object literal for the 'Restriction Value' attribute feature. + * + * + * @generated + */ + EAttribute VEHICLE_RELATED_RESTRICTION__RESTRICTION_VALUE = eINSTANCE.getVehicleRelatedRestriction_RestrictionValue(); + + /** + * The meta object literal for the 'Restriction Location' containment reference feature. + * + * + * @generated + */ + EReference VEHICLE_RELATED_RESTRICTION__RESTRICTION_LOCATION = eINSTANCE.getVehicleRelatedRestriction_RestrictionLocation(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl Temporary Speed Limit}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTemporarySpeedLimit() + * @generated + */ + EClass TEMPORARY_SPEED_LIMIT = eINSTANCE.getTemporarySpeedLimit(); + + /** + * The meta object literal for the 'Temporary Speed Limit Sections' containment reference list feature. + * + * + * @generated + */ + EReference TEMPORARY_SPEED_LIMIT__TEMPORARY_SPEED_LIMIT_SECTIONS = eINSTANCE.getTemporarySpeedLimit_TemporarySpeedLimitSections(); + + /** + * The meta object literal for the 'Units MPH' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT__UNITS_MPH = eINSTANCE.getTemporarySpeedLimit_UnitsMPH(); + + /** + * The meta object literal for the 'Offset' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT__OFFSET = eINSTANCE.getTemporarySpeedLimit_Offset(); + + /** + * The meta object literal for the 'Applicability' containment reference list feature. + * + * + * @generated + */ + EReference TEMPORARY_SPEED_LIMIT__APPLICABILITY = eINSTANCE.getTemporarySpeedLimit_Applicability(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl Temporary Speed Limit Section}' class. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.TemporarySpeedLimitSectionImpl + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.impl.trafficincidentPackageImpl#getTemporarySpeedLimitSection() + * @generated + */ + EClass TEMPORARY_SPEED_LIMIT_SECTION = eINSTANCE.getTemporarySpeedLimitSection(); + + /** + * The meta object literal for the 'Speed Limit Value' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitValue(); + + /** + * The meta object literal for the 'Speed Limit Value Wet' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_VALUE_WET = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitValueWet(); + + /** + * The meta object literal for the 'Speed Limit Length' attribute feature. + * + * + * @generated + */ + EAttribute TEMPORARY_SPEED_LIMIT_SECTION__SPEED_LIMIT_LENGTH = eINSTANCE.getTemporarySpeedLimitSection_SpeedLimitLength(); + + } + +} //trafficincidentPackage diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentAdapterFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentAdapterFactory.java new file mode 100755 index 0000000..4ee0cd3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentAdapterFactory.java @@ -0,0 +1,287 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; + +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.*; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage + * @generated + */ +public class trafficincidentAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static trafficincidentPackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public trafficincidentAdapterFactory() { + if (modelPackage == null) { + modelPackage = trafficincidentPackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected trafficincidentSwitch modelSwitch = + new trafficincidentSwitch() { + @Override + public Adapter caseTrafficIncident(TrafficIncident object) { + return createTrafficIncidentAdapter(); + } + @Override + public Adapter caseCause(Cause object) { + return createCauseAdapter(); + } + @Override + public Adapter caseLinkedCause(LinkedCause object) { + return createLinkedCauseAdapter(); + } + @Override + public Adapter caseDirectCause(DirectCause object) { + return createDirectCauseAdapter(); + } + @Override + public Adapter caseLaneRestrictions(LaneRestrictions object) { + return createLaneRestrictionsAdapter(); + } + @Override + public Adapter caseAdvice(Advice object) { + return createAdviceAdapter(); + } + @Override + public Adapter caseApplicability(Applicability object) { + return createApplicabilityAdapter(); + } + @Override + public Adapter caseVehicleRelatedRestriction(VehicleRelatedRestriction object) { + return createVehicleRelatedRestrictionAdapter(); + } + @Override + public Adapter caseTemporarySpeedLimit(TemporarySpeedLimit object) { + return createTemporarySpeedLimitAdapter(); + } + @Override + public Adapter caseTemporarySpeedLimitSection(TemporarySpeedLimitSection object) { + return createTemporarySpeedLimitSectionAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident Traffic Incident}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident + * @generated + */ + public Adapter createTrafficIncidentAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause + * @generated + */ + public Adapter createCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause Linked Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause + * @generated + */ + public Adapter createLinkedCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause Direct Cause}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause + * @generated + */ + public Adapter createDirectCauseAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions Lane Restrictions}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions + * @generated + */ + public Adapter createLaneRestrictionsAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice Advice}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice + * @generated + */ + public Adapter createAdviceAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability Applicability}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability + * @generated + */ + public Adapter createApplicabilityAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction Vehicle Related Restriction}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction + * @generated + */ + public Adapter createVehicleRelatedRestrictionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit Temporary Speed Limit}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimit + * @generated + */ + public Adapter createTemporarySpeedLimitAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection Temporary Speed Limit Section}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TemporarySpeedLimitSection + * @generated + */ + public Adapter createTemporarySpeedLimitSectionAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //trafficincidentAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentSwitch.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentSwitch.java new file mode 100755 index 0000000..8d12409 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model/src/org/genivi/trafficincidentsservice/trafficincidents/trafficincident/util/trafficincidentSwitch.java @@ -0,0 +1,306 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidents.trafficincident.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.util.Switch; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.*; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage + * @generated + */ +public class trafficincidentSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static trafficincidentPackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public trafficincidentSwitch() { + if (modelPackage == null) { + modelPackage = trafficincidentPackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case trafficincidentPackage.TRAFFIC_INCIDENT: { + TrafficIncident trafficIncident = (TrafficIncident)theEObject; + T result = caseTrafficIncident(trafficIncident); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.CAUSE: { + Cause cause = (Cause)theEObject; + T result = caseCause(cause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.LINKED_CAUSE: { + LinkedCause linkedCause = (LinkedCause)theEObject; + T result = caseLinkedCause(linkedCause); + if (result == null) result = caseCause(linkedCause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.DIRECT_CAUSE: { + DirectCause directCause = (DirectCause)theEObject; + T result = caseDirectCause(directCause); + if (result == null) result = caseCause(directCause); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.LANE_RESTRICTIONS: { + LaneRestrictions laneRestrictions = (LaneRestrictions)theEObject; + T result = caseLaneRestrictions(laneRestrictions); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.ADVICE: { + Advice advice = (Advice)theEObject; + T result = caseAdvice(advice); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.APPLICABILITY: { + Applicability applicability = (Applicability)theEObject; + T result = caseApplicability(applicability); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.VEHICLE_RELATED_RESTRICTION: { + VehicleRelatedRestriction vehicleRelatedRestriction = (VehicleRelatedRestriction)theEObject; + T result = caseVehicleRelatedRestriction(vehicleRelatedRestriction); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT: { + TemporarySpeedLimit temporarySpeedLimit = (TemporarySpeedLimit)theEObject; + T result = caseTemporarySpeedLimit(temporarySpeedLimit); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentPackage.TEMPORARY_SPEED_LIMIT_SECTION: { + TemporarySpeedLimitSection temporarySpeedLimitSection = (TemporarySpeedLimitSection)theEObject; + T result = caseTemporarySpeedLimitSection(temporarySpeedLimitSection); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incident'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incident'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncident(TrafficIncident object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCause(Cause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Linked Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Linked Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLinkedCause(LinkedCause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Direct Cause'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Direct Cause'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseDirectCause(DirectCause object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Lane Restrictions'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Lane Restrictions'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseLaneRestrictions(LaneRestrictions object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Advice'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Advice'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseAdvice(Advice object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Applicability'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Applicability'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseApplicability(Applicability object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Vehicle Related Restriction'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Vehicle Related Restriction'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseVehicleRelatedRestriction(VehicleRelatedRestriction object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Temporary Speed Limit'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Temporary Speed Limit'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTemporarySpeedLimit(TemporarySpeedLimit object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Temporary Speed Limit Section'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Temporary Speed Limit Section'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTemporarySpeedLimitSection(TemporarySpeedLimitSection object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //trafficincidentSwitch diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.classpath new file mode 100755 index 0000000..be9eba3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.classpath @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.project new file mode 100755 index 0000000..6924aaa --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/.project @@ -0,0 +1,30 @@ + + + org.genivi.trafficincidentsservice.trafficincidentsservice-model + This project contains the model which defines the API's of the Traffic Incidents Service. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.booleanexpr-model + org.genivi.trafficinfo.demo + org.genivi.iconset-model + org.genivi.locref-model + org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..7b9cd89 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.trafficinfo.trafficincidents-model;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Export-Package: org.genivi.trafficincidentsservice, + org.genivi.trafficincidentsservice.impl, + org.genivi.trafficincidentsservice.util +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.genivi.basetypes-model;visibility:=reexport, + org.genivi.iconset-model;visibility:=reexport, + org.genivi.locref-model;visibility:=reexport, + org.genivi.trafficinfo.trafficincident;visibility:=reexport, + org.genivi.trafficinfo.xtrafficincident;resolution:=optional;visibility:=reexport, + org.genivi.trafficinfo.trafficincidenttables;resolution:=optional;visibility:=reexport +Bundle-ActivationPolicy: lazy +Import-Package: org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident, + org.genivi.trafficincidentsservice.trafficincidents.trafficincident, + org.genivi.trafficincidentsservice.trafficincidenttables diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/ReadMe.confluence new file mode 100755 index 0000000..3179668 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/ReadMe.confluence @@ -0,0 +1,3 @@ +This project defines the main interfaces of the TrafficIncidentsService. The data models for traffic incidents are in sub packages in other projects. + +TrafficIncidentsService.ecorediag, in de model folder, provides a good overview of the structure of the interfaces. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/build.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecore b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecore new file mode 100755 index 0000000..1d3c591 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecore @@ -0,0 +1,683 @@ + + + +
+ + + +
+ + +
+
+ + + +
+ + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + + + + +
+ + + +
+ + + + +
+ + + + + +
+ + + + + + +
+ + + +
+ + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + + + +
+ + + +
+ + + + +
+ + + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ + + + + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + +
+ + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + + + + + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecorediag b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecorediag new file mode 100755 index 0000000..31c1087 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.ecorediag @@ -0,0 +1,696 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.genmodel b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.genmodel new file mode 100755 index 0000000..120bdc9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/model/TrafficIncidentsService.genmodel @@ -0,0 +1,348 @@ + + + TrafficIncidentsService.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.properties new file mode 100755 index 0000000..cc1093f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = TrafficIncidents Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.xml new file mode 100755 index 0000000..cd5e9a4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/plugin.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/pom.xml new file mode 100755 index 0000000..811d880 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/pom.xml @@ -0,0 +1,58 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice + trafficincidentsservice-model + jar + 1.0-SNAPSHOT + GENIVI Traffic Incidents Service API model + This project contains the model which defines the API's of the Traffic Incidents Service. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi + basetypes-model + + + org.genivi + booleanexpr-model + + + org.genivi + iconset-model + + + org.genivi + locref-model + + + org.genivi.trafficincidentsservice.trafficincidents + trafficincidents-trafficincident-model + + + org.genivi.trafficincidentsservice.trafficincidentfeed + trafficincidentfeed-trafficincident-model + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/CategoryDefinition.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/CategoryDefinition.java new file mode 100755 index 0000000..e2e4a75 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/CategoryDefinition.java @@ -0,0 +1,218 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.LocalizedString; +import org.genivi.iconset.IconInfo; + +/** + * + * A representation of the model object 'Category Definition'. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.CategoryDefinition#getLocalizedNamesList Localized Names}
  • + *
  • {@link org.genivi.trafficincidentsservice.CategoryDefinition#getCategoryId Category Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.CategoryDefinition#getIconsList Icons}
  • + *
  • {@link org.genivi.trafficincidentsservice.CategoryDefinition#getExpression Expression}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getCategoryDefinition() + * @model + * @generated + */ +public interface CategoryDefinition extends EObject { + /** + * + * + * @generated + */ + LocalizedString[] getLocalizedNames(); + + /** + * + * + * @generated + */ + LocalizedString getLocalizedNames(int index); + + /** + * + * + * @generated + */ + int getLocalizedNamesLength(); + + /** + * + * + * @generated + */ + void setLocalizedNames(LocalizedString[] newLocalizedNames); + + /** + * + * + * @generated + */ + void setLocalizedNames(int index, LocalizedString element); + + /** + * Returns the value of the 'Localized Names' containment reference list. + * The list contents are of type {@link org.genivi.common.LocalizedString}. + * + *

+ * If the meaning of the 'Localized Names' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Localized Names' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getCategoryDefinition_LocalizedNames() + * @model containment="true" + * @generated + */ + EList getLocalizedNamesList(); + + /** + * Returns the value of the 'Category Id' attribute. + * + *

+ * If the meaning of the 'Category Id' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Category Id' attribute. + * @see #setCategoryId(int) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getCategoryDefinition_CategoryId() + * @model required="true" + * @generated + */ + int getCategoryId(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getCategoryId Category Id}' attribute. + * + * + * @param value the new value of the 'Category Id' attribute. + * @see #getCategoryId() + * @generated + */ + void setCategoryId(int value); + + /** + * + * + * @generated + */ + IconInfo[] getIcons(); + + /** + * + * + * @generated + */ + IconInfo getIcons(int index); + + /** + * + * + * @generated + */ + int getIconsLength(); + + /** + * + * + * @generated + */ + void setIcons(IconInfo[] newIcons); + + /** + * + * + * @generated + */ + void setIcons(int index, IconInfo element); + + /** + * Returns the value of the 'Icons' containment reference list. + * The list contents are of type {@link org.genivi.iconset.IconInfo}. + * + *

+ * If the meaning of the 'Icons' containment reference list isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Icons' containment reference list. + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getCategoryDefinition_Icons() + * @model containment="true" + * @generated + */ + EList getIconsList(); + + /** + * Returns the value of the 'Expression' attribute. + * + *

+ * If the meaning of the 'Expression' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * @return the value of the 'Expression' attribute. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #setExpression(String) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getCategoryDefinition_Expression() + * @model unsettable="true" required="true" + * @generated + */ + String getExpression(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getExpression Expression}' attribute. + * + * + * @param value the new value of the 'Expression' attribute. + * @see #isSetExpression() + * @see #unsetExpression() + * @see #getExpression() + * @generated + */ + void setExpression(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getExpression Expression}' attribute. + * + * + * @see #isSetExpression() + * @see #getExpression() + * @see #setExpression(String) + * @generated + */ + void unsetExpression(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getExpression Expression}' attribute is set. + * + * + * @return whether the value of the 'Expression' attribute is set. + * @see #unsetExpression() + * @see #getExpression() + * @see #setExpression(String) + * @generated + */ + boolean isSetExpression(); + +} // CategoryDefinition diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/FeedInformation.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/FeedInformation.java new file mode 100755 index 0000000..6c40466 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/FeedInformation.java @@ -0,0 +1,321 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.ecore.EObject; + +/** + * + * A representation of the model object 'Feed Information'. + * + * + * + * This data type provides information about a Traffic Incident Feed. + * + * + *

+ * The following features are supported: + *

    + *
  • {@link org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName Data Provider Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.FeedInformation#getProtocolName Protocol Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName Communication Channel Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus Feed Status}
  • + *
  • {@link org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus Traffic Incidents Status}
  • + *
+ *

+ * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation() + * @model + * @generated + */ +public interface FeedInformation extends EObject { + /** + * Returns the value of the 'Data Provider Name' attribute. + * + *

+ * If the meaning of the 'Data Provider Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The name of the data provider. + * + * @return the value of the 'Data Provider Name' attribute. + * @see #isSetDataProviderName() + * @see #unsetDataProviderName() + * @see #setDataProviderName(String) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation_DataProviderName() + * @model unsettable="true" + * @generated + */ + String getDataProviderName(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName Data Provider Name}' attribute. + * + * + * @param value the new value of the 'Data Provider Name' attribute. + * @see #isSetDataProviderName() + * @see #unsetDataProviderName() + * @see #getDataProviderName() + * @generated + */ + void setDataProviderName(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName Data Provider Name}' attribute. + * + * + * @see #isSetDataProviderName() + * @see #getDataProviderName() + * @see #setDataProviderName(String) + * @generated + */ + void unsetDataProviderName(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName Data Provider Name}' attribute is set. + * + * + * @return whether the value of the 'Data Provider Name' attribute is set. + * @see #unsetDataProviderName() + * @see #getDataProviderName() + * @see #setDataProviderName(String) + * @generated + */ + boolean isSetDataProviderName(); + + /** + * Returns the value of the 'Protocol Name' attribute. + * + *

+ * If the meaning of the 'Protocol Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The name of the protocol via which the Traffic Incidents are received. + * There are no predefined values. + * + * @return the value of the 'Protocol Name' attribute. + * @see #isSetProtocolName() + * @see #unsetProtocolName() + * @see #setProtocolName(String) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation_ProtocolName() + * @model unsettable="true" + * @generated + */ + String getProtocolName(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getProtocolName Protocol Name}' attribute. + * + * + * @param value the new value of the 'Protocol Name' attribute. + * @see #isSetProtocolName() + * @see #unsetProtocolName() + * @see #getProtocolName() + * @generated + */ + void setProtocolName(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getProtocolName Protocol Name}' attribute. + * + * + * @see #isSetProtocolName() + * @see #getProtocolName() + * @see #setProtocolName(String) + * @generated + */ + void unsetProtocolName(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getProtocolName Protocol Name}' attribute is set. + * + * + * @return whether the value of the 'Protocol Name' attribute is set. + * @see #unsetProtocolName() + * @see #getProtocolName() + * @see #setProtocolName(String) + * @generated + */ + boolean isSetProtocolName(); + + /** + * Returns the value of the 'Communication Channel Name' attribute. + * + *

+ * If the meaning of the 'Communication Channel Name' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The name of the communication channel. + * There are no predefined values. + * + * @return the value of the 'Communication Channel Name' attribute. + * @see #isSetCommunicationChannelName() + * @see #unsetCommunicationChannelName() + * @see #setCommunicationChannelName(String) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation_CommunicationChannelName() + * @model unsettable="true" + * @generated + */ + String getCommunicationChannelName(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName Communication Channel Name}' attribute. + * + * + * @param value the new value of the 'Communication Channel Name' attribute. + * @see #isSetCommunicationChannelName() + * @see #unsetCommunicationChannelName() + * @see #getCommunicationChannelName() + * @generated + */ + void setCommunicationChannelName(String value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName Communication Channel Name}' attribute. + * + * + * @see #isSetCommunicationChannelName() + * @see #getCommunicationChannelName() + * @see #setCommunicationChannelName(String) + * @generated + */ + void unsetCommunicationChannelName(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName Communication Channel Name}' attribute is set. + * + * + * @return whether the value of the 'Communication Channel Name' attribute is set. + * @see #unsetCommunicationChannelName() + * @see #getCommunicationChannelName() + * @see #setCommunicationChannelName(String) + * @generated + */ + boolean isSetCommunicationChannelName(); + + /** + * Returns the value of the 'Feed Status' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus}. + * + *

+ * If the meaning of the 'Feed Status' attribute isn't clear, + * there really should be more of a description here... + *

+ * + * + * The status of the Feed. + * + * @return the value of the 'Feed Status' attribute. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus + * @see #isSetFeedStatus() + * @see #unsetFeedStatus() + * @see #setFeedStatus(TrafficIncidentFeedStatus) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation_FeedStatus() + * @model unsettable="true" required="true" + * @generated + */ + TrafficIncidentFeedStatus getFeedStatus(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus Feed Status}' attribute. + * + * + * @param value the new value of the 'Feed Status' attribute. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus + * @see #isSetFeedStatus() + * @see #unsetFeedStatus() + * @see #getFeedStatus() + * @generated + */ + void setFeedStatus(TrafficIncidentFeedStatus value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus Feed Status}' attribute. + * + * + * @see #isSetFeedStatus() + * @see #getFeedStatus() + * @see #setFeedStatus(TrafficIncidentFeedStatus) + * @generated + */ + void unsetFeedStatus(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus Feed Status}' attribute is set. + * + * + * @return whether the value of the 'Feed Status' attribute is set. + * @see #unsetFeedStatus() + * @see #getFeedStatus() + * @see #setFeedStatus(TrafficIncidentFeedStatus) + * @generated + */ + boolean isSetFeedStatus(); + + /** + * Returns the value of the 'Traffic Incidents Status' attribute. + * The literals are from the enumeration {@link org.genivi.trafficincidentsservice.TrafficIncidentsStatus}. + * + * + * + * The status of the Traffic Incidents delivered by this Feed. + * + * @return the value of the 'Traffic Incidents Status' attribute. + * @see org.genivi.trafficincidentsservice.TrafficIncidentsStatus + * @see #isSetTrafficIncidentsStatus() + * @see #unsetTrafficIncidentsStatus() + * @see #setTrafficIncidentsStatus(TrafficIncidentsStatus) + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getFeedInformation_TrafficIncidentsStatus() + * @model unsettable="true" required="true" + * @generated + */ + TrafficIncidentsStatus getTrafficIncidentsStatus(); + + /** + * Sets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus Traffic Incidents Status}' attribute. + * + * + * @param value the new value of the 'Traffic Incidents Status' attribute. + * @see org.genivi.trafficincidentsservice.TrafficIncidentsStatus + * @see #isSetTrafficIncidentsStatus() + * @see #unsetTrafficIncidentsStatus() + * @see #getTrafficIncidentsStatus() + * @generated + */ + void setTrafficIncidentsStatus(TrafficIncidentsStatus value); + + /** + * Unsets the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus Traffic Incidents Status}' attribute. + * + * + * @see #isSetTrafficIncidentsStatus() + * @see #getTrafficIncidentsStatus() + * @see #setTrafficIncidentsStatus(TrafficIncidentsStatus) + * @generated + */ + void unsetTrafficIncidentsStatus(); + + /** + * Returns whether the value of the '{@link org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus Traffic Incidents Status}' attribute is set. + * + * + * @return whether the value of the 'Traffic Incidents Status' attribute is set. + * @see #unsetTrafficIncidentsStatus() + * @see #getTrafficIncidentsStatus() + * @see #setTrafficIncidentsStatus(TrafficIncidentsStatus) + * @generated + */ + boolean isSetTrafficIncidentsStatus(); + +} // FeedInformation diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/LengthUnit.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/LengthUnit.java new file mode 100755 index 0000000..d2d0eb4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/LengthUnit.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Length Unit', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getLengthUnit() + * @model + * @generated + */ +public enum LengthUnit implements Enumerator { + /** + * The 'KILOMETERS' literal object. + * + * + * @see #KILOMETERS_VALUE + * @generated + * @ordered + */ + KILOMETERS(1, "KILOMETERS", "KILOMETERS"), + + /** + * The 'MILES' literal object. + * + * + * @see #MILES_VALUE + * @generated + * @ordered + */ + MILES(2, "MILES", "MILES"); + + /** + * The 'KILOMETERS' literal value. + * + *

+ * If the meaning of 'KILOMETERS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #KILOMETERS + * @model + * @generated + * @ordered + */ + public static final int KILOMETERS_VALUE = 1; + + /** + * The 'MILES' literal value. + * + *

+ * If the meaning of 'MILES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MILES + * @model + * @generated + * @ordered + */ + public static final int MILES_VALUE = 2; + + /** + * An array of all the 'Length Unit' enumerators. + * + * + * @generated + */ + private static final LengthUnit[] VALUES_ARRAY = + new LengthUnit[] { + KILOMETERS, + MILES, + }; + + /** + * A public read-only list of all the 'Length Unit' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Length Unit' literal with the specified literal value. + * + * + * @generated + */ + public static LengthUnit get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LengthUnit result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Length Unit' literal with the specified name. + * + * + * @generated + */ + public static LengthUnit getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LengthUnit result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Length Unit' literal with the specified integer value. + * + * + * @generated + */ + public static LengthUnit get(int value) { + switch (value) { + case KILOMETERS_VALUE: return KILOMETERS; + case MILES_VALUE: return MILES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private LengthUnit(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //LengthUnit diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/SpeedUnit.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/SpeedUnit.java new file mode 100755 index 0000000..f06f62a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/SpeedUnit.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Speed Unit', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getSpeedUnit() + * @model + * @generated + */ +public enum SpeedUnit implements Enumerator { + /** + * The 'KILOMETERS PER HOUR' literal object. + * + * + * @see #KILOMETERS_PER_HOUR_VALUE + * @generated + * @ordered + */ + KILOMETERS_PER_HOUR(1, "KILOMETERS_PER_HOUR", "KILOMETERS_PER_HOUR"), + + /** + * The 'MILES PER HOUR' literal object. + * + * + * @see #MILES_PER_HOUR_VALUE + * @generated + * @ordered + */ + MILES_PER_HOUR(2, "MILES_PER_HOUR", "MILES_PER_HOUR"); + + /** + * The 'KILOMETERS PER HOUR' literal value. + * + *

+ * If the meaning of 'KILOMETERS PER HOUR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #KILOMETERS_PER_HOUR + * @model + * @generated + * @ordered + */ + public static final int KILOMETERS_PER_HOUR_VALUE = 1; + + /** + * The 'MILES PER HOUR' literal value. + * + *

+ * If the meaning of 'MILES PER HOUR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MILES_PER_HOUR + * @model + * @generated + * @ordered + */ + public static final int MILES_PER_HOUR_VALUE = 2; + + /** + * An array of all the 'Speed Unit' enumerators. + * + * + * @generated + */ + private static final SpeedUnit[] VALUES_ARRAY = + new SpeedUnit[] { + KILOMETERS_PER_HOUR, + MILES_PER_HOUR, + }; + + /** + * A public read-only list of all the 'Speed Unit' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Speed Unit' literal with the specified literal value. + * + * + * @generated + */ + public static SpeedUnit get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SpeedUnit result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Speed Unit' literal with the specified name. + * + * + * @generated + */ + public static SpeedUnit getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SpeedUnit result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Speed Unit' literal with the specified integer value. + * + * + * @generated + */ + public static SpeedUnit get(int value) { + switch (value) { + case KILOMETERS_PER_HOUR_VALUE: return KILOMETERS_PER_HOUR; + case MILES_PER_HOUR_VALUE: return MILES_PER_HOUR; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private SpeedUnit(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //SpeedUnit diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TextDetailLevel.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TextDetailLevel.java new file mode 100755 index 0000000..5ab64c4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TextDetailLevel.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Text Detail Level', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTextDetailLevel() + * @model + * @generated + */ +public enum TextDetailLevel implements Enumerator { + /** + * The 'FULL' literal object. + * + * + * @see #FULL_VALUE + * @generated + * @ordered + */ + FULL(1, "FULL", "FULL"), + + /** + * The 'SUMMARY' literal object. + * + * + * @see #SUMMARY_VALUE + * @generated + * @ordered + */ + SUMMARY(2, "SUMMARY", "SUMMARY"); + + /** + * The 'FULL' literal value. + * + *

+ * If the meaning of 'FULL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FULL + * @model + * @generated + * @ordered + */ + public static final int FULL_VALUE = 1; + + /** + * The 'SUMMARY' literal value. + * + *

+ * If the meaning of 'SUMMARY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SUMMARY + * @model + * @generated + * @ordered + */ + public static final int SUMMARY_VALUE = 2; + + /** + * An array of all the 'Text Detail Level' enumerators. + * + * + * @generated + */ + private static final TextDetailLevel[] VALUES_ARRAY = + new TextDetailLevel[] { + FULL, + SUMMARY, + }; + + /** + * A public read-only list of all the 'Text Detail Level' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Text Detail Level' literal with the specified literal value. + * + * + * @generated + */ + public static TextDetailLevel get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TextDetailLevel result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Text Detail Level' literal with the specified name. + * + * + * @generated + */ + public static TextDetailLevel getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TextDetailLevel result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Text Detail Level' literal with the specified integer value. + * + * + * @generated + */ + public static TextDetailLevel get(int value) { + switch (value) { + case FULL_VALUE: return FULL; + case SUMMARY_VALUE: return SUMMARY; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TextDetailLevel(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TextDetailLevel diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeed.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeed.java new file mode 100755 index 0000000..1efe056 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeed.java @@ -0,0 +1,116 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; + +/** + * + * A representation of the model object 'Traffic Incidents Updates'. + * + * + * + * This interface can be used by Traffic Incident Feeds to feed Traffic Incidents into the Traffic Incidents Service. + * + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentFeed() + * @model + * @generated + */ +public interface TrafficIncidentFeed extends EObject { + /** + * + * + * + * Get the API version of this interface implemented by the service. + * @param listener The class on which the callback function is called. + * + * @model + * @generated + */ + void getVersion(TrafficIncidentFeedListener listener); + + /** + * + * + * + * Get the current language. In case of a client/server based Feed, this language can be sent to the server in order to receive any textual information in the right language. + * @param listener The class on which the callback function is called. + * + * @model + * @generated + */ + void getLanguage(TrafficIncidentFeedListener listener); + + /** + * + * + * + * Add this client as a listener for changes in the current language. In case of changes, getLanguageReply() is called on the listener. + * @param listener The class on which the callback function is called. + * + * @model + * @generated + */ + void addLanguageListener(TrafficIncidentFeedListener listener, TrafficIncidentFeedListener changeListener); + + /** + * + * + * + * Clear the internal store of the Traffic Incidents Service. This may be needed if the source of the Traffic Incidents is changed, or if the server indicates that a reset is needed. + * + * @model + * @generated + */ + void clear(); + + /** + * + * + * + * Update the Traffic Incidents in the internal store of the Traffic Incidents Service. These updates can consist of incidents to be removed (cancelledIncidentIds), and/or new or updated incidents (updatedIncidents). The 'cancels' are handled before the 'updates'. + * @param cancelledIncidentIds The unique Ids of the incidents to be deleted. + * @param updatedIncidents The new or updated incidents. + * + * @model cancelledIncidentIdsMany="true" updatedIncidentsMany="true" + * @generated + */ + void updateIncidents(int feedId, EList cancelledIncidentIds, EList updatedIncidents); + + /** + * + * + * @model + * @generated + */ + void updateStatus(int feedId, TrafficIncidentFeedStatus feedStatus, TrafficIncidentsStatus incidentsStatus); + + /** + * + * + * @model + * @generated + */ + void registerFeed(TrafficIncidentFeedListener listener, String dataProviderName, String protocolName, String communicationChannelName); + + /** + * + * + * + * Remove this client as a listener for changes in the current language. + * + * @model + * @generated + */ + void removeLanguageListener(TrafficIncidentFeedListener listener, TrafficIncidentFeedListener changeListener); + +} // TrafficIncidentFeed diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedListener.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedListener.java new file mode 100755 index 0000000..4e27d07 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedListener.java @@ -0,0 +1,74 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.Version; + +/** + * + * A representation of the model object 'Traffic Incidents Updates Listener'. + * + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentFeedListener() + * @model + * @generated + */ +public interface TrafficIncidentFeedListener extends EObject { + /** + * + * + * + * This method is called as a response to getVersion(). + * @param version The API version of this interface implemented by the service. + * + * @model + * @generated + */ + void getVersionReply(Version version); + + /** + * + * + * + * This method is called as a response to getLanguage() or addLanguegeListener() when the language is changed. + * @param languageCode The currently used language. + * @param countryCode The currently used, country specific variant of the language. + * + * @model + * @generated + */ + void getLanguageReply(String languageCode, String countryCode); + + /** + * + * + * @model + * @generated + */ + void registerFeedReply(int feedId); + + /** + * + * + * @model + * @generated + */ + void addLanguageListenerReply(); + + /** + * + * + * @model + * @generated + */ + void removeLanguageListenerReply(); + +} // TrafficIncidentFeedListener diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedStatus.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedStatus.java new file mode 100755 index 0000000..ef9ac89 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentFeedStatus.java @@ -0,0 +1,245 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Traffic Incident Feed Status', + * and utility methods for working with them. + * + * + * This type provides information on the status of a Traffic Incident Feed, or of a combination of Traffic Incident Feeds. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentFeedStatus() + * @model + * @generated + */ +public enum TrafficIncidentFeedStatus implements Enumerator { + /** + * The 'UNAVAILABLE' literal object. + * + * + * @see #UNAVAILABLE_VALUE + * @generated + * @ordered + */ + UNAVAILABLE(1, "UNAVAILABLE", "UNAVAILABLE"), + + /** + * The 'CONNECTED' literal object. + * + * + * @see #CONNECTED_VALUE + * @generated + * @ordered + */ + CONNECTED(2, "CONNECTED", "CONNECTED"), + + /** + * The 'DISCONNECTED' literal object. + * + * + * @see #DISCONNECTED_VALUE + * @generated + * @ordered + */ + DISCONNECTED(3, "DISCONNECTED", "DISCONNECTED"); + + /** + * The 'UNAVAILABLE' literal value. + * + * + * + * There is no Traffic Incident Feed available. A feed is not available if a connection is not possible. + * Examples of this are: there is no location table available for the current country (in case of TMC), + * or the user has no valid subscription. + * + * @see #UNAVAILABLE + * @model + * @generated + * @ordered + */ + public static final int UNAVAILABLE_VALUE = 1; + + /** + * The 'CONNECTED' literal value. + * + * + * + * One or more Traffic Incident Feeds are available and connected (a communication channel is operational). + * + * @see #CONNECTED + * @model + * @generated + * @ordered + */ + public static final int CONNECTED_VALUE = 2; + + /** + * The 'DISCONNECTED' literal value. + * + * + * + * One or more Traffic Incident Feeds are available but none of them is currently connected + * (the communication channels are not operational). + * For example, an RDS/TMC receiver is available but there is no signal, + * or a TPEG over HTTP/IP feed is available but the connection to the server failed. + * + * @see #DISCONNECTED + * @model + * @generated + * @ordered + */ + public static final int DISCONNECTED_VALUE = 3; + + /** + * An array of all the 'Traffic Incident Feed Status' enumerators. + * + * + * @generated + */ + private static final TrafficIncidentFeedStatus[] VALUES_ARRAY = + new TrafficIncidentFeedStatus[] { + UNAVAILABLE, + CONNECTED, + DISCONNECTED, + }; + + /** + * A public read-only list of all the 'Traffic Incident Feed Status' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Traffic Incident Feed Status' literal with the specified literal value. + * + * + * @generated + */ + public static TrafficIncidentFeedStatus get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentFeedStatus result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incident Feed Status' literal with the specified name. + * + * + * @generated + */ + public static TrafficIncidentFeedStatus getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentFeedStatus result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incident Feed Status' literal with the specified integer value. + * + * + * @generated + */ + public static TrafficIncidentFeedStatus get(int value) { + switch (value) { + case UNAVAILABLE_VALUE: return UNAVAILABLE; + case CONNECTED_VALUE: return CONNECTED; + case DISCONNECTED_VALUE: return DISCONNECTED; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TrafficIncidentFeedStatus(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TrafficIncidentFeedStatus diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentField.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentField.java new file mode 100755 index 0000000..468da09 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentField.java @@ -0,0 +1,718 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Traffic Incident Field', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentField() + * @model + * @generated + */ +public enum TrafficIncidentField implements Enumerator { + /** + * The 'TRAFFIC INCIDENT ID' literal object. + * + * + * @see #TRAFFIC_INCIDENT_ID_VALUE + * @generated + * @ordered + */ + TRAFFIC_INCIDENT_ID(1, "TRAFFIC_INCIDENT_ID", "TRAFFIC_INCIDENT_ID"), + + /** + * The 'EFFECT CODE' literal object. + * + * + * @see #EFFECT_CODE_VALUE + * @generated + * @ordered + */ + EFFECT_CODE(2, "EFFECT_CODE", "EFFECT_CODE"), + + /** + * The 'EFFECT TEXT' literal object. + * + * + * @see #EFFECT_TEXT_VALUE + * @generated + * @ordered + */ + EFFECT_TEXT(3, "EFFECT_TEXT", "EFFECT_TEXT"), + + /** + * The 'START TIME' literal object. + * + * + * @see #START_TIME_VALUE + * @generated + * @ordered + */ + START_TIME(4, "START_TIME", "START_TIME"), + + /** + * The 'STOP TIME' literal object. + * + * + * @see #STOP_TIME_VALUE + * @generated + * @ordered + */ + STOP_TIME(5, "STOP_TIME", "STOP_TIME"), + + /** + * The 'TENDENCY' literal object. + * + * + * @see #TENDENCY_VALUE + * @generated + * @ordered + */ + TENDENCY(6, "TENDENCY", "TENDENCY"), + + /** + * The 'TENDENCY TEXT' literal object. + * + * + * @see #TENDENCY_TEXT_VALUE + * @generated + * @ordered + */ + TENDENCY_TEXT(7, "TENDENCY_TEXT", "TENDENCY_TEXT"), + + /** + * The 'LENGTH AFFECTED' literal object. + * + * + * @see #LENGTH_AFFECTED_VALUE + * @generated + * @ordered + */ + LENGTH_AFFECTED(8, "LENGTH_AFFECTED", "LENGTH_AFFECTED"), + + /** + * The 'AVERAGE SPEED ABSOLUTE' literal object. + * + * + * @see #AVERAGE_SPEED_ABSOLUTE_VALUE + * @generated + * @ordered + */ + AVERAGE_SPEED_ABSOLUTE(9, "AVERAGE_SPEED_ABSOLUTE", "AVERAGE_SPEED_ABSOLUTE"), + + /** + * The 'DELAY' literal object. + * + * + * @see #DELAY_VALUE + * @generated + * @ordered + */ + DELAY(10, "DELAY", "DELAY"), + + /** + * The 'SEGMENT SPEED LIMIT' literal object. + * + * + * @see #SEGMENT_SPEED_LIMIT_VALUE + * @generated + * @ordered + */ + SEGMENT_SPEED_LIMIT(11, "SEGMENT_SPEED_LIMIT", "SEGMENT_SPEED_LIMIT"), + + /** + * The 'CAUSES' literal object. + * + * + * @see #CAUSES_VALUE + * @generated + * @ordered + */ + CAUSES(13, "CAUSES", "CAUSES"), + + /** + * The 'CAUSE TEXTS' literal object. + * + * + * @see #CAUSE_TEXTS_VALUE + * @generated + * @ordered + */ + CAUSE_TEXTS(14, "CAUSE_TEXTS", "CAUSE_TEXTS"), + + /** + * The 'APPLICABILITY TEXTS' literal object. + * + * + * @see #APPLICABILITY_TEXTS_VALUE + * @generated + * @ordered + */ + APPLICABILITY_TEXTS(16, "APPLICABILITY_TEXTS", "APPLICABILITY_TEXTS"), + + /** + * The 'LOCATION' literal object. + * + * + * @see #LOCATION_VALUE + * @generated + * @ordered + */ + LOCATION(17, "LOCATION", "LOCATION"), + + /** + * The 'LOCATION INFO' literal object. + * + * + * @see #LOCATION_INFO_VALUE + * @generated + * @ordered + */ + LOCATION_INFO(18, "LOCATION_INFO", "LOCATION_INFO"), + + /** + * The 'LOCATION BOUNDING BOX' literal object. + * + * + * @see #LOCATION_BOUNDING_BOX_VALUE + * @generated + * @ordered + */ + LOCATION_BOUNDING_BOX(19, "LOCATION_BOUNDING_BOX", "LOCATION_BOUNDING_BOX"), /** + * The 'APPLICABILITY' literal object. + * + * + * @see #APPLICABILITY_VALUE + * @generated + * @ordered + */ + APPLICABILITY(15, "APPLICABILITY", "APPLICABILITY"), /** + * The 'ADVICES' literal object. + * + * + * @see #ADVICES_VALUE + * @generated + * @ordered + */ + ADVICES(20, "ADVICES", "ADVICES"), /** + * The 'ADVICE TEXTS' literal object. + * + * + * @see #ADVICE_TEXTS_VALUE + * @generated + * @ordered + */ + ADVICE_TEXTS(21, "ADVICE_TEXTS", "ADVICE_TEXTS"), /** + * The 'EXPECTED SPEED ABSOLUTE' literal object. + * + * + * @see #EXPECTED_SPEED_ABSOLUTE_VALUE + * @generated + * @ordered + */ + EXPECTED_SPEED_ABSOLUTE(12, "EXPECTED_SPEED_ABSOLUTE", "EXPECTED_SPEED_ABSOLUTE"); + + /** + * The 'TRAFFIC INCIDENT ID' literal value. + * + *

+ * If the meaning of 'TRAFFIC INCIDENT ID' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAFFIC_INCIDENT_ID + * @model + * @generated + * @ordered + */ + public static final int TRAFFIC_INCIDENT_ID_VALUE = 1; + + /** + * The 'EFFECT CODE' literal value. + * + *

+ * If the meaning of 'EFFECT CODE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EFFECT_CODE + * @model + * @generated + * @ordered + */ + public static final int EFFECT_CODE_VALUE = 2; + + /** + * The 'EFFECT TEXT' literal value. + * + *

+ * If the meaning of 'EFFECT TEXT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EFFECT_TEXT + * @model + * @generated + * @ordered + */ + public static final int EFFECT_TEXT_VALUE = 3; + + /** + * The 'START TIME' literal value. + * + *

+ * If the meaning of 'START TIME' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #START_TIME + * @model + * @generated + * @ordered + */ + public static final int START_TIME_VALUE = 4; + + /** + * The 'STOP TIME' literal value. + * + *

+ * If the meaning of 'STOP TIME' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STOP_TIME + * @model + * @generated + * @ordered + */ + public static final int STOP_TIME_VALUE = 5; + + /** + * The 'TENDENCY' literal value. + * + *

+ * If the meaning of 'TENDENCY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TENDENCY + * @model + * @generated + * @ordered + */ + public static final int TENDENCY_VALUE = 6; + + /** + * The 'TENDENCY TEXT' literal value. + * + *

+ * If the meaning of 'TENDENCY TEXT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TENDENCY_TEXT + * @model + * @generated + * @ordered + */ + public static final int TENDENCY_TEXT_VALUE = 7; + + /** + * The 'LENGTH AFFECTED' literal value. + * + *

+ * If the meaning of 'LENGTH AFFECTED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LENGTH_AFFECTED + * @model + * @generated + * @ordered + */ + public static final int LENGTH_AFFECTED_VALUE = 8; + + /** + * The 'AVERAGE SPEED ABSOLUTE' literal value. + * + *

+ * If the meaning of 'AVERAGE SPEED ABSOLUTE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AVERAGE_SPEED_ABSOLUTE + * @model + * @generated + * @ordered + */ + public static final int AVERAGE_SPEED_ABSOLUTE_VALUE = 9; + + /** + * The 'DELAY' literal value. + * + *

+ * If the meaning of 'DELAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DELAY + * @model + * @generated + * @ordered + */ + public static final int DELAY_VALUE = 10; + + /** + * The 'SEGMENT SPEED LIMIT' literal value. + * + *

+ * If the meaning of 'SEGMENT SPEED LIMIT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SEGMENT_SPEED_LIMIT + * @model + * @generated + * @ordered + */ + public static final int SEGMENT_SPEED_LIMIT_VALUE = 11; + + /** + * The 'CAUSES' literal value. + * + *

+ * If the meaning of 'CAUSES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CAUSES + * @model + * @generated + * @ordered + */ + public static final int CAUSES_VALUE = 13; + + /** + * The 'CAUSE TEXTS' literal value. + * + *

+ * If the meaning of 'CAUSE TEXTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CAUSE_TEXTS + * @model + * @generated + * @ordered + */ + public static final int CAUSE_TEXTS_VALUE = 14; + + /** + * The 'APPLICABILITY TEXTS' literal value. + * + *

+ * If the meaning of 'APPLICABILITY TEXTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #APPLICABILITY_TEXTS + * @model + * @generated + * @ordered + */ + public static final int APPLICABILITY_TEXTS_VALUE = 16; + + /** + * The 'LOCATION' literal value. + * + *

+ * If the meaning of 'LOCATION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LOCATION + * @model + * @generated + * @ordered + */ + public static final int LOCATION_VALUE = 17; + + /** + * The 'LOCATION INFO' literal value. + * + *

+ * If the meaning of 'LOCATION INFO' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LOCATION_INFO + * @model + * @generated + * @ordered + */ + public static final int LOCATION_INFO_VALUE = 18; + + /** + * The 'LOCATION BOUNDING BOX' literal value. + * + *

+ * If the meaning of 'LOCATION BOUNDING BOX' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LOCATION_BOUNDING_BOX + * @model + * @generated + * @ordered + */ + public static final int LOCATION_BOUNDING_BOX_VALUE = 19; + + /** + * The 'APPLICABILITY' literal value. + * + *

+ * If the meaning of 'APPLICABILITY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #APPLICABILITY + * @model + * @generated + * @ordered + */ + public static final int APPLICABILITY_VALUE = 15; + + /** + * The 'ADVICES' literal value. + * + *

+ * If the meaning of 'ADVICES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ADVICES + * @model + * @generated + * @ordered + */ + public static final int ADVICES_VALUE = 20; + + /** + * The 'ADVICE TEXTS' literal value. + * + *

+ * If the meaning of 'ADVICE TEXTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ADVICE_TEXTS + * @model + * @generated + * @ordered + */ + public static final int ADVICE_TEXTS_VALUE = 21; + + /** + * The 'EXPECTED SPEED ABSOLUTE' literal value. + * + *

+ * If the meaning of 'EXPECTED SPEED ABSOLUTE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EXPECTED_SPEED_ABSOLUTE + * @model + * @generated + * @ordered + */ + public static final int EXPECTED_SPEED_ABSOLUTE_VALUE = 12; + + /** + * An array of all the 'Traffic Incident Field' enumerators. + * + * + * @generated + */ + private static final TrafficIncidentField[] VALUES_ARRAY = + new TrafficIncidentField[] { + TRAFFIC_INCIDENT_ID, + EFFECT_CODE, + EFFECT_TEXT, + START_TIME, + STOP_TIME, + TENDENCY, + TENDENCY_TEXT, + LENGTH_AFFECTED, + AVERAGE_SPEED_ABSOLUTE, + DELAY, + SEGMENT_SPEED_LIMIT, + CAUSES, + CAUSE_TEXTS, + APPLICABILITY_TEXTS, + LOCATION, + LOCATION_INFO, + LOCATION_BOUNDING_BOX, + APPLICABILITY, + ADVICES, + ADVICE_TEXTS, + EXPECTED_SPEED_ABSOLUTE, + }; + + /** + * A public read-only list of all the 'Traffic Incident Field' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Traffic Incident Field' literal with the specified literal value. + * + * + * @generated + */ + public static TrafficIncidentField get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentField result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incident Field' literal with the specified name. + * + * + * @generated + */ + public static TrafficIncidentField getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentField result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incident Field' literal with the specified integer value. + * + * + * @generated + */ + public static TrafficIncidentField get(int value) { + switch (value) { + case TRAFFIC_INCIDENT_ID_VALUE: return TRAFFIC_INCIDENT_ID; + case EFFECT_CODE_VALUE: return EFFECT_CODE; + case EFFECT_TEXT_VALUE: return EFFECT_TEXT; + case START_TIME_VALUE: return START_TIME; + case STOP_TIME_VALUE: return STOP_TIME; + case TENDENCY_VALUE: return TENDENCY; + case TENDENCY_TEXT_VALUE: return TENDENCY_TEXT; + case LENGTH_AFFECTED_VALUE: return LENGTH_AFFECTED; + case AVERAGE_SPEED_ABSOLUTE_VALUE: return AVERAGE_SPEED_ABSOLUTE; + case DELAY_VALUE: return DELAY; + case SEGMENT_SPEED_LIMIT_VALUE: return SEGMENT_SPEED_LIMIT; + case CAUSES_VALUE: return CAUSES; + case CAUSE_TEXTS_VALUE: return CAUSE_TEXTS; + case APPLICABILITY_TEXTS_VALUE: return APPLICABILITY_TEXTS; + case LOCATION_VALUE: return LOCATION; + case LOCATION_INFO_VALUE: return LOCATION_INFO; + case LOCATION_BOUNDING_BOX_VALUE: return LOCATION_BOUNDING_BOX; + case APPLICABILITY_VALUE: return APPLICABILITY; + case ADVICES_VALUE: return ADVICES; + case ADVICE_TEXTS_VALUE: return ADVICE_TEXTS; + case EXPECTED_SPEED_ABSOLUTE_VALUE: return EXPECTED_SPEED_ABSOLUTE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TrafficIncidentField(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TrafficIncidentField diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidents.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidents.java new file mode 100755 index 0000000..a7279fb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidents.java @@ -0,0 +1,383 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.RectangularArea; + +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * + * A representation of the model object 'Traffic Incidents'. + * + * + * + * This is the main interface via which a client obtains Traffic Information. + * + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidents() + * @model annotation="http://www.tomtom.com/emfidl/2012/GenModel versionMajor='0' versionMinor='1'" + * @generated + */ +public interface TrafficIncidents extends EObject { + /** + * + * + * + * Get the API version of this interface implemented by the service. + * @param listener The class on which the callback function is called. + * + * @model + * @generated + */ + void getVersion(TrafficIncidentsListener listener); + + /** + * + * + * + * Get all the Ids of the current traffic incidents. + * @param listener The class on which the callback function is called. + * @param warningLevels + * Only incidents with one of the specified warning levels will be returned. + * In case of an empty list, traffic incidents with any warning level (and no specified warning level) are returned. + * + * @model warningLevelsMany="true" categoryIdsMany="true" + * @generated + */ + void getTrafficIncidentIds(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds); + + /** + * + * + * + * Get the Ids of the traffic incidents in a number of areas. + * @param listener The class on which the callback function is called. + * @param warningLevels + * Only incidents with one of the specified warning levels will be returned. + * In case of an empty list, traffic incidents with any warning level (and no specified warning level) are returned. + * @param areas The areas for which the traffic incident Ids are requested. + * + * @model warningLevelsMany="true" categoryIdsMany="true" areasMany="true" + * @generated + */ + void getTrafficIncidentIdsInAreas(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, EList areas); + + /** + * + * + * + * Get a number of Traffic Incidents. + * @param listener The class on which the callback function is called. + * @param trafficIncidentIds The Ids of the requested Traffic Incidents. + * @param includeTextFields The text fields in the returned Traffic Incident will only be filled in if this parameter is set to true. + * + * @model trafficIncidentIdsMany="true" + * @generated + */ + void getTrafficIncidents(TrafficIncidentsListener listener, EList trafficIncidentIds, boolean includeTextFields); + + /** + * + * + * + * Get a number of Traffic Incidents, where only specific fields are filled in.. + * @param listener The class on which the callback function is called. + * @param trafficIncidentIds The Ids of the requested Traffic Incidents. + * @param trafficIncidentFields The fields (attributes) to be filled in in the Traffic Incident. + * + * @model trafficIncidentIdsMany="true" trafficIncidentFieldsMany="true" + * @generated + */ + void getTrafficIncidentsFields(TrafficIncidentsListener listener, EList trafficIncidentIds, EList trafficIncidentFields); + + /** + * + * + * + * Get the texts for a number of Traffic Incidents. + * @param listener The class on which the callback function is called. + * @param trafficIncidentIds The Ids of the Traffic Incidents for which the texts are requested. + * @param textDetailLevel The amount of detail to be provided in the texts. + * + * @model trafficIncidentIdsMany="true" + * @generated + */ + void getTexts(TrafficIncidentsListener listener, EList trafficIncidentIds, TextDetailLevel textDetailLevel); + + /** + * + * + * + * Add a listener which is notified in case of any change in Traffic Incidents status. + * In case of a status change, the TrafficIncidentsStatus() method of the listener is called. + * + * @model + * @generated + */ + void addTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener); + + /** + * + * + * @model + * @generated + */ + void addFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener); + + /** + * + * + * @model + * @generated + */ + void removeUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener); + + /** + * + * + * @model + * @generated + */ + void removeAreasUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener); + + /** + * + * + * @model + * @generated + */ + void removeTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener); + + /** + * + * + * @model + * @generated + */ + void removeFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener); + + /** + * + * + * + * Add a listener which is notified in case of any update in the traffic information. + * In case of an update the updates() method of the listener is called. + * @param listener The class on which the callback function is called. + * @param warningLevels + * Only incidents with one of the specified warning levels will be returned. + * In case of an empty list, traffic incidents with any warning level (and no specified warning level) are returned. + * + * @model warningLevelsMany="true" categoryIdsMany="true" + * @generated + */ + void addUpdateListener(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, TrafficIncidentsListener updateListener); + + /** + * + * + * + * Add a listener which is notified in case of an update in the traffic information in one or more specific area's. + * In case of an update the updatesInAreas() method of the listener is called. + * @param listener The class on which the callback function is called. + * @param warningLevels + * Only incidents with one of the specified warning levels will be returned. + * In case of an empty list, traffic incidents with any warning level (and no specified warning level) are returned. + * @param areas The area's to be observed for changes. + * + * @model warningLevelsMany="true" categoryIdsMany="true" areasMany="true" + * @generated + */ + void addAreasUpdateListener(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, EList areas, TrafficIncidentsListener updateListener); + + /** + * + * + * + * Get the current language. + * @param listener The class on which the callback function is called. + * + * @model + * @generated + */ + void getLanguage(TrafficIncidentsListener listener); + + /** + * + * + * + * Set the language. + * @param languageCode The language to be used. + * @param countryCode The country specific variant for the language to be used. + * + * @model + * @generated + */ + void setLanguage(TrafficIncidentsListener listener, String languageCode, String countryCode); + + /** + * + * + * @model + * @generated + */ + void setTimeFormat(TrafficIncidentsListener listener, String timeFormat); + + /** + * + * + * @model + * @generated + */ + void setDateFormat(TrafficIncidentsListener listener, String dateFormat); + + /** + * + * + * @model + * @generated + */ + void setLengthUnit(TrafficIncidentsListener listener, LengthUnit lengthUnit); + + /** + * + * + * @model + * @generated + */ + void setWeightUnit(TrafficIncidentsListener listener, WeightUnit weightUnit); + + /** + * + * + * @model + * @generated + */ + void reserveIconSetIds(TrafficIncidentsListener listener, int numberOfIds); + + /** + * + * + * @model iconSetIdsMany="true" + * @generated + */ + void freeIconSetIds(TrafficIncidentsListener listener, EList iconSetIds); + + /** + * + * + * @model + * @generated + */ + void getIconSets(TrafficIncidentsListener listener); + + /** + * + * + * @model iconSetsMany="true" + * @generated + */ + void addIconSetDefinitions(TrafficIncidentsListener listener, EList iconSets); + + /** + * + * + * @model iconSetIdsMany="true" + * @generated + */ + void removeIconSetDefinitions(TrafficIncidentsListener listener, EList iconSetIds); + + /** + * + * + * @model iconInfosMany="true" + * @generated + */ + void getIconDefinitions(TrafficIncidentsListener listener, EList iconInfos); + + /** + * + * + * @model iconDefinitionsMany="true" + * @generated + */ + void addIconDefinitions(TrafficIncidentsListener listener, EList iconDefinitions); + + /** + * + * + * @model iconInfosMany="true" + * @generated + */ + void removeIconDefinitions(TrafficIncidentsListener listener, EList iconInfos); + + /** + * + * + * @model + * @generated + */ + void reserveCategoryIds(TrafficIncidentsListener listener, int numberOfIds); + + /** + * + * + * @model categoryIdsMany="true" + * @generated + */ + void freeCategoryIds(TrafficIncidentsListener listener, EList categoryIds); + + /** + * + * + * @model + * @generated + */ + void getCategoryDefinitions(TrafficIncidentsListener listener); + + /** + * + * + * @model categoryDefinitionsMany="true" + * @generated + */ + void addCategoryDefinitions(TrafficIncidentsListener listener, EList categoryDefinitions); + + /** + * + * + * @model categoryIdsMany="true" + * @generated + */ + void removeCategoryDefinitions(TrafficIncidentsListener listener, EList categoryIds); + + /** + * + * + * @model + * @generated + */ + void getApplicability(TrafficIncidentsListener listener); + + /** + * + * + * @model + * @generated + */ + void setApplicability(TrafficIncidentsListener listener, String filterExpression); + +} // TrafficIncidents diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsListener.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsListener.java new file mode 100755 index 0000000..7a14629 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsListener.java @@ -0,0 +1,422 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EObject; + +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; + +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + +/** + * + * A representation of the model object 'Traffic Incidents Listener'. + * + * + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentsListener() + * @model + * @generated + */ +public interface TrafficIncidentsListener extends EObject { + /** + * + * + * + * This method is called as a response to getVersion(). + * @param version The API version of this interface implemented by the service. + * + * @model + * @generated + */ + void getVersionReply(Version version); + + /** + * + * + * + * This method is called as a response to getTrafficIncidentIds(). + * @param trafficIncidentIds The Ids of the requested traffic incidents. + * + * @model trafficIncidentIdsMany="true" + * @generated + */ + void getTrafficIncidentIdsReply(EList trafficIncidentIds); + + /** + * + * + * + * This method is called as a response to getTrafficIncidentIdsInAreas(). + * @param trafficIncidentIds The Ids of the requested traffic incidents. + * + * @model trafficIncidentIdsMany="true" + * @generated + */ + void getTrafficIncidentIdsInAreasReply(EList trafficIncidentIds); + + /** + * + * + * + * This method is called as a response to getTrafficIncidents(). + * @param trafficIncidents + * The requested Traffic Incidents. This list may be shorter than the request list + * as nothing is returned for Ids that don't exist (anymore). + * + * @model trafficIncidentsMany="true" + * @generated + */ + void getTrafficIncidentsReply(EList trafficIncidents); + + /** + * + * + * + * This method is called as a response to getTrafficIncidentsFields(). + * @param trafficIncidents + * The requested Traffic Incidents, with only the requested fields filled in. + * This list may be shorter than the request list as nothing is returned for + * Ids that don't exist (anymore). + * + * @model trafficIncidentsMany="true" + * @generated + */ + void getTrafficIncidentsFieldsReply(EList trafficIncidents); + + /** + * + * + * + * This method is called as a response to getTexts(). + * @param texts + * Text information per requested traffic incident. + * The texts will be in the same order as the trafficIncidentIds in the request. + * + * @model textsMany="true" + * @generated + */ + void getTextsReply(EList texts); + + /** + * + * + * @model + * @generated + */ + void addTrafficIncidentsStatusListenerReply(); + + /** + * + * + * @model + * @generated + */ + void addFeedInformationListenerReply(); + + /** + * + * + * @model + * @generated + */ + void addUpdateListenerReply(); + + /** + * + * + * @model + * @generated + */ + void removeUpdateListenerReply(); + + /** + * + * + * @model + * @generated + */ + void addAreasUpdateListenerReply(); + + /** + * + * + * @model + * @generated + */ + void removeAreasUpdateListenerReply(); + + /** + * + * + * @model + * @generated + */ + void setLanguageReply(); + + /** + * + * + * @model + * @generated + */ + void setTimeFormatReply(); + + /** + * + * + * @model + * @generated + */ + void setDateFormatReply(); + + /** + * + * + * @model + * @generated + */ + void setLengthUnitReply(); + + /** + * + * + * @model + * @generated + */ + void setWeightUnitReply(); + + /** + * + * + * @model + * @generated + */ + void setApplicabilityReply(); + + /** + * + * + * @model + * @generated + */ + void freeCategoryIdsReply(); + + /** + * + * + * + * If a client has registered itself as a listener for any updates in the traffic incidents, + * this method is called if there are changes. + * + * @model unchangedTrafficIncidentIdsMany="true" changedTrafficIncidentIdsMany="true" newTrafficIncidentIdsMany="true" deletedTrafficIncidentIdsMany="true" + * @generated + */ + void updates(EList unchangedTrafficIncidentIds, EList changedTrafficIncidentIds, EList newTrafficIncidentIds, EList deletedTrafficIncidentIds); + + /** + * + * + * + * If a client has registered itself as a listener for updates in the traffic incidents in one or more area's + * (via addAreaUpdateListener() or addAreasUpdateListener()), + * this method is called if there are changes. + * @param areas The area's in which changes have taken place. + * + * @model areasMany="true" + * @generated + */ + void updatesInAreas(EList areas); + + /** + * + * + * + * This method is called as a response to getLanguage(). + * @param languageCode The language. + * @param countryCode The country specific variant for the language. + * + * @model + * @generated + */ + void getLanguageReply(String languageCode, String countryCode); + + /** + * + * + * + * If a client has registered itself as a listener for changes in the Traffic Incidents status, + * this method is called upon changes in the Traffic Incidents status. + * The provided status information is the combined status of the available feeds in the system. + * Details of how the information is combined is given per parameter. + * @param trafficIncidentFeedStatus + * The combined status of the Traffic Incident Feeds. + * If all Feeds are UNAVAILABLE, the status is UNAVAILABLE. + * Else, if any of the Feeds is CONNECTED, the status is CONNECTED. + * Else, the status is DISCONNECTED (so there are Feeds available, but none of them is connected). + * @param trafficIncidentsStatus + * The combined status of the Traffic Incidents. + * If the status for all the Feeds is AVAILABLE, , the combined status is AVAILABLE. + * Else, if the status for one of the Feeds is PARTLY_AVAILABLE, the combined status is PARTLY_AVAILABLE. + * Else, the combined status is UNAVAILABLE (so there are no Traffic Incidents at all). + * + * + * Meaning of the enum values at this level: + * UNAVAILABLE: The are no incidents in the system, and currently they can also not be received. + * PARTLY_AVAILABLE: There are or may be incidents in the system, but the set of incidents is probably not up to date. + * This means that big changes are possible. Examples: Upon start-up, some incidents have already been received, + * but there are more incidents to receive. If the user is looking at the map display, new incidents may suddenly appear. + * When a connection is lost, the information stays valid for some time, but the information may no longer be fully up to date, + * and at some point in time a lot of incidents may suddenly disappear because they are no longer valid. + * AVAILABLE: The reception and handling of the incidents is stable, and as up to date as possible with respect to the used protocol(s). + * It is however still possible that there are currently no Traffic Incidents. + * + * @model + * @generated + */ + void trafficIncidentsStatus(TrafficIncidentFeedStatus trafficIncidentFeedStatus, TrafficIncidentsStatus trafficIncidentsStatus); + + /** + * + * + * + * If a client has registered itself as a listener for changes in the Feed Information, + * this method is called upon changes in the Feed Information. + * @param feedsInformation The information per Traffic Incident Feed. + * + * @model feedsInformationMany="true" + * @generated + */ + void feedInformation(EList feedsInformation); + + /** + * + * + * @model categoryIdsMany="true" + * @generated + */ + void reserveCategoryIdsReply(EList categoryIds); + + /** + * + * + * @model iconSetIdsMany="true" + * @generated + */ + void reserveIconSetIdsReply(EList iconSetIds); + + /** + * + * + * @model iconSetsMany="true" + * @generated + */ + void getIconSetsReply(EList iconSets); + + /** + * + * + * @model + * @generated + */ + void addIconSetDefinitionsReply(); + + /** + * + * + * @model + * @generated + */ + void removeIconSetDefinitionsReply(); + + /** + * + * + * @model + * @generated + */ + void removeFeedInformationListenerReply(); + + /** + * + * + * @model + * @generated + */ + void removeTrafficIncidentsStatusListenerReply(); + + /** + * + * + * @model iconDefinitionsMany="true" + * @generated + */ + void getIconDefinitionsReply(EList iconDefinitions); + + /** + * + * + * @model + * @generated + */ + void addIconDefinitionsReply(); + + /** + * + * + * @model + * @generated + */ + void removeIconDefinitionsReply(); + + /** + * + * + * @model categoryDefinitionsMany="true" + * @generated + */ + void getCategoryDefinitionsReply(EList categoryDefinitions); + + /** + * + * + * @model + * @generated + */ + void addCategoryDefinitionsReply(); + + /** + * + * + * @model + * @generated + */ + void removeCategoryDefinitionsReply(); + + /** + * + * + * @model + * @generated + */ + void freeIconSetIdsReply(); + + /** + * + * + * @model + * @generated + */ + void getApplicabilityReply(String filterExpression); + +} // TrafficIncidentsListener diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsStatus.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsStatus.java new file mode 100755 index 0000000..2194c43 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/TrafficIncidentsStatus.java @@ -0,0 +1,241 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Traffic Incidents Status', + * and utility methods for working with them. + * + * + * This type provides information on the status of the Traffic Incidents. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getTrafficIncidentsStatus() + * @model + * @generated + */ +public enum TrafficIncidentsStatus implements Enumerator { + /** + * The 'UNAVAILABLE' literal object. + * + * + * @see #UNAVAILABLE_VALUE + * @generated + * @ordered + */ + UNAVAILABLE(1, "UNAVAILABLE", "UNAVAILABLE"), + + /** + * The 'PARTLY AVAILABLE' literal object. + * + * + * @see #PARTLY_AVAILABLE_VALUE + * @generated + * @ordered + */ + PARTLY_AVAILABLE(2, "PARTLY_AVAILABLE", "PARTLY_AVAILABLE"), + + /** + * The 'AVAILABLE' literal object. + * + * + * @see #AVAILABLE_VALUE + * @generated + * @ordered + */ + AVAILABLE(3, "AVAILABLE", "AVAILABLE"); + + /** + * The 'UNAVAILABLE' literal value. + * + * + * + * There is no Traffic Incident data available. + * + * @see #UNAVAILABLE + * @model + * @generated + * @ordered + */ + public static final int UNAVAILABLE_VALUE = 1; + + /** + * The 'PARTLY AVAILABLE' literal value. + * + * + * + * There is incomplete Traffic Incident data available. This happens e.g. if the Feed status has changed from DISCONNECTED to CONNECTED + * and the system knows that not all information has been received, or if the Feed status goes temporarily from CONNECTED to DISCONNECTED. + * + * @see #PARTLY_AVAILABLE + * @model + * @generated + * @ordered + */ + public static final int PARTLY_AVAILABLE_VALUE = 2; + + /** + * The 'AVAILABLE' literal value. + * + * + * + * There is Traffic Incident data available. + * + * @see #AVAILABLE + * @model + * @generated + * @ordered + */ + public static final int AVAILABLE_VALUE = 3; + + /** + * An array of all the 'Traffic Incidents Status' enumerators. + * + * + * @generated + */ + private static final TrafficIncidentsStatus[] VALUES_ARRAY = + new TrafficIncidentsStatus[] { + UNAVAILABLE, + PARTLY_AVAILABLE, + AVAILABLE, + }; + + /** + * A public read-only list of all the 'Traffic Incidents Status' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Traffic Incidents Status' literal with the specified literal value. + * + * + * @generated + */ + public static TrafficIncidentsStatus get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentsStatus result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incidents Status' literal with the specified name. + * + * + * @generated + */ + public static TrafficIncidentsStatus getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficIncidentsStatus result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Incidents Status' literal with the specified integer value. + * + * + * @generated + */ + public static TrafficIncidentsStatus get(int value) { + switch (value) { + case UNAVAILABLE_VALUE: return UNAVAILABLE; + case PARTLY_AVAILABLE_VALUE: return PARTLY_AVAILABLE; + case AVAILABLE_VALUE: return AVAILABLE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TrafficIncidentsStatus(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TrafficIncidentsStatus diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/WeightUnit.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/WeightUnit.java new file mode 100755 index 0000000..b374d3c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/WeightUnit.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Weight Unit', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#getWeightUnit() + * @model + * @generated + */ +public enum WeightUnit implements Enumerator { + /** + * The 'KILOGRAM' literal object. + * + * + * @see #KILOGRAM_VALUE + * @generated + * @ordered + */ + KILOGRAM(1, "KILOGRAM", "KILOGRAM"), + + /** + * The 'POUND' literal object. + * + * + * @see #POUND_VALUE + * @generated + * @ordered + */ + POUND(2, "POUND", "POUND"); + + /** + * The 'KILOGRAM' literal value. + * + *

+ * If the meaning of 'KILOGRAM' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #KILOGRAM + * @model + * @generated + * @ordered + */ + public static final int KILOGRAM_VALUE = 1; + + /** + * The 'POUND' literal value. + * + *

+ * If the meaning of 'POUND' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #POUND + * @model + * @generated + * @ordered + */ + public static final int POUND_VALUE = 2; + + /** + * An array of all the 'Weight Unit' enumerators. + * + * + * @generated + */ + private static final WeightUnit[] VALUES_ARRAY = + new WeightUnit[] { + KILOGRAM, + POUND, + }; + + /** + * A public read-only list of all the 'Weight Unit' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Weight Unit' literal with the specified literal value. + * + * + * @generated + */ + public static WeightUnit get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WeightUnit result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Weight Unit' literal with the specified name. + * + * + * @generated + */ + public static WeightUnit getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WeightUnit result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Weight Unit' literal with the specified integer value. + * + * + * @generated + */ + public static WeightUnit get(int value) { + switch (value) { + case KILOGRAM_VALUE: return KILOGRAM; + case POUND_VALUE: return POUND; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private WeightUnit(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //WeightUnit diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/CategoryDefinitionImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/CategoryDefinitionImpl.java new file mode 100755 index 0000000..d559b9c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/CategoryDefinitionImpl.java @@ -0,0 +1,464 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import java.util.Collection; + +import org.eclipse.emf.common.notify.Notification; +import org.eclipse.emf.common.notify.NotificationChain; +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.InternalEObject; +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EObjectContainmentEList; +import org.eclipse.emf.ecore.util.InternalEList; +import org.genivi.common.LocalizedString; +import org.genivi.iconset.IconInfo; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * An implementation of the model object 'Category Definition'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl#getLocalizedNamesList Localized Names}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl#getCategoryId Category Id}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl#getIconsList Icons}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl#getExpression Expression}
  • + *
+ *

+ * + * @generated + */ +public class CategoryDefinitionImpl extends EObjectImpl implements CategoryDefinition { + /** + * The cached value of the '{@link #getLocalizedNamesList() Localized Names}' containment reference list. + * + * + * @see #getLocalizedNamesList() + * @generated + * @ordered + */ + protected EList localizedNames; + + /** + * The empty value for the '{@link #getLocalizedNames() Localized Names}' array accessor. + * + * + * @see #getLocalizedNames() + * @generated + * @ordered + */ + protected static final LocalizedString[] LOCALIZED_NAMES_EEMPTY_ARRAY = new LocalizedString [0]; + + /** + * The default value of the '{@link #getCategoryId() Category Id}' attribute. + * + * + * @see #getCategoryId() + * @generated + * @ordered + */ + protected static final int CATEGORY_ID_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getCategoryId() Category Id}' attribute. + * + * + * @see #getCategoryId() + * @generated + * @ordered + */ + protected int categoryId = CATEGORY_ID_EDEFAULT; + + /** + * The cached value of the '{@link #getIconsList() Icons}' containment reference list. + * + * + * @see #getIconsList() + * @generated + * @ordered + */ + protected EList icons; + + /** + * The empty value for the '{@link #getIcons() Icons}' array accessor. + * + * + * @see #getIcons() + * @generated + * @ordered + */ + protected static final IconInfo[] ICONS_EEMPTY_ARRAY = new IconInfo [0]; + + /** + * The default value of the '{@link #getExpression() Expression}' attribute. + * + * + * @see #getExpression() + * @generated + * @ordered + */ + protected static final String EXPRESSION_EDEFAULT = null; + + /** + * The cached value of the '{@link #getExpression() Expression}' attribute. + * + * + * @see #getExpression() + * @generated + * @ordered + */ + protected String expression = EXPRESSION_EDEFAULT; + + /** + * This is true if the Expression attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean expressionESet; + + /** + * + * + * @generated + */ + protected CategoryDefinitionImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.CATEGORY_DEFINITION; + } + + /** + * + * + * @generated + */ + public LocalizedString[] getLocalizedNames() { + if (localizedNames == null || localizedNames.isEmpty()) return LOCALIZED_NAMES_EEMPTY_ARRAY; + BasicEList list = (BasicEList)localizedNames; + list.shrink(); + return (LocalizedString[])list.data(); + } + + /** + * + * + * @generated + */ + public LocalizedString getLocalizedNames(int index) { + return getLocalizedNamesList().get(index); + } + + /** + * + * + * @generated + */ + public int getLocalizedNamesLength() { + return localizedNames == null ? 0 : localizedNames.size(); + } + + /** + * + * + * @generated + */ + public void setLocalizedNames(LocalizedString[] newLocalizedNames) { + ((BasicEList)getLocalizedNamesList()).setData(newLocalizedNames.length, newLocalizedNames); + } + + /** + * + * + * @generated + */ + public void setLocalizedNames(int index, LocalizedString element) { + getLocalizedNamesList().set(index, element); + } + + /** + * + * + * @generated + */ + public EList getLocalizedNamesList() { + if (localizedNames == null) { + localizedNames = new EObjectContainmentEList(LocalizedString.class, this, trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES); + } + return localizedNames; + } + + /** + * + * + * @generated + */ + public int getCategoryId() { + return categoryId; + } + + /** + * + * + * @generated + */ + public void setCategoryId(int newCategoryId) { + int oldCategoryId = categoryId; + categoryId = newCategoryId; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.CATEGORY_DEFINITION__CATEGORY_ID, oldCategoryId, categoryId)); + } + + /** + * + * + * @generated + */ + public IconInfo[] getIcons() { + if (icons == null || icons.isEmpty()) return ICONS_EEMPTY_ARRAY; + BasicEList list = (BasicEList)icons; + list.shrink(); + return (IconInfo[])list.data(); + } + + /** + * + * + * @generated + */ + public IconInfo getIcons(int index) { + return getIconsList().get(index); + } + + /** + * + * + * @generated + */ + public int getIconsLength() { + return icons == null ? 0 : icons.size(); + } + + /** + * + * + * @generated + */ + public void setIcons(IconInfo[] newIcons) { + ((BasicEList)getIconsList()).setData(newIcons.length, newIcons); + } + + /** + * + * + * @generated + */ + public void setIcons(int index, IconInfo element) { + getIconsList().set(index, element); + } + + /** + * + * + * @generated + */ + public EList getIconsList() { + if (icons == null) { + icons = new EObjectContainmentEList(IconInfo.class, this, trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS); + } + return icons; + } + + /** + * + * + * @generated + */ + public String getExpression() { + return expression; + } + + /** + * + * + * @generated + */ + public void setExpression(String newExpression) { + String oldExpression = expression; + expression = newExpression; + boolean oldExpressionESet = expressionESet; + expressionESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION, oldExpression, expression, !oldExpressionESet)); + } + + /** + * + * + * @generated + */ + public void unsetExpression() { + String oldExpression = expression; + boolean oldExpressionESet = expressionESet; + expression = EXPRESSION_EDEFAULT; + expressionESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION, oldExpression, EXPRESSION_EDEFAULT, oldExpressionESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetExpression() { + return expressionESet; + } + + /** + * + * + * @generated + */ + @Override + public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { + switch (featureID) { + case trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES: + return ((InternalEList)getLocalizedNamesList()).basicRemove(otherEnd, msgs); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS: + return ((InternalEList)getIconsList()).basicRemove(otherEnd, msgs); + } + return super.eInverseRemove(otherEnd, featureID, msgs); + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES: + return getLocalizedNamesList(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__CATEGORY_ID: + return getCategoryId(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS: + return getIconsList(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION: + return getExpression(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @SuppressWarnings("unchecked") + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES: + getLocalizedNamesList().clear(); + getLocalizedNamesList().addAll((Collection)newValue); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__CATEGORY_ID: + setCategoryId((Integer)newValue); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS: + getIconsList().clear(); + getIconsList().addAll((Collection)newValue); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION: + setExpression((String)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES: + getLocalizedNamesList().clear(); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__CATEGORY_ID: + setCategoryId(CATEGORY_ID_EDEFAULT); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS: + getIconsList().clear(); + return; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION: + unsetExpression(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentsservicePackage.CATEGORY_DEFINITION__LOCALIZED_NAMES: + return localizedNames != null && !localizedNames.isEmpty(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__CATEGORY_ID: + return categoryId != CATEGORY_ID_EDEFAULT; + case trafficincidentsservicePackage.CATEGORY_DEFINITION__ICONS: + return icons != null && !icons.isEmpty(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION__EXPRESSION: + return isSetExpression(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (categoryId: "); + result.append(categoryId); + result.append(", expression: "); + if (expressionESet) result.append(expression); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //CategoryDefinitionImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/FeedInformationImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/FeedInformationImpl.java new file mode 100755 index 0000000..3f0a236 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/FeedInformationImpl.java @@ -0,0 +1,556 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.common.notify.Notification; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.ENotificationImpl; +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * An implementation of the model object 'Feed Information'. + * + *

+ * The following features are implemented: + *

    + *
  • {@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl#getDataProviderName Data Provider Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl#getProtocolName Protocol Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl#getCommunicationChannelName Communication Channel Name}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl#getFeedStatus Feed Status}
  • + *
  • {@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl#getTrafficIncidentsStatus Traffic Incidents Status}
  • + *
+ *

+ * + * @generated + */ +public class FeedInformationImpl extends EObjectImpl implements FeedInformation { + /** + * The default value of the '{@link #getDataProviderName() Data Provider Name}' attribute. + * + * + * @see #getDataProviderName() + * @generated + * @ordered + */ + protected static final String DATA_PROVIDER_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getDataProviderName() Data Provider Name}' attribute. + * + * + * @see #getDataProviderName() + * @generated + * @ordered + */ + protected String dataProviderName = DATA_PROVIDER_NAME_EDEFAULT; + + /** + * This is true if the Data Provider Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean dataProviderNameESet; + + /** + * The default value of the '{@link #getProtocolName() Protocol Name}' attribute. + * + * + * @see #getProtocolName() + * @generated + * @ordered + */ + protected static final String PROTOCOL_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getProtocolName() Protocol Name}' attribute. + * + * + * @see #getProtocolName() + * @generated + * @ordered + */ + protected String protocolName = PROTOCOL_NAME_EDEFAULT; + + /** + * This is true if the Protocol Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean protocolNameESet; + + /** + * The default value of the '{@link #getCommunicationChannelName() Communication Channel Name}' attribute. + * + * + * @see #getCommunicationChannelName() + * @generated + * @ordered + */ + protected static final String COMMUNICATION_CHANNEL_NAME_EDEFAULT = null; + + /** + * The cached value of the '{@link #getCommunicationChannelName() Communication Channel Name}' attribute. + * + * + * @see #getCommunicationChannelName() + * @generated + * @ordered + */ + protected String communicationChannelName = COMMUNICATION_CHANNEL_NAME_EDEFAULT; + + /** + * This is true if the Communication Channel Name attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean communicationChannelNameESet; + + /** + * The default value of the '{@link #getFeedStatus() Feed Status}' attribute. + * + * + * @see #getFeedStatus() + * @generated + * @ordered + */ + protected static final TrafficIncidentFeedStatus FEED_STATUS_EDEFAULT = TrafficIncidentFeedStatus.UNAVAILABLE; + + /** + * The cached value of the '{@link #getFeedStatus() Feed Status}' attribute. + * + * + * @see #getFeedStatus() + * @generated + * @ordered + */ + protected TrafficIncidentFeedStatus feedStatus = FEED_STATUS_EDEFAULT; + + /** + * This is true if the Feed Status attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean feedStatusESet; + + /** + * The default value of the '{@link #getTrafficIncidentsStatus() Traffic Incidents Status}' attribute. + * + * + * @see #getTrafficIncidentsStatus() + * @generated + * @ordered + */ + protected static final TrafficIncidentsStatus TRAFFIC_INCIDENTS_STATUS_EDEFAULT = TrafficIncidentsStatus.UNAVAILABLE; + + /** + * The cached value of the '{@link #getTrafficIncidentsStatus() Traffic Incidents Status}' attribute. + * + * + * @see #getTrafficIncidentsStatus() + * @generated + * @ordered + */ + protected TrafficIncidentsStatus trafficIncidentsStatus = TRAFFIC_INCIDENTS_STATUS_EDEFAULT; + + /** + * This is true if the Traffic Incidents Status attribute has been set. + * + * + * @generated + * @ordered + */ + protected boolean trafficIncidentsStatusESet; + + /** + * + * + * @generated + */ + protected FeedInformationImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.FEED_INFORMATION; + } + + /** + * + * + * @generated + */ + public String getDataProviderName() { + return dataProviderName; + } + + /** + * + * + * @generated + */ + public void setDataProviderName(String newDataProviderName) { + String oldDataProviderName = dataProviderName; + dataProviderName = newDataProviderName; + boolean oldDataProviderNameESet = dataProviderNameESet; + dataProviderNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME, oldDataProviderName, dataProviderName, !oldDataProviderNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetDataProviderName() { + String oldDataProviderName = dataProviderName; + boolean oldDataProviderNameESet = dataProviderNameESet; + dataProviderName = DATA_PROVIDER_NAME_EDEFAULT; + dataProviderNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME, oldDataProviderName, DATA_PROVIDER_NAME_EDEFAULT, oldDataProviderNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetDataProviderName() { + return dataProviderNameESet; + } + + /** + * + * + * @generated + */ + public String getProtocolName() { + return protocolName; + } + + /** + * + * + * @generated + */ + public void setProtocolName(String newProtocolName) { + String oldProtocolName = protocolName; + protocolName = newProtocolName; + boolean oldProtocolNameESet = protocolNameESet; + protocolNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME, oldProtocolName, protocolName, !oldProtocolNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetProtocolName() { + String oldProtocolName = protocolName; + boolean oldProtocolNameESet = protocolNameESet; + protocolName = PROTOCOL_NAME_EDEFAULT; + protocolNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME, oldProtocolName, PROTOCOL_NAME_EDEFAULT, oldProtocolNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetProtocolName() { + return protocolNameESet; + } + + /** + * + * + * @generated + */ + public String getCommunicationChannelName() { + return communicationChannelName; + } + + /** + * + * + * @generated + */ + public void setCommunicationChannelName(String newCommunicationChannelName) { + String oldCommunicationChannelName = communicationChannelName; + communicationChannelName = newCommunicationChannelName; + boolean oldCommunicationChannelNameESet = communicationChannelNameESet; + communicationChannelNameESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME, oldCommunicationChannelName, communicationChannelName, !oldCommunicationChannelNameESet)); + } + + /** + * + * + * @generated + */ + public void unsetCommunicationChannelName() { + String oldCommunicationChannelName = communicationChannelName; + boolean oldCommunicationChannelNameESet = communicationChannelNameESet; + communicationChannelName = COMMUNICATION_CHANNEL_NAME_EDEFAULT; + communicationChannelNameESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME, oldCommunicationChannelName, COMMUNICATION_CHANNEL_NAME_EDEFAULT, oldCommunicationChannelNameESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetCommunicationChannelName() { + return communicationChannelNameESet; + } + + /** + * + * + * @generated + */ + public TrafficIncidentFeedStatus getFeedStatus() { + return feedStatus; + } + + /** + * + * + * @generated + */ + public void setFeedStatus(TrafficIncidentFeedStatus newFeedStatus) { + TrafficIncidentFeedStatus oldFeedStatus = feedStatus; + feedStatus = newFeedStatus == null ? FEED_STATUS_EDEFAULT : newFeedStatus; + boolean oldFeedStatusESet = feedStatusESet; + feedStatusESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS, oldFeedStatus, feedStatus, !oldFeedStatusESet)); + } + + /** + * + * + * @generated + */ + public void unsetFeedStatus() { + TrafficIncidentFeedStatus oldFeedStatus = feedStatus; + boolean oldFeedStatusESet = feedStatusESet; + feedStatus = FEED_STATUS_EDEFAULT; + feedStatusESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS, oldFeedStatus, FEED_STATUS_EDEFAULT, oldFeedStatusESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetFeedStatus() { + return feedStatusESet; + } + + /** + * + * + * @generated + */ + public TrafficIncidentsStatus getTrafficIncidentsStatus() { + return trafficIncidentsStatus; + } + + /** + * + * + * @generated + */ + public void setTrafficIncidentsStatus(TrafficIncidentsStatus newTrafficIncidentsStatus) { + TrafficIncidentsStatus oldTrafficIncidentsStatus = trafficIncidentsStatus; + trafficIncidentsStatus = newTrafficIncidentsStatus == null ? TRAFFIC_INCIDENTS_STATUS_EDEFAULT : newTrafficIncidentsStatus; + boolean oldTrafficIncidentsStatusESet = trafficIncidentsStatusESet; + trafficIncidentsStatusESet = true; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS, oldTrafficIncidentsStatus, trafficIncidentsStatus, !oldTrafficIncidentsStatusESet)); + } + + /** + * + * + * @generated + */ + public void unsetTrafficIncidentsStatus() { + TrafficIncidentsStatus oldTrafficIncidentsStatus = trafficIncidentsStatus; + boolean oldTrafficIncidentsStatusESet = trafficIncidentsStatusESet; + trafficIncidentsStatus = TRAFFIC_INCIDENTS_STATUS_EDEFAULT; + trafficIncidentsStatusESet = false; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.UNSET, trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS, oldTrafficIncidentsStatus, TRAFFIC_INCIDENTS_STATUS_EDEFAULT, oldTrafficIncidentsStatusESet)); + } + + /** + * + * + * @generated + */ + public boolean isSetTrafficIncidentsStatus() { + return trafficIncidentsStatusESet; + } + + /** + * + * + * @generated + */ + @Override + public Object eGet(int featureID, boolean resolve, boolean coreType) { + switch (featureID) { + case trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME: + return getDataProviderName(); + case trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME: + return getProtocolName(); + case trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME: + return getCommunicationChannelName(); + case trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS: + return getFeedStatus(); + case trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS: + return getTrafficIncidentsStatus(); + } + return super.eGet(featureID, resolve, coreType); + } + + /** + * + * + * @generated + */ + @Override + public void eSet(int featureID, Object newValue) { + switch (featureID) { + case trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME: + setDataProviderName((String)newValue); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME: + setProtocolName((String)newValue); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME: + setCommunicationChannelName((String)newValue); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS: + setFeedStatus((TrafficIncidentFeedStatus)newValue); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS: + setTrafficIncidentsStatus((TrafficIncidentsStatus)newValue); + return; + } + super.eSet(featureID, newValue); + } + + /** + * + * + * @generated + */ + @Override + public void eUnset(int featureID) { + switch (featureID) { + case trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME: + unsetDataProviderName(); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME: + unsetProtocolName(); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME: + unsetCommunicationChannelName(); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS: + unsetFeedStatus(); + return; + case trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS: + unsetTrafficIncidentsStatus(); + return; + } + super.eUnset(featureID); + } + + /** + * + * + * @generated + */ + @Override + public boolean eIsSet(int featureID) { + switch (featureID) { + case trafficincidentsservicePackage.FEED_INFORMATION__DATA_PROVIDER_NAME: + return isSetDataProviderName(); + case trafficincidentsservicePackage.FEED_INFORMATION__PROTOCOL_NAME: + return isSetProtocolName(); + case trafficincidentsservicePackage.FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME: + return isSetCommunicationChannelName(); + case trafficincidentsservicePackage.FEED_INFORMATION__FEED_STATUS: + return isSetFeedStatus(); + case trafficincidentsservicePackage.FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS: + return isSetTrafficIncidentsStatus(); + } + return super.eIsSet(featureID); + } + + /** + * + * + * @generated + */ + @Override + public String toString() { + if (eIsProxy()) return super.toString(); + + StringBuffer result = new StringBuffer(super.toString()); + result.append(" (dataProviderName: "); + if (dataProviderNameESet) result.append(dataProviderName); else result.append(""); + result.append(", protocolName: "); + if (protocolNameESet) result.append(protocolName); else result.append(""); + result.append(", communicationChannelName: "); + if (communicationChannelNameESet) result.append(communicationChannelName); else result.append(""); + result.append(", feedStatus: "); + if (feedStatusESet) result.append(feedStatus); else result.append(""); + result.append(", trafficIncidentsStatus: "); + if (trafficIncidentsStatusESet) result.append(trafficIncidentsStatus); else result.append(""); + result.append(')'); + return result.toString(); + } + +} //FeedInformationImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedImpl.java new file mode 100755 index 0000000..6c76144 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedImpl.java @@ -0,0 +1,141 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident; + + +/** + * + * An implementation of the model object 'Traffic Incident Feed'. + * + *

+ *

+ * + * @generated + */ +public class TrafficIncidentFeedImpl extends EObjectImpl implements TrafficIncidentFeed { + /** + * + * + * @generated + */ + protected TrafficIncidentFeedImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.TRAFFIC_INCIDENT_FEED; + } + + /** + * + * + * @generated + */ + public void getVersion(TrafficIncidentFeedListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguage(TrafficIncidentFeedListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addLanguageListener(TrafficIncidentFeedListener listener, TrafficIncidentFeedListener changeListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void clear() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void updateIncidents(int feedId, EList cancelledIncidentIds, EList updatedIncidents) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void updateStatus(int feedId, TrafficIncidentFeedStatus feedStatus, TrafficIncidentsStatus incidentsStatus) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void registerFeed(TrafficIncidentFeedListener listener, String dataProviderName, String protocolName, String communicationChannelName) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeLanguageListener(TrafficIncidentFeedListener listener, TrafficIncidentFeedListener changeListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //TrafficIncidentFeedImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedListenerImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedListenerImpl.java new file mode 100755 index 0000000..4f489f0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentFeedListenerImpl.java @@ -0,0 +1,103 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.Version; + +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * An implementation of the model object 'Traffic Incident Feed Listener'. + * + *

+ *

+ * + * @generated + */ +public class TrafficIncidentFeedListenerImpl extends EObjectImpl implements TrafficIncidentFeedListener { + /** + * + * + * @generated + */ + protected TrafficIncidentFeedListenerImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.TRAFFIC_INCIDENT_FEED_LISTENER; + } + + /** + * + * + * @generated + */ + public void getVersionReply(Version version) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguageReply(String languageCode, String countryCode) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void registerFeedReply(int feedId) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addLanguageListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeLanguageListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //TrafficIncidentFeedListenerImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsImpl.java new file mode 100755 index 0000000..cca9229 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsImpl.java @@ -0,0 +1,441 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.common.RectangularArea; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +/** + * + * An implementation of the model object 'Traffic Incidents'. + * + *

+ *

+ * + * @generated + */ +public class TrafficIncidentsImpl extends EObjectImpl implements TrafficIncidents { + /** + * + * + * @generated + */ + protected TrafficIncidentsImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.TRAFFIC_INCIDENTS; + } + + /** + * + * + * @generated + */ + public void getVersion(TrafficIncidentsListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentIds(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentIdsInAreas(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, EList areas) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidents(TrafficIncidentsListener listener, EList trafficIncidentIds, boolean includeTextFields) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentsFields(TrafficIncidentsListener listener, EList trafficIncidentIds, EList trafficIncidentFields) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTexts(TrafficIncidentsListener listener, EList trafficIncidentIds, TextDetailLevel textDetailLevel) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeAreasUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeTrafficIncidentsStatusListener(TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addUpdateListener(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, TrafficIncidentsListener updateListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addAreasUpdateListener(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds, EList areas, TrafficIncidentsListener updateListener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguage(TrafficIncidentsListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setLanguage(TrafficIncidentsListener listener, String languageCode, String countryCode) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setTimeFormat(TrafficIncidentsListener listener, String timeFormat) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setDateFormat(TrafficIncidentsListener listener, String dateFormat) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setLengthUnit(TrafficIncidentsListener listener, LengthUnit lengthUnit) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setWeightUnit(TrafficIncidentsListener listener, WeightUnit weightUnit) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void reserveIconSetIds(TrafficIncidentsListener listener, int numberOfIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void freeIconSetIds(TrafficIncidentsListener listener, EList iconSetIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getIconSets(TrafficIncidentsListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addIconSetDefinitions(TrafficIncidentsListener listener, EList iconSets) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeIconSetDefinitions(TrafficIncidentsListener listener, EList iconSetIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addIconDefinitions(TrafficIncidentsListener listener, EList iconDefinitions) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void reserveCategoryIds(TrafficIncidentsListener listener, int numberOfIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void freeCategoryIds(TrafficIncidentsListener listener, EList categoryIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getCategoryDefinitions(TrafficIncidentsListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addCategoryDefinitions(TrafficIncidentsListener listener, EList categoryDefinitions) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeCategoryDefinitions(TrafficIncidentsListener listener, EList categoryIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getApplicability(TrafficIncidentsListener listener) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setApplicability(TrafficIncidentsListener listener, String filterExpression) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //TrafficIncidentsImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsListenerImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsListenerImpl.java new file mode 100755 index 0000000..94f0fb2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/TrafficIncidentsListenerImpl.java @@ -0,0 +1,488 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.common.util.EList; + +import org.eclipse.emf.ecore.EClass; + +import org.eclipse.emf.ecore.impl.EObjectImpl; + +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; + +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + + +/** + * + * An implementation of the model object 'Traffic Incidents Listener'. + * + *

+ *

+ * + * @generated + */ +public class TrafficIncidentsListenerImpl extends EObjectImpl implements TrafficIncidentsListener { + /** + * + * + * @generated + */ + protected TrafficIncidentsListenerImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + protected EClass eStaticClass() { + return trafficincidentsservicePackage.Literals.TRAFFIC_INCIDENTS_LISTENER; + } + + /** + * + * + * @generated + */ + public void getVersionReply(Version version) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentIdsReply(EList trafficIncidentIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentIdsInAreasReply(EList trafficIncidentIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentsReply(EList trafficIncidents) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTrafficIncidentsFieldsReply(EList trafficIncidents) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getTextsReply(EList texts) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addTrafficIncidentsStatusListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addFeedInformationListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addUpdateListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeUpdateListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addAreasUpdateListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeAreasUpdateListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setLanguageReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setTimeFormatReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setDateFormatReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setLengthUnitReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setWeightUnitReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void setApplicabilityReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void freeCategoryIdsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void updates(EList unchangedTrafficIncidentIds, EList changedTrafficIncidentIds, EList newTrafficIncidentIds, EList deletedTrafficIncidentIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void updatesInAreas(EList areas) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getLanguageReply(String languageCode, String countryCode) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void trafficIncidentsStatus(TrafficIncidentFeedStatus trafficIncidentFeedStatus, TrafficIncidentsStatus trafficIncidentsStatus) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void feedInformation(EList feedsInformation) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void reserveCategoryIdsReply(EList categoryIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void reserveIconSetIdsReply(EList iconSetIds) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getIconSetsReply(EList iconSets) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addIconSetDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeIconSetDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeFeedInformationListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeTrafficIncidentsStatusListenerReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getIconDefinitionsReply(EList iconDefinitions) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addIconDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeIconDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getCategoryDefinitionsReply(EList categoryDefinitions) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void addCategoryDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void removeCategoryDefinitionsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void freeIconSetIdsReply() { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + + /** + * + * + * @generated + */ + public void getApplicabilityReply(String filterExpression) { + // TODO: implement this method + // Ensure that you remove @generated or mark it @generated NOT + throw new UnsupportedOperationException(); + } + +} //TrafficIncidentsListenerImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsserviceFactoryImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsserviceFactoryImpl.java new file mode 100755 index 0000000..46d5a9b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsserviceFactoryImpl.java @@ -0,0 +1,362 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.impl.EFactoryImpl; +import org.eclipse.emf.ecore.plugin.EcorePlugin; +import org.genivi.trafficincidentsservice.*; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.SpeedUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidentsserviceFactory; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class trafficincidentsserviceFactoryImpl extends EFactoryImpl implements trafficincidentsserviceFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static trafficincidentsserviceFactory init() { + try { + trafficincidentsserviceFactory thetrafficincidentsserviceFactory = (trafficincidentsserviceFactory)EPackage.Registry.INSTANCE.getEFactory(trafficincidentsservicePackage.eNS_URI); + if (thetrafficincidentsserviceFactory != null) { + return thetrafficincidentsserviceFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new trafficincidentsserviceFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public trafficincidentsserviceFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS: return createTrafficIncidents(); + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS_LISTENER: return createTrafficIncidentsListener(); + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED: return createTrafficIncidentFeed(); + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED_LISTENER: return createTrafficIncidentFeedListener(); + case trafficincidentsservicePackage.FEED_INFORMATION: return createFeedInformation(); + case trafficincidentsservicePackage.CATEGORY_DEFINITION: return createCategoryDefinition(); + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FIELD: + return createTrafficIncidentFieldFromString(eDataType, initialValue); + case trafficincidentsservicePackage.TEXT_DETAIL_LEVEL: + return createTextDetailLevelFromString(eDataType, initialValue); + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED_STATUS: + return createTrafficIncidentFeedStatusFromString(eDataType, initialValue); + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS_STATUS: + return createTrafficIncidentsStatusFromString(eDataType, initialValue); + case trafficincidentsservicePackage.SPEED_UNIT: + return createSpeedUnitFromString(eDataType, initialValue); + case trafficincidentsservicePackage.LENGTH_UNIT: + return createLengthUnitFromString(eDataType, initialValue); + case trafficincidentsservicePackage.WEIGHT_UNIT: + return createWeightUnitFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FIELD: + return convertTrafficIncidentFieldToString(eDataType, instanceValue); + case trafficincidentsservicePackage.TEXT_DETAIL_LEVEL: + return convertTextDetailLevelToString(eDataType, instanceValue); + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED_STATUS: + return convertTrafficIncidentFeedStatusToString(eDataType, instanceValue); + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS_STATUS: + return convertTrafficIncidentsStatusToString(eDataType, instanceValue); + case trafficincidentsservicePackage.SPEED_UNIT: + return convertSpeedUnitToString(eDataType, instanceValue); + case trafficincidentsservicePackage.LENGTH_UNIT: + return convertLengthUnitToString(eDataType, instanceValue); + case trafficincidentsservicePackage.WEIGHT_UNIT: + return convertWeightUnitToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public TrafficIncidents createTrafficIncidents() { + TrafficIncidentsImpl trafficIncidents = new TrafficIncidentsImpl(); + return trafficIncidents; + } + + /** + * + * + * @generated + */ + public TrafficIncidentsListener createTrafficIncidentsListener() { + TrafficIncidentsListenerImpl trafficIncidentsListener = new TrafficIncidentsListenerImpl(); + return trafficIncidentsListener; + } + + /** + * + * + * @generated + */ + public TrafficIncidentFeed createTrafficIncidentFeed() { + TrafficIncidentFeedImpl trafficIncidentFeed = new TrafficIncidentFeedImpl(); + return trafficIncidentFeed; + } + + /** + * + * + * @generated + */ + public TrafficIncidentFeedListener createTrafficIncidentFeedListener() { + TrafficIncidentFeedListenerImpl trafficIncidentFeedListener = new TrafficIncidentFeedListenerImpl(); + return trafficIncidentFeedListener; + } + + /** + * + * + * @generated + */ + public FeedInformation createFeedInformation() { + FeedInformationImpl feedInformation = new FeedInformationImpl(); + return feedInformation; + } + + /** + * + * + * @generated + */ + public CategoryDefinition createCategoryDefinition() { + CategoryDefinitionImpl categoryDefinition = new CategoryDefinitionImpl(); + return categoryDefinition; + } + + /** + * + * + * @generated + */ + public TrafficIncidentField createTrafficIncidentFieldFromString(EDataType eDataType, String initialValue) { + TrafficIncidentField result = TrafficIncidentField.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTrafficIncidentFieldToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public TextDetailLevel createTextDetailLevelFromString(EDataType eDataType, String initialValue) { + TextDetailLevel result = TextDetailLevel.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTextDetailLevelToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public TrafficIncidentFeedStatus createTrafficIncidentFeedStatusFromString(EDataType eDataType, String initialValue) { + TrafficIncidentFeedStatus result = TrafficIncidentFeedStatus.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTrafficIncidentFeedStatusToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public TrafficIncidentsStatus createTrafficIncidentsStatusFromString(EDataType eDataType, String initialValue) { + TrafficIncidentsStatus result = TrafficIncidentsStatus.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTrafficIncidentsStatusToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public SpeedUnit createSpeedUnitFromString(EDataType eDataType, String initialValue) { + SpeedUnit result = SpeedUnit.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertSpeedUnitToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public LengthUnit createLengthUnitFromString(EDataType eDataType, String initialValue) { + LengthUnit result = LengthUnit.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertLengthUnitToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public WeightUnit createWeightUnitFromString(EDataType eDataType, String initialValue) { + WeightUnit result = WeightUnit.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertWeightUnitToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public trafficincidentsservicePackage gettrafficincidentsservicePackage() { + return (trafficincidentsservicePackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static trafficincidentsservicePackage getPackage() { + return trafficincidentsservicePackage.eINSTANCE; + } + +} //trafficincidentsserviceFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsservicePackageImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsservicePackageImpl.java new file mode 100755 index 0000000..fd65632 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/impl/trafficincidentsservicePackageImpl.java @@ -0,0 +1,903 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.impl; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EOperation; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; +import org.eclipse.emf.ecore.impl.EPackageImpl; +import org.genivi.common.CommonPackage; +import org.genivi.iconset.IconsetPackage; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.SpeedUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidentsserviceFactory; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; +import org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.XTrafficIncidentPackage; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class trafficincidentsservicePackageImpl extends EPackageImpl implements trafficincidentsservicePackage { + /** + * + * + * @generated + */ + private EClass trafficIncidentsEClass = null; + + /** + * + * + * @generated + */ + private EClass trafficIncidentsListenerEClass = null; + + /** + * + * + * @generated + */ + private EClass trafficIncidentFeedEClass = null; + + /** + * + * + * @generated + */ + private EClass trafficIncidentFeedListenerEClass = null; + + /** + * + * + * @generated + */ + private EClass feedInformationEClass = null; + + /** + * + * + * @generated + */ + private EClass categoryDefinitionEClass = null; + + /** + * + * + * @generated + */ + private EEnum trafficIncidentFieldEEnum = null; + + /** + * + * + * @generated + */ + private EEnum textDetailLevelEEnum = null; + + /** + * + * + * @generated + */ + private EEnum trafficIncidentFeedStatusEEnum = null; + + /** + * + * + * @generated + */ + private EEnum trafficIncidentsStatusEEnum = null; + + /** + * + * + * @generated + */ + private EEnum speedUnitEEnum = null; + + /** + * + * + * @generated + */ + private EEnum lengthUnitEEnum = null; + + /** + * + * + * @generated + */ + private EEnum weightUnitEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage#eNS_URI + * @see #init() + * @generated + */ + private trafficincidentsservicePackageImpl() { + super(eNS_URI, trafficincidentsserviceFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link trafficincidentsservicePackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static trafficincidentsservicePackage init() { + if (isInited) return (trafficincidentsservicePackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidentsservicePackage.eNS_URI); + + // Obtain or create and register package + trafficincidentsservicePackageImpl thetrafficincidentsservicePackage = (trafficincidentsservicePackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof trafficincidentsservicePackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new trafficincidentsservicePackageImpl()); + + isInited = true; + + // Initialize simple dependencies + IconsetPackage.eINSTANCE.eClass(); + trafficincidentPackage.eINSTANCE.eClass(); + XTrafficIncidentPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thetrafficincidentsservicePackage.createPackageContents(); + + // Initialize created meta-data + thetrafficincidentsservicePackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thetrafficincidentsservicePackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(trafficincidentsservicePackage.eNS_URI, thetrafficincidentsservicePackage); + return thetrafficincidentsservicePackage; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncidents() { + return trafficIncidentsEClass; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncidentsListener() { + return trafficIncidentsListenerEClass; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncidentFeed() { + return trafficIncidentFeedEClass; + } + + /** + * + * + * @generated + */ + public EClass getTrafficIncidentFeedListener() { + return trafficIncidentFeedListenerEClass; + } + + /** + * + * + * @generated + */ + public EClass getFeedInformation() { + return feedInformationEClass; + } + + /** + * + * + * @generated + */ + public EAttribute getFeedInformation_DataProviderName() { + return (EAttribute)feedInformationEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getFeedInformation_ProtocolName() { + return (EAttribute)feedInformationEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EAttribute getFeedInformation_CommunicationChannelName() { + return (EAttribute)feedInformationEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getFeedInformation_FeedStatus() { + return (EAttribute)feedInformationEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EAttribute getFeedInformation_TrafficIncidentsStatus() { + return (EAttribute)feedInformationEClass.getEStructuralFeatures().get(4); + } + + /** + * + * + * @generated + */ + public EClass getCategoryDefinition() { + return categoryDefinitionEClass; + } + + /** + * + * + * @generated + */ + public EReference getCategoryDefinition_LocalizedNames() { + return (EReference)categoryDefinitionEClass.getEStructuralFeatures().get(0); + } + + /** + * + * + * @generated + */ + public EAttribute getCategoryDefinition_CategoryId() { + return (EAttribute)categoryDefinitionEClass.getEStructuralFeatures().get(1); + } + + /** + * + * + * @generated + */ + public EReference getCategoryDefinition_Icons() { + return (EReference)categoryDefinitionEClass.getEStructuralFeatures().get(2); + } + + /** + * + * + * @generated + */ + public EAttribute getCategoryDefinition_Expression() { + return (EAttribute)categoryDefinitionEClass.getEStructuralFeatures().get(3); + } + + /** + * + * + * @generated + */ + public EEnum getTrafficIncidentField() { + return trafficIncidentFieldEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTextDetailLevel() { + return textDetailLevelEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTrafficIncidentFeedStatus() { + return trafficIncidentFeedStatusEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTrafficIncidentsStatus() { + return trafficIncidentsStatusEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getSpeedUnit() { + return speedUnitEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getLengthUnit() { + return lengthUnitEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getWeightUnit() { + return weightUnitEEnum; + } + + /** + * + * + * @generated + */ + public trafficincidentsserviceFactory gettrafficincidentsserviceFactory() { + return (trafficincidentsserviceFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create classes and their features + trafficIncidentsEClass = createEClass(TRAFFIC_INCIDENTS); + + trafficIncidentsListenerEClass = createEClass(TRAFFIC_INCIDENTS_LISTENER); + + trafficIncidentFeedEClass = createEClass(TRAFFIC_INCIDENT_FEED); + + trafficIncidentFeedListenerEClass = createEClass(TRAFFIC_INCIDENT_FEED_LISTENER); + + feedInformationEClass = createEClass(FEED_INFORMATION); + createEAttribute(feedInformationEClass, FEED_INFORMATION__DATA_PROVIDER_NAME); + createEAttribute(feedInformationEClass, FEED_INFORMATION__PROTOCOL_NAME); + createEAttribute(feedInformationEClass, FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME); + createEAttribute(feedInformationEClass, FEED_INFORMATION__FEED_STATUS); + createEAttribute(feedInformationEClass, FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS); + + categoryDefinitionEClass = createEClass(CATEGORY_DEFINITION); + createEReference(categoryDefinitionEClass, CATEGORY_DEFINITION__LOCALIZED_NAMES); + createEAttribute(categoryDefinitionEClass, CATEGORY_DEFINITION__CATEGORY_ID); + createEReference(categoryDefinitionEClass, CATEGORY_DEFINITION__ICONS); + createEAttribute(categoryDefinitionEClass, CATEGORY_DEFINITION__EXPRESSION); + + // Create enums + trafficIncidentFieldEEnum = createEEnum(TRAFFIC_INCIDENT_FIELD); + textDetailLevelEEnum = createEEnum(TEXT_DETAIL_LEVEL); + trafficIncidentFeedStatusEEnum = createEEnum(TRAFFIC_INCIDENT_FEED_STATUS); + trafficIncidentsStatusEEnum = createEEnum(TRAFFIC_INCIDENTS_STATUS); + speedUnitEEnum = createEEnum(SPEED_UNIT); + lengthUnitEEnum = createEEnum(LENGTH_UNIT); + weightUnitEEnum = createEEnum(WEIGHT_UNIT); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Obtain other dependent packages + trafficincidenttablesPackage thetrafficincidenttablesPackage = (trafficincidenttablesPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidenttablesPackage.eNS_URI); + CommonPackage theCommonPackage = (CommonPackage)EPackage.Registry.INSTANCE.getEPackage(CommonPackage.eNS_URI); + IconsetPackage theIconsetPackage = (IconsetPackage)EPackage.Registry.INSTANCE.getEPackage(IconsetPackage.eNS_URI); + trafficincidentPackage thetrafficincidentPackage = (trafficincidentPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidentPackage.eNS_URI); + XTrafficIncidentPackage theXTrafficIncidentPackage = (XTrafficIncidentPackage)EPackage.Registry.INSTANCE.getEPackage(XTrafficIncidentPackage.eNS_URI); + + // Create type parameters + + // Set bounds for type parameters + + // Add supertypes to classes + + // Initialize classes and features; add operations and parameters + initEClass(trafficIncidentsEClass, TrafficIncidents.class, "TrafficIncidents", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + EOperation op = addEOperation(trafficIncidentsEClass, null, "getVersion", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addUpdateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidenttablesPackage.getWarningLevel(), "warningLevels", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "updateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addAreasUpdateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidenttablesPackage.getWarningLevel(), "warningLevels", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theCommonPackage.getRectangularArea(), "areas", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "updateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getLanguage", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setLanguage", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "languageCode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "countryCode", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setTimeFormat", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "timeFormat", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setDateFormat", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "dateFormat", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setLengthUnit", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getLengthUnit(), "lengthUnit", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setWeightUnit", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getWeightUnit(), "weightUnit", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getApplicability", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "setApplicability", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "filterExpression", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "reserveIconSetIds", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "numberOfIds", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "freeIconSetIds", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "iconSetIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getIconSets", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addIconSetDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconSet(), "iconSets", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeIconSetDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "iconSetIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getIconDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconInfo(), "iconInfos", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addIconDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconDefinition(), "iconDefinitions", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeIconDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconInfo(), "iconInfos", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "reserveCategoryIds", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "numberOfIds", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "freeCategoryIds", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getCategoryDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addCategoryDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getCategoryDefinition(), "categoryDefinitions", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeCategoryDefinitions", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getTrafficIncidentIds", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidenttablesPackage.getWarningLevel(), "warningLevels", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getTrafficIncidentIdsInAreas", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidenttablesPackage.getWarningLevel(), "warningLevels", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theCommonPackage.getRectangularArea(), "areas", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getTrafficIncidents", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "trafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEBoolean(), "includeTextFields", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getTrafficIncidentsFields", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "trafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentField(), "trafficIncidentFields", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "getTexts", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "trafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTextDetailLevel(), "textDetailLevel", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addTrafficIncidentsStatusListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "trafficIncidentsStatusListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "addFeedInformationListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "feedInformationListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeUpdateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "updateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeAreasUpdateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "updateListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeTrafficIncidentsStatusListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "trafficIncidentsStatusListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsEClass, null, "removeFeedInformationListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsListener(), "feedInformationListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(trafficIncidentsListenerEClass, TrafficIncidentsListener.class, "TrafficIncidentsListener", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getVersionReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theCommonPackage.getVersion(), "version", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "updates", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "unchangedTrafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "changedTrafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "newTrafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "deletedTrafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "updatesInAreas", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theCommonPackage.getRectangularArea(), "areas", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "trafficIncidentsStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedStatus(), "trafficIncidentFeedStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsStatus(), "trafficIncidentsStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "feedInformation", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getFeedInformation(), "feedsInformation", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getLanguageReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "languageCode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "countryCode", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getApplicabilityReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "filterExpression", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "reserveIconSetIdsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "iconSetIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "reserveCategoryIdsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "categoryIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getTrafficIncidentIdsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "trafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getTrafficIncidentIdsInAreasReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "trafficIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getTrafficIncidentsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidentPackage.getTrafficIncident(), "trafficIncidents", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getTrafficIncidentsFieldsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, thetrafficincidentPackage.getTrafficIncident(), "trafficIncidents", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getTextsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "texts", 0, -1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addTrafficIncidentsStatusListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addFeedInformationListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addUpdateListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeUpdateListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addAreasUpdateListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeAreasUpdateListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setLanguageReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setTimeFormatReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setDateFormatReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setLengthUnitReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setWeightUnitReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "setApplicabilityReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "freeCategoryIdsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getCategoryDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getCategoryDefinition(), "categoryDefinitions", 0, -1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addCategoryDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeCategoryDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "freeIconSetIdsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getIconDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconDefinition(), "iconDefinitions", 0, -1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addIconDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeIconDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentsListenerEClass, null, "getIconSetsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theIconsetPackage.getIconSet(), "iconSets", 0, -1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "addIconSetDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeIconSetDefinitionsReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeFeedInformationListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentsListenerEClass, null, "removeTrafficIncidentsStatusListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(trafficIncidentFeedEClass, TrafficIncidentFeed.class, "TrafficIncidentFeed", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + op = addEOperation(trafficIncidentFeedEClass, null, "getVersion", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "getLanguage", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "addLanguageListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "changeListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentFeedEClass, null, "clear", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "updateIncidents", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "feedId", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "cancelledIncidentIds", 0, -1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theXTrafficIncidentPackage.getTrafficIncident(), "updatedIncidents", 0, -1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "updateStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "feedId", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedStatus(), "feedStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentsStatus(), "incidentsStatus", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "registerFeed", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "dataProviderName", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "protocolName", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "communicationChannelName", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedEClass, null, "removeLanguageListener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "listener", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, this.getTrafficIncidentFeedListener(), "changeListener", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(trafficIncidentFeedListenerEClass, TrafficIncidentFeedListener.class, "TrafficIncidentFeedListener", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + + op = addEOperation(trafficIncidentFeedListenerEClass, null, "getVersionReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, theCommonPackage.getVersion(), "version", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedListenerEClass, null, "getLanguageReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "languageCode", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEString(), "countryCode", 0, 1, IS_UNIQUE, IS_ORDERED); + + op = addEOperation(trafficIncidentFeedListenerEClass, null, "registerFeedReply", 0, 1, IS_UNIQUE, IS_ORDERED); + addEParameter(op, ecorePackage.getEInt(), "feedId", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentFeedListenerEClass, null, "addLanguageListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + addEOperation(trafficIncidentFeedListenerEClass, null, "removeLanguageListenerReply", 0, 1, IS_UNIQUE, IS_ORDERED); + + initEClass(feedInformationEClass, FeedInformation.class, "FeedInformation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEAttribute(getFeedInformation_DataProviderName(), ecorePackage.getEString(), "dataProviderName", null, 0, 1, FeedInformation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFeedInformation_ProtocolName(), ecorePackage.getEString(), "protocolName", null, 0, 1, FeedInformation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFeedInformation_CommunicationChannelName(), ecorePackage.getEString(), "communicationChannelName", null, 0, 1, FeedInformation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFeedInformation_FeedStatus(), this.getTrafficIncidentFeedStatus(), "feedStatus", null, 1, 1, FeedInformation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getFeedInformation_TrafficIncidentsStatus(), this.getTrafficIncidentsStatus(), "trafficIncidentsStatus", null, 1, 1, FeedInformation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + initEClass(categoryDefinitionEClass, CategoryDefinition.class, "CategoryDefinition", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); + initEReference(getCategoryDefinition_LocalizedNames(), theCommonPackage.getLocalizedString(), null, "localizedNames", null, 0, -1, CategoryDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCategoryDefinition_CategoryId(), ecorePackage.getEInt(), "categoryId", null, 1, 1, CategoryDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getCategoryDefinition_Icons(), theIconsetPackage.getIconInfo(), null, "icons", null, 0, -1, CategoryDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getCategoryDefinition_Expression(), ecorePackage.getEString(), "expression", null, 1, 1, CategoryDefinition.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + + // Initialize enums and add enum literals + initEEnum(trafficIncidentFieldEEnum, TrafficIncidentField.class, "TrafficIncidentField"); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.TRAFFIC_INCIDENT_ID); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.EFFECT_CODE); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.EFFECT_TEXT); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.START_TIME); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.STOP_TIME); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.TENDENCY); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.TENDENCY_TEXT); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.LENGTH_AFFECTED); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.AVERAGE_SPEED_ABSOLUTE); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.DELAY); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.SEGMENT_SPEED_LIMIT); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.CAUSES); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.CAUSE_TEXTS); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.APPLICABILITY_TEXTS); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.LOCATION); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.LOCATION_INFO); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.LOCATION_BOUNDING_BOX); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.APPLICABILITY); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.ADVICES); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.ADVICE_TEXTS); + addEEnumLiteral(trafficIncidentFieldEEnum, TrafficIncidentField.EXPECTED_SPEED_ABSOLUTE); + + initEEnum(textDetailLevelEEnum, TextDetailLevel.class, "TextDetailLevel"); + addEEnumLiteral(textDetailLevelEEnum, TextDetailLevel.FULL); + addEEnumLiteral(textDetailLevelEEnum, TextDetailLevel.SUMMARY); + + initEEnum(trafficIncidentFeedStatusEEnum, TrafficIncidentFeedStatus.class, "TrafficIncidentFeedStatus"); + addEEnumLiteral(trafficIncidentFeedStatusEEnum, TrafficIncidentFeedStatus.UNAVAILABLE); + addEEnumLiteral(trafficIncidentFeedStatusEEnum, TrafficIncidentFeedStatus.CONNECTED); + addEEnumLiteral(trafficIncidentFeedStatusEEnum, TrafficIncidentFeedStatus.DISCONNECTED); + + initEEnum(trafficIncidentsStatusEEnum, TrafficIncidentsStatus.class, "TrafficIncidentsStatus"); + addEEnumLiteral(trafficIncidentsStatusEEnum, TrafficIncidentsStatus.UNAVAILABLE); + addEEnumLiteral(trafficIncidentsStatusEEnum, TrafficIncidentsStatus.PARTLY_AVAILABLE); + addEEnumLiteral(trafficIncidentsStatusEEnum, TrafficIncidentsStatus.AVAILABLE); + + initEEnum(speedUnitEEnum, SpeedUnit.class, "SpeedUnit"); + addEEnumLiteral(speedUnitEEnum, SpeedUnit.KILOMETERS_PER_HOUR); + addEEnumLiteral(speedUnitEEnum, SpeedUnit.MILES_PER_HOUR); + + initEEnum(lengthUnitEEnum, LengthUnit.class, "LengthUnit"); + addEEnumLiteral(lengthUnitEEnum, LengthUnit.KILOMETERS); + addEEnumLiteral(lengthUnitEEnum, LengthUnit.MILES); + + initEEnum(weightUnitEEnum, WeightUnit.class, "WeightUnit"); + addEEnumLiteral(weightUnitEEnum, WeightUnit.KILOGRAM); + addEEnumLiteral(weightUnitEEnum, WeightUnit.POUND); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + // http://www.tomtom.com/emfidl/2012/GenModel + createGenModel_2Annotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + + /** + * Initializes the annotations for http://www.tomtom.com/emfidl/2012/GenModel. + * + * + * @generated + */ + protected void createGenModel_2Annotations() { + String source = "http://www.tomtom.com/emfidl/2012/GenModel"; + addAnnotation + (trafficIncidentsEClass, + source, + new String[] { + "versionMajor", "0", + "versionMinor", "1" + }); + } + +} //trafficincidentsservicePackageImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsserviceFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsserviceFactory.java new file mode 100755 index 0000000..9a31760 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsserviceFactory.java @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage + * @generated + */ +public interface trafficincidentsserviceFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + trafficincidentsserviceFactory eINSTANCE = org.genivi.trafficincidentsservice.impl.trafficincidentsserviceFactoryImpl.init(); + + /** + * Returns a new object of class 'Traffic Incidents'. + * + * + * @return a new object of class 'Traffic Incidents'. + * @generated + */ + TrafficIncidents createTrafficIncidents(); + + /** + * Returns a new object of class 'Traffic Incidents Listener'. + * + * + * @return a new object of class 'Traffic Incidents Listener'. + * @generated + */ + TrafficIncidentsListener createTrafficIncidentsListener(); + + /** + * Returns a new object of class 'Traffic Incident Feed'. + * + * + * @return a new object of class 'Traffic Incident Feed'. + * @generated + */ + TrafficIncidentFeed createTrafficIncidentFeed(); + + /** + * Returns a new object of class 'Traffic Incident Feed Listener'. + * + * + * @return a new object of class 'Traffic Incident Feed Listener'. + * @generated + */ + TrafficIncidentFeedListener createTrafficIncidentFeedListener(); + + /** + * Returns a new object of class 'Feed Information'. + * + * + * @return a new object of class 'Feed Information'. + * @generated + */ + FeedInformation createFeedInformation(); + + /** + * Returns a new object of class 'Category Definition'. + * + * + * @return a new object of class 'Category Definition'. + * @generated + */ + CategoryDefinition createCategoryDefinition(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + trafficincidentsservicePackage gettrafficincidentsservicePackage(); + +} //trafficincidentsserviceFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsservicePackage.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsservicePackage.java new file mode 100755 index 0000000..32c8aae --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/trafficincidentsservicePackage.java @@ -0,0 +1,788 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import org.eclipse.emf.ecore.EAttribute; +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.EReference; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.trafficincidentsservice.trafficincidentsserviceFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface trafficincidentsservicePackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "trafficincidentsservice"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.trafficinfo.trafficincidentsservice"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "trafficincidentsservice"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + trafficincidentsservicePackage eINSTANCE = org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentsImpl Traffic Incidents}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentsImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidents() + * @generated + */ + int TRAFFIC_INCIDENTS = 0; + + /** + * The number of structural features of the 'Traffic Incidents' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENTS_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentsListenerImpl Traffic Incidents Listener}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentsListenerImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentsListener() + * @generated + */ + int TRAFFIC_INCIDENTS_LISTENER = 1; + + /** + * The number of structural features of the 'Traffic Incidents Listener' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENTS_LISTENER_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedImpl Traffic Incident Feed}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeed() + * @generated + */ + int TRAFFIC_INCIDENT_FEED = 2; + + /** + * The number of structural features of the 'Traffic Incident Feed' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT_FEED_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedListenerImpl Traffic Incident Feed Listener}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedListenerImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeedListener() + * @generated + */ + int TRAFFIC_INCIDENT_FEED_LISTENER = 3; + + /** + * The number of structural features of the 'Traffic Incident Feed Listener' class. + * + * + * @generated + * @ordered + */ + int TRAFFIC_INCIDENT_FEED_LISTENER_FEATURE_COUNT = 0; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl Feed Information}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.FeedInformationImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getFeedInformation() + * @generated + */ + int FEED_INFORMATION = 4; + + /** + * The feature id for the 'Data Provider Name' attribute. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION__DATA_PROVIDER_NAME = 0; + + /** + * The feature id for the 'Protocol Name' attribute. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION__PROTOCOL_NAME = 1; + + /** + * The feature id for the 'Communication Channel Name' attribute. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME = 2; + + /** + * The feature id for the 'Feed Status' attribute. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION__FEED_STATUS = 3; + + /** + * The feature id for the 'Traffic Incidents Status' attribute. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS = 4; + + /** + * The number of structural features of the 'Feed Information' class. + * + * + * @generated + * @ordered + */ + int FEED_INFORMATION_FEATURE_COUNT = 5; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl Category Definition}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getCategoryDefinition() + * @generated + */ + int CATEGORY_DEFINITION = 5; + + /** + * The feature id for the 'Localized Names' containment reference list. + * + * + * @generated + * @ordered + */ + int CATEGORY_DEFINITION__LOCALIZED_NAMES = 0; + + /** + * The feature id for the 'Category Id' attribute. + * + * + * @generated + * @ordered + */ + int CATEGORY_DEFINITION__CATEGORY_ID = 1; + + /** + * The feature id for the 'Icons' containment reference list. + * + * + * @generated + * @ordered + */ + int CATEGORY_DEFINITION__ICONS = 2; + + /** + * The feature id for the 'Expression' attribute. + * + * + * @generated + * @ordered + */ + int CATEGORY_DEFINITION__EXPRESSION = 3; + + /** + * The number of structural features of the 'Category Definition' class. + * + * + * @generated + * @ordered + */ + int CATEGORY_DEFINITION_FEATURE_COUNT = 4; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentField Traffic Incident Field}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentField + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentField() + * @generated + */ + int TRAFFIC_INCIDENT_FIELD = 6; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.TextDetailLevel Text Detail Level}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TextDetailLevel + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTextDetailLevel() + * @generated + */ + int TEXT_DETAIL_LEVEL = 7; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus Traffic Incident Feed Status}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeedStatus() + * @generated + */ + int TRAFFIC_INCIDENT_FEED_STATUS = 8; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentsStatus Traffic Incidents Status}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentsStatus + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentsStatus() + * @generated + */ + int TRAFFIC_INCIDENTS_STATUS = 9; + + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.SpeedUnit Speed Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.SpeedUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getSpeedUnit() + * @generated + */ + int SPEED_UNIT = 10; + + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.LengthUnit Length Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.LengthUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getLengthUnit() + * @generated + */ + int LENGTH_UNIT = 11; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.WeightUnit Weight Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.WeightUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getWeightUnit() + * @generated + */ + int WEIGHT_UNIT = 12; + + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.TrafficIncidents Traffic Incidents}'. + * + * + * @return the meta object for class 'Traffic Incidents'. + * @see org.genivi.trafficincidentsservice.TrafficIncidents + * @generated + */ + EClass getTrafficIncidents(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.TrafficIncidentsListener Traffic Incidents Listener}'. + * + * + * @return the meta object for class 'Traffic Incidents Listener'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentsListener + * @generated + */ + EClass getTrafficIncidentsListener(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeed Traffic Incident Feed}'. + * + * + * @return the meta object for class 'Traffic Incident Feed'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeed + * @generated + */ + EClass getTrafficIncidentFeed(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeedListener Traffic Incident Feed Listener}'. + * + * + * @return the meta object for class 'Traffic Incident Feed Listener'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedListener + * @generated + */ + EClass getTrafficIncidentFeedListener(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.FeedInformation Feed Information}'. + * + * + * @return the meta object for class 'Feed Information'. + * @see org.genivi.trafficincidentsservice.FeedInformation + * @generated + */ + EClass getFeedInformation(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName Data Provider Name}'. + * + * + * @return the meta object for the attribute 'Data Provider Name'. + * @see org.genivi.trafficincidentsservice.FeedInformation#getDataProviderName() + * @see #getFeedInformation() + * @generated + */ + EAttribute getFeedInformation_DataProviderName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.FeedInformation#getProtocolName Protocol Name}'. + * + * + * @return the meta object for the attribute 'Protocol Name'. + * @see org.genivi.trafficincidentsservice.FeedInformation#getProtocolName() + * @see #getFeedInformation() + * @generated + */ + EAttribute getFeedInformation_ProtocolName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName Communication Channel Name}'. + * + * + * @return the meta object for the attribute 'Communication Channel Name'. + * @see org.genivi.trafficincidentsservice.FeedInformation#getCommunicationChannelName() + * @see #getFeedInformation() + * @generated + */ + EAttribute getFeedInformation_CommunicationChannelName(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus Feed Status}'. + * + * + * @return the meta object for the attribute 'Feed Status'. + * @see org.genivi.trafficincidentsservice.FeedInformation#getFeedStatus() + * @see #getFeedInformation() + * @generated + */ + EAttribute getFeedInformation_FeedStatus(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus Traffic Incidents Status}'. + * + * + * @return the meta object for the attribute 'Traffic Incidents Status'. + * @see org.genivi.trafficincidentsservice.FeedInformation#getTrafficIncidentsStatus() + * @see #getFeedInformation() + * @generated + */ + EAttribute getFeedInformation_TrafficIncidentsStatus(); + + /** + * Returns the meta object for class '{@link org.genivi.trafficincidentsservice.CategoryDefinition Category Definition}'. + * + * + * @return the meta object for class 'Category Definition'. + * @see org.genivi.trafficincidentsservice.CategoryDefinition + * @generated + */ + EClass getCategoryDefinition(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getLocalizedNamesList Localized Names}'. + * + * + * @return the meta object for the containment reference list 'Localized Names'. + * @see org.genivi.trafficincidentsservice.CategoryDefinition#getLocalizedNamesList() + * @see #getCategoryDefinition() + * @generated + */ + EReference getCategoryDefinition_LocalizedNames(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getCategoryId Category Id}'. + * + * + * @return the meta object for the attribute 'Category Id'. + * @see org.genivi.trafficincidentsservice.CategoryDefinition#getCategoryId() + * @see #getCategoryDefinition() + * @generated + */ + EAttribute getCategoryDefinition_CategoryId(); + + /** + * Returns the meta object for the containment reference list '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getIconsList Icons}'. + * + * + * @return the meta object for the containment reference list 'Icons'. + * @see org.genivi.trafficincidentsservice.CategoryDefinition#getIconsList() + * @see #getCategoryDefinition() + * @generated + */ + EReference getCategoryDefinition_Icons(); + + /** + * Returns the meta object for the attribute '{@link org.genivi.trafficincidentsservice.CategoryDefinition#getExpression Expression}'. + * + * + * @return the meta object for the attribute 'Expression'. + * @see org.genivi.trafficincidentsservice.CategoryDefinition#getExpression() + * @see #getCategoryDefinition() + * @generated + */ + EAttribute getCategoryDefinition_Expression(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.TrafficIncidentField Traffic Incident Field}'. + * + * + * @return the meta object for enum 'Traffic Incident Field'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentField + * @generated + */ + EEnum getTrafficIncidentField(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.TextDetailLevel Text Detail Level}'. + * + * + * @return the meta object for enum 'Text Detail Level'. + * @see org.genivi.trafficincidentsservice.TextDetailLevel + * @generated + */ + EEnum getTextDetailLevel(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus Traffic Incident Feed Status}'. + * + * + * @return the meta object for enum 'Traffic Incident Feed Status'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus + * @generated + */ + EEnum getTrafficIncidentFeedStatus(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.TrafficIncidentsStatus Traffic Incidents Status}'. + * + * + * @return the meta object for enum 'Traffic Incidents Status'. + * @see org.genivi.trafficincidentsservice.TrafficIncidentsStatus + * @generated + */ + EEnum getTrafficIncidentsStatus(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.SpeedUnit Speed Unit}'. + * + * + * @return the meta object for enum 'Speed Unit'. + * @see org.genivi.trafficincidentsservice.SpeedUnit + * @generated + */ + EEnum getSpeedUnit(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.LengthUnit Length Unit}'. + * + * + * @return the meta object for enum 'Length Unit'. + * @see org.genivi.trafficincidentsservice.LengthUnit + * @generated + */ + EEnum getLengthUnit(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.WeightUnit Weight Unit}'. + * + * + * @return the meta object for enum 'Weight Unit'. + * @see org.genivi.trafficincidentsservice.WeightUnit + * @generated + */ + EEnum getWeightUnit(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + trafficincidentsserviceFactory gettrafficincidentsserviceFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentsImpl Traffic Incidents}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentsImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidents() + * @generated + */ + EClass TRAFFIC_INCIDENTS = eINSTANCE.getTrafficIncidents(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentsListenerImpl Traffic Incidents Listener}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentsListenerImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentsListener() + * @generated + */ + EClass TRAFFIC_INCIDENTS_LISTENER = eINSTANCE.getTrafficIncidentsListener(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedImpl Traffic Incident Feed}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeed() + * @generated + */ + EClass TRAFFIC_INCIDENT_FEED = eINSTANCE.getTrafficIncidentFeed(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedListenerImpl Traffic Incident Feed Listener}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.TrafficIncidentFeedListenerImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeedListener() + * @generated + */ + EClass TRAFFIC_INCIDENT_FEED_LISTENER = eINSTANCE.getTrafficIncidentFeedListener(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.FeedInformationImpl Feed Information}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.FeedInformationImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getFeedInformation() + * @generated + */ + EClass FEED_INFORMATION = eINSTANCE.getFeedInformation(); + + /** + * The meta object literal for the 'Data Provider Name' attribute feature. + * + * + * @generated + */ + EAttribute FEED_INFORMATION__DATA_PROVIDER_NAME = eINSTANCE.getFeedInformation_DataProviderName(); + + /** + * The meta object literal for the 'Protocol Name' attribute feature. + * + * + * @generated + */ + EAttribute FEED_INFORMATION__PROTOCOL_NAME = eINSTANCE.getFeedInformation_ProtocolName(); + + /** + * The meta object literal for the 'Communication Channel Name' attribute feature. + * + * + * @generated + */ + EAttribute FEED_INFORMATION__COMMUNICATION_CHANNEL_NAME = eINSTANCE.getFeedInformation_CommunicationChannelName(); + + /** + * The meta object literal for the 'Feed Status' attribute feature. + * + * + * @generated + */ + EAttribute FEED_INFORMATION__FEED_STATUS = eINSTANCE.getFeedInformation_FeedStatus(); + + /** + * The meta object literal for the 'Traffic Incidents Status' attribute feature. + * + * + * @generated + */ + EAttribute FEED_INFORMATION__TRAFFIC_INCIDENTS_STATUS = eINSTANCE.getFeedInformation_TrafficIncidentsStatus(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl Category Definition}' class. + * + * + * @see org.genivi.trafficincidentsservice.impl.CategoryDefinitionImpl + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getCategoryDefinition() + * @generated + */ + EClass CATEGORY_DEFINITION = eINSTANCE.getCategoryDefinition(); + + /** + * The meta object literal for the 'Localized Names' containment reference list feature. + * + * + * @generated + */ + EReference CATEGORY_DEFINITION__LOCALIZED_NAMES = eINSTANCE.getCategoryDefinition_LocalizedNames(); + + /** + * The meta object literal for the 'Category Id' attribute feature. + * + * + * @generated + */ + EAttribute CATEGORY_DEFINITION__CATEGORY_ID = eINSTANCE.getCategoryDefinition_CategoryId(); + + /** + * The meta object literal for the 'Icons' containment reference list feature. + * + * + * @generated + */ + EReference CATEGORY_DEFINITION__ICONS = eINSTANCE.getCategoryDefinition_Icons(); + + /** + * The meta object literal for the 'Expression' attribute feature. + * + * + * @generated + */ + EAttribute CATEGORY_DEFINITION__EXPRESSION = eINSTANCE.getCategoryDefinition_Expression(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentField Traffic Incident Field}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentField + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentField() + * @generated + */ + EEnum TRAFFIC_INCIDENT_FIELD = eINSTANCE.getTrafficIncidentField(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.TextDetailLevel Text Detail Level}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TextDetailLevel + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTextDetailLevel() + * @generated + */ + EEnum TEXT_DETAIL_LEVEL = eINSTANCE.getTextDetailLevel(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus Traffic Incident Feed Status}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentFeedStatus() + * @generated + */ + EEnum TRAFFIC_INCIDENT_FEED_STATUS = eINSTANCE.getTrafficIncidentFeedStatus(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.TrafficIncidentsStatus Traffic Incidents Status}' enum. + * + * + * @see org.genivi.trafficincidentsservice.TrafficIncidentsStatus + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getTrafficIncidentsStatus() + * @generated + */ + EEnum TRAFFIC_INCIDENTS_STATUS = eINSTANCE.getTrafficIncidentsStatus(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.SpeedUnit Speed Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.SpeedUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getSpeedUnit() + * @generated + */ + EEnum SPEED_UNIT = eINSTANCE.getSpeedUnit(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.LengthUnit Length Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.LengthUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getLengthUnit() + * @generated + */ + EEnum LENGTH_UNIT = eINSTANCE.getLengthUnit(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.WeightUnit Weight Unit}' enum. + * + * + * @see org.genivi.trafficincidentsservice.WeightUnit + * @see org.genivi.trafficincidentsservice.impl.trafficincidentsservicePackageImpl#getWeightUnit() + * @generated + */ + EEnum WEIGHT_UNIT = eINSTANCE.getWeightUnit(); + + } + +} //trafficincidentsservicePackage diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceAdapterFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceAdapterFactory.java new file mode 100755 index 0000000..5aede9d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceAdapterFactory.java @@ -0,0 +1,219 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.util; + +import org.eclipse.emf.common.notify.Adapter; +import org.eclipse.emf.common.notify.Notifier; +import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; +import org.eclipse.emf.ecore.EObject; +import org.genivi.trafficincidentsservice.*; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * The Adapter Factory for the model. + * It provides an adapter createXXX method for each class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage + * @generated + */ +public class trafficincidentsserviceAdapterFactory extends AdapterFactoryImpl { + /** + * The cached model package. + * + * + * @generated + */ + protected static trafficincidentsservicePackage modelPackage; + + /** + * Creates an instance of the adapter factory. + * + * + * @generated + */ + public trafficincidentsserviceAdapterFactory() { + if (modelPackage == null) { + modelPackage = trafficincidentsservicePackage.eINSTANCE; + } + } + + /** + * Returns whether this factory is applicable for the type of the object. + * + * This implementation returns true if the object is either the model's package or is an instance object of the model. + * + * @return whether this factory is applicable for the type of the object. + * @generated + */ + @Override + public boolean isFactoryForType(Object object) { + if (object == modelPackage) { + return true; + } + if (object instanceof EObject) { + return ((EObject)object).eClass().getEPackage() == modelPackage; + } + return false; + } + + /** + * The switch that delegates to the createXXX methods. + * + * + * @generated + */ + protected trafficincidentsserviceSwitch modelSwitch = + new trafficincidentsserviceSwitch() { + @Override + public Adapter caseTrafficIncidents(TrafficIncidents object) { + return createTrafficIncidentsAdapter(); + } + @Override + public Adapter caseTrafficIncidentsListener(TrafficIncidentsListener object) { + return createTrafficIncidentsListenerAdapter(); + } + @Override + public Adapter caseTrafficIncidentFeed(TrafficIncidentFeed object) { + return createTrafficIncidentFeedAdapter(); + } + @Override + public Adapter caseTrafficIncidentFeedListener(TrafficIncidentFeedListener object) { + return createTrafficIncidentFeedListenerAdapter(); + } + @Override + public Adapter caseFeedInformation(FeedInformation object) { + return createFeedInformationAdapter(); + } + @Override + public Adapter caseCategoryDefinition(CategoryDefinition object) { + return createCategoryDefinitionAdapter(); + } + @Override + public Adapter defaultCase(EObject object) { + return createEObjectAdapter(); + } + }; + + /** + * Creates an adapter for the target. + * + * + * @param target the object to adapt. + * @return the adapter for the target. + * @generated + */ + @Override + public Adapter createAdapter(Notifier target) { + return modelSwitch.doSwitch((EObject)target); + } + + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.TrafficIncidents Traffic Incidents}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.TrafficIncidents + * @generated + */ + public Adapter createTrafficIncidentsAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.TrafficIncidentsListener Traffic Incidents Listener}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.TrafficIncidentsListener + * @generated + */ + public Adapter createTrafficIncidentsListenerAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeed Traffic Incident Feed}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeed + * @generated + */ + public Adapter createTrafficIncidentFeedAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.TrafficIncidentFeedListener Traffic Incident Feed Listener}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.TrafficIncidentFeedListener + * @generated + */ + public Adapter createTrafficIncidentFeedListenerAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.CategoryDefinition Category Definition}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.CategoryDefinition + * @generated + */ + public Adapter createCategoryDefinitionAdapter() { + return null; + } + + /** + * Creates a new adapter for an object of class '{@link org.genivi.trafficincidentsservice.FeedInformation Feed Information}'. + * + * This default implementation returns null so that we can easily ignore cases; + * it's useful to ignore a case when inheritance will catch all the cases anyway. + * + * @return the new adapter. + * @see org.genivi.trafficincidentsservice.FeedInformation + * @generated + */ + public Adapter createFeedInformationAdapter() { + return null; + } + + /** + * Creates a new adapter for the default case. + * + * This default implementation returns null. + * + * @return the new adapter. + * @generated + */ + public Adapter createEObjectAdapter() { + return null; + } + +} //trafficincidentsserviceAdapterFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceSwitch.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceSwitch.java new file mode 100755 index 0000000..151d363 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidentsservice-model/src/org/genivi/trafficincidentsservice/util/trafficincidentsserviceSwitch.java @@ -0,0 +1,225 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.util; + +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; +import org.genivi.trafficincidentsservice.*; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.trafficincidentsservicePackage; + +/** + * + * The Switch for the model's inheritance hierarchy. + * It supports the call {@link #doSwitch(EObject) doSwitch(object)} + * to invoke the caseXXX method for each class of the model, + * starting with the actual class of the object + * and proceeding up the inheritance hierarchy + * until a non-null result is returned, + * which is the result of the switch. + * + * @see org.genivi.trafficincidentsservice.trafficincidentsservicePackage + * @generated + */ +public class trafficincidentsserviceSwitch extends Switch { + /** + * The cached model package + * + * + * @generated + */ + protected static trafficincidentsservicePackage modelPackage; + + /** + * Creates an instance of the switch. + * + * + * @generated + */ + public trafficincidentsserviceSwitch() { + if (modelPackage == null) { + modelPackage = trafficincidentsservicePackage.eINSTANCE; + } + } + + /** + * Checks whether this is a switch for the given package. + * + * + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. + * @generated + */ + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; + } + + /** + * Calls caseXXX for each class of the model until one returns a non null result; it yields that result. + * + * + * @return the first non-null result returned by a caseXXX call. + * @generated + */ + @Override + protected T doSwitch(int classifierID, EObject theEObject) { + switch (classifierID) { + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS: { + TrafficIncidents trafficIncidents = (TrafficIncidents)theEObject; + T result = caseTrafficIncidents(trafficIncidents); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentsservicePackage.TRAFFIC_INCIDENTS_LISTENER: { + TrafficIncidentsListener trafficIncidentsListener = (TrafficIncidentsListener)theEObject; + T result = caseTrafficIncidentsListener(trafficIncidentsListener); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED: { + TrafficIncidentFeed trafficIncidentFeed = (TrafficIncidentFeed)theEObject; + T result = caseTrafficIncidentFeed(trafficIncidentFeed); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentsservicePackage.TRAFFIC_INCIDENT_FEED_LISTENER: { + TrafficIncidentFeedListener trafficIncidentFeedListener = (TrafficIncidentFeedListener)theEObject; + T result = caseTrafficIncidentFeedListener(trafficIncidentFeedListener); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentsservicePackage.FEED_INFORMATION: { + FeedInformation feedInformation = (FeedInformation)theEObject; + T result = caseFeedInformation(feedInformation); + if (result == null) result = defaultCase(theEObject); + return result; + } + case trafficincidentsservicePackage.CATEGORY_DEFINITION: { + CategoryDefinition categoryDefinition = (CategoryDefinition)theEObject; + T result = caseCategoryDefinition(categoryDefinition); + if (result == null) result = defaultCase(theEObject); + return result; + } + default: return defaultCase(theEObject); + } + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incidents'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incidents'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncidents(TrafficIncidents object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incidents Listener'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incidents Listener'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncidentsListener(TrafficIncidentsListener object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incident Feed'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incident Feed'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncidentFeed(TrafficIncidentFeed object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Traffic Incident Feed Listener'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Traffic Incident Feed Listener'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseTrafficIncidentFeedListener(TrafficIncidentFeedListener object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Feed Information'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Feed Information'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseFeedInformation(FeedInformation object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'Category Definition'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'Category Definition'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) + * @generated + */ + public T caseCategoryDefinition(CategoryDefinition object) { + return null; + } + + /** + * Returns the result of interpreting the object as an instance of 'EObject'. + * + * This implementation returns null; + * returning a non-null result will terminate the switch, but this is the last case anyway. + * + * @param object the target of the switch. + * @return the result of interpreting the object as an instance of 'EObject'. + * @see #doSwitch(org.eclipse.emf.ecore.EObject) + * @generated + */ + @Override + public T defaultCase(EObject object) { + return null; + } + +} //trafficincidentsserviceSwitch diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.classpath b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.classpath new file mode 100755 index 0000000..1af8d0d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.project b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.project new file mode 100755 index 0000000..832ce98 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/.project @@ -0,0 +1,23 @@ + + + org.genivi.trafficincidentsservice.trafficincidenttables-model + This project contains the data model for GENIVI Traffic Incidents. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.pde.ManifestBuilder + + + org.eclipse.pde.SchemaBuilder + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/META-INF/MANIFEST.MF b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/META-INF/MANIFEST.MF new file mode 100755 index 0000000..c37d016 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.genivi.trafficinfo.trafficincidenttables;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ClassPath: . +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.emf.ecore;visibility:=reexport, + org.genivi.basetypes-model +Export-Package: org.genivi.trafficincidentsservice.trafficincidenttables, + org.genivi.trafficincidentsservice.trafficincidenttables.impl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/ReadMe.confluence new file mode 100755 index 0000000..cfae46e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/ReadMe.confluence @@ -0,0 +1,3 @@ +This project defines the tables that are used in the Traffic Incident definitions of both the TrafficIncidents interface and the TrafficIncidentFeed interface. + +TrafficIncidentTables.ecorediag, in de model folder, provides a good overview of the tables. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/build.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/build.properties new file mode 100755 index 0000000..1a3a48b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/build.properties @@ -0,0 +1,14 @@ + +# +# +# +# $Id$ + +bin.includes = .,\ + model/,\ + META-INF/,\ + plugin.xml,\ + plugin.properties +jars.compile.order = . +source.. = src/ +output.. = bin/ diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecore b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecore new file mode 100755 index 0000000..50653df --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecore @@ -0,0 +1,348 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecorediag b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecorediag new file mode 100755 index 0000000..2b348d7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.ecorediag @@ -0,0 +1,1726 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.genmodel b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.genmodel new file mode 100755 index 0000000..907b234 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/model/TrafficIncidentTables.genmodel @@ -0,0 +1,352 @@ + + + TrafficIncidentTables.ecore + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.properties b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.properties new file mode 100755 index 0000000..d4e01b4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.properties @@ -0,0 +1,8 @@ + +# +# +# +# $Id$ + +pluginName = TrafficIncident Model +providerName = www.example.org diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.xml new file mode 100755 index 0000000..40c5db4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/plugin.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/pom.xml b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/pom.xml new file mode 100755 index 0000000..c081964 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + org.genivi.trafficincidentsservice + trafficincidenttables-model + jar + 1.0-SNAPSHOT + GENIVI Traffic Incident Tables data model + This project contains the data model for GENIVI Traffic Incidents. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.eclipse.emf + org.eclipse.emf.common + + + org.eclipse.emf + org.eclipse.emf.ecore + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + + + org.genivi + basetypes-model + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Accident.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Accident.java new file mode 100755 index 0000000..944e2e8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Accident.java @@ -0,0 +1,348 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Accident', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getAccident() + * @model + * @generated + */ +public enum Accident implements Enumerator { + /** + * The 'MULTI VEHICLE ACCIDENT' literal object. + * + * + * @see #MULTI_VEHICLE_ACCIDENT_VALUE + * @generated + * @ordered + */ + MULTI_VEHICLE_ACCIDENT(1, "MULTI_VEHICLE_ACCIDENT", "MULTI_VEHICLE_ACCIDENT"), + + /** + * The 'HEAVY ACCIDENT' literal object. + * + * + * @see #HEAVY_ACCIDENT_VALUE + * @generated + * @ordered + */ + HEAVY_ACCIDENT(2, "HEAVY_ACCIDENT", "HEAVY_ACCIDENT"), + + /** + * The 'ACCIDENT INVOLVING LORRY' literal object. + * + * + * @see #ACCIDENT_INVOLVING_LORRY_VALUE + * @generated + * @ordered + */ + ACCIDENT_INVOLVING_LORRY(3, "ACCIDENT_INVOLVING_LORRY", "ACCIDENT_INVOLVING_LORRY"), + + /** + * The 'ACCIDENT INVOLVING BUS' literal object. + * + * + * @see #ACCIDENT_INVOLVING_BUS_VALUE + * @generated + * @ordered + */ + ACCIDENT_INVOLVING_BUS(4, "ACCIDENT_INVOLVING_BUS", "ACCIDENT_INVOLVING_BUS"), + + /** + * The 'ACCIDENT INVOLVING HAZARDOUS MATERIALS' literal object. + * + * + * @see #ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS_VALUE + * @generated + * @ordered + */ + ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS(5, "ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS", "ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS"), + + /** + * The 'ACCIDENT ON OPPOSITE LANE' literal object. + * + * + * @see #ACCIDENT_ON_OPPOSITE_LANE_VALUE + * @generated + * @ordered + */ + ACCIDENT_ON_OPPOSITE_LANE(6, "ACCIDENT_ON_OPPOSITE_LANE", "ACCIDENT_ON_OPPOSITE_LANE"), + + /** + * The 'UNSECURED ACCIDENT' literal object. + * + * + * @see #UNSECURED_ACCIDENT_VALUE + * @generated + * @ordered + */ + UNSECURED_ACCIDENT(7, "UNSECURED_ACCIDENT", "UNSECURED_ACCIDENT"); + + /** + * The 'MULTI VEHICLE ACCIDENT' literal value. + * + *

+ * If the meaning of 'MULTI VEHICLE ACCIDENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MULTI_VEHICLE_ACCIDENT + * @model + * @generated + * @ordered + */ + public static final int MULTI_VEHICLE_ACCIDENT_VALUE = 1; + + /** + * The 'HEAVY ACCIDENT' literal value. + * + *

+ * If the meaning of 'HEAVY ACCIDENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_ACCIDENT + * @model + * @generated + * @ordered + */ + public static final int HEAVY_ACCIDENT_VALUE = 2; + + /** + * The 'ACCIDENT INVOLVING LORRY' literal value. + * + *

+ * If the meaning of 'ACCIDENT INVOLVING LORRY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ACCIDENT_INVOLVING_LORRY + * @model + * @generated + * @ordered + */ + public static final int ACCIDENT_INVOLVING_LORRY_VALUE = 3; + + /** + * The 'ACCIDENT INVOLVING BUS' literal value. + * + *

+ * If the meaning of 'ACCIDENT INVOLVING BUS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ACCIDENT_INVOLVING_BUS + * @model + * @generated + * @ordered + */ + public static final int ACCIDENT_INVOLVING_BUS_VALUE = 4; + + /** + * The 'ACCIDENT INVOLVING HAZARDOUS MATERIALS' literal value. + * + *

+ * If the meaning of 'ACCIDENT INVOLVING HAZARDOUS MATERIALS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS + * @model + * @generated + * @ordered + */ + public static final int ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS_VALUE = 5; + + /** + * The 'ACCIDENT ON OPPOSITE LANE' literal value. + * + *

+ * If the meaning of 'ACCIDENT ON OPPOSITE LANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ACCIDENT_ON_OPPOSITE_LANE + * @model + * @generated + * @ordered + */ + public static final int ACCIDENT_ON_OPPOSITE_LANE_VALUE = 6; + + /** + * The 'UNSECURED ACCIDENT' literal value. + * + *

+ * If the meaning of 'UNSECURED ACCIDENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #UNSECURED_ACCIDENT + * @model + * @generated + * @ordered + */ + public static final int UNSECURED_ACCIDENT_VALUE = 7; + + /** + * An array of all the 'Accident' enumerators. + * + * + * @generated + */ + private static final Accident[] VALUES_ARRAY = + new Accident[] { + MULTI_VEHICLE_ACCIDENT, + HEAVY_ACCIDENT, + ACCIDENT_INVOLVING_LORRY, + ACCIDENT_INVOLVING_BUS, + ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS, + ACCIDENT_ON_OPPOSITE_LANE, + UNSECURED_ACCIDENT, + }; + + /** + * A public read-only list of all the 'Accident' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Accident' literal with the specified literal value. + * + * + * @generated + */ + public static Accident get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Accident result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Accident' literal with the specified name. + * + * + * @generated + */ + public static Accident getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Accident result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Accident' literal with the specified integer value. + * + * + * @generated + */ + public static Accident get(int value) { + switch (value) { + case MULTI_VEHICLE_ACCIDENT_VALUE: return MULTI_VEHICLE_ACCIDENT; + case HEAVY_ACCIDENT_VALUE: return HEAVY_ACCIDENT; + case ACCIDENT_INVOLVING_LORRY_VALUE: return ACCIDENT_INVOLVING_LORRY; + case ACCIDENT_INVOLVING_BUS_VALUE: return ACCIDENT_INVOLVING_BUS; + case ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS_VALUE: return ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS; + case ACCIDENT_ON_OPPOSITE_LANE_VALUE: return ACCIDENT_ON_OPPOSITE_LANE; + case UNSECURED_ACCIDENT_VALUE: return UNSECURED_ACCIDENT; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Accident(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Accident diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AdviceCode.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AdviceCode.java new file mode 100755 index 0000000..42249e3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AdviceCode.java @@ -0,0 +1,618 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Advice Code', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getAdviceCode() + * @model + * @generated + */ +public enum AdviceCode implements Enumerator { + /** + * The 'DRIVE TO NEXT AVAILABLE PARKING PLACE' literal object. + * + * + * @see #DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE_VALUE + * @generated + * @ordered + */ + DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE(1, "DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE", "DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE"), + + /** + * The 'OVERTAKING NOT ALLOWED' literal object. + * + * + * @see #OVERTAKING_NOT_ALLOWED_VALUE + * @generated + * @ordered + */ + OVERTAKING_NOT_ALLOWED(2, "OVERTAKING_NOT_ALLOWED", "OVERTAKING_NOT_ALLOWED"), + + /** + * The 'DRIVING NOT ALLOWED' literal object. + * + * + * @see #DRIVING_NOT_ALLOWED_VALUE + * @generated + * @ordered + */ + DRIVING_NOT_ALLOWED(3, "DRIVING_NOT_ALLOWED", "DRIVING_NOT_ALLOWED"), + + /** + * The 'USE HARD SHOULDER AS LANE' literal object. + * + * + * @see #USE_HARD_SHOULDER_AS_LANE_VALUE + * @generated + * @ordered + */ + USE_HARD_SHOULDER_AS_LANE(4, "USE_HARD_SHOULDER_AS_LANE", "USE_HARD_SHOULDER_AS_LANE"), + + /** + * The 'WAIT FOR POLICE PATROL' literal object. + * + * + * @see #WAIT_FOR_POLICE_PATROL_VALUE + * @generated + * @ordered + */ + WAIT_FOR_POLICE_PATROL(5, "WAIT_FOR_POLICE_PATROL", "WAIT_FOR_POLICE_PATROL"), + + /** + * The 'WAIT FOR IMPROVED WEATHER' literal object. + * + * + * @see #WAIT_FOR_IMPROVED_WEATHER_VALUE + * @generated + * @ordered + */ + WAIT_FOR_IMPROVED_WEATHER(6, "WAIT_FOR_IMPROVED_WEATHER", "WAIT_FOR_IMPROVED_WEATHER"), + + /** + * The 'GIVING PATH VEHICLES COMING FROM BEHIND' literal object. + * + * + * @see #GIVING_PATH_VEHICLES_COMING_FROM_BEHIND_VALUE + * @generated + * @ordered + */ + GIVING_PATH_VEHICLES_COMING_FROM_BEHIND(7, "GIVING_PATH_VEHICLES_COMING_FROM_BEHIND", "GIVING_PATH_VEHICLES_COMING_FROM_BEHIND"), + + /** + * The 'FOLLOW DIVERSION' literal object. + * + * + * @see #FOLLOW_DIVERSION_VALUE + * @generated + * @ordered + */ + FOLLOW_DIVERSION(8, "FOLLOW_DIVERSION", "FOLLOW_DIVERSION"), + + /** + * The 'NO DIVERSION TO RECOMMEND' literal object. + * + * + * @see #NO_DIVERSION_TO_RECOMMEND_VALUE + * @generated + * @ordered + */ + NO_DIVERSION_TO_RECOMMEND(9, "NO_DIVERSION_TO_RECOMMEND", "NO_DIVERSION_TO_RECOMMEND"), + + /** + * The 'DO NOT DIVERT' literal object. + * + * + * @see #DO_NOT_DIVERT_VALUE + * @generated + * @ordered + */ + DO_NOT_DIVERT(10, "DO_NOT_DIVERT", "DO_NOT_DIVERT"), + + /** + * The 'FOLLOW POLICE INSTRUCTIONS' literal object. + * + * + * @see #FOLLOW_POLICE_INSTRUCTIONS_VALUE + * @generated + * @ordered + */ + FOLLOW_POLICE_INSTRUCTIONS(11, "FOLLOW_POLICE_INSTRUCTIONS", "FOLLOW_POLICE_INSTRUCTIONS"), + + /** + * The 'AVOID THE AREA' literal object. + * + * + * @see #AVOID_THE_AREA_VALUE + * @generated + * @ordered + */ + AVOID_THE_AREA(12, "AVOID_THE_AREA", "AVOID_THE_AREA"), + + /** + * The 'DRIVE CAREFULLY' literal object. + * + * + * @see #DRIVE_CAREFULLY_VALUE + * @generated + * @ordered + */ + DRIVE_CAREFULLY(13, "DRIVE_CAREFULLY", "DRIVE_CAREFULLY"), + + /** + * The 'DO NOT LEAVE YOUR VEHICLE' literal object. + * + * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE_VALUE + * @generated + * @ordered + */ + DO_NOT_LEAVE_YOUR_VEHICLE(14, "DO_NOT_LEAVE_YOUR_VEHICLE", "DO_NOT_LEAVE_YOUR_VEHICLE"), + + /** + * The 'SWITCH ON RADIO' literal object. + * + * + * @see #SWITCH_ON_RADIO_VALUE + * @generated + * @ordered + */ + SWITCH_ON_RADIO(15, "SWITCH_ON_RADIO", "SWITCH_ON_RADIO"), + + /** + * The 'USE TOLL LANES' literal object. + * + * + * @see #USE_TOLL_LANES_VALUE + * @generated + * @ordered + */ + USE_TOLL_LANES(16, "USE_TOLL_LANES", "USE_TOLL_LANES"), + + /** + * The 'WAIT FOR CONVOI' literal object. + * + * + * @see #WAIT_FOR_CONVOI_VALUE + * @generated + * @ordered + */ + WAIT_FOR_CONVOI(17, "WAIT_FOR_CONVOI", "WAIT_FOR_CONVOI"); + + /** + * The 'DRIVE TO NEXT AVAILABLE PARKING PLACE' literal value. + * + *

+ * If the meaning of 'DRIVE TO NEXT AVAILABLE PARKING PLACE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE + * @model + * @generated + * @ordered + */ + public static final int DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE_VALUE = 1; + + /** + * The 'OVERTAKING NOT ALLOWED' literal value. + * + *

+ * If the meaning of 'OVERTAKING NOT ALLOWED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OVERTAKING_NOT_ALLOWED + * @model + * @generated + * @ordered + */ + public static final int OVERTAKING_NOT_ALLOWED_VALUE = 2; + + /** + * The 'DRIVING NOT ALLOWED' literal value. + * + *

+ * If the meaning of 'DRIVING NOT ALLOWED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVING_NOT_ALLOWED + * @model + * @generated + * @ordered + */ + public static final int DRIVING_NOT_ALLOWED_VALUE = 3; + + /** + * The 'USE HARD SHOULDER AS LANE' literal value. + * + *

+ * If the meaning of 'USE HARD SHOULDER AS LANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #USE_HARD_SHOULDER_AS_LANE + * @model + * @generated + * @ordered + */ + public static final int USE_HARD_SHOULDER_AS_LANE_VALUE = 4; + + /** + * The 'WAIT FOR POLICE PATROL' literal value. + * + *

+ * If the meaning of 'WAIT FOR POLICE PATROL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WAIT_FOR_POLICE_PATROL + * @model + * @generated + * @ordered + */ + public static final int WAIT_FOR_POLICE_PATROL_VALUE = 5; + + /** + * The 'WAIT FOR IMPROVED WEATHER' literal value. + * + *

+ * If the meaning of 'WAIT FOR IMPROVED WEATHER' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WAIT_FOR_IMPROVED_WEATHER + * @model + * @generated + * @ordered + */ + public static final int WAIT_FOR_IMPROVED_WEATHER_VALUE = 6; + + /** + * The 'GIVING PATH VEHICLES COMING FROM BEHIND' literal value. + * + *

+ * If the meaning of 'GIVING PATH VEHICLES COMING FROM BEHIND' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GIVING_PATH_VEHICLES_COMING_FROM_BEHIND + * @model + * @generated + * @ordered + */ + public static final int GIVING_PATH_VEHICLES_COMING_FROM_BEHIND_VALUE = 7; + + /** + * The 'FOLLOW DIVERSION' literal value. + * + *

+ * If the meaning of 'FOLLOW DIVERSION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FOLLOW_DIVERSION + * @model + * @generated + * @ordered + */ + public static final int FOLLOW_DIVERSION_VALUE = 8; + + /** + * The 'NO DIVERSION TO RECOMMEND' literal value. + * + *

+ * If the meaning of 'NO DIVERSION TO RECOMMEND' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NO_DIVERSION_TO_RECOMMEND + * @model + * @generated + * @ordered + */ + public static final int NO_DIVERSION_TO_RECOMMEND_VALUE = 9; + + /** + * The 'DO NOT DIVERT' literal value. + * + *

+ * If the meaning of 'DO NOT DIVERT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DO_NOT_DIVERT + * @model + * @generated + * @ordered + */ + public static final int DO_NOT_DIVERT_VALUE = 10; + + /** + * The 'FOLLOW POLICE INSTRUCTIONS' literal value. + * + *

+ * If the meaning of 'FOLLOW POLICE INSTRUCTIONS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FOLLOW_POLICE_INSTRUCTIONS + * @model + * @generated + * @ordered + */ + public static final int FOLLOW_POLICE_INSTRUCTIONS_VALUE = 11; + + /** + * The 'AVOID THE AREA' literal value. + * + *

+ * If the meaning of 'AVOID THE AREA' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AVOID_THE_AREA + * @model + * @generated + * @ordered + */ + public static final int AVOID_THE_AREA_VALUE = 12; + + /** + * The 'DRIVE CAREFULLY' literal value. + * + *

+ * If the meaning of 'DRIVE CAREFULLY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVE_CAREFULLY + * @model + * @generated + * @ordered + */ + public static final int DRIVE_CAREFULLY_VALUE = 13; + + /** + * The 'DO NOT LEAVE YOUR VEHICLE' literal value. + * + *

+ * If the meaning of 'DO NOT LEAVE YOUR VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int DO_NOT_LEAVE_YOUR_VEHICLE_VALUE = 14; + + /** + * The 'SWITCH ON RADIO' literal value. + * + *

+ * If the meaning of 'SWITCH ON RADIO' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SWITCH_ON_RADIO + * @model + * @generated + * @ordered + */ + public static final int SWITCH_ON_RADIO_VALUE = 15; + + /** + * The 'USE TOLL LANES' literal value. + * + *

+ * If the meaning of 'USE TOLL LANES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #USE_TOLL_LANES + * @model + * @generated + * @ordered + */ + public static final int USE_TOLL_LANES_VALUE = 16; + + /** + * The 'WAIT FOR CONVOI' literal value. + * + *

+ * If the meaning of 'WAIT FOR CONVOI' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WAIT_FOR_CONVOI + * @model + * @generated + * @ordered + */ + public static final int WAIT_FOR_CONVOI_VALUE = 17; + + /** + * An array of all the 'Advice Code' enumerators. + * + * + * @generated + */ + private static final AdviceCode[] VALUES_ARRAY = + new AdviceCode[] { + DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE, + OVERTAKING_NOT_ALLOWED, + DRIVING_NOT_ALLOWED, + USE_HARD_SHOULDER_AS_LANE, + WAIT_FOR_POLICE_PATROL, + WAIT_FOR_IMPROVED_WEATHER, + GIVING_PATH_VEHICLES_COMING_FROM_BEHIND, + FOLLOW_DIVERSION, + NO_DIVERSION_TO_RECOMMEND, + DO_NOT_DIVERT, + FOLLOW_POLICE_INSTRUCTIONS, + AVOID_THE_AREA, + DRIVE_CAREFULLY, + DO_NOT_LEAVE_YOUR_VEHICLE, + SWITCH_ON_RADIO, + USE_TOLL_LANES, + WAIT_FOR_CONVOI, + }; + + /** + * A public read-only list of all the 'Advice Code' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Advice Code' literal with the specified literal value. + * + * + * @generated + */ + public static AdviceCode get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + AdviceCode result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Advice Code' literal with the specified name. + * + * + * @generated + */ + public static AdviceCode getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + AdviceCode result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Advice Code' literal with the specified integer value. + * + * + * @generated + */ + public static AdviceCode get(int value) { + switch (value) { + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE_VALUE: return DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE; + case OVERTAKING_NOT_ALLOWED_VALUE: return OVERTAKING_NOT_ALLOWED; + case DRIVING_NOT_ALLOWED_VALUE: return DRIVING_NOT_ALLOWED; + case USE_HARD_SHOULDER_AS_LANE_VALUE: return USE_HARD_SHOULDER_AS_LANE; + case WAIT_FOR_POLICE_PATROL_VALUE: return WAIT_FOR_POLICE_PATROL; + case WAIT_FOR_IMPROVED_WEATHER_VALUE: return WAIT_FOR_IMPROVED_WEATHER; + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND_VALUE: return GIVING_PATH_VEHICLES_COMING_FROM_BEHIND; + case FOLLOW_DIVERSION_VALUE: return FOLLOW_DIVERSION; + case NO_DIVERSION_TO_RECOMMEND_VALUE: return NO_DIVERSION_TO_RECOMMEND; + case DO_NOT_DIVERT_VALUE: return DO_NOT_DIVERT; + case FOLLOW_POLICE_INSTRUCTIONS_VALUE: return FOLLOW_POLICE_INSTRUCTIONS; + case AVOID_THE_AREA_VALUE: return AVOID_THE_AREA; + case DRIVE_CAREFULLY_VALUE: return DRIVE_CAREFULLY; + case DO_NOT_LEAVE_YOUR_VEHICLE_VALUE: return DO_NOT_LEAVE_YOUR_VEHICLE; + case SWITCH_ON_RADIO_VALUE: return SWITCH_ON_RADIO; + case USE_TOLL_LANES_VALUE: return USE_TOLL_LANES; + case WAIT_FOR_CONVOI_VALUE: return WAIT_FOR_CONVOI; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private AdviceCode(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //AdviceCode diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AnimalsOnRoadway.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AnimalsOnRoadway.java new file mode 100755 index 0000000..162f6d2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/AnimalsOnRoadway.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Animals On Roadway', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getAnimalsOnRoadway() + * @model + * @generated + */ +public enum AnimalsOnRoadway implements Enumerator { + /** + * The 'WILD ANIMALS' literal object. + * + * + * @see #WILD_ANIMALS_VALUE + * @generated + * @ordered + */ + WILD_ANIMALS(1, "WILD_ANIMALS", "WILD_ANIMALS"), + + /** + * The 'HERD OF ANIMALS' literal object. + * + * + * @see #HERD_OF_ANIMALS_VALUE + * @generated + * @ordered + */ + HERD_OF_ANIMALS(2, "HERD_OF_ANIMALS", "HERD_OF_ANIMALS"), + + /** + * The 'SMALL ANIMALS' literal object. + * + * + * @see #SMALL_ANIMALS_VALUE + * @generated + * @ordered + */ + SMALL_ANIMALS(3, "SMALL_ANIMALS", "SMALL_ANIMALS"), + + /** + * The 'LARGE ANIMALS' literal object. + * + * + * @see #LARGE_ANIMALS_VALUE + * @generated + * @ordered + */ + LARGE_ANIMALS(4, "LARGE_ANIMALS", "LARGE_ANIMALS"); + + /** + * The 'WILD ANIMALS' literal value. + * + *

+ * If the meaning of 'WILD ANIMALS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WILD_ANIMALS + * @model + * @generated + * @ordered + */ + public static final int WILD_ANIMALS_VALUE = 1; + + /** + * The 'HERD OF ANIMALS' literal value. + * + *

+ * If the meaning of 'HERD OF ANIMALS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HERD_OF_ANIMALS + * @model + * @generated + * @ordered + */ + public static final int HERD_OF_ANIMALS_VALUE = 2; + + /** + * The 'SMALL ANIMALS' literal value. + * + *

+ * If the meaning of 'SMALL ANIMALS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SMALL_ANIMALS + * @model + * @generated + * @ordered + */ + public static final int SMALL_ANIMALS_VALUE = 3; + + /** + * The 'LARGE ANIMALS' literal value. + * + *

+ * If the meaning of 'LARGE ANIMALS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LARGE_ANIMALS + * @model + * @generated + * @ordered + */ + public static final int LARGE_ANIMALS_VALUE = 4; + + /** + * An array of all the 'Animals On Roadway' enumerators. + * + * + * @generated + */ + private static final AnimalsOnRoadway[] VALUES_ARRAY = + new AnimalsOnRoadway[] { + WILD_ANIMALS, + HERD_OF_ANIMALS, + SMALL_ANIMALS, + LARGE_ANIMALS, + }; + + /** + * A public read-only list of all the 'Animals On Roadway' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Animals On Roadway' literal with the specified literal value. + * + * + * @generated + */ + public static AnimalsOnRoadway get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + AnimalsOnRoadway result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Animals On Roadway' literal with the specified name. + * + * + * @generated + */ + public static AnimalsOnRoadway getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + AnimalsOnRoadway result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Animals On Roadway' literal with the specified integer value. + * + * + * @generated + */ + public static AnimalsOnRoadway get(int value) { + switch (value) { + case WILD_ANIMALS_VALUE: return WILD_ANIMALS; + case HERD_OF_ANIMALS_VALUE: return HERD_OF_ANIMALS; + case SMALL_ANIMALS_VALUE: return SMALL_ANIMALS; + case LARGE_ANIMALS_VALUE: return LARGE_ANIMALS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private AnimalsOnRoadway(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //AnimalsOnRoadway diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/BrokenDownVehicles.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/BrokenDownVehicles.java new file mode 100755 index 0000000..d4e7279 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/BrokenDownVehicles.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Broken Down Vehicles', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getBrokenDownVehicles() + * @model + * @generated + */ +public enum BrokenDownVehicles implements Enumerator { + /** + * The 'BROKEN DOWN VEHICLE BURNING' literal object. + * + * + * @see #BROKEN_DOWN_VEHICLE_BURNING_VALUE + * @generated + * @ordered + */ + BROKEN_DOWN_VEHICLE_BURNING(1, "BROKEN_DOWN_VEHICLE_BURNING", "BROKEN_DOWN_VEHICLE_BURNING"), + + /** + * The 'BROKEN DOWN UNLIT VEHICLE' literal object. + * + * + * @see #BROKEN_DOWN_UNLIT_VEHICLE_VALUE + * @generated + * @ordered + */ + BROKEN_DOWN_UNLIT_VEHICLE(2, "BROKEN_DOWN_UNLIT_VEHICLE", "BROKEN_DOWN_UNLIT_VEHICLE"); + + /** + * The 'BROKEN DOWN VEHICLE BURNING' literal value. + * + *

+ * If the meaning of 'BROKEN DOWN VEHICLE BURNING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BROKEN_DOWN_VEHICLE_BURNING + * @model + * @generated + * @ordered + */ + public static final int BROKEN_DOWN_VEHICLE_BURNING_VALUE = 1; + + /** + * The 'BROKEN DOWN UNLIT VEHICLE' literal value. + * + *

+ * If the meaning of 'BROKEN DOWN UNLIT VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BROKEN_DOWN_UNLIT_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int BROKEN_DOWN_UNLIT_VEHICLE_VALUE = 2; + + /** + * An array of all the 'Broken Down Vehicles' enumerators. + * + * + * @generated + */ + private static final BrokenDownVehicles[] VALUES_ARRAY = + new BrokenDownVehicles[] { + BROKEN_DOWN_VEHICLE_BURNING, + BROKEN_DOWN_UNLIT_VEHICLE, + }; + + /** + * A public read-only list of all the 'Broken Down Vehicles' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Broken Down Vehicles' literal with the specified literal value. + * + * + * @generated + */ + public static BrokenDownVehicles get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + BrokenDownVehicles result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Broken Down Vehicles' literal with the specified name. + * + * + * @generated + */ + public static BrokenDownVehicles getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + BrokenDownVehicles result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Broken Down Vehicles' literal with the specified integer value. + * + * + * @generated + */ + public static BrokenDownVehicles get(int value) { + switch (value) { + case BROKEN_DOWN_VEHICLE_BURNING_VALUE: return BROKEN_DOWN_VEHICLE_BURNING; + case BROKEN_DOWN_UNLIT_VEHICLE_VALUE: return BROKEN_DOWN_UNLIT_VEHICLE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private BrokenDownVehicles(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //BrokenDownVehicles diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/CauseCode.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/CauseCode.java new file mode 100755 index 0000000..4e31daa --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/CauseCode.java @@ -0,0 +1,996 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Cause Code', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getCauseCode() + * @model + * @generated + */ +public enum CauseCode implements Enumerator { + /** + * The 'TRAFFIC CONGESTION' literal object. + * + * + * @see #TRAFFIC_CONGESTION_VALUE + * @generated + * @ordered + */ + TRAFFIC_CONGESTION(1, "TRAFFIC_CONGESTION", "TRAFFIC_CONGESTION"), + + /** + * The 'ACCIDENT' literal object. + * + * + * @see #ACCIDENT_VALUE + * @generated + * @ordered + */ + ACCIDENT(2, "ACCIDENT", "ACCIDENT"), + + /** + * The 'ROADWORKS' literal object. + * + * + * @see #ROADWORKS_VALUE + * @generated + * @ordered + */ + ROADWORKS(3, "ROADWORKS", "ROADWORKS"), + + /** + * The 'NARROW LANES' literal object. + * + * + * @see #NARROW_LANES_VALUE + * @generated + * @ordered + */ + NARROW_LANES(4, "NARROW_LANES", "NARROW_LANES"), + + /** + * The 'IMPASSIBILITY' literal object. + * + * + * @see #IMPASSIBILITY_VALUE + * @generated + * @ordered + */ + IMPASSIBILITY(5, "IMPASSIBILITY", "IMPASSIBILITY"), + + /** + * The 'SLIPPERY ROAD' literal object. + * + * + * @see #SLIPPERY_ROAD_VALUE + * @generated + * @ordered + */ + SLIPPERY_ROAD(6, "SLIPPERY_ROAD", "SLIPPERY_ROAD"), + + /** + * The 'AQUAPLANING' literal object. + * + * + * @see #AQUAPLANING_VALUE + * @generated + * @ordered + */ + AQUAPLANING(7, "AQUAPLANING", "AQUAPLANING"), + + /** + * The 'FIRE' literal object. + * + * + * @see #FIRE_VALUE + * @generated + * @ordered + */ + FIRE(8, "FIRE", "FIRE"), + + /** + * The 'HAZARDOUS DRIVING CONDITIONS' literal object. + * + * + * @see #HAZARDOUS_DRIVING_CONDITIONS_VALUE + * @generated + * @ordered + */ + HAZARDOUS_DRIVING_CONDITIONS(9, "HAZARDOUS_DRIVING_CONDITIONS", "HAZARDOUS_DRIVING_CONDITIONS"), + + /** + * The 'OBJECTS ON THE ROAD' literal object. + * + * + * @see #OBJECTS_ON_THE_ROAD_VALUE + * @generated + * @ordered + */ + OBJECTS_ON_THE_ROAD(10, "OBJECTS_ON_THE_ROAD", "OBJECTS_ON_THE_ROAD"), + + /** + * The 'ANIMALS ON ROADWAY' literal object. + * + * + * @see #ANIMALS_ON_ROADWAY_VALUE + * @generated + * @ordered + */ + ANIMALS_ON_ROADWAY(11, "ANIMALS_ON_ROADWAY", "ANIMALS_ON_ROADWAY"), + + /** + * The 'PEOPLE ON ROADWAY' literal object. + * + * + * @see #PEOPLE_ON_ROADWAY_VALUE + * @generated + * @ordered + */ + PEOPLE_ON_ROADWAY(12, "PEOPLE_ON_ROADWAY", "PEOPLE_ON_ROADWAY"), + + /** + * The 'BROKEN DOWN VEHICLES' literal object. + * + * + * @see #BROKEN_DOWN_VEHICLES_VALUE + * @generated + * @ordered + */ + BROKEN_DOWN_VEHICLES(13, "BROKEN_DOWN_VEHICLES", "BROKEN_DOWN_VEHICLES"), + + /** + * The 'VEHICLE ON WRONG CARRIAGEWAY' literal object. + * + * + * @see #VEHICLE_ON_WRONG_CARRIAGEWAY_VALUE + * @generated + * @ordered + */ + VEHICLE_ON_WRONG_CARRIAGEWAY(14, "VEHICLE_ON_WRONG_CARRIAGEWAY", "VEHICLE_ON_WRONG_CARRIAGEWAY"), + + /** + * The 'RESCUE AND RECOVERY WORK IN PROGRESS' literal object. + * + * + * @see #RESCUE_AND_RECOVERY_WORK_IN_PROGRESS_VALUE + * @generated + * @ordered + */ + RESCUE_AND_RECOVERY_WORK_IN_PROGRESS(15, "RESCUE_AND_RECOVERY_WORK_IN_PROGRESS", "RESCUE_AND_RECOVERY_WORK_IN_PROGRESS"), + + /** + * The 'REGULATORY MEASURE' literal object. + * + * + * @see #REGULATORY_MEASURE_VALUE + * @generated + * @ordered + */ + REGULATORY_MEASURE(16, "REGULATORY_MEASURE", "REGULATORY_MEASURE"), + + /** + * The 'EXTREME WEATHER CONDITIONS' literal object. + * + * + * @see #EXTREME_WEATHER_CONDITIONS_VALUE + * @generated + * @ordered + */ + EXTREME_WEATHER_CONDITIONS(17, "EXTREME_WEATHER_CONDITIONS", "EXTREME_WEATHER_CONDITIONS"), + + /** + * The 'VISIBILITY REDUCED' literal object. + * + * + * @see #VISIBILITY_REDUCED_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED(18, "VISIBILITY_REDUCED", "VISIBILITY_REDUCED"), + + /** + * The 'PRECIPITATION' literal object. + * + * + * @see #PRECIPITATION_VALUE + * @generated + * @ordered + */ + PRECIPITATION(19, "PRECIPITATION", "PRECIPITATION"), + + /** + * The 'RECKLESS PERSONS' literal object. + * + * + * @see #RECKLESS_PERSONS_VALUE + * @generated + * @ordered + */ + RECKLESS_PERSONS(20, "RECKLESS_PERSONS", "RECKLESS_PERSONS"), + + /** + * The 'OVER HEIGHT WARNING SYSTEM TRIGGERED' literal object. + * + * + * @see #OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED_VALUE + * @generated + * @ordered + */ + OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED(21, "OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED", "OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED"), + + /** + * The 'TRAFFIC REGULATIONS CHANGED' literal object. + * + * + * @see #TRAFFIC_REGULATIONS_CHANGED_VALUE + * @generated + * @ordered + */ + TRAFFIC_REGULATIONS_CHANGED(22, "TRAFFIC_REGULATIONS_CHANGED", "TRAFFIC_REGULATIONS_CHANGED"), + + /** + * The 'MAJOR EVENT' literal object. + * + * + * @see #MAJOR_EVENT_VALUE + * @generated + * @ordered + */ + MAJOR_EVENT(23, "MAJOR_EVENT", "MAJOR_EVENT"), + + /** + * The 'SERVICE NOT OPERATING' literal object. + * + * + * @see #SERVICE_NOT_OPERATING_VALUE + * @generated + * @ordered + */ + SERVICE_NOT_OPERATING(24, "SERVICE_NOT_OPERATING", "SERVICE_NOT_OPERATING"), + + /** + * The 'SERVICE NOT USEABLE' literal object. + * + * + * @see #SERVICE_NOT_USEABLE_VALUE + * @generated + * @ordered + */ + SERVICE_NOT_USEABLE(25, "SERVICE_NOT_USEABLE", "SERVICE_NOT_USEABLE"), + + /** + * The 'SLOW MOVING VEHICLES' literal object. + * + * + * @see #SLOW_MOVING_VEHICLES_VALUE + * @generated + * @ordered + */ + SLOW_MOVING_VEHICLES(26, "SLOW_MOVING_VEHICLES", "SLOW_MOVING_VEHICLES"), + + /** + * The 'DANGEROUS END OF QUEUE' literal object. + * + * + * @see #DANGEROUS_END_OF_QUEUE_VALUE + * @generated + * @ordered + */ + DANGEROUS_END_OF_QUEUE(27, "DANGEROUS_END_OF_QUEUE", "DANGEROUS_END_OF_QUEUE"), + + /** + * The 'RISK OF FIRE' literal object. + * + * + * @see #RISK_OF_FIRE_VALUE + * @generated + * @ordered + */ + RISK_OF_FIRE(28, "RISK_OF_FIRE", "RISK_OF_FIRE"), + + /** + * The 'TIME DELAY' literal object. + * + * + * @see #TIME_DELAY_VALUE + * @generated + * @ordered + */ + TIME_DELAY(29, "TIME_DELAY", "TIME_DELAY"), + + /** + * The 'POLICE CHECKPOINT' literal object. + * + * + * @see #POLICE_CHECKPOINT_VALUE + * @generated + * @ordered + */ + POLICE_CHECKPOINT(30, "POLICE_CHECKPOINT", "POLICE_CHECKPOINT"), + + /** + * The 'MALFUNCTIONING ROADSIDE EQUIPMENT' literal object. + * + * + * @see #MALFUNCTIONING_ROADSIDE_EQUIPMENT_VALUE + * @generated + * @ordered + */ + MALFUNCTIONING_ROADSIDE_EQUIPMENT(31, "MALFUNCTIONING_ROADSIDE_EQUIPMENT", "MALFUNCTIONING_ROADSIDE_EQUIPMENT"); + + /** + * The 'TRAFFIC CONGESTION' literal value. + * + *

+ * If the meaning of 'TRAFFIC CONGESTION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAFFIC_CONGESTION + * @model + * @generated + * @ordered + */ + public static final int TRAFFIC_CONGESTION_VALUE = 1; + + /** + * The 'ACCIDENT' literal value. + * + *

+ * If the meaning of 'ACCIDENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ACCIDENT + * @model + * @generated + * @ordered + */ + public static final int ACCIDENT_VALUE = 2; + + /** + * The 'ROADWORKS' literal value. + * + *

+ * If the meaning of 'ROADWORKS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROADWORKS + * @model + * @generated + * @ordered + */ + public static final int ROADWORKS_VALUE = 3; + + /** + * The 'NARROW LANES' literal value. + * + *

+ * If the meaning of 'NARROW LANES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NARROW_LANES + * @model + * @generated + * @ordered + */ + public static final int NARROW_LANES_VALUE = 4; + + /** + * The 'IMPASSIBILITY' literal value. + * + *

+ * If the meaning of 'IMPASSIBILITY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #IMPASSIBILITY + * @model + * @generated + * @ordered + */ + public static final int IMPASSIBILITY_VALUE = 5; + + /** + * The 'SLIPPERY ROAD' literal value. + * + *

+ * If the meaning of 'SLIPPERY ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLIPPERY_ROAD + * @model + * @generated + * @ordered + */ + public static final int SLIPPERY_ROAD_VALUE = 6; + + /** + * The 'AQUAPLANING' literal value. + * + *

+ * If the meaning of 'AQUAPLANING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AQUAPLANING + * @model + * @generated + * @ordered + */ + public static final int AQUAPLANING_VALUE = 7; + + /** + * The 'FIRE' literal value. + * + *

+ * If the meaning of 'FIRE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FIRE + * @model + * @generated + * @ordered + */ + public static final int FIRE_VALUE = 8; + + /** + * The 'HAZARDOUS DRIVING CONDITIONS' literal value. + * + *

+ * If the meaning of 'HAZARDOUS DRIVING CONDITIONS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HAZARDOUS_DRIVING_CONDITIONS + * @model + * @generated + * @ordered + */ + public static final int HAZARDOUS_DRIVING_CONDITIONS_VALUE = 9; + + /** + * The 'OBJECTS ON THE ROAD' literal value. + * + *

+ * If the meaning of 'OBJECTS ON THE ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OBJECTS_ON_THE_ROAD + * @model + * @generated + * @ordered + */ + public static final int OBJECTS_ON_THE_ROAD_VALUE = 10; + + /** + * The 'ANIMALS ON ROADWAY' literal value. + * + *

+ * If the meaning of 'ANIMALS ON ROADWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ANIMALS_ON_ROADWAY + * @model + * @generated + * @ordered + */ + public static final int ANIMALS_ON_ROADWAY_VALUE = 11; + + /** + * The 'PEOPLE ON ROADWAY' literal value. + * + *

+ * If the meaning of 'PEOPLE ON ROADWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PEOPLE_ON_ROADWAY + * @model + * @generated + * @ordered + */ + public static final int PEOPLE_ON_ROADWAY_VALUE = 12; + + /** + * The 'BROKEN DOWN VEHICLES' literal value. + * + *

+ * If the meaning of 'BROKEN DOWN VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BROKEN_DOWN_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int BROKEN_DOWN_VEHICLES_VALUE = 13; + + /** + * The 'VEHICLE ON WRONG CARRIAGEWAY' literal value. + * + *

+ * If the meaning of 'VEHICLE ON WRONG CARRIAGEWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_ON_WRONG_CARRIAGEWAY + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_ON_WRONG_CARRIAGEWAY_VALUE = 14; + + /** + * The 'RESCUE AND RECOVERY WORK IN PROGRESS' literal value. + * + *

+ * If the meaning of 'RESCUE AND RECOVERY WORK IN PROGRESS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RESCUE_AND_RECOVERY_WORK_IN_PROGRESS + * @model + * @generated + * @ordered + */ + public static final int RESCUE_AND_RECOVERY_WORK_IN_PROGRESS_VALUE = 15; + + /** + * The 'REGULATORY MEASURE' literal value. + * + *

+ * If the meaning of 'REGULATORY MEASURE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #REGULATORY_MEASURE + * @model + * @generated + * @ordered + */ + public static final int REGULATORY_MEASURE_VALUE = 16; + + /** + * The 'EXTREME WEATHER CONDITIONS' literal value. + * + *

+ * If the meaning of 'EXTREME WEATHER CONDITIONS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EXTREME_WEATHER_CONDITIONS + * @model + * @generated + * @ordered + */ + public static final int EXTREME_WEATHER_CONDITIONS_VALUE = 17; + + /** + * The 'VISIBILITY REDUCED' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_VALUE = 18; + + /** + * The 'PRECIPITATION' literal value. + * + *

+ * If the meaning of 'PRECIPITATION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PRECIPITATION + * @model + * @generated + * @ordered + */ + public static final int PRECIPITATION_VALUE = 19; + + /** + * The 'RECKLESS PERSONS' literal value. + * + *

+ * If the meaning of 'RECKLESS PERSONS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RECKLESS_PERSONS + * @model + * @generated + * @ordered + */ + public static final int RECKLESS_PERSONS_VALUE = 20; + + /** + * The 'OVER HEIGHT WARNING SYSTEM TRIGGERED' literal value. + * + *

+ * If the meaning of 'OVER HEIGHT WARNING SYSTEM TRIGGERED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED + * @model + * @generated + * @ordered + */ + public static final int OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED_VALUE = 21; + + /** + * The 'TRAFFIC REGULATIONS CHANGED' literal value. + * + *

+ * If the meaning of 'TRAFFIC REGULATIONS CHANGED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAFFIC_REGULATIONS_CHANGED + * @model + * @generated + * @ordered + */ + public static final int TRAFFIC_REGULATIONS_CHANGED_VALUE = 22; + + /** + * The 'MAJOR EVENT' literal value. + * + *

+ * If the meaning of 'MAJOR EVENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MAJOR_EVENT + * @model + * @generated + * @ordered + */ + public static final int MAJOR_EVENT_VALUE = 23; + + /** + * The 'SERVICE NOT OPERATING' literal value. + * + *

+ * If the meaning of 'SERVICE NOT OPERATING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SERVICE_NOT_OPERATING + * @model + * @generated + * @ordered + */ + public static final int SERVICE_NOT_OPERATING_VALUE = 24; + + /** + * The 'SERVICE NOT USEABLE' literal value. + * + *

+ * If the meaning of 'SERVICE NOT USEABLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SERVICE_NOT_USEABLE + * @model + * @generated + * @ordered + */ + public static final int SERVICE_NOT_USEABLE_VALUE = 25; + + /** + * The 'SLOW MOVING VEHICLES' literal value. + * + *

+ * If the meaning of 'SLOW MOVING VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLOW_MOVING_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int SLOW_MOVING_VEHICLES_VALUE = 26; + + /** + * The 'DANGEROUS END OF QUEUE' literal value. + * + *

+ * If the meaning of 'DANGEROUS END OF QUEUE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DANGEROUS_END_OF_QUEUE + * @model + * @generated + * @ordered + */ + public static final int DANGEROUS_END_OF_QUEUE_VALUE = 27; + + /** + * The 'RISK OF FIRE' literal value. + * + *

+ * If the meaning of 'RISK OF FIRE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RISK_OF_FIRE + * @model + * @generated + * @ordered + */ + public static final int RISK_OF_FIRE_VALUE = 28; + + /** + * The 'TIME DELAY' literal value. + * + *

+ * If the meaning of 'TIME DELAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TIME_DELAY + * @model + * @generated + * @ordered + */ + public static final int TIME_DELAY_VALUE = 29; + + /** + * The 'POLICE CHECKPOINT' literal value. + * + *

+ * If the meaning of 'POLICE CHECKPOINT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #POLICE_CHECKPOINT + * @model + * @generated + * @ordered + */ + public static final int POLICE_CHECKPOINT_VALUE = 30; + + /** + * The 'MALFUNCTIONING ROADSIDE EQUIPMENT' literal value. + * + *

+ * If the meaning of 'MALFUNCTIONING ROADSIDE EQUIPMENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MALFUNCTIONING_ROADSIDE_EQUIPMENT + * @model + * @generated + * @ordered + */ + public static final int MALFUNCTIONING_ROADSIDE_EQUIPMENT_VALUE = 31; + + /** + * An array of all the 'Cause Code' enumerators. + * + * + * @generated + */ + private static final CauseCode[] VALUES_ARRAY = + new CauseCode[] { + TRAFFIC_CONGESTION, + ACCIDENT, + ROADWORKS, + NARROW_LANES, + IMPASSIBILITY, + SLIPPERY_ROAD, + AQUAPLANING, + FIRE, + HAZARDOUS_DRIVING_CONDITIONS, + OBJECTS_ON_THE_ROAD, + ANIMALS_ON_ROADWAY, + PEOPLE_ON_ROADWAY, + BROKEN_DOWN_VEHICLES, + VEHICLE_ON_WRONG_CARRIAGEWAY, + RESCUE_AND_RECOVERY_WORK_IN_PROGRESS, + REGULATORY_MEASURE, + EXTREME_WEATHER_CONDITIONS, + VISIBILITY_REDUCED, + PRECIPITATION, + RECKLESS_PERSONS, + OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED, + TRAFFIC_REGULATIONS_CHANGED, + MAJOR_EVENT, + SERVICE_NOT_OPERATING, + SERVICE_NOT_USEABLE, + SLOW_MOVING_VEHICLES, + DANGEROUS_END_OF_QUEUE, + RISK_OF_FIRE, + TIME_DELAY, + POLICE_CHECKPOINT, + MALFUNCTIONING_ROADSIDE_EQUIPMENT, + }; + + /** + * A public read-only list of all the 'Cause Code' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Cause Code' literal with the specified literal value. + * + * + * @generated + */ + public static CauseCode get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + CauseCode result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Cause Code' literal with the specified name. + * + * + * @generated + */ + public static CauseCode getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + CauseCode result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Cause Code' literal with the specified integer value. + * + * + * @generated + */ + public static CauseCode get(int value) { + switch (value) { + case TRAFFIC_CONGESTION_VALUE: return TRAFFIC_CONGESTION; + case ACCIDENT_VALUE: return ACCIDENT; + case ROADWORKS_VALUE: return ROADWORKS; + case NARROW_LANES_VALUE: return NARROW_LANES; + case IMPASSIBILITY_VALUE: return IMPASSIBILITY; + case SLIPPERY_ROAD_VALUE: return SLIPPERY_ROAD; + case AQUAPLANING_VALUE: return AQUAPLANING; + case FIRE_VALUE: return FIRE; + case HAZARDOUS_DRIVING_CONDITIONS_VALUE: return HAZARDOUS_DRIVING_CONDITIONS; + case OBJECTS_ON_THE_ROAD_VALUE: return OBJECTS_ON_THE_ROAD; + case ANIMALS_ON_ROADWAY_VALUE: return ANIMALS_ON_ROADWAY; + case PEOPLE_ON_ROADWAY_VALUE: return PEOPLE_ON_ROADWAY; + case BROKEN_DOWN_VEHICLES_VALUE: return BROKEN_DOWN_VEHICLES; + case VEHICLE_ON_WRONG_CARRIAGEWAY_VALUE: return VEHICLE_ON_WRONG_CARRIAGEWAY; + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS_VALUE: return RESCUE_AND_RECOVERY_WORK_IN_PROGRESS; + case REGULATORY_MEASURE_VALUE: return REGULATORY_MEASURE; + case EXTREME_WEATHER_CONDITIONS_VALUE: return EXTREME_WEATHER_CONDITIONS; + case VISIBILITY_REDUCED_VALUE: return VISIBILITY_REDUCED; + case PRECIPITATION_VALUE: return PRECIPITATION; + case RECKLESS_PERSONS_VALUE: return RECKLESS_PERSONS; + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED_VALUE: return OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED; + case TRAFFIC_REGULATIONS_CHANGED_VALUE: return TRAFFIC_REGULATIONS_CHANGED; + case MAJOR_EVENT_VALUE: return MAJOR_EVENT; + case SERVICE_NOT_OPERATING_VALUE: return SERVICE_NOT_OPERATING; + case SERVICE_NOT_USEABLE_VALUE: return SERVICE_NOT_USEABLE; + case SLOW_MOVING_VEHICLES_VALUE: return SLOW_MOVING_VEHICLES; + case DANGEROUS_END_OF_QUEUE_VALUE: return DANGEROUS_END_OF_QUEUE; + case RISK_OF_FIRE_VALUE: return RISK_OF_FIRE; + case TIME_DELAY_VALUE: return TIME_DELAY; + case POLICE_CHECKPOINT_VALUE: return POLICE_CHECKPOINT; + case MALFUNCTIONING_ROADSIDE_EQUIPMENT_VALUE: return MALFUNCTIONING_ROADSIDE_EQUIPMENT; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private CauseCode(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //CauseCode diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DangerousEndOfQueue.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DangerousEndOfQueue.java new file mode 100755 index 0000000..f125b6a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DangerousEndOfQueue.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Dangerous End Of Queue', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getDangerousEndOfQueue() + * @model + * @generated + */ +public enum DangerousEndOfQueue implements Enumerator { + /** + * The 'SUDDEN END OF QUEUE' literal object. + * + * + * @see #SUDDEN_END_OF_QUEUE_VALUE + * @generated + * @ordered + */ + SUDDEN_END_OF_QUEUE(1, "SUDDEN_END_OF_QUEUE", "SUDDEN_END_OF_QUEUE"), + + /** + * The 'QUEUE OVER HILL' literal object. + * + * + * @see #QUEUE_OVER_HILL_VALUE + * @generated + * @ordered + */ + QUEUE_OVER_HILL(2, "QUEUE_OVER_HILL", "QUEUE_OVER_HILL"), + + /** + * The 'QUEUE AROUND BEND' literal object. + * + * + * @see #QUEUE_AROUND_BEND_VALUE + * @generated + * @ordered + */ + QUEUE_AROUND_BEND(3, "QUEUE_AROUND_BEND", "QUEUE_AROUND_BEND"), + + /** + * The 'QUEUE IN TUNNEL' literal object. + * + * + * @see #QUEUE_IN_TUNNEL_VALUE + * @generated + * @ordered + */ + QUEUE_IN_TUNNEL(4, "QUEUE_IN_TUNNEL", "QUEUE_IN_TUNNEL"); + + /** + * The 'SUDDEN END OF QUEUE' literal value. + * + *

+ * If the meaning of 'SUDDEN END OF QUEUE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SUDDEN_END_OF_QUEUE + * @model + * @generated + * @ordered + */ + public static final int SUDDEN_END_OF_QUEUE_VALUE = 1; + + /** + * The 'QUEUE OVER HILL' literal value. + * + *

+ * If the meaning of 'QUEUE OVER HILL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #QUEUE_OVER_HILL + * @model + * @generated + * @ordered + */ + public static final int QUEUE_OVER_HILL_VALUE = 2; + + /** + * The 'QUEUE AROUND BEND' literal value. + * + *

+ * If the meaning of 'QUEUE AROUND BEND' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #QUEUE_AROUND_BEND + * @model + * @generated + * @ordered + */ + public static final int QUEUE_AROUND_BEND_VALUE = 3; + + /** + * The 'QUEUE IN TUNNEL' literal value. + * + *

+ * If the meaning of 'QUEUE IN TUNNEL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #QUEUE_IN_TUNNEL + * @model + * @generated + * @ordered + */ + public static final int QUEUE_IN_TUNNEL_VALUE = 4; + + /** + * An array of all the 'Dangerous End Of Queue' enumerators. + * + * + * @generated + */ + private static final DangerousEndOfQueue[] VALUES_ARRAY = + new DangerousEndOfQueue[] { + SUDDEN_END_OF_QUEUE, + QUEUE_OVER_HILL, + QUEUE_AROUND_BEND, + QUEUE_IN_TUNNEL, + }; + + /** + * A public read-only list of all the 'Dangerous End Of Queue' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Dangerous End Of Queue' literal with the specified literal value. + * + * + * @generated + */ + public static DangerousEndOfQueue get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DangerousEndOfQueue result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Dangerous End Of Queue' literal with the specified name. + * + * + * @generated + */ + public static DangerousEndOfQueue getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DangerousEndOfQueue result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Dangerous End Of Queue' literal with the specified integer value. + * + * + * @generated + */ + public static DangerousEndOfQueue get(int value) { + switch (value) { + case SUDDEN_END_OF_QUEUE_VALUE: return SUDDEN_END_OF_QUEUE; + case QUEUE_OVER_HILL_VALUE: return QUEUE_OVER_HILL; + case QUEUE_AROUND_BEND_VALUE: return QUEUE_AROUND_BEND; + case QUEUE_IN_TUNNEL_VALUE: return QUEUE_IN_TUNNEL; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private DangerousEndOfQueue(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //DangerousEndOfQueue diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DoNotLeaveYourVehicle.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DoNotLeaveYourVehicle.java new file mode 100755 index 0000000..1f48bb4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DoNotLeaveYourVehicle.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Do Not Leave Your Vehicle', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getDoNotLeaveYourVehicle() + * @model + * @generated + */ +public enum DoNotLeaveYourVehicle implements Enumerator { + /** + * The 'DO NOT LEAVE YOUR VEHICLE' literal object. + * + * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE_VALUE + * @generated + * @ordered + */ + DO_NOT_LEAVE_YOUR_VEHICLE(1, "DO_NOT_LEAVE_YOUR_VEHICLE", "DO_NOT_LEAVE_YOUR_VEHICLE"), + + /** + * The 'DO NOT LEAVE YOUR VEHICLE CLOSE WINDOWS' literal object. + * + * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS_VALUE + * @generated + * @ordered + */ + DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS(2, "DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS", "DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS"); + + /** + * The 'DO NOT LEAVE YOUR VEHICLE' literal value. + * + *

+ * If the meaning of 'DO NOT LEAVE YOUR VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int DO_NOT_LEAVE_YOUR_VEHICLE_VALUE = 1; + + /** + * The 'DO NOT LEAVE YOUR VEHICLE CLOSE WINDOWS' literal value. + * + *

+ * If the meaning of 'DO NOT LEAVE YOUR VEHICLE CLOSE WINDOWS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS + * @model + * @generated + * @ordered + */ + public static final int DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS_VALUE = 2; + + /** + * An array of all the 'Do Not Leave Your Vehicle' enumerators. + * + * + * @generated + */ + private static final DoNotLeaveYourVehicle[] VALUES_ARRAY = + new DoNotLeaveYourVehicle[] { + DO_NOT_LEAVE_YOUR_VEHICLE, + DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS, + }; + + /** + * A public read-only list of all the 'Do Not Leave Your Vehicle' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Do Not Leave Your Vehicle' literal with the specified literal value. + * + * + * @generated + */ + public static DoNotLeaveYourVehicle get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DoNotLeaveYourVehicle result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Do Not Leave Your Vehicle' literal with the specified name. + * + * + * @generated + */ + public static DoNotLeaveYourVehicle getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DoNotLeaveYourVehicle result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Do Not Leave Your Vehicle' literal with the specified integer value. + * + * + * @generated + */ + public static DoNotLeaveYourVehicle get(int value) { + switch (value) { + case DO_NOT_LEAVE_YOUR_VEHICLE_VALUE: return DO_NOT_LEAVE_YOUR_VEHICLE; + case DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS_VALUE: return DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private DoNotLeaveYourVehicle(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //DoNotLeaveYourVehicle diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DriveCarefully.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DriveCarefully.java new file mode 100755 index 0000000..04cea96 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DriveCarefully.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Drive Carefully', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getDriveCarefully() + * @model + * @generated + */ +public enum DriveCarefully implements Enumerator { + /** + * The 'DRIVE CAREFULLY DANGEROUS SITUATION ON ENTRY SLIP ROAD' literal object. + * + * + * @see #DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD_VALUE + * @generated + * @ordered + */ + DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD(1, "DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD", "DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD"), + + /** + * The 'DRIVE CAREFULLY DANGEROUS SITUATION ON EXIT SLIP ROAD' literal object. + * + * + * @see #DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD_VALUE + * @generated + * @ordered + */ + DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD(2, "DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD", "DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD"), + + /** + * The 'DRIVE CAREFULLY ICE BUILDUP ON CABLE STRUCTURE' literal object. + * + * + * @see #DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE_VALUE + * @generated + * @ordered + */ + DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE(3, "DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE", "DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE"); + + /** + * The 'DRIVE CAREFULLY DANGEROUS SITUATION ON ENTRY SLIP ROAD' literal value. + * + *

+ * If the meaning of 'DRIVE CAREFULLY DANGEROUS SITUATION ON ENTRY SLIP ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD + * @model + * @generated + * @ordered + */ + public static final int DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD_VALUE = 1; + + /** + * The 'DRIVE CAREFULLY DANGEROUS SITUATION ON EXIT SLIP ROAD' literal value. + * + *

+ * If the meaning of 'DRIVE CAREFULLY DANGEROUS SITUATION ON EXIT SLIP ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD + * @model + * @generated + * @ordered + */ + public static final int DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD_VALUE = 2; + + /** + * The 'DRIVE CAREFULLY ICE BUILDUP ON CABLE STRUCTURE' literal value. + * + *

+ * If the meaning of 'DRIVE CAREFULLY ICE BUILDUP ON CABLE STRUCTURE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE + * @model + * @generated + * @ordered + */ + public static final int DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE_VALUE = 3; + + /** + * An array of all the 'Drive Carefully' enumerators. + * + * + * @generated + */ + private static final DriveCarefully[] VALUES_ARRAY = + new DriveCarefully[] { + DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD, + DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD, + DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE, + }; + + /** + * A public read-only list of all the 'Drive Carefully' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Drive Carefully' literal with the specified literal value. + * + * + * @generated + */ + public static DriveCarefully get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DriveCarefully result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Drive Carefully' literal with the specified name. + * + * + * @generated + */ + public static DriveCarefully getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DriveCarefully result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Drive Carefully' literal with the specified integer value. + * + * + * @generated + */ + public static DriveCarefully get(int value) { + switch (value) { + case DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD_VALUE: return DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD; + case DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD_VALUE: return DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD; + case DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE_VALUE: return DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private DriveCarefully(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //DriveCarefully diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DrivingNotAllowed.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DrivingNotAllowed.java new file mode 100755 index 0000000..0e562e4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/DrivingNotAllowed.java @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Driving Not Allowed', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getDrivingNotAllowed() + * @model + * @generated + */ +public enum DrivingNotAllowed implements Enumerator { + /** + * The 'DRIVING NOT ALLOWED TAKE NEXT POSSIBLE PLACE TO STOP VEHICLE' literal object. + * + * + * @see #DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE_VALUE + * @generated + * @ordered + */ + DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE(1, "DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE", "DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE"); + + /** + * The 'DRIVING NOT ALLOWED TAKE NEXT POSSIBLE PLACE TO STOP VEHICLE' literal value. + * + *

+ * If the meaning of 'DRIVING NOT ALLOWED TAKE NEXT POSSIBLE PLACE TO STOP VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE_VALUE = 1; + + /** + * An array of all the 'Driving Not Allowed' enumerators. + * + * + * @generated + */ + private static final DrivingNotAllowed[] VALUES_ARRAY = + new DrivingNotAllowed[] { + DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE, + }; + + /** + * A public read-only list of all the 'Driving Not Allowed' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Driving Not Allowed' literal with the specified literal value. + * + * + * @generated + */ + public static DrivingNotAllowed get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DrivingNotAllowed result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Driving Not Allowed' literal with the specified name. + * + * + * @generated + */ + public static DrivingNotAllowed getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + DrivingNotAllowed result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Driving Not Allowed' literal with the specified integer value. + * + * + * @generated + */ + public static DrivingNotAllowed get(int value) { + switch (value) { + case DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE_VALUE: return DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private DrivingNotAllowed(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //DrivingNotAllowed diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/EffectCode.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/EffectCode.java new file mode 100755 index 0000000..9a14d56 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/EffectCode.java @@ -0,0 +1,348 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Effect Code', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getEffectCode() + * @model + * @generated + */ +public enum EffectCode implements Enumerator { + /** + * The 'TRAFFIC FLOW UNKNOWN' literal object. + * + * + * @see #TRAFFIC_FLOW_UNKNOWN_VALUE + * @generated + * @ordered + */ + TRAFFIC_FLOW_UNKNOWN(1, "TRAFFIC_FLOW_UNKNOWN", "TRAFFIC_FLOW_UNKNOWN"), + + /** + * The 'FREE TRAFFIC FLOW' literal object. + * + * + * @see #FREE_TRAFFIC_FLOW_VALUE + * @generated + * @ordered + */ + FREE_TRAFFIC_FLOW(2, "FREE_TRAFFIC_FLOW", "FREE_TRAFFIC_FLOW"), + + /** + * The 'HEAVY TRAFFIC' literal object. + * + * + * @see #HEAVY_TRAFFIC_VALUE + * @generated + * @ordered + */ + HEAVY_TRAFFIC(3, "HEAVY_TRAFFIC", "HEAVY_TRAFFIC"), + + /** + * The 'SLOW TRAFFIC' literal object. + * + * + * @see #SLOW_TRAFFIC_VALUE + * @generated + * @ordered + */ + SLOW_TRAFFIC(4, "SLOW_TRAFFIC", "SLOW_TRAFFIC"), + + /** + * The 'QUEUING TRAFFIC' literal object. + * + * + * @see #QUEUING_TRAFFIC_VALUE + * @generated + * @ordered + */ + QUEUING_TRAFFIC(5, "QUEUING_TRAFFIC", "QUEUING_TRAFFIC"), + + /** + * The 'STATIONARY TRAFFIC' literal object. + * + * + * @see #STATIONARY_TRAFFIC_VALUE + * @generated + * @ordered + */ + STATIONARY_TRAFFIC(6, "STATIONARY_TRAFFIC", "STATIONARY_TRAFFIC"), + + /** + * The 'NO TRAFFIC FLOW' literal object. + * + * + * @see #NO_TRAFFIC_FLOW_VALUE + * @generated + * @ordered + */ + NO_TRAFFIC_FLOW(7, "NO_TRAFFIC_FLOW", "NO_TRAFFIC_FLOW"); + + /** + * The 'TRAFFIC FLOW UNKNOWN' literal value. + * + *

+ * If the meaning of 'TRAFFIC FLOW UNKNOWN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAFFIC_FLOW_UNKNOWN + * @model + * @generated + * @ordered + */ + public static final int TRAFFIC_FLOW_UNKNOWN_VALUE = 1; + + /** + * The 'FREE TRAFFIC FLOW' literal value. + * + *

+ * If the meaning of 'FREE TRAFFIC FLOW' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FREE_TRAFFIC_FLOW + * @model + * @generated + * @ordered + */ + public static final int FREE_TRAFFIC_FLOW_VALUE = 2; + + /** + * The 'HEAVY TRAFFIC' literal value. + * + *

+ * If the meaning of 'HEAVY TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int HEAVY_TRAFFIC_VALUE = 3; + + /** + * The 'SLOW TRAFFIC' literal value. + * + *

+ * If the meaning of 'SLOW TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLOW_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int SLOW_TRAFFIC_VALUE = 4; + + /** + * The 'QUEUING TRAFFIC' literal value. + * + *

+ * If the meaning of 'QUEUING TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #QUEUING_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int QUEUING_TRAFFIC_VALUE = 5; + + /** + * The 'STATIONARY TRAFFIC' literal value. + * + *

+ * If the meaning of 'STATIONARY TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STATIONARY_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int STATIONARY_TRAFFIC_VALUE = 6; + + /** + * The 'NO TRAFFIC FLOW' literal value. + * + *

+ * If the meaning of 'NO TRAFFIC FLOW' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #NO_TRAFFIC_FLOW + * @model + * @generated + * @ordered + */ + public static final int NO_TRAFFIC_FLOW_VALUE = 7; + + /** + * An array of all the 'Effect Code' enumerators. + * + * + * @generated + */ + private static final EffectCode[] VALUES_ARRAY = + new EffectCode[] { + TRAFFIC_FLOW_UNKNOWN, + FREE_TRAFFIC_FLOW, + HEAVY_TRAFFIC, + SLOW_TRAFFIC, + QUEUING_TRAFFIC, + STATIONARY_TRAFFIC, + NO_TRAFFIC_FLOW, + }; + + /** + * A public read-only list of all the 'Effect Code' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Effect Code' literal with the specified literal value. + * + * + * @generated + */ + public static EffectCode get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + EffectCode result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Effect Code' literal with the specified name. + * + * + * @generated + */ + public static EffectCode getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + EffectCode result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Effect Code' literal with the specified integer value. + * + * + * @generated + */ + public static EffectCode get(int value) { + switch (value) { + case TRAFFIC_FLOW_UNKNOWN_VALUE: return TRAFFIC_FLOW_UNKNOWN; + case FREE_TRAFFIC_FLOW_VALUE: return FREE_TRAFFIC_FLOW; + case HEAVY_TRAFFIC_VALUE: return HEAVY_TRAFFIC; + case SLOW_TRAFFIC_VALUE: return SLOW_TRAFFIC; + case QUEUING_TRAFFIC_VALUE: return QUEUING_TRAFFIC; + case STATIONARY_TRAFFIC_VALUE: return STATIONARY_TRAFFIC; + case NO_TRAFFIC_FLOW_VALUE: return NO_TRAFFIC_FLOW; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private EffectCode(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //EffectCode diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ExtremeWeatherConditions.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ExtremeWeatherConditions.java new file mode 100755 index 0000000..e6dc700 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ExtremeWeatherConditions.java @@ -0,0 +1,321 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Extreme Weather Conditions', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getExtremeWeatherConditions() + * @model + * @generated + */ +public enum ExtremeWeatherConditions implements Enumerator { + /** + * The 'STRONG WINDS' literal object. + * + * + * @see #STRONG_WINDS_VALUE + * @generated + * @ordered + */ + STRONG_WINDS(1, "STRONG_WINDS", "STRONG_WINDS"), + + /** + * The 'DAMAGING HAIL' literal object. + * + * + * @see #DAMAGING_HAIL_VALUE + * @generated + * @ordered + */ + DAMAGING_HAIL(2, "DAMAGING_HAIL", "DAMAGING_HAIL"), + + /** + * The 'HURRICANE' literal object. + * + * + * @see #HURRICANE_VALUE + * @generated + * @ordered + */ + HURRICANE(3, "HURRICANE", "HURRICANE"), + + /** + * The 'THUNDERSTORM' literal object. + * + * + * @see #THUNDERSTORM_VALUE + * @generated + * @ordered + */ + THUNDERSTORM(4, "THUNDERSTORM", "THUNDERSTORM"), + + /** + * The 'TORNADO' literal object. + * + * + * @see #TORNADO_VALUE + * @generated + * @ordered + */ + TORNADO(5, "TORNADO", "TORNADO"), + + /** + * The 'BLIZARD' literal object. + * + * + * @see #BLIZARD_VALUE + * @generated + * @ordered + */ + BLIZARD(6, "BLIZARD", "BLIZARD"); + + /** + * The 'STRONG WINDS' literal value. + * + *

+ * If the meaning of 'STRONG WINDS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STRONG_WINDS + * @model + * @generated + * @ordered + */ + public static final int STRONG_WINDS_VALUE = 1; + + /** + * The 'DAMAGING HAIL' literal value. + * + *

+ * If the meaning of 'DAMAGING HAIL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DAMAGING_HAIL + * @model + * @generated + * @ordered + */ + public static final int DAMAGING_HAIL_VALUE = 2; + + /** + * The 'HURRICANE' literal value. + * + *

+ * If the meaning of 'HURRICANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HURRICANE + * @model + * @generated + * @ordered + */ + public static final int HURRICANE_VALUE = 3; + + /** + * The 'THUNDERSTORM' literal value. + * + *

+ * If the meaning of 'THUNDERSTORM' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #THUNDERSTORM + * @model + * @generated + * @ordered + */ + public static final int THUNDERSTORM_VALUE = 4; + + /** + * The 'TORNADO' literal value. + * + *

+ * If the meaning of 'TORNADO' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TORNADO + * @model + * @generated + * @ordered + */ + public static final int TORNADO_VALUE = 5; + + /** + * The 'BLIZARD' literal value. + * + *

+ * If the meaning of 'BLIZARD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BLIZARD + * @model + * @generated + * @ordered + */ + public static final int BLIZARD_VALUE = 6; + + /** + * An array of all the 'Extreme Weather Conditions' enumerators. + * + * + * @generated + */ + private static final ExtremeWeatherConditions[] VALUES_ARRAY = + new ExtremeWeatherConditions[] { + STRONG_WINDS, + DAMAGING_HAIL, + HURRICANE, + THUNDERSTORM, + TORNADO, + BLIZARD, + }; + + /** + * A public read-only list of all the 'Extreme Weather Conditions' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Extreme Weather Conditions' literal with the specified literal value. + * + * + * @generated + */ + public static ExtremeWeatherConditions get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ExtremeWeatherConditions result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Extreme Weather Conditions' literal with the specified name. + * + * + * @generated + */ + public static ExtremeWeatherConditions getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ExtremeWeatherConditions result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Extreme Weather Conditions' literal with the specified integer value. + * + * + * @generated + */ + public static ExtremeWeatherConditions get(int value) { + switch (value) { + case STRONG_WINDS_VALUE: return STRONG_WINDS; + case DAMAGING_HAIL_VALUE: return DAMAGING_HAIL; + case HURRICANE_VALUE: return HURRICANE; + case THUNDERSTORM_VALUE: return THUNDERSTORM; + case TORNADO_VALUE: return TORNADO; + case BLIZARD_VALUE: return BLIZARD; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ExtremeWeatherConditions(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ExtremeWeatherConditions diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Fire.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Fire.java new file mode 100755 index 0000000..fecfc50 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Fire.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Fire', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getFire() + * @model + * @generated + */ +public enum Fire implements Enumerator { + /** + * The 'MAJOR FIRE' literal object. + * + * + * @see #MAJOR_FIRE_VALUE + * @generated + * @ordered + */ + MAJOR_FIRE(1, "MAJOR_FIRE", "MAJOR_FIRE"), + + /** + * The 'FOREST FIRE' literal object. + * + * + * @see #FOREST_FIRE_VALUE + * @generated + * @ordered + */ + FOREST_FIRE(2, "FOREST_FIRE", "FOREST_FIRE"); + + /** + * The 'MAJOR FIRE' literal value. + * + *

+ * If the meaning of 'MAJOR FIRE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MAJOR_FIRE + * @model + * @generated + * @ordered + */ + public static final int MAJOR_FIRE_VALUE = 1; + + /** + * The 'FOREST FIRE' literal value. + * + *

+ * If the meaning of 'FOREST FIRE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FOREST_FIRE + * @model + * @generated + * @ordered + */ + public static final int FOREST_FIRE_VALUE = 2; + + /** + * An array of all the 'Fire' enumerators. + * + * + * @generated + */ + private static final Fire[] VALUES_ARRAY = + new Fire[] { + MAJOR_FIRE, + FOREST_FIRE, + }; + + /** + * A public read-only list of all the 'Fire' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Fire' literal with the specified literal value. + * + * + * @generated + */ + public static Fire get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Fire result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Fire' literal with the specified name. + * + * + * @generated + */ + public static Fire getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Fire result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Fire' literal with the specified integer value. + * + * + * @generated + */ + public static Fire get(int value) { + switch (value) { + case MAJOR_FIRE_VALUE: return MAJOR_FIRE; + case FOREST_FIRE_VALUE: return FOREST_FIRE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Fire(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Fire diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/FollowDiversion.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/FollowDiversion.java new file mode 100755 index 0000000..8804eae --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/FollowDiversion.java @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Follow Diversion', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getFollowDiversion() + * @model + * @generated + */ +public enum FollowDiversion implements Enumerator { + /** + * The 'FOLLOW DIVERSION SIGNS' literal object. + * + * + * @see #FOLLOW_DIVERSION_SIGNS_VALUE + * @generated + * @ordered + */ + FOLLOW_DIVERSION_SIGNS(1, "FOLLOW_DIVERSION_SIGNS", "FOLLOW_DIVERSION_SIGNS"); + + /** + * The 'FOLLOW DIVERSION SIGNS' literal value. + * + *

+ * If the meaning of 'FOLLOW DIVERSION SIGNS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FOLLOW_DIVERSION_SIGNS + * @model + * @generated + * @ordered + */ + public static final int FOLLOW_DIVERSION_SIGNS_VALUE = 1; + + /** + * An array of all the 'Follow Diversion' enumerators. + * + * + * @generated + */ + private static final FollowDiversion[] VALUES_ARRAY = + new FollowDiversion[] { + FOLLOW_DIVERSION_SIGNS, + }; + + /** + * A public read-only list of all the 'Follow Diversion' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Follow Diversion' literal with the specified literal value. + * + * + * @generated + */ + public static FollowDiversion get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + FollowDiversion result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Follow Diversion' literal with the specified name. + * + * + * @generated + */ + public static FollowDiversion getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + FollowDiversion result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Follow Diversion' literal with the specified integer value. + * + * + * @generated + */ + public static FollowDiversion get(int value) { + switch (value) { + case FOLLOW_DIVERSION_SIGNS_VALUE: return FOLLOW_DIVERSION_SIGNS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private FollowDiversion(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //FollowDiversion diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/GivingPathVehiclesFromBehind.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/GivingPathVehiclesFromBehind.java new file mode 100755 index 0000000..b4690ed --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/GivingPathVehiclesFromBehind.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Giving Path Vehicles From Behind', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getGivingPathVehiclesFromBehind() + * @model + * @generated + */ +public enum GivingPathVehiclesFromBehind implements Enumerator { + /** + * The 'GIVING PATH FOR RESCUE VEHICLE' literal object. + * + * + * @see #GIVING_PATH_FOR_RESCUE_VEHICLE_VALUE + * @generated + * @ordered + */ + GIVING_PATH_FOR_RESCUE_VEHICLE(1, "GIVING_PATH_FOR_RESCUE_VEHICLE", "GIVING_PATH_FOR_RESCUE_VEHICLE"), + + /** + * The 'GIVING PATH FOR SERVICE VEHICLES' literal object. + * + * + * @see #GIVING_PATH_FOR_SERVICE_VEHICLES_VALUE + * @generated + * @ordered + */ + GIVING_PATH_FOR_SERVICE_VEHICLES(2, "GIVING_PATH_FOR_SERVICE_VEHICLES", "GIVING_PATH_FOR_SERVICE_VEHICLES"); + + /** + * The 'GIVING PATH FOR RESCUE VEHICLE' literal value. + * + *

+ * If the meaning of 'GIVING PATH FOR RESCUE VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GIVING_PATH_FOR_RESCUE_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int GIVING_PATH_FOR_RESCUE_VEHICLE_VALUE = 1; + + /** + * The 'GIVING PATH FOR SERVICE VEHICLES' literal value. + * + *

+ * If the meaning of 'GIVING PATH FOR SERVICE VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GIVING_PATH_FOR_SERVICE_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int GIVING_PATH_FOR_SERVICE_VEHICLES_VALUE = 2; + + /** + * An array of all the 'Giving Path Vehicles From Behind' enumerators. + * + * + * @generated + */ + private static final GivingPathVehiclesFromBehind[] VALUES_ARRAY = + new GivingPathVehiclesFromBehind[] { + GIVING_PATH_FOR_RESCUE_VEHICLE, + GIVING_PATH_FOR_SERVICE_VEHICLES, + }; + + /** + * A public read-only list of all the 'Giving Path Vehicles From Behind' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Giving Path Vehicles From Behind' literal with the specified literal value. + * + * + * @generated + */ + public static GivingPathVehiclesFromBehind get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + GivingPathVehiclesFromBehind result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Giving Path Vehicles From Behind' literal with the specified name. + * + * + * @generated + */ + public static GivingPathVehiclesFromBehind getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + GivingPathVehiclesFromBehind result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Giving Path Vehicles From Behind' literal with the specified integer value. + * + * + * @generated + */ + public static GivingPathVehiclesFromBehind get(int value) { + switch (value) { + case GIVING_PATH_FOR_RESCUE_VEHICLE_VALUE: return GIVING_PATH_FOR_RESCUE_VEHICLE; + case GIVING_PATH_FOR_SERVICE_VEHICLES_VALUE: return GIVING_PATH_FOR_SERVICE_VEHICLES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private GivingPathVehiclesFromBehind(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //GivingPathVehiclesFromBehind diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/HazardousDrivingConditions.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/HazardousDrivingConditions.java new file mode 100755 index 0000000..44998a5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/HazardousDrivingConditions.java @@ -0,0 +1,402 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Hazardous Driving Conditions', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getHazardousDrivingConditions() + * @model + * @generated + */ +public enum HazardousDrivingConditions implements Enumerator { + /** + * The 'ROCKFALLS' literal object. + * + * + * @see #ROCKFALLS_VALUE + * @generated + * @ordered + */ + ROCKFALLS(1, "ROCKFALLS", "ROCKFALLS"), + + /** + * The 'EARTHQUAKE DAMAGE' literal object. + * + * + * @see #EARTHQUAKE_DAMAGE_VALUE + * @generated + * @ordered + */ + EARTHQUAKE_DAMAGE(2, "EARTHQUAKE_DAMAGE", "EARTHQUAKE_DAMAGE"), + + /** + * The 'SEWER COLLAPSE' literal object. + * + * + * @see #SEWER_COLLAPSE_VALUE + * @generated + * @ordered + */ + SEWER_COLLAPSE(3, "SEWER_COLLAPSE", "SEWER_COLLAPSE"), + + /** + * The 'SUBSIDENCE' literal object. + * + * + * @see #SUBSIDENCE_VALUE + * @generated + * @ordered + */ + SUBSIDENCE(4, "SUBSIDENCE", "SUBSIDENCE"), + + /** + * The 'SNOW DRIFTS' literal object. + * + * + * @see #SNOW_DRIFTS_VALUE + * @generated + * @ordered + */ + SNOW_DRIFTS(5, "SNOW_DRIFTS", "SNOW_DRIFTS"), + + /** + * The 'STORM DAMAGE' literal object. + * + * + * @see #STORM_DAMAGE_VALUE + * @generated + * @ordered + */ + STORM_DAMAGE(6, "STORM_DAMAGE", "STORM_DAMAGE"), + + /** + * The 'BURST PIPE' literal object. + * + * + * @see #BURST_PIPE_VALUE + * @generated + * @ordered + */ + BURST_PIPE(7, "BURST_PIPE", "BURST_PIPE"), + + /** + * The 'VOLCANO ERUPTION' literal object. + * + * + * @see #VOLCANO_ERUPTION_VALUE + * @generated + * @ordered + */ + VOLCANO_ERUPTION(8, "VOLCANO_ERUPTION", "VOLCANO_ERUPTION"), + + /** + * The 'FALLING ICE' literal object. + * + * + * @see #FALLING_ICE_VALUE + * @generated + * @ordered + */ + FALLING_ICE(9, "FALLING_ICE", "FALLING_ICE"); + + /** + * The 'ROCKFALLS' literal value. + * + *

+ * If the meaning of 'ROCKFALLS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROCKFALLS + * @model + * @generated + * @ordered + */ + public static final int ROCKFALLS_VALUE = 1; + + /** + * The 'EARTHQUAKE DAMAGE' literal value. + * + *

+ * If the meaning of 'EARTHQUAKE DAMAGE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EARTHQUAKE_DAMAGE + * @model + * @generated + * @ordered + */ + public static final int EARTHQUAKE_DAMAGE_VALUE = 2; + + /** + * The 'SEWER COLLAPSE' literal value. + * + *

+ * If the meaning of 'SEWER COLLAPSE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SEWER_COLLAPSE + * @model + * @generated + * @ordered + */ + public static final int SEWER_COLLAPSE_VALUE = 3; + + /** + * The 'SUBSIDENCE' literal value. + * + *

+ * If the meaning of 'SUBSIDENCE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SUBSIDENCE + * @model + * @generated + * @ordered + */ + public static final int SUBSIDENCE_VALUE = 4; + + /** + * The 'SNOW DRIFTS' literal value. + * + *

+ * If the meaning of 'SNOW DRIFTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SNOW_DRIFTS + * @model + * @generated + * @ordered + */ + public static final int SNOW_DRIFTS_VALUE = 5; + + /** + * The 'STORM DAMAGE' literal value. + * + *

+ * If the meaning of 'STORM DAMAGE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STORM_DAMAGE + * @model + * @generated + * @ordered + */ + public static final int STORM_DAMAGE_VALUE = 6; + + /** + * The 'BURST PIPE' literal value. + * + *

+ * If the meaning of 'BURST PIPE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BURST_PIPE + * @model + * @generated + * @ordered + */ + public static final int BURST_PIPE_VALUE = 7; + + /** + * The 'VOLCANO ERUPTION' literal value. + * + *

+ * If the meaning of 'VOLCANO ERUPTION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VOLCANO_ERUPTION + * @model + * @generated + * @ordered + */ + public static final int VOLCANO_ERUPTION_VALUE = 8; + + /** + * The 'FALLING ICE' literal value. + * + *

+ * If the meaning of 'FALLING ICE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FALLING_ICE + * @model + * @generated + * @ordered + */ + public static final int FALLING_ICE_VALUE = 9; + + /** + * An array of all the 'Hazardous Driving Conditions' enumerators. + * + * + * @generated + */ + private static final HazardousDrivingConditions[] VALUES_ARRAY = + new HazardousDrivingConditions[] { + ROCKFALLS, + EARTHQUAKE_DAMAGE, + SEWER_COLLAPSE, + SUBSIDENCE, + SNOW_DRIFTS, + STORM_DAMAGE, + BURST_PIPE, + VOLCANO_ERUPTION, + FALLING_ICE, + }; + + /** + * A public read-only list of all the 'Hazardous Driving Conditions' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Hazardous Driving Conditions' literal with the specified literal value. + * + * + * @generated + */ + public static HazardousDrivingConditions get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + HazardousDrivingConditions result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Hazardous Driving Conditions' literal with the specified name. + * + * + * @generated + */ + public static HazardousDrivingConditions getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + HazardousDrivingConditions result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Hazardous Driving Conditions' literal with the specified integer value. + * + * + * @generated + */ + public static HazardousDrivingConditions get(int value) { + switch (value) { + case ROCKFALLS_VALUE: return ROCKFALLS; + case EARTHQUAKE_DAMAGE_VALUE: return EARTHQUAKE_DAMAGE; + case SEWER_COLLAPSE_VALUE: return SEWER_COLLAPSE; + case SUBSIDENCE_VALUE: return SUBSIDENCE; + case SNOW_DRIFTS_VALUE: return SNOW_DRIFTS; + case STORM_DAMAGE_VALUE: return STORM_DAMAGE; + case BURST_PIPE_VALUE: return BURST_PIPE; + case VOLCANO_ERUPTION_VALUE: return VOLCANO_ERUPTION; + case FALLING_ICE_VALUE: return FALLING_ICE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private HazardousDrivingConditions(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //HazardousDrivingConditions diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Impassibility.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Impassibility.java new file mode 100755 index 0000000..4c5c158 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Impassibility.java @@ -0,0 +1,321 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Impassibility', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getImpassibility() + * @model + * @generated + */ +public enum Impassibility implements Enumerator { + /** + * The 'FLOODING' literal object. + * + * + * @see #FLOODING_VALUE + * @generated + * @ordered + */ + FLOODING(1, "FLOODING", "FLOODING"), + + /** + * The 'DANGER OF AVALANCHES' literal object. + * + * + * @see #DANGER_OF_AVALANCHES_VALUE + * @generated + * @ordered + */ + DANGER_OF_AVALANCHES(2, "DANGER_OF_AVALANCHES", "DANGER_OF_AVALANCHES"), + + /** + * The 'BLASTING OF AVALANCHES' literal object. + * + * + * @see #BLASTING_OF_AVALANCHES_VALUE + * @generated + * @ordered + */ + BLASTING_OF_AVALANCHES(3, "BLASTING_OF_AVALANCHES", "BLASTING_OF_AVALANCHES"), + + /** + * The 'LANDSLIPS' literal object. + * + * + * @see #LANDSLIPS_VALUE + * @generated + * @ordered + */ + LANDSLIPS(4, "LANDSLIPS", "LANDSLIPS"), + + /** + * The 'CHEMICAL SPILLAGE' literal object. + * + * + * @see #CHEMICAL_SPILLAGE_VALUE + * @generated + * @ordered + */ + CHEMICAL_SPILLAGE(5, "CHEMICAL_SPILLAGE", "CHEMICAL_SPILLAGE"), + + /** + * The 'WINTER CLOSURE' literal object. + * + * + * @see #WINTER_CLOSURE_VALUE + * @generated + * @ordered + */ + WINTER_CLOSURE(6, "WINTER_CLOSURE", "WINTER_CLOSURE"); + + /** + * The 'FLOODING' literal value. + * + *

+ * If the meaning of 'FLOODING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FLOODING + * @model + * @generated + * @ordered + */ + public static final int FLOODING_VALUE = 1; + + /** + * The 'DANGER OF AVALANCHES' literal value. + * + *

+ * If the meaning of 'DANGER OF AVALANCHES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DANGER_OF_AVALANCHES + * @model + * @generated + * @ordered + */ + public static final int DANGER_OF_AVALANCHES_VALUE = 2; + + /** + * The 'BLASTING OF AVALANCHES' literal value. + * + *

+ * If the meaning of 'BLASTING OF AVALANCHES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BLASTING_OF_AVALANCHES + * @model + * @generated + * @ordered + */ + public static final int BLASTING_OF_AVALANCHES_VALUE = 3; + + /** + * The 'LANDSLIPS' literal value. + * + *

+ * If the meaning of 'LANDSLIPS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LANDSLIPS + * @model + * @generated + * @ordered + */ + public static final int LANDSLIPS_VALUE = 4; + + /** + * The 'CHEMICAL SPILLAGE' literal value. + * + *

+ * If the meaning of 'CHEMICAL SPILLAGE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CHEMICAL_SPILLAGE + * @model + * @generated + * @ordered + */ + public static final int CHEMICAL_SPILLAGE_VALUE = 5; + + /** + * The 'WINTER CLOSURE' literal value. + * + *

+ * If the meaning of 'WINTER CLOSURE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WINTER_CLOSURE + * @model + * @generated + * @ordered + */ + public static final int WINTER_CLOSURE_VALUE = 6; + + /** + * An array of all the 'Impassibility' enumerators. + * + * + * @generated + */ + private static final Impassibility[] VALUES_ARRAY = + new Impassibility[] { + FLOODING, + DANGER_OF_AVALANCHES, + BLASTING_OF_AVALANCHES, + LANDSLIPS, + CHEMICAL_SPILLAGE, + WINTER_CLOSURE, + }; + + /** + * A public read-only list of all the 'Impassibility' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Impassibility' literal with the specified literal value. + * + * + * @generated + */ + public static Impassibility get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Impassibility result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Impassibility' literal with the specified name. + * + * + * @generated + */ + public static Impassibility getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Impassibility result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Impassibility' literal with the specified integer value. + * + * + * @generated + */ + public static Impassibility get(int value) { + switch (value) { + case FLOODING_VALUE: return FLOODING; + case DANGER_OF_AVALANCHES_VALUE: return DANGER_OF_AVALANCHES; + case BLASTING_OF_AVALANCHES_VALUE: return BLASTING_OF_AVALANCHES; + case LANDSLIPS_VALUE: return LANDSLIPS; + case CHEMICAL_SPILLAGE_VALUE: return CHEMICAL_SPILLAGE; + case WINTER_CLOSURE_VALUE: return WINTER_CLOSURE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Impassibility(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Impassibility diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/LaneRestrictionType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/LaneRestrictionType.java new file mode 100755 index 0000000..bbde559 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/LaneRestrictionType.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Lane Restriction Type', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getLaneRestrictionType() + * @model + * @generated + */ +public enum LaneRestrictionType implements Enumerator { + /** + * The 'LANES CLOSED' literal object. + * + * + * @see #LANES_CLOSED_VALUE + * @generated + * @ordered + */ + LANES_CLOSED(1, "LANES_CLOSED", "LANES_CLOSED"), + + /** + * The 'LANES OPEN' literal object. + * + * + * @see #LANES_OPEN_VALUE + * @generated + * @ordered + */ + LANES_OPEN(2, "LANES_OPEN", "LANES_OPEN"), + + /** + * The 'RIGHT LANES CLOSED' literal object. + * + * + * @see #RIGHT_LANES_CLOSED_VALUE + * @generated + * @ordered + */ + RIGHT_LANES_CLOSED(3, "RIGHT_LANES_CLOSED", "RIGHT_LANES_CLOSED"), + + /** + * The 'LEFT LANES CLOSED' literal object. + * + * + * @see #LEFT_LANES_CLOSED_VALUE + * @generated + * @ordered + */ + LEFT_LANES_CLOSED(4, "LEFT_LANES_CLOSED", "LEFT_LANES_CLOSED"); + + /** + * The 'LANES CLOSED' literal value. + * + *

+ * If the meaning of 'LANES CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LANES_CLOSED + * @model + * @generated + * @ordered + */ + public static final int LANES_CLOSED_VALUE = 1; + + /** + * The 'LANES OPEN' literal value. + * + *

+ * If the meaning of 'LANES OPEN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LANES_OPEN + * @model + * @generated + * @ordered + */ + public static final int LANES_OPEN_VALUE = 2; + + /** + * The 'RIGHT LANES CLOSED' literal value. + * + *

+ * If the meaning of 'RIGHT LANES CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RIGHT_LANES_CLOSED + * @model + * @generated + * @ordered + */ + public static final int RIGHT_LANES_CLOSED_VALUE = 3; + + /** + * The 'LEFT LANES CLOSED' literal value. + * + *

+ * If the meaning of 'LEFT LANES CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LEFT_LANES_CLOSED + * @model + * @generated + * @ordered + */ + public static final int LEFT_LANES_CLOSED_VALUE = 4; + + /** + * An array of all the 'Lane Restriction Type' enumerators. + * + * + * @generated + */ + private static final LaneRestrictionType[] VALUES_ARRAY = + new LaneRestrictionType[] { + LANES_CLOSED, + LANES_OPEN, + RIGHT_LANES_CLOSED, + LEFT_LANES_CLOSED, + }; + + /** + * A public read-only list of all the 'Lane Restriction Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Lane Restriction Type' literal with the specified literal value. + * + * + * @generated + */ + public static LaneRestrictionType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LaneRestrictionType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Lane Restriction Type' literal with the specified name. + * + * + * @generated + */ + public static LaneRestrictionType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + LaneRestrictionType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Lane Restriction Type' literal with the specified integer value. + * + * + * @generated + */ + public static LaneRestrictionType get(int value) { + switch (value) { + case LANES_CLOSED_VALUE: return LANES_CLOSED; + case LANES_OPEN_VALUE: return LANES_OPEN; + case RIGHT_LANES_CLOSED_VALUE: return RIGHT_LANES_CLOSED; + case LEFT_LANES_CLOSED_VALUE: return LEFT_LANES_CLOSED; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private LaneRestrictionType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //LaneRestrictionType diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MajorEvent.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MajorEvent.java new file mode 100755 index 0000000..241dd01 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MajorEvent.java @@ -0,0 +1,402 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Major Event', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getMajorEvent() + * @model + * @generated + */ +public enum MajorEvent implements Enumerator { + /** + * The 'SPORTS EVENT' literal object. + * + * + * @see #SPORTS_EVENT_VALUE + * @generated + * @ordered + */ + SPORTS_EVENT(1, "SPORTS_EVENT", "SPORTS_EVENT"), + + /** + * The 'DEMONSTRATION' literal object. + * + * + * @see #DEMONSTRATION_VALUE + * @generated + * @ordered + */ + DEMONSTRATION(2, "DEMONSTRATION", "DEMONSTRATION"), + + /** + * The 'DEMONSTRATION WITH VEHICLES' literal object. + * + * + * @see #DEMONSTRATION_WITH_VEHICLES_VALUE + * @generated + * @ordered + */ + DEMONSTRATION_WITH_VEHICLES(3, "DEMONSTRATION_WITH_VEHICLES", "DEMONSTRATION_WITH_VEHICLES"), + + /** + * The 'CONCERT' literal object. + * + * + * @see #CONCERT_VALUE + * @generated + * @ordered + */ + CONCERT(4, "CONCERT", "CONCERT"), + + /** + * The 'FAIR' literal object. + * + * + * @see #FAIR_VALUE + * @generated + * @ordered + */ + FAIR(5, "FAIR", "FAIR"), + + /** + * The 'MILITARY TRAINING' literal object. + * + * + * @see #MILITARY_TRAINING_VALUE + * @generated + * @ordered + */ + MILITARY_TRAINING(6, "MILITARY_TRAINING", "MILITARY_TRAINING"), + + /** + * The 'EMERGENCY TRAINING' literal object. + * + * + * @see #EMERGENCY_TRAINING_VALUE + * @generated + * @ordered + */ + EMERGENCY_TRAINING(7, "EMERGENCY_TRAINING", "EMERGENCY_TRAINING"), + + /** + * The 'FESTIVITY' literal object. + * + * + * @see #FESTIVITY_VALUE + * @generated + * @ordered + */ + FESTIVITY(8, "FESTIVITY", "FESTIVITY"), + + /** + * The 'PROCESSION' literal object. + * + * + * @see #PROCESSION_VALUE + * @generated + * @ordered + */ + PROCESSION(9, "PROCESSION", "PROCESSION"); + + /** + * The 'SPORTS EVENT' literal value. + * + *

+ * If the meaning of 'SPORTS EVENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SPORTS_EVENT + * @model + * @generated + * @ordered + */ + public static final int SPORTS_EVENT_VALUE = 1; + + /** + * The 'DEMONSTRATION' literal value. + * + *

+ * If the meaning of 'DEMONSTRATION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DEMONSTRATION + * @model + * @generated + * @ordered + */ + public static final int DEMONSTRATION_VALUE = 2; + + /** + * The 'DEMONSTRATION WITH VEHICLES' literal value. + * + *

+ * If the meaning of 'DEMONSTRATION WITH VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DEMONSTRATION_WITH_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int DEMONSTRATION_WITH_VEHICLES_VALUE = 3; + + /** + * The 'CONCERT' literal value. + * + *

+ * If the meaning of 'CONCERT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CONCERT + * @model + * @generated + * @ordered + */ + public static final int CONCERT_VALUE = 4; + + /** + * The 'FAIR' literal value. + * + *

+ * If the meaning of 'FAIR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FAIR + * @model + * @generated + * @ordered + */ + public static final int FAIR_VALUE = 5; + + /** + * The 'MILITARY TRAINING' literal value. + * + *

+ * If the meaning of 'MILITARY TRAINING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MILITARY_TRAINING + * @model + * @generated + * @ordered + */ + public static final int MILITARY_TRAINING_VALUE = 6; + + /** + * The 'EMERGENCY TRAINING' literal value. + * + *

+ * If the meaning of 'EMERGENCY TRAINING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EMERGENCY_TRAINING + * @model + * @generated + * @ordered + */ + public static final int EMERGENCY_TRAINING_VALUE = 7; + + /** + * The 'FESTIVITY' literal value. + * + *

+ * If the meaning of 'FESTIVITY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FESTIVITY + * @model + * @generated + * @ordered + */ + public static final int FESTIVITY_VALUE = 8; + + /** + * The 'PROCESSION' literal value. + * + *

+ * If the meaning of 'PROCESSION' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PROCESSION + * @model + * @generated + * @ordered + */ + public static final int PROCESSION_VALUE = 9; + + /** + * An array of all the 'Major Event' enumerators. + * + * + * @generated + */ + private static final MajorEvent[] VALUES_ARRAY = + new MajorEvent[] { + SPORTS_EVENT, + DEMONSTRATION, + DEMONSTRATION_WITH_VEHICLES, + CONCERT, + FAIR, + MILITARY_TRAINING, + EMERGENCY_TRAINING, + FESTIVITY, + PROCESSION, + }; + + /** + * A public read-only list of all the 'Major Event' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Major Event' literal with the specified literal value. + * + * + * @generated + */ + public static MajorEvent get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MajorEvent result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Major Event' literal with the specified name. + * + * + * @generated + */ + public static MajorEvent getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MajorEvent result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Major Event' literal with the specified integer value. + * + * + * @generated + */ + public static MajorEvent get(int value) { + switch (value) { + case SPORTS_EVENT_VALUE: return SPORTS_EVENT; + case DEMONSTRATION_VALUE: return DEMONSTRATION; + case DEMONSTRATION_WITH_VEHICLES_VALUE: return DEMONSTRATION_WITH_VEHICLES; + case CONCERT_VALUE: return CONCERT; + case FAIR_VALUE: return FAIR; + case MILITARY_TRAINING_VALUE: return MILITARY_TRAINING; + case EMERGENCY_TRAINING_VALUE: return EMERGENCY_TRAINING; + case FESTIVITY_VALUE: return FESTIVITY; + case PROCESSION_VALUE: return PROCESSION; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private MajorEvent(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //MajorEvent diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MalfunctioningRoadsideEquipment.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MalfunctioningRoadsideEquipment.java new file mode 100755 index 0000000..5b03579 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/MalfunctioningRoadsideEquipment.java @@ -0,0 +1,294 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Malfunctioning Roadside Equipment', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getMalfunctioningRoadsideEquipment() + * @model + * @generated + */ +public enum MalfunctioningRoadsideEquipment implements Enumerator { + /** + * The 'ROAD RAIL CROSSING FAILURE' literal object. + * + * + * @see #ROAD_RAIL_CROSSING_FAILURE_VALUE + * @generated + * @ordered + */ + ROAD_RAIL_CROSSING_FAILURE(1, "ROAD_RAIL_CROSSING_FAILURE", "ROAD_RAIL_CROSSING_FAILURE"), + + /** + * The 'TUNNEL VENTILATION NOT WORKING' literal object. + * + * + * @see #TUNNEL_VENTILATION_NOT_WORKING_VALUE + * @generated + * @ordered + */ + TUNNEL_VENTILATION_NOT_WORKING(2, "TUNNEL_VENTILATION_NOT_WORKING", "TUNNEL_VENTILATION_NOT_WORKING"), + + /** + * The 'TRAFFIC CONTROL SIGNALS WORKING INCORRECTLY' literal object. + * + * + * @see #TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY_VALUE + * @generated + * @ordered + */ + TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY(3, "TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY", "TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY"), + + /** + * The 'EMERGENCY TELEPHONES NOT WORKING' literal object. + * + * + * @see #EMERGENCY_TELEPHONES_NOT_WORKING_VALUE + * @generated + * @ordered + */ + EMERGENCY_TELEPHONES_NOT_WORKING(4, "EMERGENCY_TELEPHONES_NOT_WORKING", "EMERGENCY_TELEPHONES_NOT_WORKING"), + + /** + * The 'AUTOMATIC PAYMENT LANES NOT WORKING' literal object. + * + * + * @see #AUTOMATIC_PAYMENT_LANES_NOT_WORKING_VALUE + * @generated + * @ordered + */ + AUTOMATIC_PAYMENT_LANES_NOT_WORKING(5, "AUTOMATIC_PAYMENT_LANES_NOT_WORKING", "AUTOMATIC_PAYMENT_LANES_NOT_WORKING"); + + /** + * The 'ROAD RAIL CROSSING FAILURE' literal value. + * + *

+ * If the meaning of 'ROAD RAIL CROSSING FAILURE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROAD_RAIL_CROSSING_FAILURE + * @model + * @generated + * @ordered + */ + public static final int ROAD_RAIL_CROSSING_FAILURE_VALUE = 1; + + /** + * The 'TUNNEL VENTILATION NOT WORKING' literal value. + * + *

+ * If the meaning of 'TUNNEL VENTILATION NOT WORKING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TUNNEL_VENTILATION_NOT_WORKING + * @model + * @generated + * @ordered + */ + public static final int TUNNEL_VENTILATION_NOT_WORKING_VALUE = 2; + + /** + * The 'TRAFFIC CONTROL SIGNALS WORKING INCORRECTLY' literal value. + * + *

+ * If the meaning of 'TRAFFIC CONTROL SIGNALS WORKING INCORRECTLY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY + * @model + * @generated + * @ordered + */ + public static final int TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY_VALUE = 3; + + /** + * The 'EMERGENCY TELEPHONES NOT WORKING' literal value. + * + *

+ * If the meaning of 'EMERGENCY TELEPHONES NOT WORKING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EMERGENCY_TELEPHONES_NOT_WORKING + * @model + * @generated + * @ordered + */ + public static final int EMERGENCY_TELEPHONES_NOT_WORKING_VALUE = 4; + + /** + * The 'AUTOMATIC PAYMENT LANES NOT WORKING' literal value. + * + *

+ * If the meaning of 'AUTOMATIC PAYMENT LANES NOT WORKING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AUTOMATIC_PAYMENT_LANES_NOT_WORKING + * @model + * @generated + * @ordered + */ + public static final int AUTOMATIC_PAYMENT_LANES_NOT_WORKING_VALUE = 5; + + /** + * An array of all the 'Malfunctioning Roadside Equipment' enumerators. + * + * + * @generated + */ + private static final MalfunctioningRoadsideEquipment[] VALUES_ARRAY = + new MalfunctioningRoadsideEquipment[] { + ROAD_RAIL_CROSSING_FAILURE, + TUNNEL_VENTILATION_NOT_WORKING, + TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY, + EMERGENCY_TELEPHONES_NOT_WORKING, + AUTOMATIC_PAYMENT_LANES_NOT_WORKING, + }; + + /** + * A public read-only list of all the 'Malfunctioning Roadside Equipment' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Malfunctioning Roadside Equipment' literal with the specified literal value. + * + * + * @generated + */ + public static MalfunctioningRoadsideEquipment get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MalfunctioningRoadsideEquipment result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Malfunctioning Roadside Equipment' literal with the specified name. + * + * + * @generated + */ + public static MalfunctioningRoadsideEquipment getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + MalfunctioningRoadsideEquipment result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Malfunctioning Roadside Equipment' literal with the specified integer value. + * + * + * @generated + */ + public static MalfunctioningRoadsideEquipment get(int value) { + switch (value) { + case ROAD_RAIL_CROSSING_FAILURE_VALUE: return ROAD_RAIL_CROSSING_FAILURE; + case TUNNEL_VENTILATION_NOT_WORKING_VALUE: return TUNNEL_VENTILATION_NOT_WORKING; + case TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY_VALUE: return TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY; + case EMERGENCY_TELEPHONES_NOT_WORKING_VALUE: return EMERGENCY_TELEPHONES_NOT_WORKING; + case AUTOMATIC_PAYMENT_LANES_NOT_WORKING_VALUE: return AUTOMATIC_PAYMENT_LANES_NOT_WORKING; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private MalfunctioningRoadsideEquipment(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //MalfunctioningRoadsideEquipment diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/NarrowLanes.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/NarrowLanes.java new file mode 100755 index 0000000..026626a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/NarrowLanes.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Narrow Lanes', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getNarrowLanes() + * @model + * @generated + */ +public enum NarrowLanes implements Enumerator { + /** + * The 'CONTRAFLOW' literal object. + * + * + * @see #CONTRAFLOW_VALUE + * @generated + * @ordered + */ + CONTRAFLOW(1, "CONTRAFLOW", "CONTRAFLOW"), + + /** + * The 'HARD SHOULDER CLOSED' literal object. + * + * + * @see #HARD_SHOULDER_CLOSED_VALUE + * @generated + * @ordered + */ + HARD_SHOULDER_CLOSED(2, "HARD_SHOULDER_CLOSED", "HARD_SHOULDER_CLOSED"), + + /** + * The 'SLIP LANE CLOSED' literal object. + * + * + * @see #SLIP_LANE_CLOSED_VALUE + * @generated + * @ordered + */ + SLIP_LANE_CLOSED(3, "SLIP_LANE_CLOSED", "SLIP_LANE_CLOSED"), + + /** + * The 'CRAWLER LANE CLOSED' literal object. + * + * + * @see #CRAWLER_LANE_CLOSED_VALUE + * @generated + * @ordered + */ + CRAWLER_LANE_CLOSED(4, "CRAWLER_LANE_CLOSED", "CRAWLER_LANE_CLOSED"); + + /** + * The 'CONTRAFLOW' literal value. + * + *

+ * If the meaning of 'CONTRAFLOW' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CONTRAFLOW + * @model + * @generated + * @ordered + */ + public static final int CONTRAFLOW_VALUE = 1; + + /** + * The 'HARD SHOULDER CLOSED' literal value. + * + *

+ * If the meaning of 'HARD SHOULDER CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HARD_SHOULDER_CLOSED + * @model + * @generated + * @ordered + */ + public static final int HARD_SHOULDER_CLOSED_VALUE = 2; + + /** + * The 'SLIP LANE CLOSED' literal value. + * + *

+ * If the meaning of 'SLIP LANE CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLIP_LANE_CLOSED + * @model + * @generated + * @ordered + */ + public static final int SLIP_LANE_CLOSED_VALUE = 3; + + /** + * The 'CRAWLER LANE CLOSED' literal value. + * + *

+ * If the meaning of 'CRAWLER LANE CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CRAWLER_LANE_CLOSED + * @model + * @generated + * @ordered + */ + public static final int CRAWLER_LANE_CLOSED_VALUE = 4; + + /** + * An array of all the 'Narrow Lanes' enumerators. + * + * + * @generated + */ + private static final NarrowLanes[] VALUES_ARRAY = + new NarrowLanes[] { + CONTRAFLOW, + HARD_SHOULDER_CLOSED, + SLIP_LANE_CLOSED, + CRAWLER_LANE_CLOSED, + }; + + /** + * A public read-only list of all the 'Narrow Lanes' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Narrow Lanes' literal with the specified literal value. + * + * + * @generated + */ + public static NarrowLanes get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + NarrowLanes result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Narrow Lanes' literal with the specified name. + * + * + * @generated + */ + public static NarrowLanes getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + NarrowLanes result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Narrow Lanes' literal with the specified integer value. + * + * + * @generated + */ + public static NarrowLanes get(int value) { + switch (value) { + case CONTRAFLOW_VALUE: return CONTRAFLOW; + case HARD_SHOULDER_CLOSED_VALUE: return HARD_SHOULDER_CLOSED; + case SLIP_LANE_CLOSED_VALUE: return SLIP_LANE_CLOSED; + case CRAWLER_LANE_CLOSED_VALUE: return CRAWLER_LANE_CLOSED; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private NarrowLanes(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //NarrowLanes diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ObjectsOnTheRoad.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ObjectsOnTheRoad.java new file mode 100755 index 0000000..4a3784b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ObjectsOnTheRoad.java @@ -0,0 +1,348 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Objects On The Road', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getObjectsOnTheRoad() + * @model + * @generated + */ +public enum ObjectsOnTheRoad implements Enumerator { + /** + * The 'SHED LOAD' literal object. + * + * + * @see #SHED_LOAD_VALUE + * @generated + * @ordered + */ + SHED_LOAD(1, "SHED_LOAD", "SHED_LOAD"), + + /** + * The 'PARTS OF VEHICLES' literal object. + * + * + * @see #PARTS_OF_VEHICLES_VALUE + * @generated + * @ordered + */ + PARTS_OF_VEHICLES(2, "PARTS_OF_VEHICLES", "PARTS_OF_VEHICLES"), + + /** + * The 'PARTS OF TYRES' literal object. + * + * + * @see #PARTS_OF_TYRES_VALUE + * @generated + * @ordered + */ + PARTS_OF_TYRES(3, "PARTS_OF_TYRES", "PARTS_OF_TYRES"), + + /** + * The 'BIG OBJECTS' literal object. + * + * + * @see #BIG_OBJECTS_VALUE + * @generated + * @ordered + */ + BIG_OBJECTS(4, "BIG_OBJECTS", "BIG_OBJECTS"), + + /** + * The 'FALLEN TREES' literal object. + * + * + * @see #FALLEN_TREES_VALUE + * @generated + * @ordered + */ + FALLEN_TREES(5, "FALLEN_TREES", "FALLEN_TREES"), + + /** + * The 'HUB CAPS' literal object. + * + * + * @see #HUB_CAPS_VALUE + * @generated + * @ordered + */ + HUB_CAPS(6, "HUB_CAPS", "HUB_CAPS"), + + /** + * The 'WAITING VEHICLES' literal object. + * + * + * @see #WAITING_VEHICLES_VALUE + * @generated + * @ordered + */ + WAITING_VEHICLES(7, "WAITING_VEHICLES", "WAITING_VEHICLES"); + + /** + * The 'SHED LOAD' literal value. + * + *

+ * If the meaning of 'SHED LOAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SHED_LOAD + * @model + * @generated + * @ordered + */ + public static final int SHED_LOAD_VALUE = 1; + + /** + * The 'PARTS OF VEHICLES' literal value. + * + *

+ * If the meaning of 'PARTS OF VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PARTS_OF_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int PARTS_OF_VEHICLES_VALUE = 2; + + /** + * The 'PARTS OF TYRES' literal value. + * + *

+ * If the meaning of 'PARTS OF TYRES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PARTS_OF_TYRES + * @model + * @generated + * @ordered + */ + public static final int PARTS_OF_TYRES_VALUE = 3; + + /** + * The 'BIG OBJECTS' literal value. + * + *

+ * If the meaning of 'BIG OBJECTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BIG_OBJECTS + * @model + * @generated + * @ordered + */ + public static final int BIG_OBJECTS_VALUE = 4; + + /** + * The 'FALLEN TREES' literal value. + * + *

+ * If the meaning of 'FALLEN TREES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FALLEN_TREES + * @model + * @generated + * @ordered + */ + public static final int FALLEN_TREES_VALUE = 5; + + /** + * The 'HUB CAPS' literal value. + * + *

+ * If the meaning of 'HUB CAPS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HUB_CAPS + * @model + * @generated + * @ordered + */ + public static final int HUB_CAPS_VALUE = 6; + + /** + * The 'WAITING VEHICLES' literal value. + * + *

+ * If the meaning of 'WAITING VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WAITING_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int WAITING_VEHICLES_VALUE = 7; + + /** + * An array of all the 'Objects On The Road' enumerators. + * + * + * @generated + */ + private static final ObjectsOnTheRoad[] VALUES_ARRAY = + new ObjectsOnTheRoad[] { + SHED_LOAD, + PARTS_OF_VEHICLES, + PARTS_OF_TYRES, + BIG_OBJECTS, + FALLEN_TREES, + HUB_CAPS, + WAITING_VEHICLES, + }; + + /** + * A public read-only list of all the 'Objects On The Road' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Objects On The Road' literal with the specified literal value. + * + * + * @generated + */ + public static ObjectsOnTheRoad get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ObjectsOnTheRoad result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Objects On The Road' literal with the specified name. + * + * + * @generated + */ + public static ObjectsOnTheRoad getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ObjectsOnTheRoad result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Objects On The Road' literal with the specified integer value. + * + * + * @generated + */ + public static ObjectsOnTheRoad get(int value) { + switch (value) { + case SHED_LOAD_VALUE: return SHED_LOAD; + case PARTS_OF_VEHICLES_VALUE: return PARTS_OF_VEHICLES; + case PARTS_OF_TYRES_VALUE: return PARTS_OF_TYRES; + case BIG_OBJECTS_VALUE: return BIG_OBJECTS; + case FALLEN_TREES_VALUE: return FALLEN_TREES; + case HUB_CAPS_VALUE: return HUB_CAPS; + case WAITING_VEHICLES_VALUE: return WAITING_VEHICLES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ObjectsOnTheRoad(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ObjectsOnTheRoad diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/OvertakingNotAllowed.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/OvertakingNotAllowed.java new file mode 100755 index 0000000..8abe5d2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/OvertakingNotAllowed.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Overtaking Not Allowed', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getOvertakingNotAllowed() + * @model + * @generated + */ +public enum OvertakingNotAllowed implements Enumerator { + /** + * The 'DO NOT USE OVERTAKING LANES' literal object. + * + * + * @see #DO_NOT_USE_OVERTAKING_LANES_VALUE + * @generated + * @ordered + */ + DO_NOT_USE_OVERTAKING_LANES(1, "DO_NOT_USE_OVERTAKING_LANES", "DO_NOT_USE_OVERTAKING_LANES"), + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON CRAWLER LANE' literal object. + * + * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE_VALUE + * @generated + * @ordered + */ + OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE(2, "OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE", "OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE"), + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON LEFT MOST LANE' literal object. + * + * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE_VALUE + * @generated + * @ordered + */ + OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE(3, "OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE", "OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE"), + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON RIGHT MOST LANE' literal object. + * + * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE_VALUE + * @generated + * @ordered + */ + OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE(4, "OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE", "OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE"); + + /** + * The 'DO NOT USE OVERTAKING LANES' literal value. + * + *

+ * If the meaning of 'DO NOT USE OVERTAKING LANES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DO_NOT_USE_OVERTAKING_LANES + * @model + * @generated + * @ordered + */ + public static final int DO_NOT_USE_OVERTAKING_LANES_VALUE = 1; + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON CRAWLER LANE' literal value. + * + *

+ * If the meaning of 'OVERTAKING NOT ALLOWED DRIVE ON CRAWLER LANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE + * @model + * @generated + * @ordered + */ + public static final int OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE_VALUE = 2; + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON LEFT MOST LANE' literal value. + * + *

+ * If the meaning of 'OVERTAKING NOT ALLOWED DRIVE ON LEFT MOST LANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE + * @model + * @generated + * @ordered + */ + public static final int OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE_VALUE = 3; + + /** + * The 'OVERTAKING NOT ALLOWED DRIVE ON RIGHT MOST LANE' literal value. + * + *

+ * If the meaning of 'OVERTAKING NOT ALLOWED DRIVE ON RIGHT MOST LANE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE + * @model + * @generated + * @ordered + */ + public static final int OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE_VALUE = 4; + + /** + * An array of all the 'Overtaking Not Allowed' enumerators. + * + * + * @generated + */ + private static final OvertakingNotAllowed[] VALUES_ARRAY = + new OvertakingNotAllowed[] { + DO_NOT_USE_OVERTAKING_LANES, + OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE, + OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE, + OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE, + }; + + /** + * A public read-only list of all the 'Overtaking Not Allowed' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Overtaking Not Allowed' literal with the specified literal value. + * + * + * @generated + */ + public static OvertakingNotAllowed get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + OvertakingNotAllowed result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Overtaking Not Allowed' literal with the specified name. + * + * + * @generated + */ + public static OvertakingNotAllowed getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + OvertakingNotAllowed result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Overtaking Not Allowed' literal with the specified integer value. + * + * + * @generated + */ + public static OvertakingNotAllowed get(int value) { + switch (value) { + case DO_NOT_USE_OVERTAKING_LANES_VALUE: return DO_NOT_USE_OVERTAKING_LANES; + case OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE_VALUE: return OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE; + case OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE_VALUE: return OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE; + case OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE_VALUE: return OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private OvertakingNotAllowed(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //OvertakingNotAllowed diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PeopleOnRoadway.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PeopleOnRoadway.java new file mode 100755 index 0000000..6017976 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PeopleOnRoadway.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'People On Roadway', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getPeopleOnRoadway() + * @model + * @generated + */ +public enum PeopleOnRoadway implements Enumerator { + /** + * The 'CHILDREN ON ROADWAY' literal object. + * + * + * @see #CHILDREN_ON_ROADWAY_VALUE + * @generated + * @ordered + */ + CHILDREN_ON_ROADWAY(1, "CHILDREN_ON_ROADWAY", "CHILDREN_ON_ROADWAY"), + + /** + * The 'CYCLISTS ON ROADWAY' literal object. + * + * + * @see #CYCLISTS_ON_ROADWAY_VALUE + * @generated + * @ordered + */ + CYCLISTS_ON_ROADWAY(2, "CYCLISTS_ON_ROADWAY", "CYCLISTS_ON_ROADWAY"), + + /** + * The 'MOTOR CYCLIST ON ROADWAY' literal object. + * + * + * @see #MOTOR_CYCLIST_ON_ROADWAY_VALUE + * @generated + * @ordered + */ + MOTOR_CYCLIST_ON_ROADWAY(3, "MOTOR_CYCLIST_ON_ROADWAY", "MOTOR_CYCLIST_ON_ROADWAY"); + + /** + * The 'CHILDREN ON ROADWAY' literal value. + * + *

+ * If the meaning of 'CHILDREN ON ROADWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CHILDREN_ON_ROADWAY + * @model + * @generated + * @ordered + */ + public static final int CHILDREN_ON_ROADWAY_VALUE = 1; + + /** + * The 'CYCLISTS ON ROADWAY' literal value. + * + *

+ * If the meaning of 'CYCLISTS ON ROADWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CYCLISTS_ON_ROADWAY + * @model + * @generated + * @ordered + */ + public static final int CYCLISTS_ON_ROADWAY_VALUE = 2; + + /** + * The 'MOTOR CYCLIST ON ROADWAY' literal value. + * + *

+ * If the meaning of 'MOTOR CYCLIST ON ROADWAY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTOR_CYCLIST_ON_ROADWAY + * @model + * @generated + * @ordered + */ + public static final int MOTOR_CYCLIST_ON_ROADWAY_VALUE = 3; + + /** + * An array of all the 'People On Roadway' enumerators. + * + * + * @generated + */ + private static final PeopleOnRoadway[] VALUES_ARRAY = + new PeopleOnRoadway[] { + CHILDREN_ON_ROADWAY, + CYCLISTS_ON_ROADWAY, + MOTOR_CYCLIST_ON_ROADWAY, + }; + + /** + * A public read-only list of all the 'People On Roadway' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'People On Roadway' literal with the specified literal value. + * + * + * @generated + */ + public static PeopleOnRoadway get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PeopleOnRoadway result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'People On Roadway' literal with the specified name. + * + * + * @generated + */ + public static PeopleOnRoadway getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PeopleOnRoadway result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'People On Roadway' literal with the specified integer value. + * + * + * @generated + */ + public static PeopleOnRoadway get(int value) { + switch (value) { + case CHILDREN_ON_ROADWAY_VALUE: return CHILDREN_ON_ROADWAY; + case CYCLISTS_ON_ROADWAY_VALUE: return CYCLISTS_ON_ROADWAY; + case MOTOR_CYCLIST_ON_ROADWAY_VALUE: return MOTOR_CYCLIST_ON_ROADWAY; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private PeopleOnRoadway(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //PeopleOnRoadway diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PoliceCheckpoint.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PoliceCheckpoint.java new file mode 100755 index 0000000..3ccdcc1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/PoliceCheckpoint.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Police Checkpoint', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getPoliceCheckpoint() + * @model + * @generated + */ +public enum PoliceCheckpoint implements Enumerator { + /** + * The 'PERMANENT POLICE CHECKPOINT' literal object. + * + * + * @see #PERMANENT_POLICE_CHECKPOINT_VALUE + * @generated + * @ordered + */ + PERMANENT_POLICE_CHECKPOINT(1, "PERMANENT_POLICE_CHECKPOINT", "PERMANENT_POLICE_CHECKPOINT"), + + /** + * The 'TEMPORARY POLICE CHECKPOINT' literal object. + * + * + * @see #TEMPORARY_POLICE_CHECKPOINT_VALUE + * @generated + * @ordered + */ + TEMPORARY_POLICE_CHECKPOINT(2, "TEMPORARY_POLICE_CHECKPOINT", "TEMPORARY_POLICE_CHECKPOINT"); + + /** + * The 'PERMANENT POLICE CHECKPOINT' literal value. + * + *

+ * If the meaning of 'PERMANENT POLICE CHECKPOINT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PERMANENT_POLICE_CHECKPOINT + * @model + * @generated + * @ordered + */ + public static final int PERMANENT_POLICE_CHECKPOINT_VALUE = 1; + + /** + * The 'TEMPORARY POLICE CHECKPOINT' literal value. + * + *

+ * If the meaning of 'TEMPORARY POLICE CHECKPOINT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TEMPORARY_POLICE_CHECKPOINT + * @model + * @generated + * @ordered + */ + public static final int TEMPORARY_POLICE_CHECKPOINT_VALUE = 2; + + /** + * An array of all the 'Police Checkpoint' enumerators. + * + * + * @generated + */ + private static final PoliceCheckpoint[] VALUES_ARRAY = + new PoliceCheckpoint[] { + PERMANENT_POLICE_CHECKPOINT, + TEMPORARY_POLICE_CHECKPOINT, + }; + + /** + * A public read-only list of all the 'Police Checkpoint' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Police Checkpoint' literal with the specified literal value. + * + * + * @generated + */ + public static PoliceCheckpoint get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PoliceCheckpoint result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Police Checkpoint' literal with the specified name. + * + * + * @generated + */ + public static PoliceCheckpoint getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + PoliceCheckpoint result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Police Checkpoint' literal with the specified integer value. + * + * + * @generated + */ + public static PoliceCheckpoint get(int value) { + switch (value) { + case PERMANENT_POLICE_CHECKPOINT_VALUE: return PERMANENT_POLICE_CHECKPOINT; + case TEMPORARY_POLICE_CHECKPOINT_VALUE: return TEMPORARY_POLICE_CHECKPOINT; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private PoliceCheckpoint(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //PoliceCheckpoint diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Precipitation.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Precipitation.java new file mode 100755 index 0000000..c6c0d16 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Precipitation.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Precipitation', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getPrecipitation() + * @model + * @generated + */ +public enum Precipitation implements Enumerator { + /** + * The 'HEAVY RAIN' literal object. + * + * + * @see #HEAVY_RAIN_VALUE + * @generated + * @ordered + */ + HEAVY_RAIN(1, "HEAVY_RAIN", "HEAVY_RAIN"), + + /** + * The 'HEAVY SNOWFALL' literal object. + * + * + * @see #HEAVY_SNOWFALL_VALUE + * @generated + * @ordered + */ + HEAVY_SNOWFALL(2, "HEAVY_SNOWFALL", "HEAVY_SNOWFALL"), + + /** + * The 'SOFT HAIL' literal object. + * + * + * @see #SOFT_HAIL_VALUE + * @generated + * @ordered + */ + SOFT_HAIL(3, "SOFT_HAIL", "SOFT_HAIL"); + + /** + * The 'HEAVY RAIN' literal value. + * + *

+ * If the meaning of 'HEAVY RAIN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_RAIN + * @model + * @generated + * @ordered + */ + public static final int HEAVY_RAIN_VALUE = 1; + + /** + * The 'HEAVY SNOWFALL' literal value. + * + *

+ * If the meaning of 'HEAVY SNOWFALL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_SNOWFALL + * @model + * @generated + * @ordered + */ + public static final int HEAVY_SNOWFALL_VALUE = 2; + + /** + * The 'SOFT HAIL' literal value. + * + *

+ * If the meaning of 'SOFT HAIL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SOFT_HAIL + * @model + * @generated + * @ordered + */ + public static final int SOFT_HAIL_VALUE = 3; + + /** + * An array of all the 'Precipitation' enumerators. + * + * + * @generated + */ + private static final Precipitation[] VALUES_ARRAY = + new Precipitation[] { + HEAVY_RAIN, + HEAVY_SNOWFALL, + SOFT_HAIL, + }; + + /** + * A public read-only list of all the 'Precipitation' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Precipitation' literal with the specified literal value. + * + * + * @generated + */ + public static Precipitation get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Precipitation result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Precipitation' literal with the specified name. + * + * + * @generated + */ + public static Precipitation getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Precipitation result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Precipitation' literal with the specified integer value. + * + * + * @generated + */ + public static Precipitation get(int value) { + switch (value) { + case HEAVY_RAIN_VALUE: return HEAVY_RAIN; + case HEAVY_SNOWFALL_VALUE: return HEAVY_SNOWFALL; + case SOFT_HAIL_VALUE: return SOFT_HAIL; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Precipitation(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Precipitation diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RecklessPersons.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RecklessPersons.java new file mode 100755 index 0000000..629c222 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RecklessPersons.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Reckless Persons', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRecklessPersons() + * @model + * @generated + */ +public enum RecklessPersons implements Enumerator { + /** + * The 'RECKLESS DRIVER' literal object. + * + * + * @see #RECKLESS_DRIVER_VALUE + * @generated + * @ordered + */ + RECKLESS_DRIVER(1, "RECKLESS_DRIVER", "RECKLESS_DRIVER"), + + /** + * The 'GUNFIRE ON ROAD' literal object. + * + * + * @see #GUNFIRE_ON_ROAD_VALUE + * @generated + * @ordered + */ + GUNFIRE_ON_ROAD(2, "GUNFIRE_ON_ROAD", "GUNFIRE_ON_ROAD"), + + /** + * The 'STONE THROWING PERSONS' literal object. + * + * + * @see #STONE_THROWING_PERSONS_VALUE + * @generated + * @ordered + */ + STONE_THROWING_PERSONS(3, "STONE_THROWING_PERSONS", "STONE_THROWING_PERSONS"); + + /** + * The 'RECKLESS DRIVER' literal value. + * + *

+ * If the meaning of 'RECKLESS DRIVER' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RECKLESS_DRIVER + * @model + * @generated + * @ordered + */ + public static final int RECKLESS_DRIVER_VALUE = 1; + + /** + * The 'GUNFIRE ON ROAD' literal value. + * + *

+ * If the meaning of 'GUNFIRE ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #GUNFIRE_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int GUNFIRE_ON_ROAD_VALUE = 2; + + /** + * The 'STONE THROWING PERSONS' literal value. + * + *

+ * If the meaning of 'STONE THROWING PERSONS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STONE_THROWING_PERSONS + * @model + * @generated + * @ordered + */ + public static final int STONE_THROWING_PERSONS_VALUE = 3; + + /** + * An array of all the 'Reckless Persons' enumerators. + * + * + * @generated + */ + private static final RecklessPersons[] VALUES_ARRAY = + new RecklessPersons[] { + RECKLESS_DRIVER, + GUNFIRE_ON_ROAD, + STONE_THROWING_PERSONS, + }; + + /** + * A public read-only list of all the 'Reckless Persons' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Reckless Persons' literal with the specified literal value. + * + * + * @generated + */ + public static RecklessPersons get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RecklessPersons result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Reckless Persons' literal with the specified name. + * + * + * @generated + */ + public static RecklessPersons getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RecklessPersons result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Reckless Persons' literal with the specified integer value. + * + * + * @generated + */ + public static RecklessPersons get(int value) { + switch (value) { + case RECKLESS_DRIVER_VALUE: return RECKLESS_DRIVER; + case GUNFIRE_ON_ROAD_VALUE: return GUNFIRE_ON_ROAD; + case STONE_THROWING_PERSONS_VALUE: return STONE_THROWING_PERSONS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RecklessPersons(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RecklessPersons diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RegulatoryMeasure.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RegulatoryMeasure.java new file mode 100755 index 0000000..14edcf1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RegulatoryMeasure.java @@ -0,0 +1,319 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Regulatory Measure', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRegulatoryMeasure() + * @model + * @generated + */ +public enum RegulatoryMeasure implements Enumerator { + /** + * The 'SECURITY ALERT' literal object. + * + * + * @see #SECURITY_ALERT_VALUE + * @generated + * @ordered + */ + SECURITY_ALERT(1, "SECURITY_ALERT", "SECURITY_ALERT"), + + /** + * The 'CONTAGIOUS DISEASE' literal object. + * + * + * @see #CONTAGIOUS_DISEASE_VALUE + * @generated + * @ordered + */ + CONTAGIOUS_DISEASE(2, "CONTAGIOUS_DISEASE", "CONTAGIOUS_DISEASE"), + + /** + * The 'ENVIRONMENTAL' literal object. + * + * + * @see #ENVIRONMENTAL_VALUE + * @generated + * @ordered + */ + ENVIRONMENTAL(3, "ENVIRONMENTAL", "ENVIRONMENTAL"), + + /** + * The 'SMOG ALERT' literal object. + * + * + * @see #SMOG_ALERT_VALUE + * @generated + * @ordered + */ + SMOG_ALERT(4, "SMOG_ALERT", "SMOG_ALERT"), + + /** + * The 'BATCH SERVICE IN PROGRESS' literal object. + * + * + * @see #BATCH_SERVICE_IN_PROGRESS_VALUE + * @generated + * @ordered + */ + BATCH_SERVICE_IN_PROGRESS(5, "BATCH_SERVICE_IN_PROGRESS", "BATCH_SERVICE_IN_PROGRESS"), /** + * The 'ROAD CLOSED BY THE REGULATORY AUTHORITIES' literal object. + * + * + * @see #ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES_VALUE + * @generated + * @ordered + */ + ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES(6, "ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES", "ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES"); + + /** + * The 'SECURITY ALERT' literal value. + * + *

+ * If the meaning of 'SECURITY ALERT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SECURITY_ALERT + * @model + * @generated + * @ordered + */ + public static final int SECURITY_ALERT_VALUE = 1; + + /** + * The 'CONTAGIOUS DISEASE' literal value. + * + *

+ * If the meaning of 'CONTAGIOUS DISEASE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CONTAGIOUS_DISEASE + * @model + * @generated + * @ordered + */ + public static final int CONTAGIOUS_DISEASE_VALUE = 2; + + /** + * The 'ENVIRONMENTAL' literal value. + * + *

+ * If the meaning of 'ENVIRONMENTAL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ENVIRONMENTAL + * @model + * @generated + * @ordered + */ + public static final int ENVIRONMENTAL_VALUE = 3; + + /** + * The 'SMOG ALERT' literal value. + * + *

+ * If the meaning of 'SMOG ALERT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SMOG_ALERT + * @model + * @generated + * @ordered + */ + public static final int SMOG_ALERT_VALUE = 4; + + /** + * The 'BATCH SERVICE IN PROGRESS' literal value. + * + *

+ * If the meaning of 'BATCH SERVICE IN PROGRESS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BATCH_SERVICE_IN_PROGRESS + * @model + * @generated + * @ordered + */ + public static final int BATCH_SERVICE_IN_PROGRESS_VALUE = 5; + + /** + * The 'ROAD CLOSED BY THE REGULATORY AUTHORITIES' literal value. + * + *

+ * If the meaning of 'ROAD CLOSED BY THE REGULATORY AUTHORITIES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES + * @model + * @generated + * @ordered + */ + public static final int ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES_VALUE = 6; + + /** + * An array of all the 'Regulatory Measure' enumerators. + * + * + * @generated + */ + private static final RegulatoryMeasure[] VALUES_ARRAY = + new RegulatoryMeasure[] { + SECURITY_ALERT, + CONTAGIOUS_DISEASE, + ENVIRONMENTAL, + SMOG_ALERT, + BATCH_SERVICE_IN_PROGRESS, + ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES, + }; + + /** + * A public read-only list of all the 'Regulatory Measure' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Regulatory Measure' literal with the specified literal value. + * + * + * @generated + */ + public static RegulatoryMeasure get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RegulatoryMeasure result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Regulatory Measure' literal with the specified name. + * + * + * @generated + */ + public static RegulatoryMeasure getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RegulatoryMeasure result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Regulatory Measure' literal with the specified integer value. + * + * + * @generated + */ + public static RegulatoryMeasure get(int value) { + switch (value) { + case SECURITY_ALERT_VALUE: return SECURITY_ALERT; + case CONTAGIOUS_DISEASE_VALUE: return CONTAGIOUS_DISEASE; + case ENVIRONMENTAL_VALUE: return ENVIRONMENTAL; + case SMOG_ALERT_VALUE: return SMOG_ALERT; + case BATCH_SERVICE_IN_PROGRESS_VALUE: return BATCH_SERVICE_IN_PROGRESS; + case ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES_VALUE: return ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RegulatoryMeasure(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RegulatoryMeasure diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RescueAndRecoveryWorkInProgress.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RescueAndRecoveryWorkInProgress.java new file mode 100755 index 0000000..9e34961 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RescueAndRecoveryWorkInProgress.java @@ -0,0 +1,294 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Rescue And Recovery Work In Progress', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRescueAndRecoveryWorkInProgress() + * @model + * @generated + */ +public enum RescueAndRecoveryWorkInProgress implements Enumerator { + /** + * The 'EMERGENCY VEHICLES' literal object. + * + * + * @see #EMERGENCY_VEHICLES_VALUE + * @generated + * @ordered + */ + EMERGENCY_VEHICLES(1, "EMERGENCY_VEHICLES", "EMERGENCY_VEHICLES"), + + /** + * The 'RESCUE HELICOPTER LANDING' literal object. + * + * + * @see #RESCUE_HELICOPTER_LANDING_VALUE + * @generated + * @ordered + */ + RESCUE_HELICOPTER_LANDING(2, "RESCUE_HELICOPTER_LANDING", "RESCUE_HELICOPTER_LANDING"), + + /** + * The 'POLICE ACTIVITY ONGOING' literal object. + * + * + * @see #POLICE_ACTIVITY_ONGOING_VALUE + * @generated + * @ordered + */ + POLICE_ACTIVITY_ONGOING(3, "POLICE_ACTIVITY_ONGOING", "POLICE_ACTIVITY_ONGOING"), + + /** + * The 'MEDICAL EMERGENCY ONGOING' literal object. + * + * + * @see #MEDICAL_EMERGENCY_ONGOING_VALUE + * @generated + * @ordered + */ + MEDICAL_EMERGENCY_ONGOING(4, "MEDICAL_EMERGENCY_ONGOING", "MEDICAL_EMERGENCY_ONGOING"), + + /** + * The 'CHILD ABDUCTION IN PROGRESS' literal object. + * + * + * @see #CHILD_ABDUCTION_IN_PROGRESS_VALUE + * @generated + * @ordered + */ + CHILD_ABDUCTION_IN_PROGRESS(5, "CHILD_ABDUCTION_IN_PROGRESS", "CHILD_ABDUCTION_IN_PROGRESS"); + + /** + * The 'EMERGENCY VEHICLES' literal value. + * + *

+ * If the meaning of 'EMERGENCY VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EMERGENCY_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int EMERGENCY_VEHICLES_VALUE = 1; + + /** + * The 'RESCUE HELICOPTER LANDING' literal value. + * + *

+ * If the meaning of 'RESCUE HELICOPTER LANDING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RESCUE_HELICOPTER_LANDING + * @model + * @generated + * @ordered + */ + public static final int RESCUE_HELICOPTER_LANDING_VALUE = 2; + + /** + * The 'POLICE ACTIVITY ONGOING' literal value. + * + *

+ * If the meaning of 'POLICE ACTIVITY ONGOING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #POLICE_ACTIVITY_ONGOING + * @model + * @generated + * @ordered + */ + public static final int POLICE_ACTIVITY_ONGOING_VALUE = 3; + + /** + * The 'MEDICAL EMERGENCY ONGOING' literal value. + * + *

+ * If the meaning of 'MEDICAL EMERGENCY ONGOING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MEDICAL_EMERGENCY_ONGOING + * @model + * @generated + * @ordered + */ + public static final int MEDICAL_EMERGENCY_ONGOING_VALUE = 4; + + /** + * The 'CHILD ABDUCTION IN PROGRESS' literal value. + * + *

+ * If the meaning of 'CHILD ABDUCTION IN PROGRESS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CHILD_ABDUCTION_IN_PROGRESS + * @model + * @generated + * @ordered + */ + public static final int CHILD_ABDUCTION_IN_PROGRESS_VALUE = 5; + + /** + * An array of all the 'Rescue And Recovery Work In Progress' enumerators. + * + * + * @generated + */ + private static final RescueAndRecoveryWorkInProgress[] VALUES_ARRAY = + new RescueAndRecoveryWorkInProgress[] { + EMERGENCY_VEHICLES, + RESCUE_HELICOPTER_LANDING, + POLICE_ACTIVITY_ONGOING, + MEDICAL_EMERGENCY_ONGOING, + CHILD_ABDUCTION_IN_PROGRESS, + }; + + /** + * A public read-only list of all the 'Rescue And Recovery Work In Progress' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Rescue And Recovery Work In Progress' literal with the specified literal value. + * + * + * @generated + */ + public static RescueAndRecoveryWorkInProgress get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RescueAndRecoveryWorkInProgress result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Rescue And Recovery Work In Progress' literal with the specified name. + * + * + * @generated + */ + public static RescueAndRecoveryWorkInProgress getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RescueAndRecoveryWorkInProgress result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Rescue And Recovery Work In Progress' literal with the specified integer value. + * + * + * @generated + */ + public static RescueAndRecoveryWorkInProgress get(int value) { + switch (value) { + case EMERGENCY_VEHICLES_VALUE: return EMERGENCY_VEHICLES; + case RESCUE_HELICOPTER_LANDING_VALUE: return RESCUE_HELICOPTER_LANDING; + case POLICE_ACTIVITY_ONGOING_VALUE: return POLICE_ACTIVITY_ONGOING; + case MEDICAL_EMERGENCY_ONGOING_VALUE: return MEDICAL_EMERGENCY_ONGOING; + case CHILD_ABDUCTION_IN_PROGRESS_VALUE: return CHILD_ABDUCTION_IN_PROGRESS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RescueAndRecoveryWorkInProgress(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RescueAndRecoveryWorkInProgress diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RestrictionType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RestrictionType.java new file mode 100755 index 0000000..609e296 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RestrictionType.java @@ -0,0 +1,905 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Restriction Type', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRestrictionType() + * @model + * @generated + */ +public enum RestrictionType implements Enumerator { + /** + * The 'WIDTH LESS THAN' literal object. + * + * + * @see #WIDTH_LESS_THAN_VALUE + * @generated + * @ordered + */ + WIDTH_LESS_THAN(1, "WIDTH_LESS_THAN", "WIDTH_LESS_THAN"), + + /** + * The 'WIDTH GREATER THAN' literal object. + * + * + * @see #WIDTH_GREATER_THAN_VALUE + * @generated + * @ordered + */ + WIDTH_GREATER_THAN(2, "WIDTH_GREATER_THAN", "WIDTH_GREATER_THAN"), + + /** + * The 'HEIGTH LESS THAN' literal object. + * + * + * @see #HEIGTH_LESS_THAN_VALUE + * @generated + * @ordered + */ + HEIGTH_LESS_THAN(3, "HEIGTH_LESS_THAN", "HEIGTH_LESS_THAN"), + + /** + * The 'HEIGTH GREATER THAN' literal object. + * + * + * @see #HEIGTH_GREATER_THAN_VALUE + * @generated + * @ordered + */ + HEIGTH_GREATER_THAN(4, "HEIGTH_GREATER_THAN", "HEIGTH_GREATER_THAN"), + + /** + * The 'WEIGHT LESS THAN' literal object. + * + * + * @see #WEIGHT_LESS_THAN_VALUE + * @generated + * @ordered + */ + WEIGHT_LESS_THAN(5, "WEIGHT_LESS_THAN", "WEIGHT_LESS_THAN"), + + /** + * The 'WEIGHT GREATER THAN' literal object. + * + * + * @see #WEIGHT_GREATER_THAN_VALUE + * @generated + * @ordered + */ + WEIGHT_GREATER_THAN(6, "WEIGHT_GREATER_THAN", "WEIGHT_GREATER_THAN"), + + /** + * The 'WITHOUT WINTER TYRE' literal object. + * + * + * @see #WITHOUT_WINTER_TYRE_VALUE + * @generated + * @ordered + */ + WITHOUT_WINTER_TYRE(7, "WITHOUT_WINTER_TYRE", "WITHOUT_WINTER_TYRE"), + + /** + * The 'WITHOUT SNOW CHAIN' literal object. + * + * + * @see #WITHOUT_SNOW_CHAIN_VALUE + * @generated + * @ordered + */ + WITHOUT_SNOW_CHAIN(8, "WITHOUT_SNOW_CHAIN", "WITHOUT_SNOW_CHAIN"), + + /** + * The 'WITH TRAILER' literal object. + * + * + * @see #WITH_TRAILER_VALUE + * @generated + * @ordered + */ + WITH_TRAILER(9, "WITH_TRAILER", "WITH_TRAILER"), + + /** + * The 'WITH CARAVAN' literal object. + * + * + * @see #WITH_CARAVAN_VALUE + * @generated + * @ordered + */ + WITH_CARAVAN(10, "WITH_CARAVAN", "WITH_CARAVAN"), + + /** + * The 'PERSONS IN VEHICLE LESS THAN' literal object. + * + * + * @see #PERSONS_IN_VEHICLE_LESS_THAN_VALUE + * @generated + * @ordered + */ + PERSONS_IN_VEHICLE_LESS_THAN(11, "PERSONS_IN_VEHICLE_LESS_THAN", "PERSONS_IN_VEHICLE_LESS_THAN"), + + /** + * The 'PERSONS IN VEHICLE MORE THAN' literal object. + * + * + * @see #PERSONS_IN_VEHICLE_MORE_THAN_VALUE + * @generated + * @ordered + */ + PERSONS_IN_VEHICLE_MORE_THAN(12, "PERSONS_IN_VEHICLE_MORE_THAN", "PERSONS_IN_VEHICLE_MORE_THAN"), + + /** + * The 'EVEN NUMBER PLATE' literal object. + * + * + * @see #EVEN_NUMBER_PLATE_VALUE + * @generated + * @ordered + */ + EVEN_NUMBER_PLATE(13, "EVEN_NUMBER_PLATE", "EVEN_NUMBER_PLATE"), + + /** + * The 'ODD NUMBER PLATE' literal object. + * + * + * @see #ODD_NUMBER_PLATE_VALUE + * @generated + * @ordered + */ + ODD_NUMBER_PLATE(14, "ODD_NUMBER_PLATE", "ODD_NUMBER_PLATE"), + + /** + * The 'LENGTH LESS THAN' literal object. + * + * + * @see #LENGTH_LESS_THAN_VALUE + * @generated + * @ordered + */ + LENGTH_LESS_THAN(15, "LENGTH_LESS_THAN", "LENGTH_LESS_THAN"), + + /** + * The 'LENGTH GREATER THAN' literal object. + * + * + * @see #LENGTH_GREATER_THAN_VALUE + * @generated + * @ordered + */ + LENGTH_GREATER_THAN(16, "LENGTH_GREATER_THAN", "LENGTH_GREATER_THAN"), + + /** + * The 'AXLE LOAD LESS THAN' literal object. + * + * + * @see #AXLE_LOAD_LESS_THAN_VALUE + * @generated + * @ordered + */ + AXLE_LOAD_LESS_THAN(17, "AXLE_LOAD_LESS_THAN", "AXLE_LOAD_LESS_THAN"), + + /** + * The 'AXLE LOAD GREATER THAN' literal object. + * + * + * @see #AXLE_LOAD_GREATER_THAN_VALUE + * @generated + * @ordered + */ + AXLE_LOAD_GREATER_THAN(18, "AXLE_LOAD_GREATER_THAN", "AXLE_LOAD_GREATER_THAN"), + + /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO3' literal object. + * + * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3_VALUE + * @generated + * @ordered + */ + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3(19, "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3", "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3"), /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO3D4' literal object. + * + * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4_VALUE + * @generated + * @ordered + */ + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4(20, "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4", "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4"), /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO4' literal object. + * + * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4_VALUE + * @generated + * @ordered + */ + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4(21, "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4", "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4"), /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO5' literal object. + * + * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5_VALUE + * @generated + * @ordered + */ + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5(22, "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5", "VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5"), /** + * The 'WITH PETROL ENGINE' literal object. + * + * + * @see #WITH_PETROL_ENGINE_VALUE + * @generated + * @ordered + */ + WITH_PETROL_ENGINE(23, "WITH_PETROL_ENGINE", "WITH_PETROL_ENGINE"), + + /** + * The 'WITH DIESEL ENGINE' literal object. + * + * + * @see #WITH_DIESEL_ENGINE_VALUE + * @generated + * @ordered + */ + WITH_DIESEL_ENGINE(24, "WITH_DIESEL_ENGINE", "WITH_DIESEL_ENGINE"), /** + * The 'WITH LPG ENGINE' literal object. + * + * + * @see #WITH_LPG_ENGINE_VALUE + * @generated + * @ordered + */ + WITH_LPG_ENGINE(25, "WITH_LPG_ENGINE", "WITH_LPG_ENGINE"), + + /** + * The 'THROUGH TRAFFIC' literal object. + * + * + * @see #THROUGH_TRAFFIC_VALUE + * @generated + * @ordered + */ + THROUGH_TRAFFIC(26, "THROUGH_TRAFFIC", "THROUGH_TRAFFIC"), + + /** + * The 'RESIDENTS TRAFFIC' literal object. + * + * + * @see #RESIDENTS_TRAFFIC_VALUE + * @generated + * @ordered + */ + RESIDENTS_TRAFFIC(27, "RESIDENTS_TRAFFIC", "RESIDENTS_TRAFFIC"), + + /** + * The 'WITH DESTINATION IN GIVEN AREA' literal object. + * + * + * @see #WITH_DESTINATION_IN_GIVEN_AREA_VALUE + * @generated + * @ordered + */ + WITH_DESTINATION_IN_GIVEN_AREA(28, "WITH_DESTINATION_IN_GIVEN_AREA", "WITH_DESTINATION_IN_GIVEN_AREA"); + + /** + * The 'WIDTH LESS THAN' literal value. + * + *

+ * If the meaning of 'WIDTH LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WIDTH_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int WIDTH_LESS_THAN_VALUE = 1; + + /** + * The 'WIDTH GREATER THAN' literal value. + * + *

+ * If the meaning of 'WIDTH GREATER THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WIDTH_GREATER_THAN + * @model + * @generated + * @ordered + */ + public static final int WIDTH_GREATER_THAN_VALUE = 2; + + /** + * The 'HEIGTH LESS THAN' literal value. + * + *

+ * If the meaning of 'HEIGTH LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEIGTH_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int HEIGTH_LESS_THAN_VALUE = 3; + + /** + * The 'HEIGTH GREATER THAN' literal value. + * + *

+ * If the meaning of 'HEIGTH GREATER THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEIGTH_GREATER_THAN + * @model + * @generated + * @ordered + */ + public static final int HEIGTH_GREATER_THAN_VALUE = 4; + + /** + * The 'WEIGHT LESS THAN' literal value. + * + *

+ * If the meaning of 'WEIGHT LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WEIGHT_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int WEIGHT_LESS_THAN_VALUE = 5; + + /** + * The 'WEIGHT GREATER THAN' literal value. + * + *

+ * If the meaning of 'WEIGHT GREATER THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WEIGHT_GREATER_THAN + * @model + * @generated + * @ordered + */ + public static final int WEIGHT_GREATER_THAN_VALUE = 6; + + /** + * The 'WITHOUT WINTER TYRE' literal value. + * + *

+ * If the meaning of 'WITHOUT WINTER TYRE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITHOUT_WINTER_TYRE + * @model + * @generated + * @ordered + */ + public static final int WITHOUT_WINTER_TYRE_VALUE = 7; + + /** + * The 'WITHOUT SNOW CHAIN' literal value. + * + *

+ * If the meaning of 'WITHOUT SNOW CHAIN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITHOUT_SNOW_CHAIN + * @model + * @generated + * @ordered + */ + public static final int WITHOUT_SNOW_CHAIN_VALUE = 8; + + /** + * The 'WITH TRAILER' literal value. + * + *

+ * If the meaning of 'WITH TRAILER' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_TRAILER + * @model + * @generated + * @ordered + */ + public static final int WITH_TRAILER_VALUE = 9; + + /** + * The 'WITH CARAVAN' literal value. + * + *

+ * If the meaning of 'WITH CARAVAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_CARAVAN + * @model + * @generated + * @ordered + */ + public static final int WITH_CARAVAN_VALUE = 10; + + /** + * The 'PERSONS IN VEHICLE LESS THAN' literal value. + * + *

+ * If the meaning of 'PERSONS IN VEHICLE LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PERSONS_IN_VEHICLE_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int PERSONS_IN_VEHICLE_LESS_THAN_VALUE = 11; + + /** + * The 'PERSONS IN VEHICLE MORE THAN' literal value. + * + *

+ * If the meaning of 'PERSONS IN VEHICLE MORE THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PERSONS_IN_VEHICLE_MORE_THAN + * @model + * @generated + * @ordered + */ + public static final int PERSONS_IN_VEHICLE_MORE_THAN_VALUE = 12; + + /** + * The 'EVEN NUMBER PLATE' literal value. + * + *

+ * If the meaning of 'EVEN NUMBER PLATE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #EVEN_NUMBER_PLATE + * @model + * @generated + * @ordered + */ + public static final int EVEN_NUMBER_PLATE_VALUE = 13; + + /** + * The 'ODD NUMBER PLATE' literal value. + * + *

+ * If the meaning of 'ODD NUMBER PLATE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ODD_NUMBER_PLATE + * @model + * @generated + * @ordered + */ + public static final int ODD_NUMBER_PLATE_VALUE = 14; + + /** + * The 'LENGTH LESS THAN' literal value. + * + *

+ * If the meaning of 'LENGTH LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LENGTH_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int LENGTH_LESS_THAN_VALUE = 15; + + /** + * The 'LENGTH GREATER THAN' literal value. + * + *

+ * If the meaning of 'LENGTH GREATER THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LENGTH_GREATER_THAN + * @model + * @generated + * @ordered + */ + public static final int LENGTH_GREATER_THAN_VALUE = 16; + + /** + * The 'AXLE LOAD LESS THAN' literal value. + * + *

+ * If the meaning of 'AXLE LOAD LESS THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AXLE_LOAD_LESS_THAN + * @model + * @generated + * @ordered + */ + public static final int AXLE_LOAD_LESS_THAN_VALUE = 17; + + /** + * The 'AXLE LOAD GREATER THAN' literal value. + * + *

+ * If the meaning of 'AXLE LOAD GREATER THAN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #AXLE_LOAD_GREATER_THAN + * @model + * @generated + * @ordered + */ + public static final int AXLE_LOAD_GREATER_THAN_VALUE = 18; + + /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO3' literal value. + * + *

+ * If the meaning of 'VEHICLE FULFILLS EMISSION STANDARD EURO3' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3 + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3_VALUE = 19; + + /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO3D4' literal value. + * + *

+ * If the meaning of 'VEHICLE FULFILLS EMISSION STANDARD EURO3D4' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4 + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4_VALUE = 20; + + /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO4' literal value. + * + *

+ * If the meaning of 'VEHICLE FULFILLS EMISSION STANDARD EURO4' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4 + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4_VALUE = 21; + + /** + * The 'VEHICLE FULFILLS EMISSION STANDARD EURO5' literal value. + * + *

+ * If the meaning of 'VEHICLE FULFILLS EMISSION STANDARD EURO5' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5 + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5_VALUE = 22; + + /** + * The 'WITH PETROL ENGINE' literal value. + * + *

+ * If the meaning of 'WITH PETROL ENGINE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_PETROL_ENGINE + * @model + * @generated + * @ordered + */ + public static final int WITH_PETROL_ENGINE_VALUE = 23; + + /** + * The 'WITH DIESEL ENGINE' literal value. + * + *

+ * If the meaning of 'WITH DIESEL ENGINE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_DIESEL_ENGINE + * @model + * @generated + * @ordered + */ + public static final int WITH_DIESEL_ENGINE_VALUE = 24; + + /** + * The 'WITH LPG ENGINE' literal value. + * + *

+ * If the meaning of 'WITH LPG ENGINE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_LPG_ENGINE + * @model + * @generated + * @ordered + */ + public static final int WITH_LPG_ENGINE_VALUE = 25; + + /** + * The 'THROUGH TRAFFIC' literal value. + * + *

+ * If the meaning of 'THROUGH TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #THROUGH_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int THROUGH_TRAFFIC_VALUE = 26; + + /** + * The 'RESIDENTS TRAFFIC' literal value. + * + *

+ * If the meaning of 'RESIDENTS TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #RESIDENTS_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int RESIDENTS_TRAFFIC_VALUE = 27; + + /** + * The 'WITH DESTINATION IN GIVEN AREA' literal value. + * + *

+ * If the meaning of 'WITH DESTINATION IN GIVEN AREA' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #WITH_DESTINATION_IN_GIVEN_AREA + * @model + * @generated + * @ordered + */ + public static final int WITH_DESTINATION_IN_GIVEN_AREA_VALUE = 28; + + /** + * An array of all the 'Restriction Type' enumerators. + * + * + * @generated + */ + private static final RestrictionType[] VALUES_ARRAY = + new RestrictionType[] { + WIDTH_LESS_THAN, + WIDTH_GREATER_THAN, + HEIGTH_LESS_THAN, + HEIGTH_GREATER_THAN, + WEIGHT_LESS_THAN, + WEIGHT_GREATER_THAN, + WITHOUT_WINTER_TYRE, + WITHOUT_SNOW_CHAIN, + WITH_TRAILER, + WITH_CARAVAN, + PERSONS_IN_VEHICLE_LESS_THAN, + PERSONS_IN_VEHICLE_MORE_THAN, + EVEN_NUMBER_PLATE, + ODD_NUMBER_PLATE, + LENGTH_LESS_THAN, + LENGTH_GREATER_THAN, + AXLE_LOAD_LESS_THAN, + AXLE_LOAD_GREATER_THAN, + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3, + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4, + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4, + VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5, + WITH_PETROL_ENGINE, + WITH_DIESEL_ENGINE, + WITH_LPG_ENGINE, + THROUGH_TRAFFIC, + RESIDENTS_TRAFFIC, + WITH_DESTINATION_IN_GIVEN_AREA, + }; + + /** + * A public read-only list of all the 'Restriction Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Restriction Type' literal with the specified literal value. + * + * + * @generated + */ + public static RestrictionType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RestrictionType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Restriction Type' literal with the specified name. + * + * + * @generated + */ + public static RestrictionType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RestrictionType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Restriction Type' literal with the specified integer value. + * + * + * @generated + */ + public static RestrictionType get(int value) { + switch (value) { + case WIDTH_LESS_THAN_VALUE: return WIDTH_LESS_THAN; + case WIDTH_GREATER_THAN_VALUE: return WIDTH_GREATER_THAN; + case HEIGTH_LESS_THAN_VALUE: return HEIGTH_LESS_THAN; + case HEIGTH_GREATER_THAN_VALUE: return HEIGTH_GREATER_THAN; + case WEIGHT_LESS_THAN_VALUE: return WEIGHT_LESS_THAN; + case WEIGHT_GREATER_THAN_VALUE: return WEIGHT_GREATER_THAN; + case WITHOUT_WINTER_TYRE_VALUE: return WITHOUT_WINTER_TYRE; + case WITHOUT_SNOW_CHAIN_VALUE: return WITHOUT_SNOW_CHAIN; + case WITH_TRAILER_VALUE: return WITH_TRAILER; + case WITH_CARAVAN_VALUE: return WITH_CARAVAN; + case PERSONS_IN_VEHICLE_LESS_THAN_VALUE: return PERSONS_IN_VEHICLE_LESS_THAN; + case PERSONS_IN_VEHICLE_MORE_THAN_VALUE: return PERSONS_IN_VEHICLE_MORE_THAN; + case EVEN_NUMBER_PLATE_VALUE: return EVEN_NUMBER_PLATE; + case ODD_NUMBER_PLATE_VALUE: return ODD_NUMBER_PLATE; + case LENGTH_LESS_THAN_VALUE: return LENGTH_LESS_THAN; + case LENGTH_GREATER_THAN_VALUE: return LENGTH_GREATER_THAN; + case AXLE_LOAD_LESS_THAN_VALUE: return AXLE_LOAD_LESS_THAN; + case AXLE_LOAD_GREATER_THAN_VALUE: return AXLE_LOAD_GREATER_THAN; + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3_VALUE: return VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3; + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4_VALUE: return VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4; + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4_VALUE: return VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4; + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5_VALUE: return VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5; + case WITH_PETROL_ENGINE_VALUE: return WITH_PETROL_ENGINE; + case WITH_DIESEL_ENGINE_VALUE: return WITH_DIESEL_ENGINE; + case WITH_LPG_ENGINE_VALUE: return WITH_LPG_ENGINE; + case THROUGH_TRAFFIC_VALUE: return THROUGH_TRAFFIC; + case RESIDENTS_TRAFFIC_VALUE: return RESIDENTS_TRAFFIC; + case WITH_DESTINATION_IN_GIVEN_AREA_VALUE: return WITH_DESTINATION_IN_GIVEN_AREA; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RestrictionType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RestrictionType diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RiskOfFire.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RiskOfFire.java new file mode 100755 index 0000000..6fcdf32 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RiskOfFire.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Risk Of Fire', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRiskOfFire() + * @model + * @generated + */ +public enum RiskOfFire implements Enumerator { + /** + * The 'LEAKAGE OF FUEL' literal object. + * + * + * @see #LEAKAGE_OF_FUEL_VALUE + * @generated + * @ordered + */ + LEAKAGE_OF_FUEL(1, "LEAKAGE_OF_FUEL", "LEAKAGE_OF_FUEL"), + + /** + * The 'LEAKAGE OF GAS' literal object. + * + * + * @see #LEAKAGE_OF_GAS_VALUE + * @generated + * @ordered + */ + LEAKAGE_OF_GAS(2, "LEAKAGE_OF_GAS", "LEAKAGE_OF_GAS"); + + /** + * The 'LEAKAGE OF FUEL' literal value. + * + *

+ * If the meaning of 'LEAKAGE OF FUEL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LEAKAGE_OF_FUEL + * @model + * @generated + * @ordered + */ + public static final int LEAKAGE_OF_FUEL_VALUE = 1; + + /** + * The 'LEAKAGE OF GAS' literal value. + * + *

+ * If the meaning of 'LEAKAGE OF GAS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LEAKAGE_OF_GAS + * @model + * @generated + * @ordered + */ + public static final int LEAKAGE_OF_GAS_VALUE = 2; + + /** + * An array of all the 'Risk Of Fire' enumerators. + * + * + * @generated + */ + private static final RiskOfFire[] VALUES_ARRAY = + new RiskOfFire[] { + LEAKAGE_OF_FUEL, + LEAKAGE_OF_GAS, + }; + + /** + * A public read-only list of all the 'Risk Of Fire' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Risk Of Fire' literal with the specified literal value. + * + * + * @generated + */ + public static RiskOfFire get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RiskOfFire result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Risk Of Fire' literal with the specified name. + * + * + * @generated + */ + public static RiskOfFire getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RiskOfFire result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Risk Of Fire' literal with the specified integer value. + * + * + * @generated + */ + public static RiskOfFire get(int value) { + switch (value) { + case LEAKAGE_OF_FUEL_VALUE: return LEAKAGE_OF_FUEL; + case LEAKAGE_OF_GAS_VALUE: return LEAKAGE_OF_GAS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RiskOfFire(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RiskOfFire diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RoadWorks.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RoadWorks.java new file mode 100755 index 0000000..376ee89 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/RoadWorks.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Road Works', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getRoadWorks() + * @model + * @generated + */ +public enum RoadWorks implements Enumerator { + /** + * The 'MAJOR ROADWORKS' literal object. + * + * + * @see #MAJOR_ROADWORKS_VALUE + * @generated + * @ordered + */ + MAJOR_ROADWORKS(1, "MAJOR_ROADWORKS", "MAJOR_ROADWORKS"), + + /** + * The 'ROAD MARKING WORK' literal object. + * + * + * @see #ROAD_MARKING_WORK_VALUE + * @generated + * @ordered + */ + ROAD_MARKING_WORK(2, "ROAD_MARKING_WORK", "ROAD_MARKING_WORK"), + + /** + * The 'SLOW MOVING ROAD MAINTENANCE' literal object. + * + * + * @see #SLOW_MOVING_ROAD_MAINTENANCE_VALUE + * @generated + * @ordered + */ + SLOW_MOVING_ROAD_MAINTENANCE(3, "SLOW_MOVING_ROAD_MAINTENANCE", "SLOW_MOVING_ROAD_MAINTENANCE"); + + /** + * The 'MAJOR ROADWORKS' literal value. + * + *

+ * If the meaning of 'MAJOR ROADWORKS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MAJOR_ROADWORKS + * @model + * @generated + * @ordered + */ + public static final int MAJOR_ROADWORKS_VALUE = 1; + + /** + * The 'ROAD MARKING WORK' literal value. + * + *

+ * If the meaning of 'ROAD MARKING WORK' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROAD_MARKING_WORK + * @model + * @generated + * @ordered + */ + public static final int ROAD_MARKING_WORK_VALUE = 2; + + /** + * The 'SLOW MOVING ROAD MAINTENANCE' literal value. + * + *

+ * If the meaning of 'SLOW MOVING ROAD MAINTENANCE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLOW_MOVING_ROAD_MAINTENANCE + * @model + * @generated + * @ordered + */ + public static final int SLOW_MOVING_ROAD_MAINTENANCE_VALUE = 3; + + /** + * An array of all the 'Road Works' enumerators. + * + * + * @generated + */ + private static final RoadWorks[] VALUES_ARRAY = + new RoadWorks[] { + MAJOR_ROADWORKS, + ROAD_MARKING_WORK, + SLOW_MOVING_ROAD_MAINTENANCE, + }; + + /** + * A public read-only list of all the 'Road Works' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Road Works' literal with the specified literal value. + * + * + * @generated + */ + public static RoadWorks get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RoadWorks result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Road Works' literal with the specified name. + * + * + * @generated + */ + public static RoadWorks getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + RoadWorks result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Road Works' literal with the specified integer value. + * + * + * @generated + */ + public static RoadWorks get(int value) { + switch (value) { + case MAJOR_ROADWORKS_VALUE: return MAJOR_ROADWORKS; + case ROAD_MARKING_WORK_VALUE: return ROAD_MARKING_WORK; + case SLOW_MOVING_ROAD_MAINTENANCE_VALUE: return SLOW_MOVING_ROAD_MAINTENANCE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private RoadWorks(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //RoadWorks diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotOperating.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotOperating.java new file mode 100755 index 0000000..4326eeb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotOperating.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Service Not Operating', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getServiceNotOperating() + * @model + * @generated + */ +public enum ServiceNotOperating implements Enumerator { + /** + * The 'FERRY SERVICE NOT OPERATING' literal object. + * + * + * @see #FERRY_SERVICE_NOT_OPERATING_VALUE + * @generated + * @ordered + */ + FERRY_SERVICE_NOT_OPERATING(1, "FERRY_SERVICE_NOT_OPERATING", "FERRY_SERVICE_NOT_OPERATING"), + + /** + * The 'PLANE SERVICE NOT OPERATING' literal object. + * + * + * @see #PLANE_SERVICE_NOT_OPERATING_VALUE + * @generated + * @ordered + */ + PLANE_SERVICE_NOT_OPERATING(2, "PLANE_SERVICE_NOT_OPERATING", "PLANE_SERVICE_NOT_OPERATING"), + + /** + * The 'TRAIN SERVICE NOT OPERATING' literal object. + * + * + * @see #TRAIN_SERVICE_NOT_OPERATING_VALUE + * @generated + * @ordered + */ + TRAIN_SERVICE_NOT_OPERATING(3, "TRAIN_SERVICE_NOT_OPERATING", "TRAIN_SERVICE_NOT_OPERATING"), + + /** + * The 'BUS SERVICE NOT OPERATING' literal object. + * + * + * @see #BUS_SERVICE_NOT_OPERATING_VALUE + * @generated + * @ordered + */ + BUS_SERVICE_NOT_OPERATING(4, "BUS_SERVICE_NOT_OPERATING", "BUS_SERVICE_NOT_OPERATING"); + + /** + * The 'FERRY SERVICE NOT OPERATING' literal value. + * + *

+ * If the meaning of 'FERRY SERVICE NOT OPERATING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FERRY_SERVICE_NOT_OPERATING + * @model + * @generated + * @ordered + */ + public static final int FERRY_SERVICE_NOT_OPERATING_VALUE = 1; + + /** + * The 'PLANE SERVICE NOT OPERATING' literal value. + * + *

+ * If the meaning of 'PLANE SERVICE NOT OPERATING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PLANE_SERVICE_NOT_OPERATING + * @model + * @generated + * @ordered + */ + public static final int PLANE_SERVICE_NOT_OPERATING_VALUE = 2; + + /** + * The 'TRAIN SERVICE NOT OPERATING' literal value. + * + *

+ * If the meaning of 'TRAIN SERVICE NOT OPERATING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAIN_SERVICE_NOT_OPERATING + * @model + * @generated + * @ordered + */ + public static final int TRAIN_SERVICE_NOT_OPERATING_VALUE = 3; + + /** + * The 'BUS SERVICE NOT OPERATING' literal value. + * + *

+ * If the meaning of 'BUS SERVICE NOT OPERATING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BUS_SERVICE_NOT_OPERATING + * @model + * @generated + * @ordered + */ + public static final int BUS_SERVICE_NOT_OPERATING_VALUE = 4; + + /** + * An array of all the 'Service Not Operating' enumerators. + * + * + * @generated + */ + private static final ServiceNotOperating[] VALUES_ARRAY = + new ServiceNotOperating[] { + FERRY_SERVICE_NOT_OPERATING, + PLANE_SERVICE_NOT_OPERATING, + TRAIN_SERVICE_NOT_OPERATING, + BUS_SERVICE_NOT_OPERATING, + }; + + /** + * A public read-only list of all the 'Service Not Operating' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Service Not Operating' literal with the specified literal value. + * + * + * @generated + */ + public static ServiceNotOperating get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ServiceNotOperating result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Service Not Operating' literal with the specified name. + * + * + * @generated + */ + public static ServiceNotOperating getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ServiceNotOperating result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Service Not Operating' literal with the specified integer value. + * + * + * @generated + */ + public static ServiceNotOperating get(int value) { + switch (value) { + case FERRY_SERVICE_NOT_OPERATING_VALUE: return FERRY_SERVICE_NOT_OPERATING; + case PLANE_SERVICE_NOT_OPERATING_VALUE: return PLANE_SERVICE_NOT_OPERATING; + case TRAIN_SERVICE_NOT_OPERATING_VALUE: return TRAIN_SERVICE_NOT_OPERATING; + case BUS_SERVICE_NOT_OPERATING_VALUE: return BUS_SERVICE_NOT_OPERATING; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ServiceNotOperating(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ServiceNotOperating diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotUsable.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotUsable.java new file mode 100755 index 0000000..3abe295 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/ServiceNotUsable.java @@ -0,0 +1,294 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Service Not Usable', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getServiceNotUsable() + * @model + * @generated + */ +public enum ServiceNotUsable implements Enumerator { + /** + * The 'FUEL STATION CLOSED' literal object. + * + * + * @see #FUEL_STATION_CLOSED_VALUE + * @generated + * @ordered + */ + FUEL_STATION_CLOSED(1, "FUEL_STATION_CLOSED", "FUEL_STATION_CLOSED"), + + /** + * The 'SERVICE AREA CLOSED' literal object. + * + * + * @see #SERVICE_AREA_CLOSED_VALUE + * @generated + * @ordered + */ + SERVICE_AREA_CLOSED(2, "SERVICE_AREA_CLOSED", "SERVICE_AREA_CLOSED"), + + /** + * The 'SERVICE AREA BUSY' literal object. + * + * + * @see #SERVICE_AREA_BUSY_VALUE + * @generated + * @ordered + */ + SERVICE_AREA_BUSY(3, "SERVICE_AREA_BUSY", "SERVICE_AREA_BUSY"), + + /** + * The 'PARKING FULL' literal object. + * + * + * @see #PARKING_FULL_VALUE + * @generated + * @ordered + */ + PARKING_FULL(4, "PARKING_FULL", "PARKING_FULL"), + + /** + * The 'CAR PARK CLOSED' literal object. + * + * + * @see #CAR_PARK_CLOSED_VALUE + * @generated + * @ordered + */ + CAR_PARK_CLOSED(5, "CAR_PARK_CLOSED", "CAR_PARK_CLOSED"); + + /** + * The 'FUEL STATION CLOSED' literal value. + * + *

+ * If the meaning of 'FUEL STATION CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FUEL_STATION_CLOSED + * @model + * @generated + * @ordered + */ + public static final int FUEL_STATION_CLOSED_VALUE = 1; + + /** + * The 'SERVICE AREA CLOSED' literal value. + * + *

+ * If the meaning of 'SERVICE AREA CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SERVICE_AREA_CLOSED + * @model + * @generated + * @ordered + */ + public static final int SERVICE_AREA_CLOSED_VALUE = 2; + + /** + * The 'SERVICE AREA BUSY' literal value. + * + *

+ * If the meaning of 'SERVICE AREA BUSY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SERVICE_AREA_BUSY + * @model + * @generated + * @ordered + */ + public static final int SERVICE_AREA_BUSY_VALUE = 3; + + /** + * The 'PARKING FULL' literal value. + * + *

+ * If the meaning of 'PARKING FULL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #PARKING_FULL + * @model + * @generated + * @ordered + */ + public static final int PARKING_FULL_VALUE = 4; + + /** + * The 'CAR PARK CLOSED' literal value. + * + *

+ * If the meaning of 'CAR PARK CLOSED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CAR_PARK_CLOSED + * @model + * @generated + * @ordered + */ + public static final int CAR_PARK_CLOSED_VALUE = 5; + + /** + * An array of all the 'Service Not Usable' enumerators. + * + * + * @generated + */ + private static final ServiceNotUsable[] VALUES_ARRAY = + new ServiceNotUsable[] { + FUEL_STATION_CLOSED, + SERVICE_AREA_CLOSED, + SERVICE_AREA_BUSY, + PARKING_FULL, + CAR_PARK_CLOSED, + }; + + /** + * A public read-only list of all the 'Service Not Usable' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Service Not Usable' literal with the specified literal value. + * + * + * @generated + */ + public static ServiceNotUsable get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ServiceNotUsable result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Service Not Usable' literal with the specified name. + * + * + * @generated + */ + public static ServiceNotUsable getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + ServiceNotUsable result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Service Not Usable' literal with the specified integer value. + * + * + * @generated + */ + public static ServiceNotUsable get(int value) { + switch (value) { + case FUEL_STATION_CLOSED_VALUE: return FUEL_STATION_CLOSED; + case SERVICE_AREA_CLOSED_VALUE: return SERVICE_AREA_CLOSED; + case SERVICE_AREA_BUSY_VALUE: return SERVICE_AREA_BUSY; + case PARKING_FULL_VALUE: return PARKING_FULL; + case CAR_PARK_CLOSED_VALUE: return CAR_PARK_CLOSED; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private ServiceNotUsable(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //ServiceNotUsable diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlipperyRoad.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlipperyRoad.java new file mode 100755 index 0000000..e7a219f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlipperyRoad.java @@ -0,0 +1,429 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Slippery Road', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getSlipperyRoad() + * @model + * @generated + */ +public enum SlipperyRoad implements Enumerator { + /** + * The 'HEAVY FROST ON ROAD' literal object. + * + * + * @see #HEAVY_FROST_ON_ROAD_VALUE + * @generated + * @ordered + */ + HEAVY_FROST_ON_ROAD(1, "HEAVY_FROST_ON_ROAD", "HEAVY_FROST_ON_ROAD"), + + /** + * The 'FUEL ON ROAD' literal object. + * + * + * @see #FUEL_ON_ROAD_VALUE + * @generated + * @ordered + */ + FUEL_ON_ROAD(2, "FUEL_ON_ROAD", "FUEL_ON_ROAD"), + + /** + * The 'MUD ON ROAD' literal object. + * + * + * @see #MUD_ON_ROAD_VALUE + * @generated + * @ordered + */ + MUD_ON_ROAD(3, "MUD_ON_ROAD", "MUD_ON_ROAD"), + + /** + * The 'SNOW ON ROAD' literal object. + * + * + * @see #SNOW_ON_ROAD_VALUE + * @generated + * @ordered + */ + SNOW_ON_ROAD(4, "SNOW_ON_ROAD", "SNOW_ON_ROAD"), + + /** + * The 'ICE ON ROAD' literal object. + * + * + * @see #ICE_ON_ROAD_VALUE + * @generated + * @ordered + */ + ICE_ON_ROAD(5, "ICE_ON_ROAD", "ICE_ON_ROAD"), + + /** + * The 'BLACK ICE ON ROAD' literal object. + * + * + * @see #BLACK_ICE_ON_ROAD_VALUE + * @generated + * @ordered + */ + BLACK_ICE_ON_ROAD(6, "BLACK_ICE_ON_ROAD", "BLACK_ICE_ON_ROAD"), + + /** + * The 'OIL ON ROAD' literal object. + * + * + * @see #OIL_ON_ROAD_VALUE + * @generated + * @ordered + */ + OIL_ON_ROAD(7, "OIL_ON_ROAD", "OIL_ON_ROAD"), + + /** + * The 'LOOSE CHIPPINGS' literal object. + * + * + * @see #LOOSE_CHIPPINGS_VALUE + * @generated + * @ordered + */ + LOOSE_CHIPPINGS(8, "LOOSE_CHIPPINGS", "LOOSE_CHIPPINGS"), + + /** + * The 'INSTANT BLACK ICE' literal object. + * + * + * @see #INSTANT_BLACK_ICE_VALUE + * @generated + * @ordered + */ + INSTANT_BLACK_ICE(9, "INSTANT_BLACK_ICE", "INSTANT_BLACK_ICE"), + + /** + * The 'ROADS SALTED' literal object. + * + * + * @see #ROADS_SALTED_VALUE + * @generated + * @ordered + */ + ROADS_SALTED(10, "ROADS_SALTED", "ROADS_SALTED"); + + /** + * The 'HEAVY FROST ON ROAD' literal value. + * + *

+ * If the meaning of 'HEAVY FROST ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_FROST_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int HEAVY_FROST_ON_ROAD_VALUE = 1; + + /** + * The 'FUEL ON ROAD' literal value. + * + *

+ * If the meaning of 'FUEL ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #FUEL_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int FUEL_ON_ROAD_VALUE = 2; + + /** + * The 'MUD ON ROAD' literal value. + * + *

+ * If the meaning of 'MUD ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MUD_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int MUD_ON_ROAD_VALUE = 3; + + /** + * The 'SNOW ON ROAD' literal value. + * + *

+ * If the meaning of 'SNOW ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SNOW_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int SNOW_ON_ROAD_VALUE = 4; + + /** + * The 'ICE ON ROAD' literal value. + * + *

+ * If the meaning of 'ICE ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ICE_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int ICE_ON_ROAD_VALUE = 5; + + /** + * The 'BLACK ICE ON ROAD' literal value. + * + *

+ * If the meaning of 'BLACK ICE ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BLACK_ICE_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int BLACK_ICE_ON_ROAD_VALUE = 6; + + /** + * The 'OIL ON ROAD' literal value. + * + *

+ * If the meaning of 'OIL ON ROAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #OIL_ON_ROAD + * @model + * @generated + * @ordered + */ + public static final int OIL_ON_ROAD_VALUE = 7; + + /** + * The 'LOOSE CHIPPINGS' literal value. + * + *

+ * If the meaning of 'LOOSE CHIPPINGS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LOOSE_CHIPPINGS + * @model + * @generated + * @ordered + */ + public static final int LOOSE_CHIPPINGS_VALUE = 8; + + /** + * The 'INSTANT BLACK ICE' literal value. + * + *

+ * If the meaning of 'INSTANT BLACK ICE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #INSTANT_BLACK_ICE + * @model + * @generated + * @ordered + */ + public static final int INSTANT_BLACK_ICE_VALUE = 9; + + /** + * The 'ROADS SALTED' literal value. + * + *

+ * If the meaning of 'ROADS SALTED' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ROADS_SALTED + * @model + * @generated + * @ordered + */ + public static final int ROADS_SALTED_VALUE = 10; + + /** + * An array of all the 'Slippery Road' enumerators. + * + * + * @generated + */ + private static final SlipperyRoad[] VALUES_ARRAY = + new SlipperyRoad[] { + HEAVY_FROST_ON_ROAD, + FUEL_ON_ROAD, + MUD_ON_ROAD, + SNOW_ON_ROAD, + ICE_ON_ROAD, + BLACK_ICE_ON_ROAD, + OIL_ON_ROAD, + LOOSE_CHIPPINGS, + INSTANT_BLACK_ICE, + ROADS_SALTED, + }; + + /** + * A public read-only list of all the 'Slippery Road' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Slippery Road' literal with the specified literal value. + * + * + * @generated + */ + public static SlipperyRoad get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SlipperyRoad result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Slippery Road' literal with the specified name. + * + * + * @generated + */ + public static SlipperyRoad getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SlipperyRoad result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Slippery Road' literal with the specified integer value. + * + * + * @generated + */ + public static SlipperyRoad get(int value) { + switch (value) { + case HEAVY_FROST_ON_ROAD_VALUE: return HEAVY_FROST_ON_ROAD; + case FUEL_ON_ROAD_VALUE: return FUEL_ON_ROAD; + case MUD_ON_ROAD_VALUE: return MUD_ON_ROAD; + case SNOW_ON_ROAD_VALUE: return SNOW_ON_ROAD; + case ICE_ON_ROAD_VALUE: return ICE_ON_ROAD; + case BLACK_ICE_ON_ROAD_VALUE: return BLACK_ICE_ON_ROAD; + case OIL_ON_ROAD_VALUE: return OIL_ON_ROAD; + case LOOSE_CHIPPINGS_VALUE: return LOOSE_CHIPPINGS; + case INSTANT_BLACK_ICE_VALUE: return INSTANT_BLACK_ICE; + case ROADS_SALTED_VALUE: return ROADS_SALTED; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private SlipperyRoad(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //SlipperyRoad diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlowMovingVehicles.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlowMovingVehicles.java new file mode 100755 index 0000000..d11095a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/SlowMovingVehicles.java @@ -0,0 +1,375 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Slow Moving Vehicles', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getSlowMovingVehicles() + * @model + * @generated + */ +public enum SlowMovingVehicles implements Enumerator { + /** + * The 'SLOW MOVING MAINTENANCE VEHICLE' literal object. + * + * + * @see #SLOW_MOVING_MAINTENANCE_VEHICLE_VALUE + * @generated + * @ordered + */ + SLOW_MOVING_MAINTENANCE_VEHICLE(1, "SLOW_MOVING_MAINTENANCE_VEHICLE", "SLOW_MOVING_MAINTENANCE_VEHICLE"), + + /** + * The 'VEHICLES SLOWING TO LOOK AT ACCIDENT' literal object. + * + * + * @see #VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT_VALUE + * @generated + * @ordered + */ + VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT(2, "VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT", "VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT"), + + /** + * The 'ABNORMAL LOAD' literal object. + * + * + * @see #ABNORMAL_LOAD_VALUE + * @generated + * @ordered + */ + ABNORMAL_LOAD(3, "ABNORMAL_LOAD", "ABNORMAL_LOAD"), + + /** + * The 'ABNORMAL WIDE LOAD' literal object. + * + * + * @see #ABNORMAL_WIDE_LOAD_VALUE + * @generated + * @ordered + */ + ABNORMAL_WIDE_LOAD(4, "ABNORMAL_WIDE_LOAD", "ABNORMAL_WIDE_LOAD"), + + /** + * The 'CONVOY' literal object. + * + * + * @see #CONVOY_VALUE + * @generated + * @ordered + */ + CONVOY(5, "CONVOY", "CONVOY"), + + /** + * The 'SNOWPLOUGH' literal object. + * + * + * @see #SNOWPLOUGH_VALUE + * @generated + * @ordered + */ + SNOWPLOUGH(6, "SNOWPLOUGH", "SNOWPLOUGH"), + + /** + * The 'DEICING' literal object. + * + * + * @see #DEICING_VALUE + * @generated + * @ordered + */ + DEICING(7, "DEICING", "DEICING"), + + /** + * The 'SALTING VEHICLES' literal object. + * + * + * @see #SALTING_VEHICLES_VALUE + * @generated + * @ordered + */ + SALTING_VEHICLES(8, "SALTING_VEHICLES", "SALTING_VEHICLES"); + + /** + * The 'SLOW MOVING MAINTENANCE VEHICLE' literal value. + * + *

+ * If the meaning of 'SLOW MOVING MAINTENANCE VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLOW_MOVING_MAINTENANCE_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int SLOW_MOVING_MAINTENANCE_VEHICLE_VALUE = 1; + + /** + * The 'VEHICLES SLOWING TO LOOK AT ACCIDENT' literal value. + * + *

+ * If the meaning of 'VEHICLES SLOWING TO LOOK AT ACCIDENT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT + * @model + * @generated + * @ordered + */ + public static final int VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT_VALUE = 2; + + /** + * The 'ABNORMAL LOAD' literal value. + * + *

+ * If the meaning of 'ABNORMAL LOAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ABNORMAL_LOAD + * @model + * @generated + * @ordered + */ + public static final int ABNORMAL_LOAD_VALUE = 3; + + /** + * The 'ABNORMAL WIDE LOAD' literal value. + * + *

+ * If the meaning of 'ABNORMAL WIDE LOAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #ABNORMAL_WIDE_LOAD + * @model + * @generated + * @ordered + */ + public static final int ABNORMAL_WIDE_LOAD_VALUE = 4; + + /** + * The 'CONVOY' literal value. + * + *

+ * If the meaning of 'CONVOY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CONVOY + * @model + * @generated + * @ordered + */ + public static final int CONVOY_VALUE = 5; + + /** + * The 'SNOWPLOUGH' literal value. + * + *

+ * If the meaning of 'SNOWPLOUGH' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SNOWPLOUGH + * @model + * @generated + * @ordered + */ + public static final int SNOWPLOUGH_VALUE = 6; + + /** + * The 'DEICING' literal value. + * + *

+ * If the meaning of 'DEICING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DEICING + * @model + * @generated + * @ordered + */ + public static final int DEICING_VALUE = 7; + + /** + * The 'SALTING VEHICLES' literal value. + * + *

+ * If the meaning of 'SALTING VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SALTING_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int SALTING_VEHICLES_VALUE = 8; + + /** + * An array of all the 'Slow Moving Vehicles' enumerators. + * + * + * @generated + */ + private static final SlowMovingVehicles[] VALUES_ARRAY = + new SlowMovingVehicles[] { + SLOW_MOVING_MAINTENANCE_VEHICLE, + VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT, + ABNORMAL_LOAD, + ABNORMAL_WIDE_LOAD, + CONVOY, + SNOWPLOUGH, + DEICING, + SALTING_VEHICLES, + }; + + /** + * A public read-only list of all the 'Slow Moving Vehicles' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Slow Moving Vehicles' literal with the specified literal value. + * + * + * @generated + */ + public static SlowMovingVehicles get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SlowMovingVehicles result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Slow Moving Vehicles' literal with the specified name. + * + * + * @generated + */ + public static SlowMovingVehicles getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + SlowMovingVehicles result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Slow Moving Vehicles' literal with the specified integer value. + * + * + * @generated + */ + public static SlowMovingVehicles get(int value) { + switch (value) { + case SLOW_MOVING_MAINTENANCE_VEHICLE_VALUE: return SLOW_MOVING_MAINTENANCE_VEHICLE; + case VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT_VALUE: return VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT; + case ABNORMAL_LOAD_VALUE: return ABNORMAL_LOAD; + case ABNORMAL_WIDE_LOAD_VALUE: return ABNORMAL_WIDE_LOAD; + case CONVOY_VALUE: return CONVOY; + case SNOWPLOUGH_VALUE: return SNOWPLOUGH; + case DEICING_VALUE: return DEICING; + case SALTING_VEHICLES_VALUE: return SALTING_VEHICLES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private SlowMovingVehicles(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //SlowMovingVehicles diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Tendency.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Tendency.java new file mode 100755 index 0000000..6f68790 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/Tendency.java @@ -0,0 +1,348 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Tendency', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getTendency() + * @model + * @generated + */ +public enum Tendency implements Enumerator { + /** + * The 'SLIGHTLY INCREASING' literal object. + * + * + * @see #SLIGHTLY_INCREASING_VALUE + * @generated + * @ordered + */ + SLIGHTLY_INCREASING(1, "SLIGHTLY_INCREASING", "SLIGHTLY_INCREASING"), + + /** + * The 'INCREASING' literal object. + * + * + * @see #INCREASING_VALUE + * @generated + * @ordered + */ + INCREASING(2, "INCREASING", "INCREASING"), + + /** + * The 'STRONGLY INCREASING' literal object. + * + * + * @see #STRONGLY_INCREASING_VALUE + * @generated + * @ordered + */ + STRONGLY_INCREASING(3, "STRONGLY_INCREASING", "STRONGLY_INCREASING"), + + /** + * The 'SLIGHTLY DECREASING' literal object. + * + * + * @see #SLIGHTLY_DECREASING_VALUE + * @generated + * @ordered + */ + SLIGHTLY_DECREASING(4, "SLIGHTLY_DECREASING", "SLIGHTLY_DECREASING"), + + /** + * The 'DECREASING' literal object. + * + * + * @see #DECREASING_VALUE + * @generated + * @ordered + */ + DECREASING(5, "DECREASING", "DECREASING"), + + /** + * The 'STRONGLY DECREASING' literal object. + * + * + * @see #STRONGLY_DECREASING_VALUE + * @generated + * @ordered + */ + STRONGLY_DECREASING(6, "STRONGLY_DECREASING", "STRONGLY_DECREASING"), + + /** + * The 'CONSTANT' literal object. + * + * + * @see #CONSTANT_VALUE + * @generated + * @ordered + */ + CONSTANT(7, "CONSTANT", "CONSTANT"); + + /** + * The 'SLIGHTLY INCREASING' literal value. + * + *

+ * If the meaning of 'SLIGHTLY INCREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLIGHTLY_INCREASING + * @model + * @generated + * @ordered + */ + public static final int SLIGHTLY_INCREASING_VALUE = 1; + + /** + * The 'INCREASING' literal value. + * + *

+ * If the meaning of 'INCREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #INCREASING + * @model + * @generated + * @ordered + */ + public static final int INCREASING_VALUE = 2; + + /** + * The 'STRONGLY INCREASING' literal value. + * + *

+ * If the meaning of 'STRONGLY INCREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STRONGLY_INCREASING + * @model + * @generated + * @ordered + */ + public static final int STRONGLY_INCREASING_VALUE = 3; + + /** + * The 'SLIGHTLY DECREASING' literal value. + * + *

+ * If the meaning of 'SLIGHTLY DECREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #SLIGHTLY_DECREASING + * @model + * @generated + * @ordered + */ + public static final int SLIGHTLY_DECREASING_VALUE = 4; + + /** + * The 'DECREASING' literal value. + * + *

+ * If the meaning of 'DECREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DECREASING + * @model + * @generated + * @ordered + */ + public static final int DECREASING_VALUE = 5; + + /** + * The 'STRONGLY DECREASING' literal value. + * + *

+ * If the meaning of 'STRONGLY DECREASING' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #STRONGLY_DECREASING + * @model + * @generated + * @ordered + */ + public static final int STRONGLY_DECREASING_VALUE = 6; + + /** + * The 'CONSTANT' literal value. + * + *

+ * If the meaning of 'CONSTANT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CONSTANT + * @model + * @generated + * @ordered + */ + public static final int CONSTANT_VALUE = 7; + + /** + * An array of all the 'Tendency' enumerators. + * + * + * @generated + */ + private static final Tendency[] VALUES_ARRAY = + new Tendency[] { + SLIGHTLY_INCREASING, + INCREASING, + STRONGLY_INCREASING, + SLIGHTLY_DECREASING, + DECREASING, + STRONGLY_DECREASING, + CONSTANT, + }; + + /** + * A public read-only list of all the 'Tendency' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Tendency' literal with the specified literal value. + * + * + * @generated + */ + public static Tendency get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Tendency result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Tendency' literal with the specified name. + * + * + * @generated + */ + public static Tendency getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + Tendency result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Tendency' literal with the specified integer value. + * + * + * @generated + */ + public static Tendency get(int value) { + switch (value) { + case SLIGHTLY_INCREASING_VALUE: return SLIGHTLY_INCREASING; + case INCREASING_VALUE: return INCREASING; + case STRONGLY_INCREASING_VALUE: return STRONGLY_INCREASING; + case SLIGHTLY_DECREASING_VALUE: return SLIGHTLY_DECREASING; + case DECREASING_VALUE: return DECREASING; + case STRONGLY_DECREASING_VALUE: return STRONGLY_DECREASING; + case CONSTANT_VALUE: return CONSTANT; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private Tendency(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //Tendency diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TimeDelay.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TimeDelay.java new file mode 100755 index 0000000..f9db8cf --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TimeDelay.java @@ -0,0 +1,240 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Time Delay', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getTimeDelay() + * @model + * @generated + */ +public enum TimeDelay implements Enumerator { + /** + * The 'TIME DELAY AT FRONTIER' literal object. + * + * + * @see #TIME_DELAY_AT_FRONTIER_VALUE + * @generated + * @ordered + */ + TIME_DELAY_AT_FRONTIER(1, "TIME_DELAY_AT_FRONTIER", "TIME_DELAY_AT_FRONTIER"), + + /** + * The 'TIME DELAY AT FERRY PORT' literal object. + * + * + * @see #TIME_DELAY_AT_FERRY_PORT_VALUE + * @generated + * @ordered + */ + TIME_DELAY_AT_FERRY_PORT(2, "TIME_DELAY_AT_FERRY_PORT", "TIME_DELAY_AT_FERRY_PORT"), + + /** + * The 'TIME DELAY AT VEHICLE ON RAIL TERMINAL' literal object. + * + * + * @see #TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL_VALUE + * @generated + * @ordered + */ + TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL(3, "TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL", "TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL"); + + /** + * The 'TIME DELAY AT FRONTIER' literal value. + * + *

+ * If the meaning of 'TIME DELAY AT FRONTIER' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TIME_DELAY_AT_FRONTIER + * @model + * @generated + * @ordered + */ + public static final int TIME_DELAY_AT_FRONTIER_VALUE = 1; + + /** + * The 'TIME DELAY AT FERRY PORT' literal value. + * + *

+ * If the meaning of 'TIME DELAY AT FERRY PORT' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TIME_DELAY_AT_FERRY_PORT + * @model + * @generated + * @ordered + */ + public static final int TIME_DELAY_AT_FERRY_PORT_VALUE = 2; + + /** + * The 'TIME DELAY AT VEHICLE ON RAIL TERMINAL' literal value. + * + *

+ * If the meaning of 'TIME DELAY AT VEHICLE ON RAIL TERMINAL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL + * @model + * @generated + * @ordered + */ + public static final int TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL_VALUE = 3; + + /** + * An array of all the 'Time Delay' enumerators. + * + * + * @generated + */ + private static final TimeDelay[] VALUES_ARRAY = + new TimeDelay[] { + TIME_DELAY_AT_FRONTIER, + TIME_DELAY_AT_FERRY_PORT, + TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL, + }; + + /** + * A public read-only list of all the 'Time Delay' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Time Delay' literal with the specified literal value. + * + * + * @generated + */ + public static TimeDelay get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TimeDelay result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Time Delay' literal with the specified name. + * + * + * @generated + */ + public static TimeDelay getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TimeDelay result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Time Delay' literal with the specified integer value. + * + * + * @generated + */ + public static TimeDelay get(int value) { + switch (value) { + case TIME_DELAY_AT_FRONTIER_VALUE: return TIME_DELAY_AT_FRONTIER; + case TIME_DELAY_AT_FERRY_PORT_VALUE: return TIME_DELAY_AT_FERRY_PORT; + case TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL_VALUE: return TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TimeDelay(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TimeDelay diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TrafficCongestion.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TrafficCongestion.java new file mode 100755 index 0000000..4ea2ad8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/TrafficCongestion.java @@ -0,0 +1,186 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Traffic Congestion', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getTrafficCongestion() + * @model + * @generated + */ +public enum TrafficCongestion implements Enumerator { + /** + * The 'INCREASED VOLUME OF TRAFFIC' literal object. + * + * + * @see #INCREASED_VOLUME_OF_TRAFFIC_VALUE + * @generated + * @ordered + */ + INCREASED_VOLUME_OF_TRAFFIC(1, "INCREASED_VOLUME_OF_TRAFFIC", "INCREASED_VOLUME_OF_TRAFFIC"); + + /** + * The 'INCREASED VOLUME OF TRAFFIC' literal value. + * + *

+ * If the meaning of 'INCREASED VOLUME OF TRAFFIC' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #INCREASED_VOLUME_OF_TRAFFIC + * @model + * @generated + * @ordered + */ + public static final int INCREASED_VOLUME_OF_TRAFFIC_VALUE = 1; + + /** + * An array of all the 'Traffic Congestion' enumerators. + * + * + * @generated + */ + private static final TrafficCongestion[] VALUES_ARRAY = + new TrafficCongestion[] { + INCREASED_VOLUME_OF_TRAFFIC, + }; + + /** + * A public read-only list of all the 'Traffic Congestion' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Traffic Congestion' literal with the specified literal value. + * + * + * @generated + */ + public static TrafficCongestion get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficCongestion result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Congestion' literal with the specified name. + * + * + * @generated + */ + public static TrafficCongestion getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + TrafficCongestion result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Traffic Congestion' literal with the specified integer value. + * + * + * @generated + */ + public static TrafficCongestion get(int value) { + switch (value) { + case INCREASED_VOLUME_OF_TRAFFIC_VALUE: return INCREASED_VOLUME_OF_TRAFFIC; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private TrafficCongestion(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //TrafficCongestion diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/UseTollLanes.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/UseTollLanes.java new file mode 100755 index 0000000..d459811 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/UseTollLanes.java @@ -0,0 +1,213 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Use Toll Lanes', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getUseTollLanes() + * @model + * @generated + */ +public enum UseTollLanes implements Enumerator { + /** + * The 'USE MANUAL PAYMENT TOLL LANES' literal object. + * + * + * @see #USE_MANUAL_PAYMENT_TOLL_LANES_VALUE + * @generated + * @ordered + */ + USE_MANUAL_PAYMENT_TOLL_LANES(1, "USE_MANUAL_PAYMENT_TOLL_LANES", "USE_MANUAL_PAYMENT_TOLL_LANES"), + + /** + * The 'USE AUTOMATIC PAYMENT TOLL LANES' literal object. + * + * + * @see #USE_AUTOMATIC_PAYMENT_TOLL_LANES_VALUE + * @generated + * @ordered + */ + USE_AUTOMATIC_PAYMENT_TOLL_LANES(2, "USE_AUTOMATIC_PAYMENT_TOLL_LANES", "USE_AUTOMATIC_PAYMENT_TOLL_LANES"); + + /** + * The 'USE MANUAL PAYMENT TOLL LANES' literal value. + * + *

+ * If the meaning of 'USE MANUAL PAYMENT TOLL LANES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #USE_MANUAL_PAYMENT_TOLL_LANES + * @model + * @generated + * @ordered + */ + public static final int USE_MANUAL_PAYMENT_TOLL_LANES_VALUE = 1; + + /** + * The 'USE AUTOMATIC PAYMENT TOLL LANES' literal value. + * + *

+ * If the meaning of 'USE AUTOMATIC PAYMENT TOLL LANES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #USE_AUTOMATIC_PAYMENT_TOLL_LANES + * @model + * @generated + * @ordered + */ + public static final int USE_AUTOMATIC_PAYMENT_TOLL_LANES_VALUE = 2; + + /** + * An array of all the 'Use Toll Lanes' enumerators. + * + * + * @generated + */ + private static final UseTollLanes[] VALUES_ARRAY = + new UseTollLanes[] { + USE_MANUAL_PAYMENT_TOLL_LANES, + USE_AUTOMATIC_PAYMENT_TOLL_LANES, + }; + + /** + * A public read-only list of all the 'Use Toll Lanes' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Use Toll Lanes' literal with the specified literal value. + * + * + * @generated + */ + public static UseTollLanes get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + UseTollLanes result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Use Toll Lanes' literal with the specified name. + * + * + * @generated + */ + public static UseTollLanes getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + UseTollLanes result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Use Toll Lanes' literal with the specified integer value. + * + * + * @generated + */ + public static UseTollLanes get(int value) { + switch (value) { + case USE_MANUAL_PAYMENT_TOLL_LANES_VALUE: return USE_MANUAL_PAYMENT_TOLL_LANES; + case USE_AUTOMATIC_PAYMENT_TOLL_LANES_VALUE: return USE_AUTOMATIC_PAYMENT_TOLL_LANES; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private UseTollLanes(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //UseTollLanes diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VehicleType.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VehicleType.java new file mode 100755 index 0000000..b73249c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VehicleType.java @@ -0,0 +1,456 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Vehicle Type', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getVehicleType() + * @model + * @generated + */ +public enum VehicleType implements Enumerator { + /** + * The 'CAR' literal object. + * + * + * @see #CAR_VALUE + * @generated + * @ordered + */ + CAR(1, "CAR", "CAR"), + + /** + * The 'LORRY' literal object. + * + * + * @see #LORRY_VALUE + * @generated + * @ordered + */ + LORRY(2, "LORRY", "LORRY"), + + /** + * The 'BUS' literal object. + * + * + * @see #BUS_VALUE + * @generated + * @ordered + */ + BUS(3, "BUS", "BUS"), + + /** + * The 'TAXI' literal object. + * + * + * @see #TAXI_VALUE + * @generated + * @ordered + */ + TAXI(4, "TAXI", "TAXI"), + + /** + * The 'TRAIN' literal object. + * + * + * @see #TRAIN_VALUE + * @generated + * @ordered + */ + TRAIN(5, "TRAIN", "TRAIN"), + + /** + * The 'MOTOR CYCLE' literal object. + * + * + * @see #MOTOR_CYCLE_VALUE + * @generated + * @ordered + */ + MOTOR_CYCLE(6, "MOTOR_CYCLE", "MOTOR_CYCLE"), + + /** + * The 'VEHICLE WITH TRAILER' literal object. + * + * + * @see #VEHICLE_WITH_TRAILER_VALUE + * @generated + * @ordered + */ + VEHICLE_WITH_TRAILER(7, "VEHICLE_WITH_TRAILER", "VEHICLE_WITH_TRAILER"), + + /** + * The 'MOTOR VEHICLES' literal object. + * + * + * @see #MOTOR_VEHICLES_VALUE + * @generated + * @ordered + */ + MOTOR_VEHICLES(8, "MOTOR_VEHICLES", "MOTOR_VEHICLES"), + + /** + * The 'TRANSPORT OF DANGEROUS GOODS' literal object. + * + * + * @see #TRANSPORT_OF_DANGEROUS_GOODS_VALUE + * @generated + * @ordered + */ + TRANSPORT_OF_DANGEROUS_GOODS(9, "TRANSPORT_OF_DANGEROUS_GOODS", "TRANSPORT_OF_DANGEROUS_GOODS"), + + /** + * The 'TRANSPORT OF ABNORMAL LOAD' literal object. + * + * + * @see #TRANSPORT_OF_ABNORMAL_LOAD_VALUE + * @generated + * @ordered + */ + TRANSPORT_OF_ABNORMAL_LOAD(10, "TRANSPORT_OF_ABNORMAL_LOAD", "TRANSPORT_OF_ABNORMAL_LOAD"), + + /** + * The 'HEAVY VEHICLE' literal object. + * + * + * @see #HEAVY_VEHICLE_VALUE + * @generated + * @ordered + */ + HEAVY_VEHICLE(11, "HEAVY_VEHICLE", "HEAVY_VEHICLE"); + + /** + * The 'CAR' literal value. + * + *

+ * If the meaning of 'CAR' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #CAR + * @model + * @generated + * @ordered + */ + public static final int CAR_VALUE = 1; + + /** + * The 'LORRY' literal value. + * + *

+ * If the meaning of 'LORRY' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #LORRY + * @model + * @generated + * @ordered + */ + public static final int LORRY_VALUE = 2; + + /** + * The 'BUS' literal value. + * + *

+ * If the meaning of 'BUS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #BUS + * @model + * @generated + * @ordered + */ + public static final int BUS_VALUE = 3; + + /** + * The 'TAXI' literal value. + * + *

+ * If the meaning of 'TAXI' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TAXI + * @model + * @generated + * @ordered + */ + public static final int TAXI_VALUE = 4; + + /** + * The 'TRAIN' literal value. + * + *

+ * If the meaning of 'TRAIN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRAIN + * @model + * @generated + * @ordered + */ + public static final int TRAIN_VALUE = 5; + + /** + * The 'MOTOR CYCLE' literal value. + * + *

+ * If the meaning of 'MOTOR CYCLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTOR_CYCLE + * @model + * @generated + * @ordered + */ + public static final int MOTOR_CYCLE_VALUE = 6; + + /** + * The 'VEHICLE WITH TRAILER' literal value. + * + *

+ * If the meaning of 'VEHICLE WITH TRAILER' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VEHICLE_WITH_TRAILER + * @model + * @generated + * @ordered + */ + public static final int VEHICLE_WITH_TRAILER_VALUE = 7; + + /** + * The 'MOTOR VEHICLES' literal value. + * + *

+ * If the meaning of 'MOTOR VEHICLES' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #MOTOR_VEHICLES + * @model + * @generated + * @ordered + */ + public static final int MOTOR_VEHICLES_VALUE = 8; + + /** + * The 'TRANSPORT OF DANGEROUS GOODS' literal value. + * + *

+ * If the meaning of 'TRANSPORT OF DANGEROUS GOODS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRANSPORT_OF_DANGEROUS_GOODS + * @model + * @generated + * @ordered + */ + public static final int TRANSPORT_OF_DANGEROUS_GOODS_VALUE = 9; + + /** + * The 'TRANSPORT OF ABNORMAL LOAD' literal value. + * + *

+ * If the meaning of 'TRANSPORT OF ABNORMAL LOAD' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #TRANSPORT_OF_ABNORMAL_LOAD + * @model + * @generated + * @ordered + */ + public static final int TRANSPORT_OF_ABNORMAL_LOAD_VALUE = 10; + + /** + * The 'HEAVY VEHICLE' literal value. + * + *

+ * If the meaning of 'HEAVY VEHICLE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #HEAVY_VEHICLE + * @model + * @generated + * @ordered + */ + public static final int HEAVY_VEHICLE_VALUE = 11; + + /** + * An array of all the 'Vehicle Type' enumerators. + * + * + * @generated + */ + private static final VehicleType[] VALUES_ARRAY = + new VehicleType[] { + CAR, + LORRY, + BUS, + TAXI, + TRAIN, + MOTOR_CYCLE, + VEHICLE_WITH_TRAILER, + MOTOR_VEHICLES, + TRANSPORT_OF_DANGEROUS_GOODS, + TRANSPORT_OF_ABNORMAL_LOAD, + HEAVY_VEHICLE, + }; + + /** + * A public read-only list of all the 'Vehicle Type' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Vehicle Type' literal with the specified literal value. + * + * + * @generated + */ + public static VehicleType get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + VehicleType result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Vehicle Type' literal with the specified name. + * + * + * @generated + */ + public static VehicleType getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + VehicleType result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Vehicle Type' literal with the specified integer value. + * + * + * @generated + */ + public static VehicleType get(int value) { + switch (value) { + case CAR_VALUE: return CAR; + case LORRY_VALUE: return LORRY; + case BUS_VALUE: return BUS; + case TAXI_VALUE: return TAXI; + case TRAIN_VALUE: return TRAIN; + case MOTOR_CYCLE_VALUE: return MOTOR_CYCLE; + case VEHICLE_WITH_TRAILER_VALUE: return VEHICLE_WITH_TRAILER; + case MOTOR_VEHICLES_VALUE: return MOTOR_VEHICLES; + case TRANSPORT_OF_DANGEROUS_GOODS_VALUE: return TRANSPORT_OF_DANGEROUS_GOODS; + case TRANSPORT_OF_ABNORMAL_LOAD_VALUE: return TRANSPORT_OF_ABNORMAL_LOAD; + case HEAVY_VEHICLE_VALUE: return HEAVY_VEHICLE; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private VehicleType(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //VehicleType diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VisibilityReduced.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VisibilityReduced.java new file mode 100755 index 0000000..d2b87bc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/VisibilityReduced.java @@ -0,0 +1,375 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Visibility Reduced', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getVisibilityReduced() + * @model + * @generated + */ +public enum VisibilityReduced implements Enumerator { + /** + * The 'VISIBILITY REDUCED DUE TO FOG' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_FOG_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_FOG(1, "VISIBILITY_REDUCED_DUE_TO_FOG", "VISIBILITY_REDUCED_DUE_TO_FOG"), + + /** + * The 'VISIBILITY REDUCED DUE TO SMOKE' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_SMOKE_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_SMOKE(2, "VISIBILITY_REDUCED_DUE_TO_SMOKE", "VISIBILITY_REDUCED_DUE_TO_SMOKE"), + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY SNOWFALL' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL(3, "VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL", "VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL"), + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY RAIN' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN(4, "VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN", "VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN"), + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY HAIL' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL(5, "VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL", "VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL"), + + /** + * The 'VISIBILITY REDUCED DUE TO LOW SUN GLARE' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE(6, "VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE", "VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE"), + + /** + * The 'VISIBILITY REDUCED DUE TO SANDSTORMS' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_SANDSTORMS_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_SANDSTORMS(7, "VISIBILITY_REDUCED_DUE_TO_SANDSTORMS", "VISIBILITY_REDUCED_DUE_TO_SANDSTORMS"), + + /** + * The 'VISIBILITY REDUCED DUE TO SWARMS OF INSECTS' literal object. + * + * + * @see #VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS_VALUE + * @generated + * @ordered + */ + VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS(8, "VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS", "VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS"); + + /** + * The 'VISIBILITY REDUCED DUE TO FOG' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO FOG' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_FOG + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_FOG_VALUE = 1; + + /** + * The 'VISIBILITY REDUCED DUE TO SMOKE' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO SMOKE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_SMOKE + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_SMOKE_VALUE = 2; + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY SNOWFALL' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO HEAVY SNOWFALL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL_VALUE = 3; + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY RAIN' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO HEAVY RAIN' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN_VALUE = 4; + + /** + * The 'VISIBILITY REDUCED DUE TO HEAVY HAIL' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO HEAVY HAIL' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL_VALUE = 5; + + /** + * The 'VISIBILITY REDUCED DUE TO LOW SUN GLARE' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO LOW SUN GLARE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE_VALUE = 6; + + /** + * The 'VISIBILITY REDUCED DUE TO SANDSTORMS' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO SANDSTORMS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_SANDSTORMS + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_SANDSTORMS_VALUE = 7; + + /** + * The 'VISIBILITY REDUCED DUE TO SWARMS OF INSECTS' literal value. + * + *

+ * If the meaning of 'VISIBILITY REDUCED DUE TO SWARMS OF INSECTS' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS + * @model + * @generated + * @ordered + */ + public static final int VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS_VALUE = 8; + + /** + * An array of all the 'Visibility Reduced' enumerators. + * + * + * @generated + */ + private static final VisibilityReduced[] VALUES_ARRAY = + new VisibilityReduced[] { + VISIBILITY_REDUCED_DUE_TO_FOG, + VISIBILITY_REDUCED_DUE_TO_SMOKE, + VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL, + VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN, + VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL, + VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE, + VISIBILITY_REDUCED_DUE_TO_SANDSTORMS, + VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS, + }; + + /** + * A public read-only list of all the 'Visibility Reduced' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Visibility Reduced' literal with the specified literal value. + * + * + * @generated + */ + public static VisibilityReduced get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + VisibilityReduced result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Visibility Reduced' literal with the specified name. + * + * + * @generated + */ + public static VisibilityReduced getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + VisibilityReduced result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Visibility Reduced' literal with the specified integer value. + * + * + * @generated + */ + public static VisibilityReduced get(int value) { + switch (value) { + case VISIBILITY_REDUCED_DUE_TO_FOG_VALUE: return VISIBILITY_REDUCED_DUE_TO_FOG; + case VISIBILITY_REDUCED_DUE_TO_SMOKE_VALUE: return VISIBILITY_REDUCED_DUE_TO_SMOKE; + case VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL_VALUE: return VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL; + case VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN_VALUE: return VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN; + case VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL_VALUE: return VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL; + case VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE_VALUE: return VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE; + case VISIBILITY_REDUCED_DUE_TO_SANDSTORMS_VALUE: return VISIBILITY_REDUCED_DUE_TO_SANDSTORMS; + case VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS_VALUE: return VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private VisibilityReduced(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //VisibilityReduced diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/WarningLevel.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/WarningLevel.java new file mode 100755 index 0000000..fbbcf4c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/WarningLevel.java @@ -0,0 +1,267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.emf.common.util.Enumerator; + +/** + * + * A representation of the literals of the enumeration 'Warning Level', + * and utility methods for working with them. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#getWarningLevel() + * @model + * @generated + */ +public enum WarningLevel implements Enumerator { + /** + * The 'INFORMATIVE' literal object. + * + * + * @see #INFORMATIVE_VALUE + * @generated + * @ordered + */ + INFORMATIVE(1, "INFORMATIVE", "INFORMATIVE"), + + /** + * The 'DANGER LEVEL 1' literal object. + * + * + * @see #DANGER_LEVEL_1_VALUE + * @generated + * @ordered + */ + DANGER_LEVEL_1(2, "DANGER_LEVEL_1", "DANGER_LEVEL_1"), + + /** + * The 'DANGER LEVEL 2' literal object. + * + * + * @see #DANGER_LEVEL_2_VALUE + * @generated + * @ordered + */ + DANGER_LEVEL_2(3, "DANGER_LEVEL_2", "DANGER_LEVEL_2"), + + /** + * The 'DANGER LEVEL 3' literal object. + * + * + * @see #DANGER_LEVEL_3_VALUE + * @generated + * @ordered + */ + DANGER_LEVEL_3(4, "DANGER_LEVEL_3", "DANGER_LEVEL_3"); + + /** + * The 'INFORMATIVE' literal value. + * + *

+ * If the meaning of 'INFORMATIVE' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #INFORMATIVE + * @model + * @generated + * @ordered + */ + public static final int INFORMATIVE_VALUE = 1; + + /** + * The 'DANGER LEVEL 1' literal value. + * + *

+ * If the meaning of 'DANGER LEVEL 1' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DANGER_LEVEL_1 + * @model + * @generated + * @ordered + */ + public static final int DANGER_LEVEL_1_VALUE = 2; + + /** + * The 'DANGER LEVEL 2' literal value. + * + *

+ * If the meaning of 'DANGER LEVEL 2' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DANGER_LEVEL_2 + * @model + * @generated + * @ordered + */ + public static final int DANGER_LEVEL_2_VALUE = 3; + + /** + * The 'DANGER LEVEL 3' literal value. + * + *

+ * If the meaning of 'DANGER LEVEL 3' literal object isn't clear, + * there really should be more of a description here... + *

+ * + * @see #DANGER_LEVEL_3 + * @model + * @generated + * @ordered + */ + public static final int DANGER_LEVEL_3_VALUE = 4; + + /** + * An array of all the 'Warning Level' enumerators. + * + * + * @generated + */ + private static final WarningLevel[] VALUES_ARRAY = + new WarningLevel[] { + INFORMATIVE, + DANGER_LEVEL_1, + DANGER_LEVEL_2, + DANGER_LEVEL_3, + }; + + /** + * A public read-only list of all the 'Warning Level' enumerators. + * + * + * @generated + */ + public static final List VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY)); + + /** + * Returns the 'Warning Level' literal with the specified literal value. + * + * + * @generated + */ + public static WarningLevel get(String literal) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WarningLevel result = VALUES_ARRAY[i]; + if (result.toString().equals(literal)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Warning Level' literal with the specified name. + * + * + * @generated + */ + public static WarningLevel getByName(String name) { + for (int i = 0; i < VALUES_ARRAY.length; ++i) { + WarningLevel result = VALUES_ARRAY[i]; + if (result.getName().equals(name)) { + return result; + } + } + return null; + } + + /** + * Returns the 'Warning Level' literal with the specified integer value. + * + * + * @generated + */ + public static WarningLevel get(int value) { + switch (value) { + case INFORMATIVE_VALUE: return INFORMATIVE; + case DANGER_LEVEL_1_VALUE: return DANGER_LEVEL_1; + case DANGER_LEVEL_2_VALUE: return DANGER_LEVEL_2; + case DANGER_LEVEL_3_VALUE: return DANGER_LEVEL_3; + } + return null; + } + + /** + * + * + * @generated + */ + private final int value; + + /** + * + * + * @generated + */ + private final String name; + + /** + * + * + * @generated + */ + private final String literal; + + /** + * Only this class can construct instances. + * + * + * @generated + */ + private WarningLevel(int value, String name, String literal) { + this.value = value; + this.name = name; + this.literal = literal; + } + + /** + * + * + * @generated + */ + public int getValue() { + return value; + } + + /** + * + * + * @generated + */ + public String getName() { + return name; + } + + /** + * + * + * @generated + */ + public String getLiteral() { + return literal; + } + + /** + * Returns the literal value of the enumerator, which is its string representation. + * + * + * @generated + */ + @Override + public String toString() { + return literal; + } + +} //WarningLevel diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesFactoryImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesFactoryImpl.java new file mode 100755 index 0000000..5e8b912 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesFactoryImpl.java @@ -0,0 +1,1124 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables.impl; + +import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EFactoryImpl; + +import org.eclipse.emf.ecore.plugin.EcorePlugin; + +import org.genivi.trafficincidentsservice.trafficincidenttables.*; + +/** + * + * An implementation of the model Factory. + * + * @generated + */ +public class trafficincidenttablesFactoryImpl extends EFactoryImpl implements trafficincidenttablesFactory { + /** + * Creates the default factory implementation. + * + * + * @generated + */ + public static trafficincidenttablesFactory init() { + try { + trafficincidenttablesFactory thetrafficincidenttablesFactory = (trafficincidenttablesFactory)EPackage.Registry.INSTANCE.getEFactory(trafficincidenttablesPackage.eNS_URI); + if (thetrafficincidenttablesFactory != null) { + return thetrafficincidenttablesFactory; + } + } + catch (Exception exception) { + EcorePlugin.INSTANCE.log(exception); + } + return new trafficincidenttablesFactoryImpl(); + } + + /** + * Creates an instance of the factory. + * + * + * @generated + */ + public trafficincidenttablesFactoryImpl() { + super(); + } + + /** + * + * + * @generated + */ + @Override + public EObject create(EClass eClass) { + switch (eClass.getClassifierID()) { + default: + throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case trafficincidenttablesPackage.EFFECT_CODE: + return createEffectCodeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.TENDENCY: + return createTendencyFromString(eDataType, initialValue); + case trafficincidenttablesPackage.CAUSE_CODE: + return createCauseCodeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.WARNING_LEVEL: + return createWarningLevelFromString(eDataType, initialValue); + case trafficincidenttablesPackage.TRAFFIC_CONGESTION: + return createTrafficCongestionFromString(eDataType, initialValue); + case trafficincidenttablesPackage.ACCIDENT: + return createAccidentFromString(eDataType, initialValue); + case trafficincidenttablesPackage.ROAD_WORKS: + return createRoadWorksFromString(eDataType, initialValue); + case trafficincidenttablesPackage.NARROW_LANES: + return createNarrowLanesFromString(eDataType, initialValue); + case trafficincidenttablesPackage.IMPASSIBILITY: + return createImpassibilityFromString(eDataType, initialValue); + case trafficincidenttablesPackage.SLIPPERY_ROAD: + return createSlipperyRoadFromString(eDataType, initialValue); + case trafficincidenttablesPackage.FIRE: + return createFireFromString(eDataType, initialValue); + case trafficincidenttablesPackage.HAZARDOUS_DRIVING_CONDITIONS: + return createHazardousDrivingConditionsFromString(eDataType, initialValue); + case trafficincidenttablesPackage.OBJECTS_ON_THE_ROAD: + return createObjectsOnTheRoadFromString(eDataType, initialValue); + case trafficincidenttablesPackage.ANIMALS_ON_ROADWAY: + return createAnimalsOnRoadwayFromString(eDataType, initialValue); + case trafficincidenttablesPackage.PEOPLE_ON_ROADWAY: + return createPeopleOnRoadwayFromString(eDataType, initialValue); + case trafficincidenttablesPackage.BROKEN_DOWN_VEHICLES: + return createBrokenDownVehiclesFromString(eDataType, initialValue); + case trafficincidenttablesPackage.RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + return createRescueAndRecoveryWorkInProgressFromString(eDataType, initialValue); + case trafficincidenttablesPackage.REGULATORY_MEASURE: + return createRegulatoryMeasureFromString(eDataType, initialValue); + case trafficincidenttablesPackage.LANE_RESTRICTION_TYPE: + return createLaneRestrictionTypeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.ADVICE_CODE: + return createAdviceCodeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.VEHICLE_TYPE: + return createVehicleTypeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.RESTRICTION_TYPE: + return createRestrictionTypeFromString(eDataType, initialValue); + case trafficincidenttablesPackage.EXTREME_WEATHER_CONDITIONS: + return createExtremeWeatherConditionsFromString(eDataType, initialValue); + case trafficincidenttablesPackage.VISIBILITY_REDUCED: + return createVisibilityReducedFromString(eDataType, initialValue); + case trafficincidenttablesPackage.PRECIPITATION: + return createPrecipitationFromString(eDataType, initialValue); + case trafficincidenttablesPackage.RECKLESS_PERSONS: + return createRecklessPersonsFromString(eDataType, initialValue); + case trafficincidenttablesPackage.MAJOR_EVENT: + return createMajorEventFromString(eDataType, initialValue); + case trafficincidenttablesPackage.SERVICE_NOT_OPERATING: + return createServiceNotOperatingFromString(eDataType, initialValue); + case trafficincidenttablesPackage.SERVICE_NOT_USABLE: + return createServiceNotUsableFromString(eDataType, initialValue); + case trafficincidenttablesPackage.SLOW_MOVING_VEHICLES: + return createSlowMovingVehiclesFromString(eDataType, initialValue); + case trafficincidenttablesPackage.DANGEROUS_END_OF_QUEUE: + return createDangerousEndOfQueueFromString(eDataType, initialValue); + case trafficincidenttablesPackage.RISK_OF_FIRE: + return createRiskOfFireFromString(eDataType, initialValue); + case trafficincidenttablesPackage.TIME_DELAY: + return createTimeDelayFromString(eDataType, initialValue); + case trafficincidenttablesPackage.POLICE_CHECKPOINT: + return createPoliceCheckpointFromString(eDataType, initialValue); + case trafficincidenttablesPackage.MALFUNCTIONING_ROADSIDE_EQUIPMENT: + return createMalfunctioningRoadsideEquipmentFromString(eDataType, initialValue); + case trafficincidenttablesPackage.OVERTAKING_NOT_ALLOWED: + return createOvertakingNotAllowedFromString(eDataType, initialValue); + case trafficincidenttablesPackage.DRIVING_NOT_ALLOWED: + return createDrivingNotAllowedFromString(eDataType, initialValue); + case trafficincidenttablesPackage.GIVING_PATH_VEHICLES_FROM_BEHIND: + return createGivingPathVehiclesFromBehindFromString(eDataType, initialValue); + case trafficincidenttablesPackage.FOLLOW_DIVERSION: + return createFollowDiversionFromString(eDataType, initialValue); + case trafficincidenttablesPackage.DRIVE_CAREFULLY: + return createDriveCarefullyFromString(eDataType, initialValue); + case trafficincidenttablesPackage.DO_NOT_LEAVE_YOUR_VEHICLE: + return createDoNotLeaveYourVehicleFromString(eDataType, initialValue); + case trafficincidenttablesPackage.USE_TOLL_LANES: + return createUseTollLanesFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case trafficincidenttablesPackage.EFFECT_CODE: + return convertEffectCodeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.TENDENCY: + return convertTendencyToString(eDataType, instanceValue); + case trafficincidenttablesPackage.CAUSE_CODE: + return convertCauseCodeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.WARNING_LEVEL: + return convertWarningLevelToString(eDataType, instanceValue); + case trafficincidenttablesPackage.TRAFFIC_CONGESTION: + return convertTrafficCongestionToString(eDataType, instanceValue); + case trafficincidenttablesPackage.ACCIDENT: + return convertAccidentToString(eDataType, instanceValue); + case trafficincidenttablesPackage.ROAD_WORKS: + return convertRoadWorksToString(eDataType, instanceValue); + case trafficincidenttablesPackage.NARROW_LANES: + return convertNarrowLanesToString(eDataType, instanceValue); + case trafficincidenttablesPackage.IMPASSIBILITY: + return convertImpassibilityToString(eDataType, instanceValue); + case trafficincidenttablesPackage.SLIPPERY_ROAD: + return convertSlipperyRoadToString(eDataType, instanceValue); + case trafficincidenttablesPackage.FIRE: + return convertFireToString(eDataType, instanceValue); + case trafficincidenttablesPackage.HAZARDOUS_DRIVING_CONDITIONS: + return convertHazardousDrivingConditionsToString(eDataType, instanceValue); + case trafficincidenttablesPackage.OBJECTS_ON_THE_ROAD: + return convertObjectsOnTheRoadToString(eDataType, instanceValue); + case trafficincidenttablesPackage.ANIMALS_ON_ROADWAY: + return convertAnimalsOnRoadwayToString(eDataType, instanceValue); + case trafficincidenttablesPackage.PEOPLE_ON_ROADWAY: + return convertPeopleOnRoadwayToString(eDataType, instanceValue); + case trafficincidenttablesPackage.BROKEN_DOWN_VEHICLES: + return convertBrokenDownVehiclesToString(eDataType, instanceValue); + case trafficincidenttablesPackage.RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + return convertRescueAndRecoveryWorkInProgressToString(eDataType, instanceValue); + case trafficincidenttablesPackage.REGULATORY_MEASURE: + return convertRegulatoryMeasureToString(eDataType, instanceValue); + case trafficincidenttablesPackage.LANE_RESTRICTION_TYPE: + return convertLaneRestrictionTypeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.ADVICE_CODE: + return convertAdviceCodeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.VEHICLE_TYPE: + return convertVehicleTypeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.RESTRICTION_TYPE: + return convertRestrictionTypeToString(eDataType, instanceValue); + case trafficincidenttablesPackage.EXTREME_WEATHER_CONDITIONS: + return convertExtremeWeatherConditionsToString(eDataType, instanceValue); + case trafficincidenttablesPackage.VISIBILITY_REDUCED: + return convertVisibilityReducedToString(eDataType, instanceValue); + case trafficincidenttablesPackage.PRECIPITATION: + return convertPrecipitationToString(eDataType, instanceValue); + case trafficincidenttablesPackage.RECKLESS_PERSONS: + return convertRecklessPersonsToString(eDataType, instanceValue); + case trafficincidenttablesPackage.MAJOR_EVENT: + return convertMajorEventToString(eDataType, instanceValue); + case trafficincidenttablesPackage.SERVICE_NOT_OPERATING: + return convertServiceNotOperatingToString(eDataType, instanceValue); + case trafficincidenttablesPackage.SERVICE_NOT_USABLE: + return convertServiceNotUsableToString(eDataType, instanceValue); + case trafficincidenttablesPackage.SLOW_MOVING_VEHICLES: + return convertSlowMovingVehiclesToString(eDataType, instanceValue); + case trafficincidenttablesPackage.DANGEROUS_END_OF_QUEUE: + return convertDangerousEndOfQueueToString(eDataType, instanceValue); + case trafficincidenttablesPackage.RISK_OF_FIRE: + return convertRiskOfFireToString(eDataType, instanceValue); + case trafficincidenttablesPackage.TIME_DELAY: + return convertTimeDelayToString(eDataType, instanceValue); + case trafficincidenttablesPackage.POLICE_CHECKPOINT: + return convertPoliceCheckpointToString(eDataType, instanceValue); + case trafficincidenttablesPackage.MALFUNCTIONING_ROADSIDE_EQUIPMENT: + return convertMalfunctioningRoadsideEquipmentToString(eDataType, instanceValue); + case trafficincidenttablesPackage.OVERTAKING_NOT_ALLOWED: + return convertOvertakingNotAllowedToString(eDataType, instanceValue); + case trafficincidenttablesPackage.DRIVING_NOT_ALLOWED: + return convertDrivingNotAllowedToString(eDataType, instanceValue); + case trafficincidenttablesPackage.GIVING_PATH_VEHICLES_FROM_BEHIND: + return convertGivingPathVehiclesFromBehindToString(eDataType, instanceValue); + case trafficincidenttablesPackage.FOLLOW_DIVERSION: + return convertFollowDiversionToString(eDataType, instanceValue); + case trafficincidenttablesPackage.DRIVE_CAREFULLY: + return convertDriveCarefullyToString(eDataType, instanceValue); + case trafficincidenttablesPackage.DO_NOT_LEAVE_YOUR_VEHICLE: + return convertDoNotLeaveYourVehicleToString(eDataType, instanceValue); + case trafficincidenttablesPackage.USE_TOLL_LANES: + return convertUseTollLanesToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); + } + } + + /** + * + * + * @generated + */ + public EffectCode createEffectCodeFromString(EDataType eDataType, String initialValue) { + EffectCode result = EffectCode.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertEffectCodeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public Tendency createTendencyFromString(EDataType eDataType, String initialValue) { + Tendency result = Tendency.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTendencyToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public CauseCode createCauseCodeFromString(EDataType eDataType, String initialValue) { + CauseCode result = CauseCode.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertCauseCodeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public WarningLevel createWarningLevelFromString(EDataType eDataType, String initialValue) { + WarningLevel result = WarningLevel.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertWarningLevelToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public TrafficCongestion createTrafficCongestionFromString(EDataType eDataType, String initialValue) { + TrafficCongestion result = TrafficCongestion.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTrafficCongestionToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public Accident createAccidentFromString(EDataType eDataType, String initialValue) { + Accident result = Accident.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertAccidentToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RoadWorks createRoadWorksFromString(EDataType eDataType, String initialValue) { + RoadWorks result = RoadWorks.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRoadWorksToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public NarrowLanes createNarrowLanesFromString(EDataType eDataType, String initialValue) { + NarrowLanes result = NarrowLanes.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertNarrowLanesToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public Impassibility createImpassibilityFromString(EDataType eDataType, String initialValue) { + Impassibility result = Impassibility.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertImpassibilityToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public SlipperyRoad createSlipperyRoadFromString(EDataType eDataType, String initialValue) { + SlipperyRoad result = SlipperyRoad.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertSlipperyRoadToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public Fire createFireFromString(EDataType eDataType, String initialValue) { + Fire result = Fire.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertFireToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public HazardousDrivingConditions createHazardousDrivingConditionsFromString(EDataType eDataType, String initialValue) { + HazardousDrivingConditions result = HazardousDrivingConditions.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertHazardousDrivingConditionsToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ObjectsOnTheRoad createObjectsOnTheRoadFromString(EDataType eDataType, String initialValue) { + ObjectsOnTheRoad result = ObjectsOnTheRoad.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertObjectsOnTheRoadToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public AnimalsOnRoadway createAnimalsOnRoadwayFromString(EDataType eDataType, String initialValue) { + AnimalsOnRoadway result = AnimalsOnRoadway.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertAnimalsOnRoadwayToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public PeopleOnRoadway createPeopleOnRoadwayFromString(EDataType eDataType, String initialValue) { + PeopleOnRoadway result = PeopleOnRoadway.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertPeopleOnRoadwayToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public BrokenDownVehicles createBrokenDownVehiclesFromString(EDataType eDataType, String initialValue) { + BrokenDownVehicles result = BrokenDownVehicles.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertBrokenDownVehiclesToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RescueAndRecoveryWorkInProgress createRescueAndRecoveryWorkInProgressFromString(EDataType eDataType, String initialValue) { + RescueAndRecoveryWorkInProgress result = RescueAndRecoveryWorkInProgress.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRescueAndRecoveryWorkInProgressToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RegulatoryMeasure createRegulatoryMeasureFromString(EDataType eDataType, String initialValue) { + RegulatoryMeasure result = RegulatoryMeasure.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRegulatoryMeasureToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public LaneRestrictionType createLaneRestrictionTypeFromString(EDataType eDataType, String initialValue) { + LaneRestrictionType result = LaneRestrictionType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertLaneRestrictionTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public AdviceCode createAdviceCodeFromString(EDataType eDataType, String initialValue) { + AdviceCode result = AdviceCode.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertAdviceCodeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public VehicleType createVehicleTypeFromString(EDataType eDataType, String initialValue) { + VehicleType result = VehicleType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertVehicleTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RestrictionType createRestrictionTypeFromString(EDataType eDataType, String initialValue) { + RestrictionType result = RestrictionType.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRestrictionTypeToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ExtremeWeatherConditions createExtremeWeatherConditionsFromString(EDataType eDataType, String initialValue) { + ExtremeWeatherConditions result = ExtremeWeatherConditions.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertExtremeWeatherConditionsToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public VisibilityReduced createVisibilityReducedFromString(EDataType eDataType, String initialValue) { + VisibilityReduced result = VisibilityReduced.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertVisibilityReducedToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public Precipitation createPrecipitationFromString(EDataType eDataType, String initialValue) { + Precipitation result = Precipitation.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertPrecipitationToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RecklessPersons createRecklessPersonsFromString(EDataType eDataType, String initialValue) { + RecklessPersons result = RecklessPersons.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRecklessPersonsToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public MajorEvent createMajorEventFromString(EDataType eDataType, String initialValue) { + MajorEvent result = MajorEvent.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertMajorEventToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ServiceNotOperating createServiceNotOperatingFromString(EDataType eDataType, String initialValue) { + ServiceNotOperating result = ServiceNotOperating.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertServiceNotOperatingToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public ServiceNotUsable createServiceNotUsableFromString(EDataType eDataType, String initialValue) { + ServiceNotUsable result = ServiceNotUsable.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertServiceNotUsableToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public SlowMovingVehicles createSlowMovingVehiclesFromString(EDataType eDataType, String initialValue) { + SlowMovingVehicles result = SlowMovingVehicles.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertSlowMovingVehiclesToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public DangerousEndOfQueue createDangerousEndOfQueueFromString(EDataType eDataType, String initialValue) { + DangerousEndOfQueue result = DangerousEndOfQueue.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertDangerousEndOfQueueToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public RiskOfFire createRiskOfFireFromString(EDataType eDataType, String initialValue) { + RiskOfFire result = RiskOfFire.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertRiskOfFireToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public TimeDelay createTimeDelayFromString(EDataType eDataType, String initialValue) { + TimeDelay result = TimeDelay.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertTimeDelayToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public PoliceCheckpoint createPoliceCheckpointFromString(EDataType eDataType, String initialValue) { + PoliceCheckpoint result = PoliceCheckpoint.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertPoliceCheckpointToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public MalfunctioningRoadsideEquipment createMalfunctioningRoadsideEquipmentFromString(EDataType eDataType, String initialValue) { + MalfunctioningRoadsideEquipment result = MalfunctioningRoadsideEquipment.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertMalfunctioningRoadsideEquipmentToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public OvertakingNotAllowed createOvertakingNotAllowedFromString(EDataType eDataType, String initialValue) { + OvertakingNotAllowed result = OvertakingNotAllowed.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertOvertakingNotAllowedToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public DrivingNotAllowed createDrivingNotAllowedFromString(EDataType eDataType, String initialValue) { + DrivingNotAllowed result = DrivingNotAllowed.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertDrivingNotAllowedToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public GivingPathVehiclesFromBehind createGivingPathVehiclesFromBehindFromString(EDataType eDataType, String initialValue) { + GivingPathVehiclesFromBehind result = GivingPathVehiclesFromBehind.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertGivingPathVehiclesFromBehindToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public FollowDiversion createFollowDiversionFromString(EDataType eDataType, String initialValue) { + FollowDiversion result = FollowDiversion.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertFollowDiversionToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public DriveCarefully createDriveCarefullyFromString(EDataType eDataType, String initialValue) { + DriveCarefully result = DriveCarefully.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertDriveCarefullyToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public DoNotLeaveYourVehicle createDoNotLeaveYourVehicleFromString(EDataType eDataType, String initialValue) { + DoNotLeaveYourVehicle result = DoNotLeaveYourVehicle.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertDoNotLeaveYourVehicleToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public UseTollLanes createUseTollLanesFromString(EDataType eDataType, String initialValue) { + UseTollLanes result = UseTollLanes.get(initialValue); + if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); + return result; + } + + /** + * + * + * @generated + */ + public String convertUseTollLanesToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * + * + * @generated + */ + public trafficincidenttablesPackage gettrafficincidenttablesPackage() { + return (trafficincidenttablesPackage)getEPackage(); + } + + /** + * + * + * @deprecated + * @generated + */ + @Deprecated + public static trafficincidenttablesPackage getPackage() { + return trafficincidenttablesPackage.eINSTANCE; + } + +} //trafficincidenttablesFactoryImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesPackageImpl.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesPackageImpl.java new file mode 100755 index 0000000..26dd493 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/impl/trafficincidenttablesPackageImpl.java @@ -0,0 +1,1267 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables.impl; + +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; + +import org.eclipse.emf.ecore.impl.EPackageImpl; + +import org.genivi.common.CommonPackage; + +import org.genivi.location.LocationPackage; + +import org.genivi.trafficincidentsservice.trafficincidenttables.Accident; +import org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue; +import org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle; +import org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully; +import org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode; +import org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Fire; +import org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion; +import org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind; +import org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility; +import org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent; +import org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment; +import org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint; +import org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation; +import org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons; +import org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure; +import org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire; +import org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.Tendency; +import org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay; +import org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion; +import org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType; +import org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; +import org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesFactory; +import org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage; + +/** + * + * An implementation of the model Package. + * + * @generated + */ +public class trafficincidenttablesPackageImpl extends EPackageImpl implements trafficincidenttablesPackage { + /** + * + * + * @generated + */ + private EEnum effectCodeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum tendencyEEnum = null; + + /** + * + * + * @generated + */ + private EEnum causeCodeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum warningLevelEEnum = null; + + /** + * + * + * @generated + */ + private EEnum trafficCongestionEEnum = null; + + /** + * + * + * @generated + */ + private EEnum accidentEEnum = null; + + /** + * + * + * @generated + */ + private EEnum roadWorksEEnum = null; + + /** + * + * + * @generated + */ + private EEnum narrowLanesEEnum = null; + + /** + * + * + * @generated + */ + private EEnum impassibilityEEnum = null; + + /** + * + * + * @generated + */ + private EEnum slipperyRoadEEnum = null; + + /** + * + * + * @generated + */ + private EEnum fireEEnum = null; + + /** + * + * + * @generated + */ + private EEnum hazardousDrivingConditionsEEnum = null; + + /** + * + * + * @generated + */ + private EEnum objectsOnTheRoadEEnum = null; + + /** + * + * + * @generated + */ + private EEnum animalsOnRoadwayEEnum = null; + + /** + * + * + * @generated + */ + private EEnum peopleOnRoadwayEEnum = null; + + /** + * + * + * @generated + */ + private EEnum brokenDownVehiclesEEnum = null; + + /** + * + * + * @generated + */ + private EEnum rescueAndRecoveryWorkInProgressEEnum = null; + + /** + * + * + * @generated + */ + private EEnum regulatoryMeasureEEnum = null; + + /** + * + * + * @generated + */ + private EEnum laneRestrictionTypeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum adviceCodeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum vehicleTypeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum restrictionTypeEEnum = null; + + /** + * + * + * @generated + */ + private EEnum extremeWeatherConditionsEEnum = null; + + /** + * + * + * @generated + */ + private EEnum visibilityReducedEEnum = null; + + /** + * + * + * @generated + */ + private EEnum precipitationEEnum = null; + + /** + * + * + * @generated + */ + private EEnum recklessPersonsEEnum = null; + + /** + * + * + * @generated + */ + private EEnum majorEventEEnum = null; + + /** + * + * + * @generated + */ + private EEnum serviceNotOperatingEEnum = null; + + /** + * + * + * @generated + */ + private EEnum serviceNotUsableEEnum = null; + + /** + * + * + * @generated + */ + private EEnum slowMovingVehiclesEEnum = null; + + /** + * + * + * @generated + */ + private EEnum dangerousEndOfQueueEEnum = null; + + /** + * + * + * @generated + */ + private EEnum riskOfFireEEnum = null; + + /** + * + * + * @generated + */ + private EEnum timeDelayEEnum = null; + + /** + * + * + * @generated + */ + private EEnum policeCheckpointEEnum = null; + + /** + * + * + * @generated + */ + private EEnum malfunctioningRoadsideEquipmentEEnum = null; + + /** + * + * + * @generated + */ + private EEnum overtakingNotAllowedEEnum = null; + + /** + * + * + * @generated + */ + private EEnum drivingNotAllowedEEnum = null; + + /** + * + * + * @generated + */ + private EEnum givingPathVehiclesFromBehindEEnum = null; + + /** + * + * + * @generated + */ + private EEnum followDiversionEEnum = null; + + /** + * + * + * @generated + */ + private EEnum driveCarefullyEEnum = null; + + /** + * + * + * @generated + */ + private EEnum doNotLeaveYourVehicleEEnum = null; + + /** + * + * + * @generated + */ + private EEnum useTollLanesEEnum = null; + + /** + * Creates an instance of the model Package, registered with + * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package + * package URI value. + *

Note: the correct way to create the package is via the static + * factory method {@link #init init()}, which also performs + * initialization of the package, or returns the registered package, + * if one already exists. + * + * + * @see org.eclipse.emf.ecore.EPackage.Registry + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage#eNS_URI + * @see #init() + * @generated + */ + private trafficincidenttablesPackageImpl() { + super(eNS_URI, trafficincidenttablesFactory.eINSTANCE); + } + + /** + * + * + * @generated + */ + private static boolean isInited = false; + + /** + * Creates, registers, and initializes the Package for this model, and for any others upon which it depends. + * + *

This method is used to initialize {@link trafficincidenttablesPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. + * + * + * @see #eNS_URI + * @see #createPackageContents() + * @see #initializePackageContents() + * @generated + */ + public static trafficincidenttablesPackage init() { + if (isInited) return (trafficincidenttablesPackage)EPackage.Registry.INSTANCE.getEPackage(trafficincidenttablesPackage.eNS_URI); + + // Obtain or create and register package + trafficincidenttablesPackageImpl thetrafficincidenttablesPackage = (trafficincidenttablesPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof trafficincidenttablesPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new trafficincidenttablesPackageImpl()); + + isInited = true; + + // Initialize simple dependencies + LocationPackage.eINSTANCE.eClass(); + CommonPackage.eINSTANCE.eClass(); + + // Create package meta-data objects + thetrafficincidenttablesPackage.createPackageContents(); + + // Initialize created meta-data + thetrafficincidenttablesPackage.initializePackageContents(); + + // Mark meta-data to indicate it can't be changed + thetrafficincidenttablesPackage.freeze(); + + + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(trafficincidenttablesPackage.eNS_URI, thetrafficincidenttablesPackage); + return thetrafficincidenttablesPackage; + } + + /** + * + * + * @generated + */ + public EEnum getEffectCode() { + return effectCodeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTendency() { + return tendencyEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getCauseCode() { + return causeCodeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getWarningLevel() { + return warningLevelEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTrafficCongestion() { + return trafficCongestionEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getAccident() { + return accidentEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRoadWorks() { + return roadWorksEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getNarrowLanes() { + return narrowLanesEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getImpassibility() { + return impassibilityEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getSlipperyRoad() { + return slipperyRoadEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getFire() { + return fireEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getHazardousDrivingConditions() { + return hazardousDrivingConditionsEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getObjectsOnTheRoad() { + return objectsOnTheRoadEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getAnimalsOnRoadway() { + return animalsOnRoadwayEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getPeopleOnRoadway() { + return peopleOnRoadwayEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getBrokenDownVehicles() { + return brokenDownVehiclesEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRescueAndRecoveryWorkInProgress() { + return rescueAndRecoveryWorkInProgressEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRegulatoryMeasure() { + return regulatoryMeasureEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getLaneRestrictionType() { + return laneRestrictionTypeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getAdviceCode() { + return adviceCodeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getVehicleType() { + return vehicleTypeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRestrictionType() { + return restrictionTypeEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getExtremeWeatherConditions() { + return extremeWeatherConditionsEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getVisibilityReduced() { + return visibilityReducedEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getPrecipitation() { + return precipitationEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRecklessPersons() { + return recklessPersonsEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getMajorEvent() { + return majorEventEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getServiceNotOperating() { + return serviceNotOperatingEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getServiceNotUsable() { + return serviceNotUsableEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getSlowMovingVehicles() { + return slowMovingVehiclesEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getDangerousEndOfQueue() { + return dangerousEndOfQueueEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getRiskOfFire() { + return riskOfFireEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getTimeDelay() { + return timeDelayEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getPoliceCheckpoint() { + return policeCheckpointEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getMalfunctioningRoadsideEquipment() { + return malfunctioningRoadsideEquipmentEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getOvertakingNotAllowed() { + return overtakingNotAllowedEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getDrivingNotAllowed() { + return drivingNotAllowedEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getGivingPathVehiclesFromBehind() { + return givingPathVehiclesFromBehindEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getFollowDiversion() { + return followDiversionEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getDriveCarefully() { + return driveCarefullyEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getDoNotLeaveYourVehicle() { + return doNotLeaveYourVehicleEEnum; + } + + /** + * + * + * @generated + */ + public EEnum getUseTollLanes() { + return useTollLanesEEnum; + } + + /** + * + * + * @generated + */ + public trafficincidenttablesFactory gettrafficincidenttablesFactory() { + return (trafficincidenttablesFactory)getEFactoryInstance(); + } + + /** + * + * + * @generated + */ + private boolean isCreated = false; + + /** + * Creates the meta-model objects for the package. This method is + * guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void createPackageContents() { + if (isCreated) return; + isCreated = true; + + // Create enums + effectCodeEEnum = createEEnum(EFFECT_CODE); + tendencyEEnum = createEEnum(TENDENCY); + causeCodeEEnum = createEEnum(CAUSE_CODE); + warningLevelEEnum = createEEnum(WARNING_LEVEL); + trafficCongestionEEnum = createEEnum(TRAFFIC_CONGESTION); + accidentEEnum = createEEnum(ACCIDENT); + roadWorksEEnum = createEEnum(ROAD_WORKS); + narrowLanesEEnum = createEEnum(NARROW_LANES); + impassibilityEEnum = createEEnum(IMPASSIBILITY); + slipperyRoadEEnum = createEEnum(SLIPPERY_ROAD); + fireEEnum = createEEnum(FIRE); + hazardousDrivingConditionsEEnum = createEEnum(HAZARDOUS_DRIVING_CONDITIONS); + objectsOnTheRoadEEnum = createEEnum(OBJECTS_ON_THE_ROAD); + animalsOnRoadwayEEnum = createEEnum(ANIMALS_ON_ROADWAY); + peopleOnRoadwayEEnum = createEEnum(PEOPLE_ON_ROADWAY); + brokenDownVehiclesEEnum = createEEnum(BROKEN_DOWN_VEHICLES); + rescueAndRecoveryWorkInProgressEEnum = createEEnum(RESCUE_AND_RECOVERY_WORK_IN_PROGRESS); + regulatoryMeasureEEnum = createEEnum(REGULATORY_MEASURE); + laneRestrictionTypeEEnum = createEEnum(LANE_RESTRICTION_TYPE); + adviceCodeEEnum = createEEnum(ADVICE_CODE); + vehicleTypeEEnum = createEEnum(VEHICLE_TYPE); + restrictionTypeEEnum = createEEnum(RESTRICTION_TYPE); + extremeWeatherConditionsEEnum = createEEnum(EXTREME_WEATHER_CONDITIONS); + visibilityReducedEEnum = createEEnum(VISIBILITY_REDUCED); + precipitationEEnum = createEEnum(PRECIPITATION); + recklessPersonsEEnum = createEEnum(RECKLESS_PERSONS); + majorEventEEnum = createEEnum(MAJOR_EVENT); + serviceNotOperatingEEnum = createEEnum(SERVICE_NOT_OPERATING); + serviceNotUsableEEnum = createEEnum(SERVICE_NOT_USABLE); + slowMovingVehiclesEEnum = createEEnum(SLOW_MOVING_VEHICLES); + dangerousEndOfQueueEEnum = createEEnum(DANGEROUS_END_OF_QUEUE); + riskOfFireEEnum = createEEnum(RISK_OF_FIRE); + timeDelayEEnum = createEEnum(TIME_DELAY); + policeCheckpointEEnum = createEEnum(POLICE_CHECKPOINT); + malfunctioningRoadsideEquipmentEEnum = createEEnum(MALFUNCTIONING_ROADSIDE_EQUIPMENT); + overtakingNotAllowedEEnum = createEEnum(OVERTAKING_NOT_ALLOWED); + drivingNotAllowedEEnum = createEEnum(DRIVING_NOT_ALLOWED); + givingPathVehiclesFromBehindEEnum = createEEnum(GIVING_PATH_VEHICLES_FROM_BEHIND); + followDiversionEEnum = createEEnum(FOLLOW_DIVERSION); + driveCarefullyEEnum = createEEnum(DRIVE_CAREFULLY); + doNotLeaveYourVehicleEEnum = createEEnum(DO_NOT_LEAVE_YOUR_VEHICLE); + useTollLanesEEnum = createEEnum(USE_TOLL_LANES); + } + + /** + * + * + * @generated + */ + private boolean isInitialized = false; + + /** + * Complete the initialization of the package and its meta-model. This + * method is guarded to have no affect on any invocation but its first. + * + * + * @generated + */ + public void initializePackageContents() { + if (isInitialized) return; + isInitialized = true; + + // Initialize package + setName(eNAME); + setNsPrefix(eNS_PREFIX); + setNsURI(eNS_URI); + + // Initialize enums and add enum literals + initEEnum(effectCodeEEnum, EffectCode.class, "EffectCode"); + addEEnumLiteral(effectCodeEEnum, EffectCode.TRAFFIC_FLOW_UNKNOWN); + addEEnumLiteral(effectCodeEEnum, EffectCode.FREE_TRAFFIC_FLOW); + addEEnumLiteral(effectCodeEEnum, EffectCode.HEAVY_TRAFFIC); + addEEnumLiteral(effectCodeEEnum, EffectCode.SLOW_TRAFFIC); + addEEnumLiteral(effectCodeEEnum, EffectCode.QUEUING_TRAFFIC); + addEEnumLiteral(effectCodeEEnum, EffectCode.STATIONARY_TRAFFIC); + addEEnumLiteral(effectCodeEEnum, EffectCode.NO_TRAFFIC_FLOW); + + initEEnum(tendencyEEnum, Tendency.class, "Tendency"); + addEEnumLiteral(tendencyEEnum, Tendency.SLIGHTLY_INCREASING); + addEEnumLiteral(tendencyEEnum, Tendency.INCREASING); + addEEnumLiteral(tendencyEEnum, Tendency.STRONGLY_INCREASING); + addEEnumLiteral(tendencyEEnum, Tendency.SLIGHTLY_DECREASING); + addEEnumLiteral(tendencyEEnum, Tendency.DECREASING); + addEEnumLiteral(tendencyEEnum, Tendency.STRONGLY_DECREASING); + addEEnumLiteral(tendencyEEnum, Tendency.CONSTANT); + + initEEnum(causeCodeEEnum, CauseCode.class, "CauseCode"); + addEEnumLiteral(causeCodeEEnum, CauseCode.TRAFFIC_CONGESTION); + addEEnumLiteral(causeCodeEEnum, CauseCode.ACCIDENT); + addEEnumLiteral(causeCodeEEnum, CauseCode.ROADWORKS); + addEEnumLiteral(causeCodeEEnum, CauseCode.NARROW_LANES); + addEEnumLiteral(causeCodeEEnum, CauseCode.IMPASSIBILITY); + addEEnumLiteral(causeCodeEEnum, CauseCode.SLIPPERY_ROAD); + addEEnumLiteral(causeCodeEEnum, CauseCode.AQUAPLANING); + addEEnumLiteral(causeCodeEEnum, CauseCode.FIRE); + addEEnumLiteral(causeCodeEEnum, CauseCode.HAZARDOUS_DRIVING_CONDITIONS); + addEEnumLiteral(causeCodeEEnum, CauseCode.OBJECTS_ON_THE_ROAD); + addEEnumLiteral(causeCodeEEnum, CauseCode.ANIMALS_ON_ROADWAY); + addEEnumLiteral(causeCodeEEnum, CauseCode.PEOPLE_ON_ROADWAY); + addEEnumLiteral(causeCodeEEnum, CauseCode.BROKEN_DOWN_VEHICLES); + addEEnumLiteral(causeCodeEEnum, CauseCode.VEHICLE_ON_WRONG_CARRIAGEWAY); + addEEnumLiteral(causeCodeEEnum, CauseCode.RESCUE_AND_RECOVERY_WORK_IN_PROGRESS); + addEEnumLiteral(causeCodeEEnum, CauseCode.REGULATORY_MEASURE); + addEEnumLiteral(causeCodeEEnum, CauseCode.EXTREME_WEATHER_CONDITIONS); + addEEnumLiteral(causeCodeEEnum, CauseCode.VISIBILITY_REDUCED); + addEEnumLiteral(causeCodeEEnum, CauseCode.PRECIPITATION); + addEEnumLiteral(causeCodeEEnum, CauseCode.RECKLESS_PERSONS); + addEEnumLiteral(causeCodeEEnum, CauseCode.OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED); + addEEnumLiteral(causeCodeEEnum, CauseCode.TRAFFIC_REGULATIONS_CHANGED); + addEEnumLiteral(causeCodeEEnum, CauseCode.MAJOR_EVENT); + addEEnumLiteral(causeCodeEEnum, CauseCode.SERVICE_NOT_OPERATING); + addEEnumLiteral(causeCodeEEnum, CauseCode.SERVICE_NOT_USEABLE); + addEEnumLiteral(causeCodeEEnum, CauseCode.SLOW_MOVING_VEHICLES); + addEEnumLiteral(causeCodeEEnum, CauseCode.DANGEROUS_END_OF_QUEUE); + addEEnumLiteral(causeCodeEEnum, CauseCode.RISK_OF_FIRE); + addEEnumLiteral(causeCodeEEnum, CauseCode.TIME_DELAY); + addEEnumLiteral(causeCodeEEnum, CauseCode.POLICE_CHECKPOINT); + addEEnumLiteral(causeCodeEEnum, CauseCode.MALFUNCTIONING_ROADSIDE_EQUIPMENT); + + initEEnum(warningLevelEEnum, WarningLevel.class, "WarningLevel"); + addEEnumLiteral(warningLevelEEnum, WarningLevel.INFORMATIVE); + addEEnumLiteral(warningLevelEEnum, WarningLevel.DANGER_LEVEL_1); + addEEnumLiteral(warningLevelEEnum, WarningLevel.DANGER_LEVEL_2); + addEEnumLiteral(warningLevelEEnum, WarningLevel.DANGER_LEVEL_3); + + initEEnum(trafficCongestionEEnum, TrafficCongestion.class, "TrafficCongestion"); + addEEnumLiteral(trafficCongestionEEnum, TrafficCongestion.INCREASED_VOLUME_OF_TRAFFIC); + + initEEnum(accidentEEnum, Accident.class, "Accident"); + addEEnumLiteral(accidentEEnum, Accident.MULTI_VEHICLE_ACCIDENT); + addEEnumLiteral(accidentEEnum, Accident.HEAVY_ACCIDENT); + addEEnumLiteral(accidentEEnum, Accident.ACCIDENT_INVOLVING_LORRY); + addEEnumLiteral(accidentEEnum, Accident.ACCIDENT_INVOLVING_BUS); + addEEnumLiteral(accidentEEnum, Accident.ACCIDENT_INVOLVING_HAZARDOUS_MATERIALS); + addEEnumLiteral(accidentEEnum, Accident.ACCIDENT_ON_OPPOSITE_LANE); + addEEnumLiteral(accidentEEnum, Accident.UNSECURED_ACCIDENT); + + initEEnum(roadWorksEEnum, RoadWorks.class, "RoadWorks"); + addEEnumLiteral(roadWorksEEnum, RoadWorks.MAJOR_ROADWORKS); + addEEnumLiteral(roadWorksEEnum, RoadWorks.ROAD_MARKING_WORK); + addEEnumLiteral(roadWorksEEnum, RoadWorks.SLOW_MOVING_ROAD_MAINTENANCE); + + initEEnum(narrowLanesEEnum, NarrowLanes.class, "NarrowLanes"); + addEEnumLiteral(narrowLanesEEnum, NarrowLanes.CONTRAFLOW); + addEEnumLiteral(narrowLanesEEnum, NarrowLanes.HARD_SHOULDER_CLOSED); + addEEnumLiteral(narrowLanesEEnum, NarrowLanes.SLIP_LANE_CLOSED); + addEEnumLiteral(narrowLanesEEnum, NarrowLanes.CRAWLER_LANE_CLOSED); + + initEEnum(impassibilityEEnum, Impassibility.class, "Impassibility"); + addEEnumLiteral(impassibilityEEnum, Impassibility.FLOODING); + addEEnumLiteral(impassibilityEEnum, Impassibility.DANGER_OF_AVALANCHES); + addEEnumLiteral(impassibilityEEnum, Impassibility.BLASTING_OF_AVALANCHES); + addEEnumLiteral(impassibilityEEnum, Impassibility.LANDSLIPS); + addEEnumLiteral(impassibilityEEnum, Impassibility.CHEMICAL_SPILLAGE); + addEEnumLiteral(impassibilityEEnum, Impassibility.WINTER_CLOSURE); + + initEEnum(slipperyRoadEEnum, SlipperyRoad.class, "SlipperyRoad"); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.HEAVY_FROST_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.FUEL_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.MUD_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.SNOW_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.ICE_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.BLACK_ICE_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.OIL_ON_ROAD); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.LOOSE_CHIPPINGS); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.INSTANT_BLACK_ICE); + addEEnumLiteral(slipperyRoadEEnum, SlipperyRoad.ROADS_SALTED); + + initEEnum(fireEEnum, Fire.class, "Fire"); + addEEnumLiteral(fireEEnum, Fire.MAJOR_FIRE); + addEEnumLiteral(fireEEnum, Fire.FOREST_FIRE); + + initEEnum(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.class, "HazardousDrivingConditions"); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.ROCKFALLS); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.EARTHQUAKE_DAMAGE); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.SEWER_COLLAPSE); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.SUBSIDENCE); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.SNOW_DRIFTS); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.STORM_DAMAGE); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.BURST_PIPE); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.VOLCANO_ERUPTION); + addEEnumLiteral(hazardousDrivingConditionsEEnum, HazardousDrivingConditions.FALLING_ICE); + + initEEnum(objectsOnTheRoadEEnum, ObjectsOnTheRoad.class, "ObjectsOnTheRoad"); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.SHED_LOAD); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.PARTS_OF_VEHICLES); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.PARTS_OF_TYRES); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.BIG_OBJECTS); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.FALLEN_TREES); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.HUB_CAPS); + addEEnumLiteral(objectsOnTheRoadEEnum, ObjectsOnTheRoad.WAITING_VEHICLES); + + initEEnum(animalsOnRoadwayEEnum, AnimalsOnRoadway.class, "AnimalsOnRoadway"); + addEEnumLiteral(animalsOnRoadwayEEnum, AnimalsOnRoadway.WILD_ANIMALS); + addEEnumLiteral(animalsOnRoadwayEEnum, AnimalsOnRoadway.HERD_OF_ANIMALS); + addEEnumLiteral(animalsOnRoadwayEEnum, AnimalsOnRoadway.SMALL_ANIMALS); + addEEnumLiteral(animalsOnRoadwayEEnum, AnimalsOnRoadway.LARGE_ANIMALS); + + initEEnum(peopleOnRoadwayEEnum, PeopleOnRoadway.class, "PeopleOnRoadway"); + addEEnumLiteral(peopleOnRoadwayEEnum, PeopleOnRoadway.CHILDREN_ON_ROADWAY); + addEEnumLiteral(peopleOnRoadwayEEnum, PeopleOnRoadway.CYCLISTS_ON_ROADWAY); + addEEnumLiteral(peopleOnRoadwayEEnum, PeopleOnRoadway.MOTOR_CYCLIST_ON_ROADWAY); + + initEEnum(brokenDownVehiclesEEnum, BrokenDownVehicles.class, "BrokenDownVehicles"); + addEEnumLiteral(brokenDownVehiclesEEnum, BrokenDownVehicles.BROKEN_DOWN_VEHICLE_BURNING); + addEEnumLiteral(brokenDownVehiclesEEnum, BrokenDownVehicles.BROKEN_DOWN_UNLIT_VEHICLE); + + initEEnum(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.class, "RescueAndRecoveryWorkInProgress"); + addEEnumLiteral(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.EMERGENCY_VEHICLES); + addEEnumLiteral(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.RESCUE_HELICOPTER_LANDING); + addEEnumLiteral(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.POLICE_ACTIVITY_ONGOING); + addEEnumLiteral(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.MEDICAL_EMERGENCY_ONGOING); + addEEnumLiteral(rescueAndRecoveryWorkInProgressEEnum, RescueAndRecoveryWorkInProgress.CHILD_ABDUCTION_IN_PROGRESS); + + initEEnum(regulatoryMeasureEEnum, RegulatoryMeasure.class, "RegulatoryMeasure"); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.SECURITY_ALERT); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.CONTAGIOUS_DISEASE); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.ENVIRONMENTAL); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.SMOG_ALERT); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.BATCH_SERVICE_IN_PROGRESS); + addEEnumLiteral(regulatoryMeasureEEnum, RegulatoryMeasure.ROAD_CLOSED_BY_THE_REGULATORY_AUTHORITIES); + + initEEnum(laneRestrictionTypeEEnum, LaneRestrictionType.class, "LaneRestrictionType"); + addEEnumLiteral(laneRestrictionTypeEEnum, LaneRestrictionType.LANES_CLOSED); + addEEnumLiteral(laneRestrictionTypeEEnum, LaneRestrictionType.LANES_OPEN); + addEEnumLiteral(laneRestrictionTypeEEnum, LaneRestrictionType.RIGHT_LANES_CLOSED); + addEEnumLiteral(laneRestrictionTypeEEnum, LaneRestrictionType.LEFT_LANES_CLOSED); + + initEEnum(adviceCodeEEnum, AdviceCode.class, "AdviceCode"); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.OVERTAKING_NOT_ALLOWED); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.DRIVING_NOT_ALLOWED); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.USE_HARD_SHOULDER_AS_LANE); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.WAIT_FOR_POLICE_PATROL); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.WAIT_FOR_IMPROVED_WEATHER); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.GIVING_PATH_VEHICLES_COMING_FROM_BEHIND); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.FOLLOW_DIVERSION); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.NO_DIVERSION_TO_RECOMMEND); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.DO_NOT_DIVERT); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.FOLLOW_POLICE_INSTRUCTIONS); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.AVOID_THE_AREA); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.DRIVE_CAREFULLY); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.DO_NOT_LEAVE_YOUR_VEHICLE); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.SWITCH_ON_RADIO); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.USE_TOLL_LANES); + addEEnumLiteral(adviceCodeEEnum, AdviceCode.WAIT_FOR_CONVOI); + + initEEnum(vehicleTypeEEnum, VehicleType.class, "VehicleType"); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.CAR); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.LORRY); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.BUS); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.TAXI); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.TRAIN); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.MOTOR_CYCLE); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.VEHICLE_WITH_TRAILER); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.MOTOR_VEHICLES); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.TRANSPORT_OF_DANGEROUS_GOODS); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.TRANSPORT_OF_ABNORMAL_LOAD); + addEEnumLiteral(vehicleTypeEEnum, VehicleType.HEAVY_VEHICLE); + + initEEnum(restrictionTypeEEnum, RestrictionType.class, "RestrictionType"); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WIDTH_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WIDTH_GREATER_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.HEIGTH_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.HEIGTH_GREATER_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WEIGHT_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WEIGHT_GREATER_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITHOUT_WINTER_TYRE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITHOUT_SNOW_CHAIN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_TRAILER); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_CARAVAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.PERSONS_IN_VEHICLE_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.PERSONS_IN_VEHICLE_MORE_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.EVEN_NUMBER_PLATE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.ODD_NUMBER_PLATE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.LENGTH_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.LENGTH_GREATER_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.AXLE_LOAD_LESS_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.AXLE_LOAD_GREATER_THAN); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_PETROL_ENGINE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_DIESEL_ENGINE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_LPG_ENGINE); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.THROUGH_TRAFFIC); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.RESIDENTS_TRAFFIC); + addEEnumLiteral(restrictionTypeEEnum, RestrictionType.WITH_DESTINATION_IN_GIVEN_AREA); + + initEEnum(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.class, "ExtremeWeatherConditions"); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.STRONG_WINDS); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.DAMAGING_HAIL); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.HURRICANE); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.THUNDERSTORM); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.TORNADO); + addEEnumLiteral(extremeWeatherConditionsEEnum, ExtremeWeatherConditions.BLIZARD); + + initEEnum(visibilityReducedEEnum, VisibilityReduced.class, "VisibilityReduced"); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_FOG); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_SMOKE); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_HEAVY_SNOWFALL); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_HEAVY_RAIN); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_HEAVY_HAIL); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_LOW_SUN_GLARE); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_SANDSTORMS); + addEEnumLiteral(visibilityReducedEEnum, VisibilityReduced.VISIBILITY_REDUCED_DUE_TO_SWARMS_OF_INSECTS); + + initEEnum(precipitationEEnum, Precipitation.class, "Precipitation"); + addEEnumLiteral(precipitationEEnum, Precipitation.HEAVY_RAIN); + addEEnumLiteral(precipitationEEnum, Precipitation.HEAVY_SNOWFALL); + addEEnumLiteral(precipitationEEnum, Precipitation.SOFT_HAIL); + + initEEnum(recklessPersonsEEnum, RecklessPersons.class, "RecklessPersons"); + addEEnumLiteral(recklessPersonsEEnum, RecklessPersons.RECKLESS_DRIVER); + addEEnumLiteral(recklessPersonsEEnum, RecklessPersons.GUNFIRE_ON_ROAD); + addEEnumLiteral(recklessPersonsEEnum, RecklessPersons.STONE_THROWING_PERSONS); + + initEEnum(majorEventEEnum, MajorEvent.class, "MajorEvent"); + addEEnumLiteral(majorEventEEnum, MajorEvent.SPORTS_EVENT); + addEEnumLiteral(majorEventEEnum, MajorEvent.DEMONSTRATION); + addEEnumLiteral(majorEventEEnum, MajorEvent.DEMONSTRATION_WITH_VEHICLES); + addEEnumLiteral(majorEventEEnum, MajorEvent.CONCERT); + addEEnumLiteral(majorEventEEnum, MajorEvent.FAIR); + addEEnumLiteral(majorEventEEnum, MajorEvent.MILITARY_TRAINING); + addEEnumLiteral(majorEventEEnum, MajorEvent.EMERGENCY_TRAINING); + addEEnumLiteral(majorEventEEnum, MajorEvent.FESTIVITY); + addEEnumLiteral(majorEventEEnum, MajorEvent.PROCESSION); + + initEEnum(serviceNotOperatingEEnum, ServiceNotOperating.class, "ServiceNotOperating"); + addEEnumLiteral(serviceNotOperatingEEnum, ServiceNotOperating.FERRY_SERVICE_NOT_OPERATING); + addEEnumLiteral(serviceNotOperatingEEnum, ServiceNotOperating.PLANE_SERVICE_NOT_OPERATING); + addEEnumLiteral(serviceNotOperatingEEnum, ServiceNotOperating.TRAIN_SERVICE_NOT_OPERATING); + addEEnumLiteral(serviceNotOperatingEEnum, ServiceNotOperating.BUS_SERVICE_NOT_OPERATING); + + initEEnum(serviceNotUsableEEnum, ServiceNotUsable.class, "ServiceNotUsable"); + addEEnumLiteral(serviceNotUsableEEnum, ServiceNotUsable.FUEL_STATION_CLOSED); + addEEnumLiteral(serviceNotUsableEEnum, ServiceNotUsable.SERVICE_AREA_CLOSED); + addEEnumLiteral(serviceNotUsableEEnum, ServiceNotUsable.SERVICE_AREA_BUSY); + addEEnumLiteral(serviceNotUsableEEnum, ServiceNotUsable.PARKING_FULL); + addEEnumLiteral(serviceNotUsableEEnum, ServiceNotUsable.CAR_PARK_CLOSED); + + initEEnum(slowMovingVehiclesEEnum, SlowMovingVehicles.class, "SlowMovingVehicles"); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.SLOW_MOVING_MAINTENANCE_VEHICLE); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.VEHICLES_SLOWING_TO_LOOK_AT_ACCIDENT); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.ABNORMAL_LOAD); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.ABNORMAL_WIDE_LOAD); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.CONVOY); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.SNOWPLOUGH); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.DEICING); + addEEnumLiteral(slowMovingVehiclesEEnum, SlowMovingVehicles.SALTING_VEHICLES); + + initEEnum(dangerousEndOfQueueEEnum, DangerousEndOfQueue.class, "DangerousEndOfQueue"); + addEEnumLiteral(dangerousEndOfQueueEEnum, DangerousEndOfQueue.SUDDEN_END_OF_QUEUE); + addEEnumLiteral(dangerousEndOfQueueEEnum, DangerousEndOfQueue.QUEUE_OVER_HILL); + addEEnumLiteral(dangerousEndOfQueueEEnum, DangerousEndOfQueue.QUEUE_AROUND_BEND); + addEEnumLiteral(dangerousEndOfQueueEEnum, DangerousEndOfQueue.QUEUE_IN_TUNNEL); + + initEEnum(riskOfFireEEnum, RiskOfFire.class, "RiskOfFire"); + addEEnumLiteral(riskOfFireEEnum, RiskOfFire.LEAKAGE_OF_FUEL); + addEEnumLiteral(riskOfFireEEnum, RiskOfFire.LEAKAGE_OF_GAS); + + initEEnum(timeDelayEEnum, TimeDelay.class, "TimeDelay"); + addEEnumLiteral(timeDelayEEnum, TimeDelay.TIME_DELAY_AT_FRONTIER); + addEEnumLiteral(timeDelayEEnum, TimeDelay.TIME_DELAY_AT_FERRY_PORT); + addEEnumLiteral(timeDelayEEnum, TimeDelay.TIME_DELAY_AT_VEHICLE_ON_RAIL_TERMINAL); + + initEEnum(policeCheckpointEEnum, PoliceCheckpoint.class, "PoliceCheckpoint"); + addEEnumLiteral(policeCheckpointEEnum, PoliceCheckpoint.PERMANENT_POLICE_CHECKPOINT); + addEEnumLiteral(policeCheckpointEEnum, PoliceCheckpoint.TEMPORARY_POLICE_CHECKPOINT); + + initEEnum(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.class, "MalfunctioningRoadsideEquipment"); + addEEnumLiteral(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.ROAD_RAIL_CROSSING_FAILURE); + addEEnumLiteral(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.TUNNEL_VENTILATION_NOT_WORKING); + addEEnumLiteral(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.TRAFFIC_CONTROL_SIGNALS_WORKING_INCORRECTLY); + addEEnumLiteral(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.EMERGENCY_TELEPHONES_NOT_WORKING); + addEEnumLiteral(malfunctioningRoadsideEquipmentEEnum, MalfunctioningRoadsideEquipment.AUTOMATIC_PAYMENT_LANES_NOT_WORKING); + + initEEnum(overtakingNotAllowedEEnum, OvertakingNotAllowed.class, "OvertakingNotAllowed"); + addEEnumLiteral(overtakingNotAllowedEEnum, OvertakingNotAllowed.DO_NOT_USE_OVERTAKING_LANES); + addEEnumLiteral(overtakingNotAllowedEEnum, OvertakingNotAllowed.OVERTAKING_NOT_ALLOWED_DRIVE_ON_CRAWLER_LANE); + addEEnumLiteral(overtakingNotAllowedEEnum, OvertakingNotAllowed.OVERTAKING_NOT_ALLOWED_DRIVE_ON_LEFT_MOST_LANE); + addEEnumLiteral(overtakingNotAllowedEEnum, OvertakingNotAllowed.OVERTAKING_NOT_ALLOWED_DRIVE_ON_RIGHT_MOST_LANE); + + initEEnum(drivingNotAllowedEEnum, DrivingNotAllowed.class, "DrivingNotAllowed"); + addEEnumLiteral(drivingNotAllowedEEnum, DrivingNotAllowed.DRIVING_NOT_ALLOWED_TAKE_NEXT_POSSIBLE_PLACE_TO_STOP_VEHICLE); + + initEEnum(givingPathVehiclesFromBehindEEnum, GivingPathVehiclesFromBehind.class, "GivingPathVehiclesFromBehind"); + addEEnumLiteral(givingPathVehiclesFromBehindEEnum, GivingPathVehiclesFromBehind.GIVING_PATH_FOR_RESCUE_VEHICLE); + addEEnumLiteral(givingPathVehiclesFromBehindEEnum, GivingPathVehiclesFromBehind.GIVING_PATH_FOR_SERVICE_VEHICLES); + + initEEnum(followDiversionEEnum, FollowDiversion.class, "FollowDiversion"); + addEEnumLiteral(followDiversionEEnum, FollowDiversion.FOLLOW_DIVERSION_SIGNS); + + initEEnum(driveCarefullyEEnum, DriveCarefully.class, "DriveCarefully"); + addEEnumLiteral(driveCarefullyEEnum, DriveCarefully.DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_ENTRY_SLIP_ROAD); + addEEnumLiteral(driveCarefullyEEnum, DriveCarefully.DRIVE_CAREFULLY_DANGEROUS_SITUATION_ON_EXIT_SLIP_ROAD); + addEEnumLiteral(driveCarefullyEEnum, DriveCarefully.DRIVE_CAREFULLY_ICE_BUILDUP_ON_CABLE_STRUCTURE); + + initEEnum(doNotLeaveYourVehicleEEnum, DoNotLeaveYourVehicle.class, "DoNotLeaveYourVehicle"); + addEEnumLiteral(doNotLeaveYourVehicleEEnum, DoNotLeaveYourVehicle.DO_NOT_LEAVE_YOUR_VEHICLE); + addEEnumLiteral(doNotLeaveYourVehicleEEnum, DoNotLeaveYourVehicle.DO_NOT_LEAVE_YOUR_VEHICLE_CLOSE_WINDOWS); + + initEEnum(useTollLanesEEnum, UseTollLanes.class, "UseTollLanes"); + addEEnumLiteral(useTollLanesEEnum, UseTollLanes.USE_MANUAL_PAYMENT_TOLL_LANES); + addEEnumLiteral(useTollLanesEEnum, UseTollLanes.USE_AUTOMATIC_PAYMENT_TOLL_LANES); + + // Create resource + createResource(eNS_URI); + + // Create annotations + // GenModel + createGenModelAnnotations(); + } + + /** + * Initializes the annotations for GenModel. + * + * + * @generated + */ + protected void createGenModelAnnotations() { + String source = "GenModel"; + addAnnotation + (this, + source, + new String[] { + "documentation", "Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/." + }); + } + +} //trafficincidenttablesPackageImpl diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesFactory.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesFactory.java new file mode 100755 index 0000000..c6df5d9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesFactory.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import org.eclipse.emf.ecore.EFactory; + +/** + * + * The Factory for the model. + * It provides a create method for each non-abstract class of the model. + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesPackage + * @generated + */ +public interface trafficincidenttablesFactory extends EFactory { + /** + * The singleton instance of the factory. + * + * + * @generated + */ + trafficincidenttablesFactory eINSTANCE = org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesFactoryImpl.init(); + + /** + * Returns the package supported by this factory. + * + * + * @return the package supported by this factory. + * @generated + */ + trafficincidenttablesPackage gettrafficincidenttablesPackage(); + +} //trafficincidenttablesFactory diff --git a/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesPackage.java b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesPackage.java new file mode 100755 index 0000000..781865a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficincidentsservice.trafficincidenttables-model/src/org/genivi/trafficincidentsservice/trafficincidenttables/trafficincidenttablesPackage.java @@ -0,0 +1,1347 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.trafficincidenttables; + +import org.eclipse.emf.ecore.EEnum; +import org.eclipse.emf.ecore.EPackage; + +/** + * + * The Package for the model. + * It contains accessors for the meta objects to represent + *

    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.trafficincidenttablesFactory + * @model kind="package" + * annotation="GenModel documentation='Copyright (C) 2013 TomTom International B.V.\r\n\r\nThis Source Code Form is subject to the terms of the Mozilla Public\r\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\r\nfile, You can obtain one at http://mozilla.org/MPL/2.0/.'" + * @generated + */ +public interface trafficincidenttablesPackage extends EPackage { + /** + * The package name. + * + * + * @generated + */ + String eNAME = "trafficincidenttables"; + + /** + * The package namespace URI. + * + * + * @generated + */ + String eNS_URI = "http://org.genivi.trafficinfo.trafficincidenttables"; + + /** + * The package namespace name. + * + * + * @generated + */ + String eNS_PREFIX = "TrafficIncidentTables"; + + /** + * The singleton instance of the package. + * + * + * @generated + */ + trafficincidenttablesPackage eINSTANCE = org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl.init(); + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode Effect Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getEffectCode() + * @generated + */ + int EFFECT_CODE = 0; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Tendency Tendency}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTendency() + * @generated + */ + int TENDENCY = 1; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode Cause Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getCauseCode() + * @generated + */ + int CAUSE_CODE = 2; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel Warning Level}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getWarningLevel() + * @generated + */ + int WARNING_LEVEL = 3; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion Traffic Congestion}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTrafficCongestion() + * @generated + */ + int TRAFFIC_CONGESTION = 4; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Accident Accident}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Accident + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAccident() + * @generated + */ + int ACCIDENT = 5; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks Road Works}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRoadWorks() + * @generated + */ + int ROAD_WORKS = 6; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes Narrow Lanes}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getNarrowLanes() + * @generated + */ + int NARROW_LANES = 7; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility Impassibility}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getImpassibility() + * @generated + */ + int IMPASSIBILITY = 8; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad Slippery Road}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getSlipperyRoad() + * @generated + */ + int SLIPPERY_ROAD = 9; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Fire Fire}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Fire + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getFire() + * @generated + */ + int FIRE = 10; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions Hazardous Driving Conditions}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getHazardousDrivingConditions() + * @generated + */ + int HAZARDOUS_DRIVING_CONDITIONS = 11; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad Objects On The Road}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getObjectsOnTheRoad() + * @generated + */ + int OBJECTS_ON_THE_ROAD = 12; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway Animals On Roadway}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAnimalsOnRoadway() + * @generated + */ + int ANIMALS_ON_ROADWAY = 13; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway People On Roadway}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPeopleOnRoadway() + * @generated + */ + int PEOPLE_ON_ROADWAY = 14; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles Broken Down Vehicles}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getBrokenDownVehicles() + * @generated + */ + int BROKEN_DOWN_VEHICLES = 15; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress Rescue And Recovery Work In Progress}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRescueAndRecoveryWorkInProgress() + * @generated + */ + int RESCUE_AND_RECOVERY_WORK_IN_PROGRESS = 16; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure Regulatory Measure}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRegulatoryMeasure() + * @generated + */ + int REGULATORY_MEASURE = 17; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType Lane Restriction Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getLaneRestrictionType() + * @generated + */ + int LANE_RESTRICTION_TYPE = 18; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode Advice Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAdviceCode() + * @generated + */ + int ADVICE_CODE = 19; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType Vehicle Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getVehicleType() + * @generated + */ + int VEHICLE_TYPE = 20; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType Restriction Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRestrictionType() + * @generated + */ + int RESTRICTION_TYPE = 21; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions Extreme Weather Conditions}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getExtremeWeatherConditions() + * @generated + */ + int EXTREME_WEATHER_CONDITIONS = 22; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced Visibility Reduced}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getVisibilityReduced() + * @generated + */ + int VISIBILITY_REDUCED = 23; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation Precipitation}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPrecipitation() + * @generated + */ + int PRECIPITATION = 24; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons Reckless Persons}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRecklessPersons() + * @generated + */ + int RECKLESS_PERSONS = 25; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent Major Event}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getMajorEvent() + * @generated + */ + int MAJOR_EVENT = 26; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating Service Not Operating}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getServiceNotOperating() + * @generated + */ + int SERVICE_NOT_OPERATING = 27; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable Service Not Usable}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getServiceNotUsable() + * @generated + */ + int SERVICE_NOT_USABLE = 28; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles Slow Moving Vehicles}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getSlowMovingVehicles() + * @generated + */ + int SLOW_MOVING_VEHICLES = 29; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue Dangerous End Of Queue}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDangerousEndOfQueue() + * @generated + */ + int DANGEROUS_END_OF_QUEUE = 30; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire Risk Of Fire}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRiskOfFire() + * @generated + */ + int RISK_OF_FIRE = 31; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay Time Delay}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTimeDelay() + * @generated + */ + int TIME_DELAY = 32; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint Police Checkpoint}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPoliceCheckpoint() + * @generated + */ + int POLICE_CHECKPOINT = 33; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment Malfunctioning Roadside Equipment}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getMalfunctioningRoadsideEquipment() + * @generated + */ + int MALFUNCTIONING_ROADSIDE_EQUIPMENT = 34; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed Overtaking Not Allowed}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getOvertakingNotAllowed() + * @generated + */ + int OVERTAKING_NOT_ALLOWED = 35; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed Driving Not Allowed}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDrivingNotAllowed() + * @generated + */ + int DRIVING_NOT_ALLOWED = 36; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind Giving Path Vehicles From Behind}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getGivingPathVehiclesFromBehind() + * @generated + */ + int GIVING_PATH_VEHICLES_FROM_BEHIND = 37; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion Follow Diversion}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getFollowDiversion() + * @generated + */ + int FOLLOW_DIVERSION = 38; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully Drive Carefully}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDriveCarefully() + * @generated + */ + int DRIVE_CAREFULLY = 39; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle Do Not Leave Your Vehicle}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDoNotLeaveYourVehicle() + * @generated + */ + int DO_NOT_LEAVE_YOUR_VEHICLE = 40; + + /** + * The meta object id for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes Use Toll Lanes}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getUseTollLanes() + * @generated + */ + int USE_TOLL_LANES = 41; + + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode Effect Code}'. + * + * + * @return the meta object for enum 'Effect Code'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @generated + */ + EEnum getEffectCode(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Tendency Tendency}'. + * + * + * @return the meta object for enum 'Tendency'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @generated + */ + EEnum getTendency(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode Cause Code}'. + * + * + * @return the meta object for enum 'Cause Code'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @generated + */ + EEnum getCauseCode(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel Warning Level}'. + * + * + * @return the meta object for enum 'Warning Level'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @generated + */ + EEnum getWarningLevel(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion Traffic Congestion}'. + * + * + * @return the meta object for enum 'Traffic Congestion'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion + * @generated + */ + EEnum getTrafficCongestion(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Accident Accident}'. + * + * + * @return the meta object for enum 'Accident'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Accident + * @generated + */ + EEnum getAccident(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks Road Works}'. + * + * + * @return the meta object for enum 'Road Works'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks + * @generated + */ + EEnum getRoadWorks(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes Narrow Lanes}'. + * + * + * @return the meta object for enum 'Narrow Lanes'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes + * @generated + */ + EEnum getNarrowLanes(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility Impassibility}'. + * + * + * @return the meta object for enum 'Impassibility'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility + * @generated + */ + EEnum getImpassibility(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad Slippery Road}'. + * + * + * @return the meta object for enum 'Slippery Road'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad + * @generated + */ + EEnum getSlipperyRoad(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Fire Fire}'. + * + * + * @return the meta object for enum 'Fire'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Fire + * @generated + */ + EEnum getFire(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions Hazardous Driving Conditions}'. + * + * + * @return the meta object for enum 'Hazardous Driving Conditions'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions + * @generated + */ + EEnum getHazardousDrivingConditions(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad Objects On The Road}'. + * + * + * @return the meta object for enum 'Objects On The Road'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad + * @generated + */ + EEnum getObjectsOnTheRoad(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway Animals On Roadway}'. + * + * + * @return the meta object for enum 'Animals On Roadway'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway + * @generated + */ + EEnum getAnimalsOnRoadway(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway People On Roadway}'. + * + * + * @return the meta object for enum 'People On Roadway'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway + * @generated + */ + EEnum getPeopleOnRoadway(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles Broken Down Vehicles}'. + * + * + * @return the meta object for enum 'Broken Down Vehicles'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles + * @generated + */ + EEnum getBrokenDownVehicles(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress Rescue And Recovery Work In Progress}'. + * + * + * @return the meta object for enum 'Rescue And Recovery Work In Progress'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress + * @generated + */ + EEnum getRescueAndRecoveryWorkInProgress(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure Regulatory Measure}'. + * + * + * @return the meta object for enum 'Regulatory Measure'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure + * @generated + */ + EEnum getRegulatoryMeasure(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType Lane Restriction Type}'. + * + * + * @return the meta object for enum 'Lane Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @generated + */ + EEnum getLaneRestrictionType(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode Advice Code}'. + * + * + * @return the meta object for enum 'Advice Code'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @generated + */ + EEnum getAdviceCode(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType Vehicle Type}'. + * + * + * @return the meta object for enum 'Vehicle Type'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @generated + */ + EEnum getVehicleType(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType Restriction Type}'. + * + * + * @return the meta object for enum 'Restriction Type'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @generated + */ + EEnum getRestrictionType(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions Extreme Weather Conditions}'. + * + * + * @return the meta object for enum 'Extreme Weather Conditions'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions + * @generated + */ + EEnum getExtremeWeatherConditions(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced Visibility Reduced}'. + * + * + * @return the meta object for enum 'Visibility Reduced'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced + * @generated + */ + EEnum getVisibilityReduced(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation Precipitation}'. + * + * + * @return the meta object for enum 'Precipitation'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation + * @generated + */ + EEnum getPrecipitation(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons Reckless Persons}'. + * + * + * @return the meta object for enum 'Reckless Persons'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons + * @generated + */ + EEnum getRecklessPersons(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent Major Event}'. + * + * + * @return the meta object for enum 'Major Event'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent + * @generated + */ + EEnum getMajorEvent(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating Service Not Operating}'. + * + * + * @return the meta object for enum 'Service Not Operating'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating + * @generated + */ + EEnum getServiceNotOperating(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable Service Not Usable}'. + * + * + * @return the meta object for enum 'Service Not Usable'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable + * @generated + */ + EEnum getServiceNotUsable(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles Slow Moving Vehicles}'. + * + * + * @return the meta object for enum 'Slow Moving Vehicles'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles + * @generated + */ + EEnum getSlowMovingVehicles(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue Dangerous End Of Queue}'. + * + * + * @return the meta object for enum 'Dangerous End Of Queue'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue + * @generated + */ + EEnum getDangerousEndOfQueue(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire Risk Of Fire}'. + * + * + * @return the meta object for enum 'Risk Of Fire'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire + * @generated + */ + EEnum getRiskOfFire(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay Time Delay}'. + * + * + * @return the meta object for enum 'Time Delay'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay + * @generated + */ + EEnum getTimeDelay(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint Police Checkpoint}'. + * + * + * @return the meta object for enum 'Police Checkpoint'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint + * @generated + */ + EEnum getPoliceCheckpoint(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment Malfunctioning Roadside Equipment}'. + * + * + * @return the meta object for enum 'Malfunctioning Roadside Equipment'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment + * @generated + */ + EEnum getMalfunctioningRoadsideEquipment(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed Overtaking Not Allowed}'. + * + * + * @return the meta object for enum 'Overtaking Not Allowed'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed + * @generated + */ + EEnum getOvertakingNotAllowed(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed Driving Not Allowed}'. + * + * + * @return the meta object for enum 'Driving Not Allowed'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed + * @generated + */ + EEnum getDrivingNotAllowed(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind Giving Path Vehicles From Behind}'. + * + * + * @return the meta object for enum 'Giving Path Vehicles From Behind'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind + * @generated + */ + EEnum getGivingPathVehiclesFromBehind(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion Follow Diversion}'. + * + * + * @return the meta object for enum 'Follow Diversion'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion + * @generated + */ + EEnum getFollowDiversion(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully Drive Carefully}'. + * + * + * @return the meta object for enum 'Drive Carefully'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully + * @generated + */ + EEnum getDriveCarefully(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle Do Not Leave Your Vehicle}'. + * + * + * @return the meta object for enum 'Do Not Leave Your Vehicle'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle + * @generated + */ + EEnum getDoNotLeaveYourVehicle(); + + /** + * Returns the meta object for enum '{@link org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes Use Toll Lanes}'. + * + * + * @return the meta object for enum 'Use Toll Lanes'. + * @see org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes + * @generated + */ + EEnum getUseTollLanes(); + + /** + * Returns the factory that creates the instances of the model. + * + * + * @return the factory that creates the instances of the model. + * @generated + */ + trafficincidenttablesFactory gettrafficincidenttablesFactory(); + + /** + * + * Defines literals for the meta objects that represent + *
    + *
  • each class,
  • + *
  • each feature of each class,
  • + *
  • each enum,
  • + *
  • and each data type
  • + *
+ * + * @generated + */ + interface Literals { + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode Effect Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.EffectCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getEffectCode() + * @generated + */ + EEnum EFFECT_CODE = eINSTANCE.getEffectCode(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Tendency Tendency}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Tendency + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTendency() + * @generated + */ + EEnum TENDENCY = eINSTANCE.getTendency(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode Cause Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.CauseCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getCauseCode() + * @generated + */ + EEnum CAUSE_CODE = eINSTANCE.getCauseCode(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel Warning Level}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getWarningLevel() + * @generated + */ + EEnum WARNING_LEVEL = eINSTANCE.getWarningLevel(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion Traffic Congestion}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTrafficCongestion() + * @generated + */ + EEnum TRAFFIC_CONGESTION = eINSTANCE.getTrafficCongestion(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Accident Accident}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Accident + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAccident() + * @generated + */ + EEnum ACCIDENT = eINSTANCE.getAccident(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks Road Works}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRoadWorks() + * @generated + */ + EEnum ROAD_WORKS = eINSTANCE.getRoadWorks(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes Narrow Lanes}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getNarrowLanes() + * @generated + */ + EEnum NARROW_LANES = eINSTANCE.getNarrowLanes(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility Impassibility}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getImpassibility() + * @generated + */ + EEnum IMPASSIBILITY = eINSTANCE.getImpassibility(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad Slippery Road}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getSlipperyRoad() + * @generated + */ + EEnum SLIPPERY_ROAD = eINSTANCE.getSlipperyRoad(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Fire Fire}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Fire + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getFire() + * @generated + */ + EEnum FIRE = eINSTANCE.getFire(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions Hazardous Driving Conditions}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getHazardousDrivingConditions() + * @generated + */ + EEnum HAZARDOUS_DRIVING_CONDITIONS = eINSTANCE.getHazardousDrivingConditions(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad Objects On The Road}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getObjectsOnTheRoad() + * @generated + */ + EEnum OBJECTS_ON_THE_ROAD = eINSTANCE.getObjectsOnTheRoad(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway Animals On Roadway}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAnimalsOnRoadway() + * @generated + */ + EEnum ANIMALS_ON_ROADWAY = eINSTANCE.getAnimalsOnRoadway(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway People On Roadway}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPeopleOnRoadway() + * @generated + */ + EEnum PEOPLE_ON_ROADWAY = eINSTANCE.getPeopleOnRoadway(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles Broken Down Vehicles}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getBrokenDownVehicles() + * @generated + */ + EEnum BROKEN_DOWN_VEHICLES = eINSTANCE.getBrokenDownVehicles(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress Rescue And Recovery Work In Progress}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRescueAndRecoveryWorkInProgress() + * @generated + */ + EEnum RESCUE_AND_RECOVERY_WORK_IN_PROGRESS = eINSTANCE.getRescueAndRecoveryWorkInProgress(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure Regulatory Measure}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRegulatoryMeasure() + * @generated + */ + EEnum REGULATORY_MEASURE = eINSTANCE.getRegulatoryMeasure(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType Lane Restriction Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.LaneRestrictionType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getLaneRestrictionType() + * @generated + */ + EEnum LANE_RESTRICTION_TYPE = eINSTANCE.getLaneRestrictionType(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode Advice Code}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.AdviceCode + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getAdviceCode() + * @generated + */ + EEnum ADVICE_CODE = eINSTANCE.getAdviceCode(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType Vehicle Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VehicleType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getVehicleType() + * @generated + */ + EEnum VEHICLE_TYPE = eINSTANCE.getVehicleType(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType Restriction Type}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRestrictionType() + * @generated + */ + EEnum RESTRICTION_TYPE = eINSTANCE.getRestrictionType(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions Extreme Weather Conditions}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getExtremeWeatherConditions() + * @generated + */ + EEnum EXTREME_WEATHER_CONDITIONS = eINSTANCE.getExtremeWeatherConditions(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced Visibility Reduced}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getVisibilityReduced() + * @generated + */ + EEnum VISIBILITY_REDUCED = eINSTANCE.getVisibilityReduced(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation Precipitation}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPrecipitation() + * @generated + */ + EEnum PRECIPITATION = eINSTANCE.getPrecipitation(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons Reckless Persons}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRecklessPersons() + * @generated + */ + EEnum RECKLESS_PERSONS = eINSTANCE.getRecklessPersons(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent Major Event}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getMajorEvent() + * @generated + */ + EEnum MAJOR_EVENT = eINSTANCE.getMajorEvent(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating Service Not Operating}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getServiceNotOperating() + * @generated + */ + EEnum SERVICE_NOT_OPERATING = eINSTANCE.getServiceNotOperating(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable Service Not Usable}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getServiceNotUsable() + * @generated + */ + EEnum SERVICE_NOT_USABLE = eINSTANCE.getServiceNotUsable(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles Slow Moving Vehicles}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getSlowMovingVehicles() + * @generated + */ + EEnum SLOW_MOVING_VEHICLES = eINSTANCE.getSlowMovingVehicles(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue Dangerous End Of Queue}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDangerousEndOfQueue() + * @generated + */ + EEnum DANGEROUS_END_OF_QUEUE = eINSTANCE.getDangerousEndOfQueue(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire Risk Of Fire}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getRiskOfFire() + * @generated + */ + EEnum RISK_OF_FIRE = eINSTANCE.getRiskOfFire(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay Time Delay}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getTimeDelay() + * @generated + */ + EEnum TIME_DELAY = eINSTANCE.getTimeDelay(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint Police Checkpoint}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getPoliceCheckpoint() + * @generated + */ + EEnum POLICE_CHECKPOINT = eINSTANCE.getPoliceCheckpoint(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment Malfunctioning Roadside Equipment}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getMalfunctioningRoadsideEquipment() + * @generated + */ + EEnum MALFUNCTIONING_ROADSIDE_EQUIPMENT = eINSTANCE.getMalfunctioningRoadsideEquipment(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed Overtaking Not Allowed}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getOvertakingNotAllowed() + * @generated + */ + EEnum OVERTAKING_NOT_ALLOWED = eINSTANCE.getOvertakingNotAllowed(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed Driving Not Allowed}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDrivingNotAllowed() + * @generated + */ + EEnum DRIVING_NOT_ALLOWED = eINSTANCE.getDrivingNotAllowed(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind Giving Path Vehicles From Behind}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getGivingPathVehiclesFromBehind() + * @generated + */ + EEnum GIVING_PATH_VEHICLES_FROM_BEHIND = eINSTANCE.getGivingPathVehiclesFromBehind(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion Follow Diversion}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getFollowDiversion() + * @generated + */ + EEnum FOLLOW_DIVERSION = eINSTANCE.getFollowDiversion(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully Drive Carefully}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDriveCarefully() + * @generated + */ + EEnum DRIVE_CAREFULLY = eINSTANCE.getDriveCarefully(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle Do Not Leave Your Vehicle}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getDoNotLeaveYourVehicle() + * @generated + */ + EEnum DO_NOT_LEAVE_YOUR_VEHICLE = eINSTANCE.getDoNotLeaveYourVehicle(); + + /** + * The meta object literal for the '{@link org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes Use Toll Lanes}' enum. + * + * + * @see org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes + * @see org.genivi.trafficincidentsservice.trafficincidenttables.impl.trafficincidenttablesPackageImpl#getUseTollLanes() + * @generated + */ + EEnum USE_TOLL_LANES = eINSTANCE.getUseTollLanes(); + + } + +} //trafficincidenttablesPackage diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.classpath b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.classpath new file mode 100755 index 0000000..def9cf4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.classpath @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.project b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.project new file mode 100755 index 0000000..03a5315 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/.project @@ -0,0 +1,16 @@ + + + org.genivi.trafficinfo.dbus-java + Copy of dbus-java with bug fixes and extensions. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.trafficinfo.libmatthew + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/ReadMe.confluence new file mode 100755 index 0000000..af390a9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/ReadMe.confluence @@ -0,0 +1,5 @@ +This project is a copy of the dbus-java project by Matthew Johnson, with small modifications needed to get the TrafficIncidentsService PoC running. +* support for unicast signals added +* some bugs fixed, e.g. support of empty lists + +The original project can be found at http://dbus.freedesktop.org/ \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/pom.xml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/pom.xml new file mode 100755 index 0000000..980f61f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/pom.xml @@ -0,0 +1,28 @@ + + + 4.0.0 + org.genivi.trafficinfo + dbus-java + jar + 1.0-SNAPSHOT + GENIVI dbus-java copy + Copy of dbus-java with bug fixes and extensions + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + org.genivi.trafficinfo + libmatthew + + + + src/main/java + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/AUTHORS b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/AUTHORS new file mode 100755 index 0000000..9b7699e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/AUTHORS @@ -0,0 +1,37 @@ +The D-Bus Java implementation was written by: + +Matthew Johnson + +Bug fixes/reports and other suggestions from: + +Remi Emonet +Simon McVittie +Dick Hollenbeck +Joshua Nichols +Ralf Kistner +Henrik Petander +Luigi Paioro +Roberto Francisco Arroyo Moreno +Steve Crane +Philippe Marschall +Daniel Machado +Anibal Sanchez +Jan Kümmel +Johannes Felten +Tom Walsh +Ed Wei +Sveinung Kvilhaugsvik +Hugues Moreau +Viktar Vauchkevich +Serkan Kaba +Adam Bennett +Frank Benoit +Gunnar Aastrand Grimnes + +The included Viewer application was originally written by: + +Peter Cox + +with patches from: + +Zsombor Gegesy diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/COPYING b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/COPYING new file mode 100755 index 0000000..d651143 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/COPYING @@ -0,0 +1,680 @@ +The D-Bus Java implementation is licensed to you under your choice of the +Academic Free License version 2.1, or the GNU Lesser/Library General Public License +version 2. Both licenses are included here. Each source code file is marked +with the proper copyright information. + +The Academic Free License +v. 2.1 + +This Academic Free License (the "License") applies to any original work of +authorship (the "Original Work") whose owner (the "Licensor") has placed the +following notice immediately following the copyright notice for the Original +Work: + +Licensed under the Academic Free License version 2.1 + +1) Grant of Copyright License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license to do the +following: + +a) to reproduce the Original Work in copies; + +b) to prepare derivative works ("Derivative Works") based upon the Original +Work; + +c) to distribute copies of the Original Work and Derivative Works to the +public; + +d) to perform the Original Work publicly; and + +e) to display the Original Work publicly. + +2) Grant of Patent License. Licensor hereby grants You a world-wide, +royalty-free, non-exclusive, perpetual, sublicenseable license, under patent +claims owned or controlled by the Licensor that are embodied in the Original +Work as furnished by the Licensor, to make, use, sell and offer for sale the +Original Work and Derivative Works. + +3) Grant of Source Code License. The term "Source Code" means the preferred +form of the Original Work for making modifications to it and all available +documentation describing how to modify the Original Work. Licensor hereby +agrees to provide a machine-readable copy of the Source Code of the Original +Work along with each copy of the Original Work that Licensor distributes. +Licensor reserves the right to satisfy this obligation by placing a +machine-readable copy of the Source Code in an information repository +reasonably calculated to permit inexpensive and convenient access by You for as +long as Licensor continues to distribute the Original Work, and by publishing +the address of that information repository in a notice immediately following +the copyright notice that applies to the Original Work. + +4) Exclusions From License Grant. Neither the names of Licensor, nor the names +of any contributors to the Original Work, nor any of their trademarks or +service marks, may be used to endorse or promote products derived from this +Original Work without express prior written permission of the Licensor. Nothing +in this License shall be deemed to grant any rights to trademarks, copyrights, +patents, trade secrets or any other intellectual property of Licensor except as +expressly stated herein. No patent license is granted to make, use, sell or +offer to sell embodiments of any patent claims other than the licensed claims +defined in Section 2. No right is granted to the trademarks of Licensor even if +such marks are included in the Original Work. Nothing in this License shall be +interpreted to prohibit Licensor from licensing under different terms from this +License any Original Work that Licensor otherwise would have a right to +license. + +5) This section intentionally omitted. + +6) Attribution Rights. You must retain, in the Source Code of any Derivative +Works that You create, all copyright, patent or trademark notices from the +Source Code of the Original Work, as well as any notices of licensing and any +descriptive text identified therein as an "Attribution Notice." You must cause +the Source Code for any Derivative Works that You create to carry a prominent +Attribution Notice reasonably calculated to inform recipients that You have +modified the Original Work. + +7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that +the copyright in and to the Original Work and the patent rights granted herein +by Licensor are owned by the Licensor or are sublicensed to You under the terms +of this License with the permission of the contributor(s) of those copyrights +and patent rights. Except as expressly stated in the immediately proceeding +sentence, the Original Work is provided under this License on an "AS IS" BASIS +and WITHOUT WARRANTY, either express or implied, including, without limitation, +the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. +This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No +license to Original Work is granted hereunder except under this disclaimer. + +8) Limitation of Liability. Under no circumstances and under no legal theory, +whether in tort (including negligence), contract, or otherwise, shall the +Licensor be liable to any person for any direct, indirect, special, incidental, +or consequential damages of any character arising as a result of this License +or the use of the Original Work including, without limitation, damages for loss +of goodwill, work stoppage, computer failure or malfunction, or any and all +other commercial damages or losses. This limitation of liability shall not +apply to liability for death or personal injury resulting from Licensor's +negligence to the extent applicable law prohibits such limitation. Some +jurisdictions do not allow the exclusion or limitation of incidental or +consequential damages, so this exclusion and limitation may not apply to You. + +9) Acceptance and Termination. If You distribute copies of the Original Work or +a Derivative Work, You must make a reasonable effort under the circumstances to +obtain the express assent of recipients to the terms of this License. Nothing +else but this License (or another written agreement between Licensor and You) +grants You permission to create Derivative Works based upon the Original Work +or to exercise any of the rights granted in Section 1 herein, and any attempt +to do so except under the terms of this License (or another written agreement +between Licensor and You) is expressly prohibited by U.S. copyright law, the +equivalent laws of other countries, and by international treaty. Therefore, by +exercising any of the rights granted to You in Section 1 herein, You indicate +Your acceptance of this License and all of its terms and conditions. + +10) Termination for Patent Action. This License shall terminate automatically +and You may no longer exercise any of the rights granted to You by this License +as of the date You commence an action, including a cross-claim or counterclaim, +against Licensor or any licensee alleging that the Original Work infringes a +patent. This termination provision shall not apply for an action alleging +patent infringement by combinations of the Original Work with other software or +hardware. + +11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this +License may be brought only in the courts of a jurisdiction wherein the +Licensor resides or in which Licensor conducts its primary business, and under +the laws of that jurisdiction excluding its conflict-of-law provisions. The +application of the United Nations Convention on Contracts for the International +Sale of Goods is expressly excluded. Any use of the Original Work outside the +scope of this License or after its termination shall be subject to the +requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., +the equivalent laws of other countries, and international treaty. This section +shall survive the termination of this License. + +12) Attorneys Fees. In any action to enforce the terms of this License or +seeking damages relating thereto, the prevailing party shall be entitled to +recover its costs and expenses, including, without limitation, reasonable +attorneys' fees and costs incurred in connection with such action, including +any appeal of such action. This section shall survive the termination of this +License. + +13) Miscellaneous. This License represents the complete agreement concerning +the subject matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent necessary to +make it enforceable. + +14) Definition of "You" in This License. "You" throughout this License, whether +in upper or lower case, means an individual or a legal entity exercising rights +under, and complying with all of the terms of, this License. For legal +entities, "You" includes any entity that controls, is controlled by, or is +under common control with you. For purposes of this definition, "control" means +(i) the power, direct or indirect, to cause the direction or management of such +entity, whether by contract or otherwise, or (ii) ownership of fifty percent +(50%) or more of the outstanding shares, or (iii) beneficial ownership of such +entity. + +15) Right to Use. You may use the Original Work in all ways not otherwise +restricted or conditioned by this License or by law, and Licensor promises not +to interfere with or be responsible for such uses by You. + +This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. +Permission is hereby granted to copy and distribute this license without +modification. This license may not be modified without the express written +permission of its copyright owner. + + +-- +END OF ACADEMIC FREE LICENSE. The following is intended to describe the +essential differences between the Academic Free License (AFL) version 1.0 and +other open source licenses: + +The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache +licenses in many respects but it is intended to solve a few problems with those +licenses. + +* The AFL is written so as to make it clear what software is being +licensed (by the inclusion of a statement following the copyright notice in the +software). This way, the license functions better than a template license. The +BSD, MIT and UoI/NCSA licenses apply to unidentified software. + +* The AFL contains a complete copyright grant to the software. The BSD +and Apache licenses are vague and incomplete in that respect. + +* The AFL contains a complete patent grant to the software. The BSD, MIT, +UoI/NCSA and Apache licenses rely on an implied patent license and contain no +explicit patent grant. + +* The AFL makes it clear that no trademark rights are granted to the +licensor's trademarks. The Apache license contains such a provision, but the +BSD, MIT and UoI/NCSA licenses do not. + +* The AFL includes the warranty by the licensor that it either owns the +copyright or that it is distributing the software under a license. None of the +other licenses contain that warranty. All other warranties are disclaimed, as +is the case for the other licenses. + +* The AFL is itself copyrighted (with the right granted to copy and distribute +without modification). This ensures that the owner of the copyright to the +license will control changes. The Apache license contains a copyright notice, +but the BSD, MIT and UoI/NCSA licenses do not. + +-- +START OF GNU LIBRARY GENERAL PUBLIC LICENSE +-- + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.bat new file mode 100755 index 0000000..8275e45 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.bat @@ -0,0 +1,10 @@ +@echo off +setlocal +set debug=%DEBUG% +set version=%VERSION% +set jarpath=%WINJARPATH% +set javaunixjarpath=%WINUNIXJARPATH% + +java -DVersion=%version% -cp %javaunixjarpath%debug-%debug%.jar;%javaunixjarpath%hexdump.jar;%jarpath%dbus.jar;%jarpath%dbus-bin.jar org.freedesktop.dbus.bin.CreateInterface %* + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sgml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sgml new file mode 100755 index 0000000..44ad676 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sgml @@ -0,0 +1,182 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Matthew"> + Johnson"> + + January 10, 2006"> + + 1"> + <debian@matthew.ath.cx>"> + + DBUS-JAVA"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2006 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + Create a Java Interface definition from DBus + introspection data. + + + + &dhpackage; + + + + + + + + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command. + + &dhpackage; takes DBus introspection data, + either as an XML file or by calling the Introspect() method on the Bus, + and converts it into a Java interface file. This is either written + to the standard output or to the correct file structure for the + Java packages. + + + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + + Use the Session Bus to query introspection data + (This is the Default) + + + + + + + + Use the System Bus to query introspection data + (Default is Session) + + + + + + + + Writes introspection data into files rather than to stdout. + + + + + + + + + Do not ignore builtin (org.freedesktop.DBus) + interfaces while parsing introspection data + + + + + + + + Show summary of options. + + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; Lesser General Public License, Version 2 as + published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2. + + + +
+ + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sh b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sh new file mode 100755 index 0000000..863d1a3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/CreateInterface.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- + +JAVA=%JAVA% +DEBUG=%DEBUG% +VERSION=%VERSION% +JARPATH=%JARPATH% +JAVAUNIXLIBPATH=%JAVAUNIXLIBPATH% +JAVAUNIXJARPATH=%JAVAUNIXJARPATH% + +exec $JAVA -DPid=$$ -DVersion=$VERSION -Djava.library.path=$JAVAUNIXLIBPATH -cp $JAVAUNIXJARPATH/unix.jar:$JAVAUNIXJARPATH/debug-$DEBUG.jar:$JAVAUNIXJARPATH/hexdump.jar:$JARPATH/dbus.jar:$JARPATH/dbus-bin.jar org.freedesktop.dbus.bin.CreateInterface "$@" diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.bat new file mode 100755 index 0000000..2489048 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.bat @@ -0,0 +1,10 @@ +@echo off +setlocal +set debug=%DEBUG% +set version=%VERSION% +set jarpath=%WINJARPATH% +set javaunixjarpath=%WINUNIXJARPATH% + +java -DVersion=%version% -cp %javaunixjarpath%debug-%debug%.jar;%javaunixjarpath%hexdump.jar;%jarpath%dbus.jar;%jarpath%dbus-bin.jar org.freedesktop.dbus.bin.Caller %* + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sgml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sgml new file mode 100755 index 0000000..9efd4f0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sgml @@ -0,0 +1,126 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Matthew"> + Johnson"> + + January 10, 2006"> + + 1"> + <debian@matthew.ath.cx>"> + + DBUS-JAVA"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2007 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + Calls methods on DBus + + + + &dhpackage; + dest + path + interface + method + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command. + + &dhpackage; calls arbitrary methods on the bus + + + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; Lesser General Public License, Version 2 as + published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2. + + + +
+ + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sh b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sh new file mode 100755 index 0000000..23f2fe5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusCall.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- + +JAVA=%JAVA% +DEBUG=%DEBUG% +VERSION=%VERSION% +JARPATH=%JARPATH% +JAVAUNIXLIBPATH=%JAVAUNIXLIBPATH% +JAVAUNIXJARPATH=%JAVAUNIXJARPATH% + +exec $JAVA -DPid=$$ -DVersion=$VERSION -Djava.library.path=$JAVAUNIXLIBPATH -cp $JAVAUNIXJARPATH/unix.jar:$JAVAUNIXJARPATH/debug-$DEBUG.jar:$JAVAUNIXJARPATH/hexdump.jar:$JARPATH/dbus.jar:$JARPATH/dbus-bin.jar org.freedesktop.dbus.bin.Caller "$@" diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.bat new file mode 100755 index 0000000..e9c1b71 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.bat @@ -0,0 +1,10 @@ +@echo off +setlocal +set debug=%DEBUG% +set version=%VERSION% +set jarpath=%WINJARPATH% +set javaunixjarpath=%WINUNIXJARPATH% + +java -DVersion=%version% -cp %javaunixjarpath%debug-%debug%.jar;%javaunixjarpath%hexdump.jar;%jarpath%dbus.jar;%jarpath%dbus-bin.jar org.freedesktop.dbus.bin.DBusDaemon %* + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sgml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sgml new file mode 100755 index 0000000..eeee64d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sgml @@ -0,0 +1,212 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Matthew"> + Johnson"> + + January 10, 2006"> + + 1"> + <debian@matthew.ath.cx>"> + + DBUS-JAVA"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2006 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + Runs a D-Bus Daemon + + + + &dhpackage; + + + + + + + + + + + address + address + file + file + file + file + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command. + + &dhpackage; provides a D-Bus daemon for applications to communicate. + + + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + + + Print the version + + + + + + + + + Print the syntax + + + + + + + + + Print the address + + + + + + + + + Generate random Unix Socket address + + + + + + + + + Generate random local TCP address + + + + + address + address + + + Listen on the specified address + + + + + file + file + + + Print address to specified file + + + + + file + file + + + Print address to specified file + + + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; Lesser General Public License, Version 2 as + published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2. + + + +
+ + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sh b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sh new file mode 100755 index 0000000..7de5000 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusDaemon.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- + +JAVA=%JAVA% +DEBUG=%DEBUG% +VERSION=%VERSION% +JARPATH=%JARPATH% +JAVAUNIXLIBPATH=%JAVAUNIXLIBPATH% +JAVAUNIXJARPATH=%JAVAUNIXJARPATH% + +exec $JAVA -DPid=$$ -DVersion=$VERSION -Djava.library.path=$JAVAUNIXLIBPATH -cp $JAVAUNIXJARPATH/unix.jar:$JAVAUNIXJARPATH/debug-$DEBUG.jar:$JAVAUNIXJARPATH/hexdump.jar:$JARPATH/dbus.jar:$JARPATH/dbus-bin.jar org.freedesktop.dbus.bin.DBusDaemon "$@" diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.bat new file mode 100755 index 0000000..f180fba --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.bat @@ -0,0 +1,10 @@ +@echo off +setlocal +set debug=%DEBUG% +set version=%VERSION% +set jarpath=%WINJARPATH% +set javaunixjarpath=%WINUNIXJARPATH% + +java -DVersion=%version% -cp %javaunixjarpath%debug-%debug%.jar;%javaunixjarpath%hexdump.jar;%jarpath%dbus.jar;%jarpath%dbus-viewer.jar;%jarpath%dbus-bin.jar org.freedesktop.dbus.viewer.DBusViewer %* + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sgml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sgml new file mode 100755 index 0000000..65535b2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sgml @@ -0,0 +1,107 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Matthew"> + Johnson"> + + January 10, 2006"> + + 1"> + <debian@matthew.ath.cx>"> + + DBUS-JAVA"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2006 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + Show connections to the Bus and introspect on them. + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command. + + &dhpackage; shows connections to the Bus in a + window. It allows you to introspect on them and save the corresponding Java + interface definitions. + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; Lesser General Public License, Version 2 as + published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2. + + + +
+ + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sh b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sh new file mode 100755 index 0000000..c060b36 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/DBusViewer.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- + +JAVA=%JAVA% +DEBUG=%DEBUG% +VERSION=%VERSION% +JARPATH=%JARPATH% +JAVAUNIXLIBPATH=%JAVAUNIXLIBPATH% +JAVAUNIXJARPATH=%JAVAUNIXJARPATH% + +exec $JAVA -DPid=$$ -DVersion=$VERSION -Djava.library.path=$JAVAUNIXLIBPATH -cp $JAVAUNIXJARPATH/unix.jar:$JAVAUNIXJARPATH/debug-$DEBUG.jar:$JAVAUNIXJARPATH/hexdump.jar:$JARPATH/dbus.jar:$JARPATH/dbus-bin.jar:$JARPATH/dbus-viewer.jar org.freedesktop.dbus.viewer.DBusViewer "$@" diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/INSTALL b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/INSTALL new file mode 100755 index 0000000..a6c5fb8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/INSTALL @@ -0,0 +1,101 @@ +D-Bus Java installation guide +----------------------------- + +Prerequisites +------------- + +To compile and install the library you will need: + + A Java 1.5-compliant VM and Compiler (at time of writing + only the Sun VM and Compiler is known to work). + The unix socket, debug and hexdump libraries from http://www.matthew.ath.cx/projects/java/ (version 0.6 or later) + GNU gettext + +To build and install the documentation you will also need: + + A LaTeX environment + tex4ht + docbook + +Compiling the Library +--------------------- + +Simply invoke `make' in the top level directory to compile the library. +Depending on your JDK installation you may need to export JAVA_HOME +appropriately. The location of the unix-socket library can be set with +JAVAUNIXLIBDIR and JAVAUNIXJARDIR. Explicit paths to the javac, jar, java and +javadoc binaries can be set with the JAVAC, JAR, JAVA and JAVADOC variables. + +The library will be installed into /usr/local by invoking `make install'. If +you wish to install them anywhere else then run make with the PREFIX variable +set to another location. More fine grained control of the installation +directories can be achieved using the BINDIR etc variables. For more detail +read the Makefile. DESTDIR can be used for packaging to install with the +correct hierarchy into a temporary folder. + +NOTE: if you set PREFIX in `make install' you should also set it when invoking +just `make'. PREFIX is to create the binary wrappers with the correct paths to +the installed library. + +Documentation for the library can be built with `make doc' and installed with +`make install-doc install-man', with the same provisos for installation paths. + +Using the Library +----------------- + +The documentation which is by default installed into +/usr/local/share/doc/libdbus-java/ gives detailed instructions on how to call +D-Bus programs using the Java implementation and a full API reference. + +To run a Java program using D-Bus you need to have the libdbus-java, +libunix-java and libdebug jar files in your classpath and the libunix-java +shared library in your library path. With the default install paths you may +have to do something like: + +java -cp /usr/local/share/java/dbus.jar:/usr/local/share/java/unix.jar:/usr/local/share/java/debug-disable.jar -Djava.library.path=/usr/local/lib/jni + +Windows +------- + +The Java D-Bus implementation can be used under Windows with TCP Sockets. There +are several windows batch scripts provided to ease use on Windows. + +If the library is being compiled in a unix environment (including cygwin) the +normal Makefile can be used to create batch files under win/ with `make win'. +These batch files are wrapper scripts to run the included programs (DBusDaemon, +CreateInterface, ...) under windows. There is also a make target which creates +a zip file containing all the jars, wrapper scripts and dependency jars. + +If you are compiling on windows there is a script, compile.bat, which will +create all the jars. You may have to alter the variables defined in it +depending where you have installed the dependencies and your Java compiler. +The other .bat files are the wrapper scripts which will need variables setting +appropriately before use. + +Debugging +--------- + +It is possible to enable debugging during the build. This will be a lot slower, +but can print a lot of useful information for debugging your program. + +To enable a debug build compile with DEBUG=enable. This will then need to be +enabled at runtime by using the debug jar with debugging enabled (usually +installed as debug-enable.jar alongside the normal jar). + +Running a program which uses this library will print some informative messages. +More verbose debug information can be got by supplying a custom debug +configuration file. This should be placed in the file `debug.conf' and has the +format: + +classname = LEVEL + +Where classname is either the special word `ALL' or a full class name like +`org.freedesktop.dbus' and LEVEL is one of NONE, CRIT, ERR, WARN, INFO, DEBUG, +VERBOSE, YES, ALL or TRUE. This will set the debug level for a particular +class. Any messages from that class at that level or higher will be printed. +Verbose debugging is extremely verbose. + +In addition, the environment variable DBUS_JAVA_EXCEPTION_DEBUG will cause all +exceptions which are handled internally to have their stack trace printed when +they are handled. This will happen unless debugging has been disabled for that +class. diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.bat new file mode 100755 index 0000000..2dd6439 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.bat @@ -0,0 +1,10 @@ +@echo off +setlocal +set debug=%DEBUG% +set version=%VERSION% +set jarpath=%WINJARPATH% +set javaunixjarpath=%WINUNIXJARPATH% + +java -DVersion=%version% -cp %javaunixjarpath%debug-%debug%.jar;%javaunixjarpath%hexdump.jar;%jarpath%dbus.jar;%jarpath%dbus-bin.jar org.freedesktop.dbus.bin.ListDBus %* + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sgml b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sgml new file mode 100755 index 0000000..4be1e95 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sgml @@ -0,0 +1,177 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Matthew"> + Johnson"> + + January 10, 2006"> + + 1"> + <debian@matthew.ath.cx>"> + + DBUS-JAVA"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2006 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + List the names on a DBus + + + + &dhpackage; + + + + + + + + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; command. + + &dhpackage; lists all the names on DBus. + + + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + + List the Session Bus + (This is the Default) + + + + + + + + List the System Bus + (Default is Session) + + + + + + + + Give the UIDs which own each name + + + + + + + + + Resolve any well-known names to their owners + + + + + + + + + Show summary of options. + + + + + + AUTHOR + + This manual page was written by &dhusername; &dhemail;. Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; Lesser General Public License, Version 2 as + published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU Lesser General Public + License can be found in /usr/share/common-licenses/LGPL-2. + + + +
+ + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sh b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sh new file mode 100755 index 0000000..4fdfb39 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/ListDBus.sh @@ -0,0 +1,10 @@ +#!/bin/sh -- + +JAVA=%JAVA% +DEBUG=%DEBUG% +VERSION=%VERSION% +JARPATH=%JARPATH% +JAVAUNIXLIBPATH=%JAVAUNIXLIBPATH% +JAVAUNIXJARPATH=%JAVAUNIXJARPATH% + +exec $JAVA -DPid=$$ -DVersion=$VERSION -Djava.library.path=$JAVAUNIXLIBPATH -cp $JAVAUNIXJARPATH/unix.jar:$JAVAUNIXJARPATH/debug-$DEBUG.jar:$JAVAUNIXJARPATH/hexdump.jar:$JARPATH/dbus.jar:$JARPATH/dbus-bin.jar org.freedesktop.dbus.bin.ListDBus "$@" diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/Makefile b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/Makefile new file mode 100755 index 0000000..65bff86 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/Makefile @@ -0,0 +1,328 @@ +# +# For profiling/debug builds use: +# +# make CFLAGS="" STRIP=touch JCFLAGS="-Xlint:all" +# JFLAGS="-Xrunhprof:heap=sites,cpu=samples,monitor=y,thread=y,doe=y -classic" check +# + +# Variables controlling compilation. May be overridden on the command line for +# debug builds etc + +# Programs +JAVAC?=javac +JAVA?=java +JAVADOC?=javadoc +JAR?=jar +MAKE?=make +MSGFMT?=msgfmt +DOCBOOKTOMAN?=docbook-to-man + +# Program parameters +CPFLAG?=-classpath +JCFLAGS?=-Xlint:all -O -g:none +JFLAGS+=-Djava.library.path=$(JAVAUNIXLIBDIR) + +# Source/Class locations +SRCDIR=org/freedesktop +CLASSDIR=classes/org/freedesktop/dbus + +# Installation variables. Controls the location of make install. May be +# overridden in the make command line to install to different locations +# +PREFIX?=/usr/local +JARPREFIX?=$(PREFIX)/share/java +BINPREFIX?=$(PREFIX)/bin +DOCPREFIX?=$(PREFIX)/share/doc/libdbus-java +MANPREFIX?=$(PREFIX)/share/man/man1 +# allows overriding the javadoc install location from command line +JAVADOCPREFIX?=$(DOCPREFIX) + +# Installation directory of the java-unix libraries +JAVAUNIXLIBDIR?=/usr/lib/jni +# Installation directory of the java-unix jars +JAVAUNIXJARDIR?=/usr/share/java +DEBUG=disable + +# Version numbering +VERSION = $(shell sed -n '1s/.* \(.*\):/\1/p' changelog) +RELEASEVERSION = $(shell sed -n '/^Version/s/.* \(.*\):/\1/p' changelog | sed -n '2p') + +DISTFILES=dbus-java.tex Makefile org tmp-session.conf CreateInterface.sgml DBusDaemon.sgml ListDBus.sgml DBusViewer.sgml changelog AUTHORS COPYING README INSTALL CreateInterface.sh DBusDaemon.sh ListDBus.sh DBusViewer.sh DBusDaemon.bat CreateInterface.bat ListDBus.bat DBusViewer.bat compile.bat DBusCall.bat DBusCall.sh DBusCall.sgml translations + +all: bin doc man +bin: libdbus-java-$(VERSION).jar dbus-java-viewer-$(VERSION).jar bin/DBusDaemon bin/ListDBus bin/CreateInterface bin/DBusViewer dbus-java-bin-$(VERSION).jar bin/DBusCall +man: CreateInterface.1 ListDBus.1 DBusDaemon.1 DBusViewer.1 DBusCall.1 +doc: doc/dbus-java.dvi doc/dbus-java.ps doc/dbus-java.pdf doc/dbus-java/index.html doc/api/index.html + +clean: + rm -rf doc bin classes testbin win + rm -f *.1 *.o *.so *.h .dist .classes .testclasses .doc *.jar *.log pid address tmp-session-bus *.gz .viewerclasses .bin .testbin .win .binclasses Manifest + rm -rf dbus-java-$(VERSION) + rm -rf dbus-java-$(RELEASEVERSION) + +classes: .classes +testclasses: .testclasses +viewerclasses: .viewerclasses +binclasses: .binclasses +.testclasses: $(SRCDIR)/dbus/test/*.java .classes + mkdir -p classes + $(JAVAC) -cp classes:${JAVAUNIXJARDIR}/debug-$(DEBUG).jar:${JAVAUNIXJARDIR}/hexdump.jar:$(CLASSPATH) -d classes $(JCFLAGS) $(SRCDIR)/dbus/test/*.java + touch .testclasses +.viewerclasses: $(SRCDIR)/dbus/viewer/*.java .classes .binclasses + mkdir -p classes + $(JAVAC) -cp classes:$(CLASSPATH):${JAVAUNIXJARDIR}/unix.jar:${JAVAUNIXJARDIR}/debug-$(DEBUG).jar:${JAVAUNIXJARDIR}/hexdump.jar -d classes $(JCFLAGS) $(SRCDIR)/dbus/viewer/*.java + touch .viewerclasses +.binclasses: $(SRCDIR)/dbus/bin/*.java .classes + mkdir -p classes + $(JAVAC) -cp classes:$(CLASSPATH):${JAVAUNIXJARDIR}/unix.jar:${JAVAUNIXJARDIR}/debug-$(DEBUG).jar:${JAVAUNIXJARDIR}/hexdump.jar -d classes $(JCFLAGS) $(SRCDIR)/dbus/bin/*.java + touch .binclasses +.classes: $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java $(SRCDIR)/dbus/exceptions/*.java $(SRCDIR)/dbus/types/*.java translations/*.po + mkdir -p classes + $(JAVAC) -d classes -cp classes:${JAVAUNIXJARDIR}/unix.jar:${JAVAUNIXJARDIR}/debug-$(DEBUG).jar:${JAVAUNIXJARDIR}/hexdump.jar:$(CLASSPATH) $(JCFLAGS) $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java $(SRCDIR)/dbus/exceptions/*.java $(SRCDIR)/dbus/types/*.java + (cd translations; for i in *.po; do $(MSGFMT) --java2 -r dbusjava_localized -d ../classes -l $${i%.po} $$i; done) + $(MSGFMT) --java2 -r dbusjava_localized -d classes translations/en_GB.po + touch .classes + +translations/en_GB.po: $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java $(SRCDIR)/dbus/exceptions/*.java $(SRCDIR)/dbus/types/*.java $(SRCDIR)/dbus/bin/*.java $(SRCDIR)/dbus/viewer/*.java + echo "#java-format" > $@ + sed -n '/_(/s/.*_("\([^"]*\)").*/\1/p' $^ | sort -u | sed 's/\(.*\)/msgid "\1"\nmsgstr "\1"/' >> $@ + +libdbus-java-$(VERSION).jar: .classes + echo "Class-Path: ${JAVAUNIXJARDIR}/unix.jar ${JAVAUNIXJARDIR}/hexdump.jar ${JAVAUNIXJARDIR}/debug-$(DEBUG).jar" > Manifest + (cd classes; $(JAR) -cfm ../$@ ../Manifest org/freedesktop/dbus/*.class org/freedesktop/*.class org/freedesktop/dbus/types/*.class org/freedesktop/dbus/exceptions/*.class *localized*class) +dbus-java-test-$(VERSION).jar: .testclasses + echo "Class-Path: ${JARPREFIX}/libdbus-java-$(VERSION).jar" > Manifest + (cd classes; $(JAR) -cfm ../$@ ../Manifest org/freedesktop/dbus/test/*.class) +dbus-java-viewer-$(VERSION).jar: .viewerclasses + echo "Class-Path: ${JARPREFIX}/libdbus-java-$(VERSION).jar" > Manifest + (cd classes; $(JAR) -cfm ../$@ ../Manifest org/freedesktop/dbus/viewer/*.class) +dbus-java-bin-$(VERSION).jar: .binclasses + echo "Class-Path: ${JARPREFIX}/libdbus-java-$(VERSION).jar" > Manifest + (cd classes; $(JAR) -cfm ../$@ ../Manifest org/freedesktop/dbus/bin/*.class) +dbus.jar: libdbus-java-$(VERSION).jar + ln -sf $< $@ +dbus-bin.jar: dbus-java-bin-$(VERSION).jar + ln -sf $< $@ +dbus-viewer.jar: dbus-java-viewer-$(VERSION).jar + ln -sf $< $@ + +jar: libdbus-java-$(VERSION).jar + +.doc: + mkdir -p doc + mkdir -p doc/dbus-java + touch .doc +.win: + mkdir -p win + touch .win +.bin: + mkdir -p bin + touch .bin +.testbin: + mkdir -p testbin + touch .testbin +doc/dbus-java.dvi: dbus-java.tex .doc + (cd doc; latex ../dbus-java.tex) + (cd doc; latex ../dbus-java.tex) + (cd doc; latex ../dbus-java.tex) +doc/dbus-java.ps: doc/dbus-java.dvi .doc + (cd doc; dvips -o dbus-java.ps dbus-java.dvi) +doc/dbus-java.pdf: doc/dbus-java.dvi .doc + (cd doc; pdflatex ../dbus-java.tex) +doc/dbus-java/index.html: dbus-java.tex .doc + mkdir -p doc/dbus-java/ + (cd doc/dbus-java; TEX4HTENV=/etc/tex4ht/tex4ht.env htlatex ../../dbus-java.tex "xhtml,2" "" "-cvalidate") + rm -f doc/dbus-java/*{4ct,4tc,aux,dvi,idv,lg,log,tmp,xref} + cp doc/dbus-java/dbus-java.html doc/dbus-java/index.html +doc/api/index.html: $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java .doc + $(JAVADOC) -quiet -author -link http://java.sun.com/j2se/1.5.0/docs/api/ -classpath $(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar -d doc/api $(SRCDIR)/*.java $(SRCDIR)/dbus/*.java $(SRCDIR)/dbus/types/*.java $(SRCDIR)/dbus/exceptions/*.java + +%.1: %.sgml + $(DOCBOOKTOMAN) $< > $@ + +bin/%: %.sh .bin + sed 's,\%JARPATH\%,$(JARPREFIX),;s,\%JAVAUNIXJARPATH\%,$(JAVAUNIXJARDIR),;s,\%JAVAUNIXLIBPATH\%,$(JAVAUNIXLIBDIR),;s,\%VERSION\%,$(VERSION),;s,\%DEBUG\%,$(DEBUG),;s,\%JAVA\%,$(JAVA),' < $< > $@ + +win/%.bat: %.bat .win + sed 's,\%WINJARPATH\%,$(JARPREFIX),;s,\%WINUNIXJARPATH\%,$(JAVAUNIXJARDIR),;s,\%VERSION\%,$(VERSION),;s,\%DEBUG\%,$(DEBUG),' < $< > $@ + +testbin/%: %.sh .testbin libdbus-java-$(VERSION).jar dbus-java-bin-$(VERSION).jar dbus-bin.jar dbus.jar dbus-viewer.jar + sed 's,\%JARPATH\%,.,;s,\%JAVAUNIXJARPATH\%,$(JAVAUNIXJARDIR),;s,\%JAVAUNIXLIBPATH\%,$(JAVAUNIXLIBDIR),;s,\%VERSION\%,$(VERSION),;s,\%DEBUG\%,$(DEBUG),;s,\%JAVA\%,$(JAVA),' < $< > $@ + chmod 755 $@ + +testrun: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.test + +low-level-run: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.test_low_level + +cross-test-server: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.cross_test_server + +cross-test-client: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.cross_test_client + +peer-server: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.test_p2p_server + +peer-client: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.test_p2p_client + +two-part-server: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.two_part_test_server + +two-part-client: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.two_part_test_client + +profilerun: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-test-$(VERSION).jar org.freedesktop.dbus.test.profile $(PROFILE) + +viewer: libdbus-java-$(VERSION).jar dbus-java-viewer-$(VERSION).jar + $(JAVA) $(JFLAGS) $(CPFLAG) $(CLASSPATH):$(JAVAUNIXJARDIR)/unix.jar:$(JAVAUNIXJARDIR)/hexdump.jar:$(JAVAUNIXJARDIR)/debug-$(DEBUG).jar:libdbus-java-$(VERSION).jar:dbus-java-viewer-$(VERSION).jar org.freedesktop.dbus.viewer.DBusViewer + +#dbus-daemon --config-file=tmp-session.conf --print-pid --print-address=5 --fork >pid 5>address ; \ + +low-level: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( testbin/DBusDaemon --addressfile address --pidfile pid & \ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + $(MAKE) DBUS_JAVA_FLOATS=true low-level-run ;\ + kill $$(cat pid)) + +checktcp: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( PASS=false; \ + testbin/DBusDaemon --tcp --addressfile address --pidfile pid 2> server.log&\ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + dbus-monitor >> monitor.log &\ + if $(MAKE) DBUS_JAVA_FLOATS=true DEBUG=$(DEBUG) testrun 2>&1 | tee client.log; then export PASS=true; fi ; \ + kill $$(cat pid) ; \ + if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi ) + + +check: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( PASS=false; \ + testbin/DBusDaemon --addressfile address --pidfile pid 2> server.log&\ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + dbus-monitor >> monitor.log &\ + if $(MAKE) DBUS_JAVA_FLOATS=true DEBUG=$(DEBUG) testrun 2>&1 | tee client.log; then export PASS=true; fi ; \ + kill $$(cat pid) ; \ + if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi ) + +cross-test-compile: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + +internal-cross-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( testbin/DBusDaemon --addressfile address --pidfile pid &\ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s cross-test-server | tee server.log &\ + sleep 1;\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s cross-test-client | tee client1.log &\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s cross-test-client | tee client2.log ;\ + kill $$(cat pid) ; ) + +peer-to-peer-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar + ( $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s peer-server 2>&1 | tee server.log &\ + sleep 1;\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s peer-client 2>&1 | tee client.log ) + +two-part-test: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( testbin/DBusDaemon --addressfile address --pidfile pid &\ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s two-part-server | tee server.log &\ + sleep 1;\ + $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true -s two-part-client | tee client.log ;\ + kill $$(cat pid) ; ) + +profile: libdbus-java-$(VERSION).jar dbus-java-test-$(VERSION).jar testbin/DBusDaemon dbus.jar dbus-java-bin-$(VERSION).jar dbus-bin.jar + ( PASS=false; \ + testbin/DBusDaemon --addressfile address --pidfile pid &\ + sleep 1; \ + export DBUS_SESSION_BUS_ADDRESS=$$(cat address) ;\ + if $(MAKE) DEBUG=$(DEBUG) DBUS_JAVA_FLOATS=true profilerun ; then export PASS=true; fi ; \ + kill $$(cat pid) ; \ + if [ "$$PASS" = "true" ]; then exit 0; else exit 1; fi ) + +uninstall: + rm -f $(DESTDIR)$(JARPREFIX)/dbus.jar $(DESTDIR)$(JARPREFIX)/dbus-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer.jar $(DESTDIR)$(JARPREFIX)/dbus-viewer-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-bin.jar $(DESTDIR)$(JARPREFIX)/dbus-bin-$(VERSION).jar + rm -rf $(DESTDIR)$(DOCPREFIX) + rm -f $(DESTDIR)$(MANPREFIX)/CreateInterface.1 $(DESTDIR)$(MANPREFIX)/ListDBus.1 $(DESTDIR)$(MANPREFIX)/DBusViewer.1 $(DESTDIR)$(MANPREFIX)/DBusDaemon.1 $(DESTDIR)$(MANPREFIX)/DBusCall.1 + rm -f $(DESTDIR)$(BINPREFIX)/CreateInterface $(DESTDIR)$(BINPREFIX)/ListDBus $(DESTDIR)$(BINPREFIX)/DBusViewer $(DESTDIR)$(BINPREFIX)/DBusDaemon $(DESTDIR)$(BINPREFIX)/DBusCall + +install: install-bin install-man install-doc + +install-bin: dbus-java-viewer-$(VERSION).jar libdbus-java-$(VERSION).jar bin/CreateInterface bin/ListDBus bin/DBusViewer bin/DBusDaemon dbus-java-bin-$(VERSION).jar bin/DBusCall + install -d $(DESTDIR)$(JARPREFIX) + install -m 644 libdbus-java-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-$(VERSION).jar + install -m 644 dbus-java-viewer-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer-$(VERSION).jar + install -m 644 dbus-java-bin-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-bin-$(VERSION).jar + ln -sf dbus-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus.jar + ln -sf dbus-viewer-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-viewer.jar + ln -sf dbus-bin-$(VERSION).jar $(DESTDIR)$(JARPREFIX)/dbus-bin.jar + install -d $(DESTDIR)$(BINPREFIX) + install bin/DBusViewer $(DESTDIR)$(BINPREFIX) + install bin/DBusCall $(DESTDIR)$(BINPREFIX) + install bin/CreateInterface $(DESTDIR)$(BINPREFIX) + install bin/ListDBus $(DESTDIR)$(BINPREFIX) + install bin/DBusDaemon $(DESTDIR)$(BINPREFIX) + +install-man: CreateInterface.1 ListDBus.1 DBusDaemon.1 DBusViewer.1 changelog AUTHORS COPYING README INSTALL DBusCall.1 + install -d $(DESTDIR)$(DOCPREFIX) + install -m 644 changelog $(DESTDIR)$(DOCPREFIX) + install -m 644 COPYING $(DESTDIR)$(DOCPREFIX) + install -m 644 AUTHORS $(DESTDIR)$(DOCPREFIX) + install -m 644 README $(DESTDIR)$(DOCPREFIX) + install -m 644 INSTALL $(DESTDIR)$(DOCPREFIX) + install -d $(DESTDIR)$(MANPREFIX) + install -m 644 CreateInterface.1 $(DESTDIR)$(MANPREFIX)/CreateInterface.1 + install -m 644 ListDBus.1 $(DESTDIR)$(MANPREFIX)/ListDBus.1 + install -m 644 DBusDaemon.1 $(DESTDIR)$(MANPREFIX)/DBusDaemon.1 + install -m 644 DBusViewer.1 $(DESTDIR)$(MANPREFIX)/DBusViewer.1 + install -m 644 DBusCall.1 $(DESTDIR)$(MANPREFIX)/DBusCall.1 + +install-doc: doc + install -d $(DESTDIR)$(DOCPREFIX) + install -m 644 doc/dbus-java.dvi $(DESTDIR)$(DOCPREFIX) + install -m 644 doc/dbus-java.ps $(DESTDIR)$(DOCPREFIX) + install -m 644 doc/dbus-java.pdf $(DESTDIR)$(DOCPREFIX) + install -d $(DESTDIR)$(DOCPREFIX)/dbus-java + install -m 644 doc/dbus-java/*.html $(DESTDIR)$(DOCPREFIX)/dbus-java + install -m 644 doc/dbus-java/*.css $(DESTDIR)$(DOCPREFIX)/dbus-java + install -d $(DESTDIR)$(JAVADOCPREFIX)/api + cp -a doc/api/* $(DESTDIR)$(JAVADOCPREFIX)/api + +dist: .dist +.dist: $(DISTFILES) + mkdir -p dbus-java-$(VERSION) + cp -fa $^ dbus-java-$(VERSION) + touch .dist +tar: dbus-java-$(VERSION).tar.gz + +distclean: + rm -rf dbus-java-$(VERSION) + rm -rf dbus-java-$(VERSION).tar.gz + rm -f .dist + +libdbus-java-$(VERSION): .dist + +dbus-java-$(VERSION).tar.gz: .dist + tar zcf $@ dbus-java-$(VERSION) +dbus-java-$(VERSION).zip: .dist + zip -r $@ dbus-java-$(VERSION)/ + +dbus-java-$(RELEASEVERSION).tar.gz: $(DISTFILES) + mkdir -p dbus-java-$(RELEASEVERSION)/ + cp -fa $^ dbus-java-$(RELEASEVERSION)/ + tar zcf $@ dbus-java-$(RELEASEVERSION) + +dbus-java-win-$(VERSION).zip: dbus-java-bin-$(VERSION).jar libdbus-java-$(VERSION).jar win/CreateInterface.bat win/DBusDaemon.bat win/DBusViewer.bat win/ListDBus.bat $(JAVAUNIXJARDIR)/hexdump.jar $(JAVAUNIXJARDIR)/debug-$(DEBUG).jar dbus-java-viewer-$(VERSION).jar win/DBusCall.bat + mkdir -p dbus-java-win-$(VERSION) + cp -fa dbus-java-bin-$(VERSION).jar dbus-java-win-$(VERSION)/dbus-bin.jar + cp -fa dbus-java-viewer-$(VERSION).jar dbus-java-win-$(VERSION)/dbus-viewer.jar + cp -fa libdbus-java-$(VERSION).jar dbus-java-win-$(VERSION)/dbus.jar + cp -fa win/* dbus-java-win-$(VERSION)/ + cp -faL $(JAVAUNIXJARDIR)/hexdump.jar dbus-java-win-$(VERSION)/ + cp -faL $(JAVAUNIXJARDIR)/debug-$(DEBUG).jar dbus-java-win-$(VERSION)/ + zip -r $@ dbus-java-win-$(VERSION)/ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/README b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/README new file mode 100755 index 0000000..9c88f8c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/README @@ -0,0 +1,32 @@ +D-Bus Java README +----------------- + +Compilation and installation is described in the INSTALL file. + +This will install two jar files, three binaries and some documentation in the +form of an HTML/PDF guide to writing D-Bus Java programs, JavaDoc API for the +library and man pages for the supplied programs. Read the documentation, it's +there for a reason. + +The installed programs are documented in their respective man pages. + +CreateInterface is a tool for creating interface stubs for D-Bus programs. It +will connect to services running on the bus and introspect on them to find +their API. This will then be written as Java interface definitions suitable for +importing into your program. A file containing the introspection data can be +used instead. + +ListDBus lists the names currently connected to a bus. + +DBusViewer is a graphical tool which combines the two tools. It will list the +names on a bus and allow you to introspect on them and save the result as Java +interface files. This currently only introspects on the root object, however. + +To run a Java program using D-Bus you need to have the libdbus-java, +libunix-java and libdebug jar files in your classpath and the libunix-java +shared library in your library path. With the default install paths you may +have to do something like: + +java -cp /usr/local/share/java/dbus.jar:/usr/local/share/java/unix.jar:/usr/local/share/java/debug-disable.jar -Djava.library.path=/usr/local/lib/jni + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/changelog b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/changelog new file mode 100755 index 0000000..f3675f7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/changelog @@ -0,0 +1,342 @@ +Version 2.7: + + * Fix bug in disconnected signal/exception handling (Spotted by Serkan Kaba + ) + * Fix bug in empty signals (Spotted by Daniel Wagner ) + * Fix bug in maps containing complex types (Spotted by Tim Court ) + * Fix signal handling bug in DBusDaemon (Spotted by Markus Gaebelein + ) + * Make MessageReader/Writer use Buffered streams to try and improve + performance + * Support reading session bus address from file in $HOME + * Fix TCP cookie timestamp problems (Report/fix from Johannes Felten + ) + * Add handleError() method to callbacks (breaks backwards source compatibility) + +Version 2.6: + + * Add DBusConnection.releaseBusName API + * Add DBusConnection.PeerSet for tracking peer lifetimes + * Fix bug where DBusDaemon never sends NameOwnerChanged/NameLost + signals + * Patches from Omair Majid to fix + DBusCall manpage and allow alternative docbook-to-man implementations. + * Fix dependency on unix.jar even in tcp mode + * Fix Path/ObjectPath cast issues (reported by Greg DeAngelis + ) + * Fix behavior when disconnected (spotted by Christopher + Armstrong ) + +Version 2.5.1: + + * Fix for possible NPex in DBusDaemon + * Add hexdump.jar to Class-Path for libdbus-java.jar + * Add GetAll to properties interface (Patch from + Sveinung Kvilhaugsvik ) + * Make signals with renamed interfaces and member names work + if they are explicitly listened for (Partially fixes: #18257). + Also make the error reporting better when it doesn't work. + * Add test for signal with renamed interface. + * Fix clearing of string buffer during marshalling (Fixes: #17362) + * Fix array marshalling bug (Fixes: #13291) + +Version 2.5: + + * Patch from Omair Majid to + have seperate javadoc installation directory + * Patch from Omair Majid to + have make all build the manpages. + * ... but as serkan_kaba requested, also provide a bin target which doesn't + * Fix returning DBusSerializables (Spotted by Johannes Felten + ) + * Fix CreateInterface (Spotted by Tom Walsh ) + * Fix serial assignment race condition (Spotted by Ed Wei + ) + * Fix dynamic introspection of objects which export the same + interface multiple times (Patch from Sveinung Kvilhaugsvik + ) + * Fix CreateInterface to mangle names which are reserved words + (Spotted by Sveinung Kvilhaugsvik ) + * Fix DBusDaemon to not crash on bad tcp connections (Patch from + Hugues Moreau ) + * Relicence to LGPL or AFL. + +Version 2.4: + + * Add DBusMemberName to force method names or signal names to something + other than the Java name (suggested by Viktar Vauchkevich ) + * Don't respond to Introspect/Ping except on the right interface + (pointed out by Serkan Kaba ) + * Automatically unexport objects which go out of scope in the + parent program (don't hold a strong reference). This is now + optional and not the default for 1. sanity and 2. a possible + bug in the WeakReference workings in Sun. + * Add fallback objects---a single object can be called for any + object under a given path prefix. + * Add support for localization of strings via gettext. + * Throw a nicer error when signals are not declared as part of an + interface. + * .viewerclasses needs to depend on .binclasses + * Use libunixsocket-java support for writing multiple byte arrays at + once to write message vectors + * check that the unix-socket-received uid matches for connections to + DBusDaemon + * Update to use libunixsocket-java syntax which works on BSDs + * Fix utf-8 characters used in test to actually be the same character... + * Add code to preallocate the buffer array array (Suggested by Adam + Bennett ) + * Fix warnings when building with gcj (fixes a bug in Peer handling and + DBusSerializable handling) + +Version 2.3.2: + + * Fix empty array/map bug (reported by Jan Kümmel + ) + * Add licence headers to files missing them + * Fix minor bug in AbstractConnection.java (reported by Frank Benoit + ) + * Make Marshalling more verbose and descriptive in the presence of + mismatched parameter lists (suggested by Anibal Sanchez + ) + * Fix struct type parsing error (spotted by Gunnar Aastrand Grimnes + and Frank Benoit + ) + * Fix parsing of serializable classes + * Anonymous SASL (needs testing) + +Version 2.3.1: + + * Fix regression in normal array handling (spotted by Anibal Sanchez + ) + +Version 2.3: + + * Apply recursive-path patch for DBusViewer (written by Zsombor Gegesy + ) + * Add Class-Path to jar manifests + * Update documentation for nested classes + * Documentation build fix + * Add test for arrays-of-structs + * Fix arrays-of-structs bug (spotted by Daniel Machado + ) + * Fix bashism in Makefile + * add DBusInterfaceName annotation to override the Java interface name as + the name exported on the bus. + +Version 2.2: + + * Fix cross-test to pass. + * Fix DBusViewer.sh *again* (Spotted by Serkan Kaba ) + * Add DBusCall + * fix CreateInterface to put DBusException in the right package in import + statements. Spotted by Steve Crane + * Update Cross-test to new spec + * Change casting and return types for get{Peer,}RemoteObject calls to + use generics so you don't need explicit casts on return types. + Suggested by Philippe Marschall . + * Test with multiple requested (same actual) connection + * Add async-with-callback API. + +Version 2.1: + + * make scripts with $JAVA + * fix DBusViewer.sh (Spotted by Luigi Paioro + +Version 2.0: + + * Remove libdbus-1 dependency and talk the wire protocol directly + * Add dependency on http://www.matthew.ath.cx/projects/java/ unix, debug + and hexdump libraries + * API changes: + * Exceptions (including DBusException and DBusExecutionException) moved + to the org.freedesktop.dbus.exceptions package. + * Convert/deserialize and dbus<->java type conversion code moved from + org.freedesktop.dbus.DBusConnection to org.freedesktop.dbus.Marshalling. + * Types moved to the org.freedesktop.dbus.types package. + * All message metadata methods have been moved to the superclass and + getObjectPath() has been renamed to getPath(). + * Deprecated method registerService has been removed. + * getUniqueName() and getNames() methods added to get the bus names + associated with this connection. + * Access to the low-level API added. + * Change all documentation to refer to 'implementation' not 'binding' + * Add peer 2 peer support with DirectConnection class + * add peer to peer test + * split some code from DBusConnection into common super-class + AbstractConnection + * Support float ('f') type with tests + * Degrade floats to doubles when DBUS_JAVA_FLOATS is not set + * add DBus.Peer interface to standard introspection data + * Document peer to peer and low level. + * Fix TCP and SHA-1 auth + * fix wrapper scripts with new depends + * add a DBusDaemon + * Make daemon multithreaded; performance improvements + * Add sending thread to library, move to blocking IO + * Ensure key directory exists when serving cookie auth + * Add TCP support to daemon + * Remove dependency on dbus-daemon for tests + * add --version support for other programs + * Add windows wrapper scripts + * Test working on Windows + * Add makefile target to build zip file for windows + * Add windows compile script + * DBusDaemon can generate random TCP ports to listen on + +Version 1.13: + + * add AccessDenied signal + * fix deadlock issue when sending objectpaths in signals, spotted by Mathis + * add Path type which can be used for non-auto OBJECT_PATH handling, spotted by Mathis + * fix some freebsd build issues: + * remove explicit recursive make calls + * parameterize /usr/lib as DBUSLIBDIR + Spotted by Roberto Francisco Arroyo Moreno + * rejig build system to replace variables in wrapper in make stage and + use DESTDIR properly, hence removing the RUNPREFIX stuff. + * add checks and documentation for DBusInterfaces not being in a package. + Spotted by Henrik Petander + +Version 1.12: + + * fix internal-cross-test bugs and increase error verbosity + * add org.freedesktop.DBus.Error.NoReply, change to that from my own + * add -pedantic -std=c99 flags to GCC + * remove supplied Hal classes as they are out of date + * change to using tex4ht rather than latex2html + +Version 1.11: + + * fix script replacement directories to be different to install directories + * split install-doc and install-man to allow easy split -doc package + +Version 1.10: + + * fix URLs to point to fdo + * check for signal path validity in Java + * fix NameAcquired spelling + * check array lengths and name lengths + * support method calls with empty interfaces + * support for non-activating remote objects + * remove errant debug statemant left in 1.9 + * Fix List> bug spotted by Remi Emonet + + * Fix OBJECT_PATH handling; bug spotted by Remi Emonet + + * added getRemoteObject and getPeerRemoteObject methods with + introspection support to guess interfaces. + * changed introspection to recurse over the exported object tree + and show sub-objects. + * compare maps unordered in tests; spotted by Simon McVittie + + * implement UInt64 with BigInteger to allow full-range UInt64s + * fix $ in introspection data for nested interfaces + * fix the required dbus version in the docs + * can now send DBUS_TYPE_SIGNATURE as Type[] + * rewrite Variant handling to work with complex types + * add $JAVA_HOME/include and $JAVA_HOME/include/linux to CFLAGS + (Fix from Joshua Nichols ) + * remove unneccessary build warnings + (Fix from Joshua Nichols ) + * seperate install and install-doc targets + (Suggested by Ralf Kistner ) + * add -fno-stack-protector flag (only for gcc 4.1 or later) + (Suggested by Ralf Kistner ) + * Revamp tuples + * Build without DBUS_API_SUBJECT_TO_CHANGE set + * fix LDFLAGS to work properly with --as-needed + (Suggested by TFKyle) + * Update CreateInterface to new API + * More speed fixes with type introspection + * Add README and INSTALL files + * Change wrappers to point to installed locations + +Version 1.9: + + * Map and List handling optimisations + * Struct optimisations + * Canonicalise D-Bus spelling in documentation + * Update documentation + * Implement cross-bindings test suite + * add getPeerRemoteObject method + * add addSigHandler methods which filter on sender and path + * Signal handling optimisations + * deprecating service in favour of bus name. Deprecated registerService in + favour of requestBusName + +Version 1.8: + + * stop dvips printing on wierd systems + * Doc patches from Dick Hollenbeck + * reduce TIMEOUT to 1ms and check for outbound messages in the JNI; reduces + RTT from 100ms to ~1ms + * Remove two java collections which were doing a lot of allocation and + deallocation and replace with data structures based on arrays. + * add removeSigHandler method + * add profiling application + * handle incoming & outgoing native array types natively (biiiig savings + here) + +Version 1.7: + + * compiles with -Xlint:all + * fixed struct/nested struct creation + * compile with -Os -O -Wall -Werror -g:none and strip + * allow overloading methods by argument type + * getJavaType bugfix from Antoine Perdaens + * nulls in Variant fix from Antoine Perdaens + * Variant parameter checking in + * CreateInterface now maintains order of parameters to signals + +Version 1.6: + + * Custom serializable objects + * Thread pool model + * CreateInterfaces updated to handle new Structs, annotations, Signals etc + +Version 1.5: + + * Remove static library dependency + +Version 1.4: + + * provide call info to called methods + * check for disconnections and throw + * complete rewrite of Structs + * add message send/receive debugging + +Version 1.3: + + * Annotation and throws support + * proper noreply support + * asynchronous method call support + * strip InternalErrorMessage reference from JNI + +Version 1.2: + + * Make sure pending messages are sent on disconnect + * Import of viewer application (Peter Cox ) + * Make CreateInterface usable in other apps. + * Import extra functions that weren't documented into DBus.java + * Implement throwing and catching of specific exception types + +Version 1.1: + + * Fix connections to multiple busses + * Allow connections by bus address + * Stricter error checking in looking up connection object + +Version 1.0: + + * 1.x is a java 1.5 version, 0.x is a java 1.4 version + * introspect on the root object + * support for nested nodes in CreateInterface + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/compile.bat b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/compile.bat new file mode 100755 index 0000000..92099f0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/compile.bat @@ -0,0 +1,17 @@ +@echo off +setlocal +REM set to true for debug builds +set debug=disable +REM set to empty for debug builds +set jcflags=-O -g:none -Xlint:all +REM set to the location you installed unix.jar, debug-*.jar and hexdump.jar +set jarpath= +REM set to the Java installation location +REM set JAVA_HOME= + +%JAVA_HOME%\bin\javac -cp .;%jarpath%unix.jar;%jarpath%debug-%debug%.jar;%jarpath%hexdump.jar;%CLASSPATH% %jcflags% org\freedesktop\*.java org\freedesktop\dbus\*.java org\freedesktop\dbus\bin\*.java org\freedesktop\dbus\exceptions\*.java org\freedesktop\dbus\types\*.java org\freedesktop\dbus\viewer\*.java +%JAVA_HOME%\bin\jar -cf dbus.jar org\freedesktop\*.class org\freedesktop\dbus\*.class org\freedesktop\dbus\exceptions\*.class org\freedesktop\dbus\types\*.class +%JAVA_HOME%\bin\jar -cf dbus-bin.jar org\freedesktop\dbus\bin\*.class +%JAVA_HOME%\bin\jar -cf dbus-viewer.jar org\freedesktop\dbus\viewer\*.class + +endlocal diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/dbus-java.tex b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/dbus-java.tex new file mode 100755 index 0000000..980a77b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/dbus-java.tex @@ -0,0 +1,1266 @@ +\documentclass[a4paper,12pt]{article} + +% +% D-Bus Java Implementation +% Copyright (c) 2005-2006 Matthew Johnson +% +% This program is free software; you can redistribute it and/or modify it +% under the terms of either the GNU Lesser General Public License Version 2 or the +% Academic Free Licence Version 2.1. +% +% Full licence texts are included in the COPYING file with this program. +% + +\usepackage{fullpage} +\usepackage{ifthen} + +\ifx\pdfoutput\undefined + \usepackage{hyperref} +\else + \usepackage[ + bookmarks, + bookmarksopen, + bookmarksnumbered=false, + colorlinks, + pdfpagemode=None, + urlcolor=black, + citecolor=black, + linkcolor=black, + pagecolor=black, + plainpages=false, + pdfpagelabels, + ]{hyperref} +\fi + +\author{Matthew Johnson\\dbus@matthew.ath.cx} +\title{D-Bus programming in Java 1.5} + +\begin{document} + +\def\javadocroot/{http://dbus.freedesktop.org/doc/dbus-java/api/} + +\maketitle + +\tableofcontents +\listoffigures +\listoftables + +\section{Introduction} + +This document describes how to use the Java implementation of D-Bus. D-Bus is +an IPC mechanism which at a low level uses message passing over Unix Sockets or +IP. D-Bus models its messages as either function calls on remote objects, or +signals emitted from them. + +Java is an object-oriented language and this implementation attempts to match +the D-Bus IPC model to the Java object model. The implementation also make +heavy use of threads and exceptions. The programmer should be careful to take +care of synchronisation issues in their code. All method calls by remote +programs on exported objects and all signal handlers are run in new threads. +Any calls on remote objects may throw {\tt DBusExecutionException}, which is a +runtime exception and so the compiler will not remind you to handle it. + +The Java D-Bus API is also documented in the JavaDoc\footnote{\url{\javadocroot/}}, +D-Bus is described in the +specification\footnote{http://dbus.freedesktop.org/doc/dbus-specification.html} +and the API documentation\footnote{http://dbus.freedesktop.org/doc/api/html/}. + +\subsection{Protocol Implementation} + +This library is a native Java implementation of the D-Bus protocol and not +a wrapper around the C reference implementation. + +\subsection{Dependencies} + +This library requires Java 1.5-compatible VM and compiler (either Sun, or +ecj+jamvm with classpath-generics newer than 0.19) and the unix socket, debug +and hexdump libraries from \url{http://www.matthew.ath.cx/projects/java/}. + +\subsection{D-Bus Terminology} + +D-Bus has several notions which are exposed to the users of the Java +implementation. + +\subsubsection{Bus Names} + +Programs on the bus are issued a unique identifier by the bus. This +is guaranteed to be unique within one run of the bus, but is +assigned sequentially to each new connection. + +There are also so called well-known bus names which a device can +request on the bus. These are of the form {\em ``org.freedesktop.DBus''}, +and any program can request them if they are not already owned. + +\subsubsection{Interfaces} + +All method calls and signals are specified using an interface, +similar to those in Java. When executing a method or sending a +signal you specify the interface the method belongs to. These are of +the form {\em ``org.freedesktop.DBus''}. + +\subsubsection{Object Paths} + +A program may expose more than one object which implements an +interface. Object paths of the form {\em ``/org/freedesktop/DBus''} +are used to distinguish objects. + +\subsubsection{Member Names} + +Methods and Signals have names which identify them within an +interface. D-Bus does not support method overloading, only one +method or signal should exist with each name. + +\subsubsection{Errors} + +A reply to any message may be an error condition. In which case you reply with +an error message which has a name of the form {\em + ``org.freedesktop.DBus.Error.ServiceUnknown''}. + +\section{DBusConnection} + +The {\tt +DBusConnection\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusConnection.html}}} +class provides methods for connecting to the bus, exporting objects, +sending signals and getting references to remote objects. + +{\tt DBusConnection} is a singleton class, multiple calls to {\tt +getConnection} will return the same bus connection. + +\begin{verbatim} +conn = DBusConnection.getConnection(DBusConnection.SESSION); +\end{verbatim} + +This creates a connection to the session bus, or returns the +existing connection. + +\begin{verbatim} +conn.addSigHandler(TestSignalInterface.TestSignal.class, + new SignalHandler()); +\end{verbatim} + +This sets up a signal handler for the given signal type. +SignalHandler.handle will be called in a new thread with an instance +of TestSignalInterface.TestSignal when that signal is recieved. + +\begin{verbatim} +conn.sendSignal(new TestSignalInterface.TestSignal( + "/foo/bar/com/Wibble", + "Bar", + new UInt32(42))); +\end{verbatim} + +This sends a signal of type {\tt TestSignalInterface.TestSignal}, +from the object {\em ``/foo/bar/com/Wibble''} with the arguments {\em +``Bar''} and {\tt UInt32(42)}. + +\begin{verbatim} +conn.exportObject("/Test", new testclass()); +\end{verbatim} + +This exports the {\tt testclass} object on the path {\em ``/Test''} + +\begin{verbatim} +Introspectable intro = (Introspectable) conn.getRemoteObject( + "foo.bar.Test", "/Test", + Introspectable.class); +\end{verbatim} + +This gets a reference to the {\em ``/Test''} object on the process with the +name {\em ``foo.bar.Test''} . The object implements the {\tt Introspectable} +interface, and calls may be made to methods in that interface as if it was a +local object. + +\begin{verbatim} +String data = intro.Introspect(); +\end{verbatim} + +The Runtime Exception {\tt DBusExecutionException} may be thrown +by any remote method if any part of the execution fails. + +\subsection{Asynchronous Calls} + +Calling a method on a remote object is synchronous, that is the thread will +block until it has a reply. If you do not want to block you can use an +asynchronous call. + +There are two ways of making asynchronous calls. You can either call the {\tt +callMethodAsync} function on the connection object, in which case you are +returned a {\tt +DBusAsyncReply\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusAsyncReply.html}}} +object which can be used to check for a reply and get the return value. This +is demonstrated in figure \ref{fig:async}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +DBusAsyncReply stuffreply = + conn.callMethodAsync(remoteObject, "methodname", arg1, arg2); +... +if (stuffreply.hasReply()) { + Boolean b = stuffreply.getReply(); + ... +} +\end{verbatim} +\end{center} +\caption{Calling an asynchronous method} +\label{fig:async} +\end{figure} + +Alternatively, you can register a callback with the connection using the {\tt +callWithCallback} function on the connection object. In this case, your +callback class (implementing the {\tt +CallbackHandler\footnote{\url{\javadocroot/org/freedesktop/dbus/CallbackHandler.html}}} +interface will be called when the reply is returned from the bus. + +\section{DBusInterface} + +To call methods or expose methods on D-Bus you need to define them with their +exact signature in a Java interface. The full name of this interface must be +the same as the D-Bus interface they represent. In addition, D-Bus interface +names must contain at least one period. This means that DBusInterfaces cannot +be declared without being in a package. + +For example, if I want to expose methods on the interface {\em +``org.freedesktop.DBus''} I would define a Java interface in the package {\tt +org.freedesktop} called {\tt DBus}. This would be in the file {\tt +org/freedesktop/DBus.java} as normal. Any object wanting to export these +methods would implement {\tt org.freedesktop.DBus}. + +Any interfaces which can be exported over D-Bus must extend {\tt +DBusInterface\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusInterface.html}}}. +A class may implement more than one exportable interface, all public methods +declared in an interface which extend {\tt DBusInterface} will be exported. + +A sample interface definition is given in figure~\ref{fig:interface}, and a +class which implements it in figure~\ref{fig:class}. More complicated +definitions can be seen in the test +classes\footnote{\url{\javadocroot/org/freedesktop/dbus/test/TestRemoteInterface2.java} +\url{\javadocroot/org/freedesktop/dbus/test/TestRemoteInterface.java}}. + +All method calls by other programs on objects you export over D-Bus +are executed in their own thread. + +{\tt DBusInterface} itself specifies one method \verb&boolean isRemote()&. If +this is executed on a remote object it will always return true. Local objects +implementing a remote interface must implement this method to return false. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package org.freedesktop; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.DBusInterface; + +public interface DBus extends DBusInterface +{ + public boolean NameHasOwner(String name); + public UInt32 RequestName(String name, UInt32 flags); +} +\end{verbatim} +\end{center} +\caption{An interface which exposes two methods} +\label{fig:interface} +\end{figure} + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package my.real.implementation; +import org.freedesktop.dbus.DBus; +import org.freedesktop.dbus.UInt32; + +public class DBusImpl implements DBus +{ + Vector names; + public boolean NameHasOwner(String name) + { + if (names.contains(name)) return true; + else return false; + } + public UInt32 RequestName(String name, UInt32 flags) + { + names.add(name); + return new UInt32(0); + } + public boolean isRemote() { return false; } +} +\end{verbatim} +\end{center} +\caption{A class providing a real implementation which can be exported} +\label{fig:class} +\end{figure} + +\subsection{Interface name overriding} + +It is highly recommended that the Java interface and package name match the +D-Bus interface. However, if, for some reason, this is not possible then the +name can be overridden by use of an Annotation. + +To override the Java interface name you should add an annotation to the +interface of {\tt +DBusInterfaceName\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusInterfaceName.html}}} +with a value of the desired D-Bus interface name. An example of this can be seen in +figure \ref{fig:interfacename}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package my.package; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusInterfaceName; + +@DBusInterfaceName("my.otherpackage.Remote") +public interface Remote extends DBusInterface +{ + ... +} +\end{verbatim} +\end{center} +\caption{Overloading the name of an interface.} +\label{fig:interfacename} +\end{figure} + +If you have signals which are declared in a renamed interface (see below for +signals) then when adding a signal handler you {\em must} use an {\tt +addSigHandler} method which takes a class object corresponding to that signal. +If you do not then receiving the signal will fail. + +\section{DBusSignal} + +Signals are also declared as part of an interface. The Java API models these as +inner classes within an interface. The containing interface must extend {\tt +DBusInterface}, and the inner classes representing the signals must extend {\tt +DBusSignal\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusSignal.html}}}. +The Signal name is derived from the name of this inner class, and the interface +from its containing interface. + +Signals can take parameters as methods can (although they cannot return +anything). For the reflection to work, a Signal declare a single constructor of +the correct type. The constructor must take the object path they are being +emitted from as their first (String) argument, followed by the other parameters +in order. They must also call the superclass constructor with the same +parameters. A full definition of a signal can be seen in +figure~\ref{fig:signal}. Again, more complicated definitions are available in +the test +classes\footnote{\url{\javadocroot/org/freedesktop/dbus/test/TestSignalInterface.html}}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package org.freedesktop; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; + +public interface DBus extends DBusInterface +{ + public class NameAcquired extends DBusSignal + { + public final String name; + public NameAcquired(String path, String name) + throws DBusException + { + super(path, name); + this.name = name; + } + } +} +\end{verbatim} +\end{center} +\caption{A Signal with one parameter} +\label{fig:signal} +\end{figure} + +\section{DBusExecutionException} + +If you wish to report an error condition in a method call you can throw an +instance of {\tt +DBusExecutionException\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusExecutionException.html}}}. +This will be sent back to the caller as an error message, and the error name is +taken from the class name of the exception. For example, if you wanted to +report an unknown method you would define an exception as in figure +\ref{fig:exceptiondef} and then throw it in your method as in figure +\ref{fig:exceptioncall}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package org.freedesktop.DBus.Error; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +public class UnknownMethod extends DBusExecutionException +{ + public UnknownMethod(String message) + { + super(message); + } +} +\end{verbatim} +\end{center} +\caption{An Exception} +\label{fig:exceptiondef} +\end{figure} + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +... +public void throwme() throws org.freedesktop.DBus.Error.UnknownMethod +{ + throw new org.freedesktop.DBus.Error.UnknownMethod("hi"); +} +... +\end{verbatim} +\end{center} +\caption{Throwing An Exception} +\label{fig:exceptioncall} +\end{figure} + +If you are calling a remote method and you want to handle such an error you can +simply catch the exception as in figure \ref{fig:exceptioncatch}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +... +try { + remote.throwme(); +} catch (org.freedesktop.DBus.Error.UnknownMethod UM) { + ... +} +... +\end{verbatim} +\end{center} +\caption{Catching An Exception} +\label{fig:exceptioncatch} +\end{figure} + +\section{DBusSigHandler} + +To handle incoming signals from other programs on the Bus you must register a +signal handler. This must implement {\tt +DBusSigHandler\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusSigHandler.html}}} +and provide an implementation for the handle method. An example Signal Handler +is in figure~\ref{fig:handler}. Signal handlers should be parameterised with +the signal they are handling. If you want a signal handler to handle multiple +signals you can leave out the parameterisation and use {\tt instanceof} to +check the type of signal you are handling. Signal handlers will be run in their +own thread. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.DBusSigHandler; + +public class Handler extends DBusSigHandler +{ + public void handle(DBus.NameAcquired sig) + { + ... + } +} +\end{verbatim} +\end{center} +\caption{A Signal Handler} +\label{fig:handler} +\end{figure} + + +\section{D-Bus Types} + +D-Bus supports a number of types in its messages, some which Java +supports natively, and some which it doesn't. This library provides +a way of modelling the extra D-Bus Types in Java. The full list of +types and what D-Bus type they map to is in table \ref{table:types}. + +\subsection{Basic Types} + +All of Java's basic types are supported as parameters and return types to methods, and as parameters to signals. These can be used in either their primitive or wrapper types. + +\subsubsection{Unsigned Types} + +D-Bus, like C and similar languages, has a notion of unsigned numeric +types. The library supplies {\tt +UInt16\footnote{\url{\javadocroot/org/freedesktop/dbus/UInt16.html}}}, {\tt +UInt32} and {\tt UInt64} classes to represent these new basic types. + +\subsection{Strings} + +D-Bus also supports sending Strings. When mentioned below, Strings +count as a basic type. + +\subsubsection{String Comparisons} + +There may be some problems with comparing strings received over D-Bus with +strings generated locally when using the String.equals method. This is due to +how the Strings are generated from a UTF8 encoding. The recommended way to +compare strings which have been sent over D-Bus is with the {\tt +java.text.Collator} class. Figure \ref{fig:collator} demonstrates its use. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +String rname = remote.getName(); +Collator col = Collator.getInstance(); +col.setDecomposition(Collator.FULL_DECOMPOSITION); +col.setStrength(Collator.PRIMARY); +if (0 != col.compare("Name", rname)) + fail("getName return value incorrect"); +\end{verbatim} +\end{center} +\caption{Comparing strings with {\tt java.text.Collator}.} +\label{fig:collator} +\end{figure} + +\subsection{Arrays} + +You can send arrays of any valid D-Bus Type over D-Bus. These can either be +declared in Java as arrays (e.g. \verb&Integer[]& or \verb&int[]&) or as Lists +(e.g. \verb&List&). All lists {\bf must} be parameterised with their +type in the source (reflection on this is used by the library to determine +their type). Also note that arrays cannot be used as part of more complex type, +only Lists (for example \verb&List>&). + +\subsection{Maps} + +D-Bus supports a dictionary type analogous to the Java Map type. This +has the additional restriction that only basic types can be used as +the key (including String). Any valid D-Bus type can be the value. As +with lists, maps must be fully parameterised. (e.g. +\verb&Map&). + +\subsection{Variants} + +D-Bus has support for a Variant type. This is similar to declaring that a +method takes a parameter of type {\tt Object}, in that a Variant may contain +any other type. Variants can either be declared using the {\tt +Variant\footnote{\url{\javadocroot/org/freedesktop/dbus/Variant.html}}} class, or as +a Type Variable. In the latter case the value is automatically unwrapped and +passed to the function. Variants in compound types (Arrays, Maps, etc) must be +declared using the Variant class with the full type passed to the Variant +constructor and manually unwrapped. + +Both these methods use variants: + +\begin{verbatim} +public void display(Variant v); +public int hash(T v); +\end{verbatim} + +\subsection{Structs} + +D-Bus has a struct type, which is a collection of other types. Java +does not have an analogue of this other than fields in classes, and +due to the limitation of Java reflection this is not sufficient. The +library declares a {\tt +Struct\footnote{\url{\javadocroot/org/freedesktop/dbus/Struct.html}}} class which can be used to create structs. +To define a struct you extend the {\tt Struct} class and define fields for each member of the struct. +These fields then need to be annotated in the order which they appear in the struct (class fields do not have a defined order). You must also define a single constructor which takes the contents of he struct in order. This is best demonstrated by an example. +Figure~\ref{fig:struct} shows a Struct definition, and +figure~\ref{fig:structmethod} shows this being used as a parameter +to a method. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusException; +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; + +public final class TestStruct extends Struct +{ + @Position(0) + public final String a; + @Position(1) + public final int b; + @Position(2) + public final String c; + public Struct3(String a, int b, String c) + { + this.a = a; + this.b = b; + this.c = c; + } +} +\end{verbatim} +\end{center} +\caption{A Struct with three elements} +\label{fig:struct} +\end{figure} + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +public void do(TestStruct data); +\end{verbatim} +\end{center} +\caption{A struct as a parameter to a method} +\label{fig:structmethod} +\end{figure} + + +Section~\ref{sec:create} describes how these can be automatically +generated from D-Bus introspection data. + +\subsection{Objects} + +You can pass references to exportable objects round using their object paths. +To do this in Java you declare a type of {\tt DBusInterface}. When the library +receive- an object path it will automatically convert it into the object you +are exporting with that object path. You can pass remote objects back to their +processes in a similar fashion. + +Using a parameter of type {\tt DBusInterface} can cause the automatic creation +of a proxy object using introspection. If the remote app does not support +introspection, or the object does not exist at the time you receive the message +then this will fail. In that case the parameter can be declared to be of type +{\tt Path}. In this case no automatic creation will be performed and you can +get the path as a string with either the {\tt getPath} or {\tt toString} methods +on the {\tt Path} object. + + +\subsection{Multiple Return Values} + +D-Bus also allows functions to return multiple values, a concept not supported +by Java. This has been solved in a fashion similar to the struct, using a {\tt +Tuple\footnote{\url{\javadocroot/org/freedesktop/dbus/Tuple.html}}} +class. Tuples are defined as generic tuples which can be parameterised for +different types and just need to be defined of the appropriate length. This can +be seen in figure~\ref{fig:tuple} and a call in figure~\ref{fig:tuplemethod}. +Again, these can be automatically generated from introspection data. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +import org.freedesktop.dbus.Tuple; + +public final class TestTuple extends Tuple +{ + public final A a; + public final B b; + public final C c; + public TestTuple(A a, B b, C c) + { + this.a = a; + this.b = b; + this.c = c; + } +} +\end{verbatim} +\end{center} +\caption{A 3-tuple} +\label{fig:tuple} +\end{figure} + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +public ThreeTuple status(int item); +\end{verbatim} +\end{center} +\caption{A Tuple being returned from a method} +\label{fig:tuplemethod} +\end{figure} + +\subsection{Full list of types} + +Table \ref{table:types} contains a full list of all the Java types and their corresponding D-Bus types. + +\begin{table} +\begin{center} +\begin{tabular}{l|l} +\bf Java Type & \bf D-Bus Type \\ +\hline +Byte & DBUS\_TYPE\_BYTE \\ +byte & DBUS\_TYPE\_BYTE \\ +Boolean & DBUS\_TYPE\_BOOLEAN \\ +boolean & DBUS\_TYPE\_BOOLEAN \\ +Short & DBUS\_TYPE\_INT16 \\ +short & DBUS\_TYPE\_INT16 \\ +UInt16 & DBUS\_TYPE\_UINT16 \\ +int & DBUS\_TYPE\_INT32 \\ +Integer & DBUS\_TYPE\_INT32 \\ +UInt32 & DBUS\_TYPE\_UINT32 \\ +long & DBUS\_TYPE\_INT64 \\ +Long & DBUS\_TYPE\_INT64 \\ +UInt64 & DBUS\_TYPE\_UINT64 \\ +double & DBUS\_TYPE\_DOUBLE \\ +Double & DBUS\_TYPE\_DOUBLE \\ +String & DBUS\_TYPE\_STRING \\ +Path & DBUS\_TYPE\_OBJECT\_PATH \\ +$<$T$>$ & DBUS\_TYPE\_VARIANT \\ +Variant & DBUS\_TYPE\_VARIANT \\ +? extends Struct & DBUS\_TYPE\_STRUCT \\ +?$[$~$]$ & DBUS\_TYPE\_ARRAY \\ +? extends List & DBUS\_TYPE\_ARRAY \\ +? extends Map & DBUS\_TYPE\_DICT \\ +? extends DBusInterface & DBUS\_TYPE\_OBJECT\_PATH \\ +Type$[$~$]$ & DBUS\_TYPE\_SIGNATURE \\ +\end{tabular} +\end{center} +\caption{Mapping between Java types and D-Bus types} +\label{table:types} +\end{table} + +\subsubsection{float} + +Currently the D-Bus reference implementation does not support a native +single-precision floating point type. Along with the C\# implementation of the +protocol, the Java implementation supports this extension to the protocol. By +default, however, the library operates in compatibility mode and converts all +floats to the double type. To disable compatibility mode export the environment +variable {\tt DBUS\_JAVA\_FLOATS=true}. + +\section{Annotations} + +You can annotate your D-Bus methods as in figure \ref{fig:annotation} to provide hints to other users of your API. Common annotations are listed in table \ref{tab:annotations}. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +package org.freedesktop; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.DBusInterface; + +@org.freedesktop.DBus.Description("Some Methods"); +public interface DBus extends DBusInterface +{ + @org.freedesktop.DBus.Description("Check if the name has an owner") + public boolean NameHasOwner(String name); + @org.freedesktop.DBus.Description("Request a name") + @org.freedesktop.DBus.Deprecated() + public UInt32 RequestName(String name, UInt32 flags); +} +\end{verbatim} +\end{center} +\caption{An annotated method} +\label{fig:annotation} +\end{figure} + + +\begin{table}[htb] +\begin{tabular}{l|l} +{\bf Name} & {\bf Meaning} \\ +\hline +org.freedesktop.DBus.Description & Provide a short 1-line description \\ + & of the method or interface. \\ +org.freedesktop.DBus.Deprecated & This method or interface is Deprecated. \\ +org.freedesktop.DBus.Method.NoReply & This method may be called and returned \\ + & without waiting for a reply. \\ +org.freedesktop.DBus.Method.Error & This method may throw the listed Exception\\ + & in addition to the standard ones. \\ +\end{tabular} +\caption{Common Annotations} +\label{tab:annotations} +\end{table} + +\section{DBusSerializable} + +Some people may want to be able to pass their own objects over D-Bus. Obviously +only raw D-Bus types can be sent on the message bus itself, but the Java +implementation allows the creation of serializable objects which can be passed to +D-Bus functions and will be converted to/from D-Bus types by the library. + +To create such a class you must implement the {\tt +DBusSerializable\footnote{\url{\javadocroot/org/freedesktop/dbus/DBusSerializable.html}}} +class and provide two methods and a zero-argument constructor. The first method +has the signature {\tt public Object\[\] serialize() throws DBusException} and +the second must be called {\tt deserialize}, return {\tt null} and take as it's +arguments exactly all the dbus types that are being serialized to {\em in +order} and {\em with parameterization}. The serialize method should return the +class properties you wish to serialize, correctly formatted for the wire ({\tt +DBusConnection.convertParameters()} can help with this), in order in an Object +array. + +An example of a serializable class can be seen in figure~\ref{fig:serializable}. + + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +import java.lang.reflect.Type; + +import java.util.List; +import java.util.Vector; + +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSerializable; + +public class TestSerializable implements DBusSerializable +{ + private int a; + private String b; + private Vector c; + public TestSerializable(int a, String b, Vector c) + { + this.a = a; + this.b = b.toString(); + this.c = c; + } + public TestSerializable() {} + public void deserialize(int a, String b, List c) + { + this.a = a; + this.b = b; + this.c = new Vector(c); + } + public Object[] serialize() + { + return new Object[] { a, b, c }; + } + public int getInt() { return a; } + public String getString() { return b; } + public Vector getVector() { return c; } + public String toString() + { + return "TestSerializable{"+a+","+b+","+c+"}"; + } +} +\end{verbatim} +\end{center} +\caption{A serializable class} +\label{fig:serializable} +\end{figure} + + + +\section{CreateInterface} +\label{sec:create} + +D-Bus provides a method to get introspection data on a remote object, which +describes the interfaces, methods and signals it provides. This introspection +data is in XML +format\footnote{http://dbus.freedesktop.org/doc/dbus-specification.html\#introspection-format}. +The library automatically provides XML introspection data on all objects which +are exported by it. Introspection data can be used to create Java interface +definitions automatically. + +The {\tt +CreateInterface\footnote{\url{\javadocroot/org/freedesktop/dbus/CreateInterface.html}}} +class will automatically create Java source files from an XML file +containing the introspection data, or by querying the remote object +over D-Bus. CreateInterface can be called from Java code, or can be run as a +stand alone program. + +The syntax for the CreateInterface program is + +\begin{verbatim} +CreateInterface [--system] [--session] [--create-files] + +CreateInterface [--create-files] +\end{verbatim} + +The Java source code interfaces will be written to the standard ouput. If the +{\tt --create-files} option is specified the correct files in the +correct directory structure will be created. + +\subsection{Nested Interfaces} + +In some cases there are nested interfaces. In this case CreateInterface will +not correctly create the Java equivalent. This is because Java cannot have both +a class and a package with the same name. The solution to this is to create +nested classes in the same file. + +An example would be the Hal interface: + +\begin{verbatim} + + ... + + + ... + +\end{verbatim} + +When converted to Java you would just have one file {\tt +org/freedesktop/Hal/Device.java} in the package {\tt org.freedesktop.Hal}, +which would contain one class and one nested class: + +\begin{verbatim} +public interface Device extends DBusInterface { + public interface Volume extends DBusInterface { + ... methods in Volume ... + } + ... methods in Device ... +} +\end{verbatim} + +\section{Debugging} + +It is possible to enable debugging in the library. This will be a lot slower, +but can print a lot of useful information for debugging your program. + +To enable a debug build compile with {\tt DEBUG=enable}. This will then need to be +enabled at runtime by using the debug jar with debugging enabled (usually +installed as debug-enable.jar alongside the normal jar). + +Running a program which uses this library will print some informative messages. +More verbose debug information can be got by supplying a custom debug +configuration file. This should be placed in the file {\tt debug.conf} and has the +format: + +\begin{verbatim} +classname = LEVEL +\end{verbatim} + +Where {\tt classname} is either the special word {\tt ALL} or a full class name +like {\tt org.freedesktop.dbus} and {\tt LEVEL} is one of {\tt NONE}, {\tt +CRIT}, {\tt ERR}, {\tt WARN}, {\tt INFO}, {\tt DEBUG}, {\tt VERBOSE}, {\tt +YES}, {\tt ALL} or {\tt TRUE}. This will set the debug level for a particular +class. Any messages from that class at that level or higher will be printed. +Verbose debugging is extremely verbose. + +In addition, setting the environment variable {\tt +DBUS\_JAVA\_EXCEPTION\_DEBUG} will cause all exceptions which are handled +internally to have their stack trace printed when they are handled. This will +happen unless debugging has been disabled for that class. + +\section{Peer to Peer} + +It is possible to connect two applications together directly without using a +bus. D-Bus calls this a peer-to-peer connection. + +The Java implementation provides an alternative to the {\tt DBusConnection} +class, the {\tt +DirectConnection\footnote{\url{\javadocroot/org/freedesktop/dbus/DirectConnection.html}}} +class. This allows you to connect two applications together directly without +the need of a bus. + +When using a DirectConnection rather than a DBusConnection most operations are +the same. The only things which differ are how you connect and the operations +which depend on a bus. Since peer connections are only one-to-one there is no +destination or source address to messages. There is also no {\tt +org.freedesktop.DBus} service running on the bus. + +\subsection{Connecting to another application} + +To connect with a peer connection one of the two applications must be listening +on the socket and the other connecting. Both of these use the same method to +instantiate the {\tt DirectConnection} but with different addresses. To listen +rather than connect you add the {\em ``listen=true''} parameter to the address. +Listening and connecting can be seen in figures \ref{fig:p2plisten} and +\ref{fig:p2pconnect} respectively. Listening will block at creating the +connection until the other application has connected. + +{\tt DirectConnection} also provides a {\tt createDynamicSession} method which +generates a random abstract unix socket address to use. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +DirectConnection dc = new DirectConnection("unix:path=/tmp/dbus-ABCXYZ,listen=true"); +\end{verbatim} +\end{center} +\caption{Listening for a peer connection} +\label{fig:p2plisten} +\end{figure} + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +DirectConnection dc = new DirectConnection("unix:path=/tmp/dbus-ABCXYZ"); +\end{verbatim} +\end{center} +\caption{Connecting to a peer connection} +\label{fig:p2pconnect} +\end{figure} + +\subsection{Getting Remote Objects} + +Getting a remote object is essentially the same as with a bus connection, +except that you do not have to specify a bus name, only an object path. There +is also no {\tt getPeerRemoteObject} method, since there can only be one peer +on this connection. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +RemoteInterface remote = dc.getRemoteObject("/Path"); +remote.doStuff(); +\end{verbatim} +\end{center} +\caption{Getting a remote object on a peer connection} +\label{fig:p2premote} +\end{figure} + +The rest of the API is the same for peer connections as bus connections, +ommiting any bus addresses. + +\section{Low-level API} + +In very rare circumstances it may be neccessary to deal directly with messages +on the bus, rather than with objects and method calls. This implementation +gives the programmer access to this low-level API but its use is strongly +recommended against. + +To use the low-level API you use a different set of classes than with the +normal API. + +\subsection{Transport} + +The {\tt Transport\footnote{\url{\javadocroot/org/freedesktop/dbus/Transport.html}}} +class is used to connect to the underlying transport with a bus address and to +send and receive messages. + +You connect by either creating a {\tt Transport} object with the bus address as +the parameter, or by calling {\tt connect} with the address later. Addresses +are represented using the {\tt BusAddress} class. + +Messages can be read by calling {\tt transport.min.readMessage()} and written +by using the {\tt transport.mout.writeMessage(m)} methods. + +\subsection{Message} + +{\tt Message\footnote{\url{\javadocroot/org/freedesktop/dbus/Message.html}}} is the +superclass of all the classes representing a message. To send a message you +need to create a subclass of this object. Possible message types are: {\tt +MethodCall}, {\tt MethodReturn}, {\tt Error} and {\tt DBusSignal}. Constructors +for these vary, but they are basically similar to the {\tt MethodCall} class. + +All the constructors have variadic parameter lists with the last of the +parameters being the signature of the message body and the parameters which +make up the body. If the message has an empty body then the last parameter must +be null. Reading and writing messages is not thread safe. + +Messages can be read either in blocking or non-blocking mode. When reading a +message in non-blocking mode, if a full message has not yet been read from the +transport the method will return null. Messages are instantiated as the correct +message type, so {\tt instanceof} will work on the returned object. Blocking +mode can be enabled with an extra parameter to the Transport constructor. + +Figure \ref{fig:lowlevel} shows how to connect to a bus, send the (required) +initial `Hello' message and +call a method with two parameters. + +\begin{figure}[htb] +\begin{center} +\begin{verbatim} +BusAddress address = new BusAddress( + System.getenv("DBUS_SESSION_BUS_ADDRESS")); +Transport conn = new Transport(address, true); + +Message m = new MethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", + "org.freedesktop. DBus", "Hello", (byte) 0, null); +conn.mout.writeMessage(m); + +m = conn.min.readMessage(); +System.out.println("Response to Hello is: "+m); + +m = new MethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", + "org.freedesktop.DBus", "RequestName", (byte) 0, + "su", "org.testname", 0); +conn.mout.writeMessage(m); + +conn.disconnect(); +\end{verbatim} +\end{center} +\caption{Low-level usage} +\label{fig:lowlevel} +\end{figure} + +\section{Examples} + +As an example here are a complete set of interfaces for the +bluemon\footnote{http://www.matthew.ath.cx/projects/bluemon} daemon, +which communicates over D-Bus. These interfaces were all created by +querying introspection data over the bus. + +\newpage + +\begin{figure}[!h] +\begin{center} +\begin{verbatim} +package cx.ath.matthew.bluemon; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.UInt32; +public interface Bluemon extends DBusInterface +{ + public Triplet + Status(String address); +} +\end{verbatim} +\end{center} +\caption{cx/ath/matthew/bluemon/Bluemon.java} +\end{figure} + +\newpage + +\begin{figure}[!h] +\begin{center} +\begin{verbatim} +package cx.ath.matthew.bluemon; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; +public interface ProximitySignal extends DBusInterface +{ + public static class Connect extends DBusSignal + { + public final String address; + public Connect(String path, String address) + throws DBusException + { + super(path, address); + this.address = address; + } + } + public static class Disconnect extends DBusSignal + { + public final String address; + public Disconnect(String path, String address) + throws DBusException + { + super(path, address); + this.address = address; + } + } +} +\end{verbatim} +\end{center} +\caption{cx/ath/matthew/bluemon/ProximitySignal.java} +\end{figure} + +\newpage + +\begin{figure}[!h] +\begin{center} +\begin{verbatim} +package cx.ath.matthew.bluemon; +import org.freedesktop.dbus.Tuple; +/** Just a typed container class */ +public final class Triplet extends Tuple +{ + public final A a; + public final B b; + public final C c; + public Triplet(A a, B b, C c) + { + super(a, b, c); + this.a = a; + this.b = b; + this.c = c; + } +} +\end{verbatim} +\end{center} +\caption{cx/ath/matthew/bluemon/Triplet.java} +\end{figure} + +\newpage + +\begin{figure}[!h] +\begin{center} +\begin{verbatim} +package cx.ath.matthew.bluemon; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; + +public class Query { + public static void main(String[] args) { + String btid; + Triplet rv = null; + + if (0 == args.length) btid = ""; + else btid = args[0]; + + DBusConnection conn = null; + try { + conn = DBusConnection.getConnection(DBusConnection.SYSTEM); + } catch (DBusException De) { + System.exit(1); + } + Bluemon b = (Bluemon) conn.getRemoteObject( + "cx.ath.matthew.bluemon.server", + "/cx/ath/matthew/bluemon/Bluemon", Bluemon.class); + try { + rv = b.Status(btid); + } catch (RuntimeException Re) { + System.exit(1); + } + String address = rv.a; + boolean status = rv.b; + int level = rv.c.intValue(); + + if (status) + System.out.println("Device "+address+ + " connected with level "+level); + else + System.out.println("Device "+address+" not connected"); + conn.disconnect(); + } +} +\end{verbatim} +\end{center} +\caption{cx/ath/matthew/bluemon/Query.java} +\end{figure} + +\newpage + +\begin{figure}[!h] +\begin{center} +\begin{verbatim} +/* cx/ath/matthew/bluemon/Client.java */ +package cx.ath.matthew.bluemon; + +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; + +public class Client implements DBusSigHandler +{ + public void handle(DBusSignal s) + { + if (s instanceof ProximitySignal.Connect) + System.out.println("Got a connect for " + +((ProximitySignal.Connect) s).address); + else if (s instanceof ProximitySignal.Disconnect) + System.out.println("Got a disconnect for " + +((ProximitySignal.Disconnect) s).address); + } + public static void main(String[] args) + { + System.out.println("Creating Connection"); + DBusConnection conn = null; + try { + conn = DBusConnection + .getConnection(DBusConnection.SYSTEM); + } catch (DBusException DBe) { + System.out.println("Could not connect to bus"); + System.exit(1); + } + + try { + conn.addSigHandler(ProximitySignal.Connect.class, + new Client()); + conn.addSigHandler(ProximitySignal.Disconnect.class, + new Client()); + } catch (DBusException DBe) { + conn.disconnect(); + System.exit(1); + } + } +} +\end{verbatim} +\end{center} +\caption{cx/ath/matthew/bluemon/Client.java} +\end{figure} + +\newpage + +\section{Credits} + +This document and the Java API were written by and are copyright to +Matthew Johnson. Much help and advice was provided by the members of +the \#dbus irc channel. Comments, corrections and patches can be sent +to dbus-java@matthew.ath.cx. + +\end{document} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/DBus.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/DBus.java new file mode 100755 index 0000000..5d99a64 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/DBus.java @@ -0,0 +1,490 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import java.util.Map; +import java.util.List; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Tuple; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.UInt64; +import org.freedesktop.dbus.Variant; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +public interface DBus extends DBusInterface +{ + public static final int DBUS_NAME_FLAG_ALLOW_REPLACEMENT = 0x01; + public static final int DBUS_NAME_FLAG_REPLACE_EXISTING = 0x02; + public static final int DBUS_NAME_FLAG_DO_NOT_QUEUE = 0x04; + public static final int DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER = 1; + public static final int DBUS_REQUEST_NAME_REPLY_IN_QUEUE = 2; + public static final int DBUS_REQUEST_NAME_REPLY_EXISTS = 3; + public static final int DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER = 4; + public static final int DBUS_RELEASE_NAME_REPLY_RELEASED = 1; + public static final int DBUS_RELEASE_NAME_REPLY_NON_EXISTANT = 2; + public static final int DBUS_RELEASE_NAME_REPLY_NOT_OWNER = 3; + public static final int DBUS_START_REPLY_SUCCESS = 1; + public static final int DBUS_START_REPLY_ALREADY_RUNNING = 2; + /** + * All DBus Applications should respond to the Ping method on this interface + */ + public interface Peer extends DBusInterface + { + public void Ping(); + } + /** + * Objects can provide introspection data via this interface and method. + * See the Introspection Format. + */ + public interface Introspectable extends DBusInterface + { + /** + * @return The XML introspection data for this object + */ + public String Introspect(); + } + /** + * A standard properties interface. + */ + public interface Properties extends DBusInterface + { + /** + * Get the value for the given property. + * @param interface_name The interface this property is associated with. + * @param property_name The name of the property. + * @return The value of the property (may be any valid DBus type). + */ + public A Get (String interface_name, String property_name); + /** + * Set the value for the given property. + * @param interface_name The interface this property is associated with. + * @param property_name The name of the property. + * @param value The new value of the property (may be any valid DBus type). + */ + public void Set (String interface_name, String property_name, A value); + /** + * Get all properties and values. + * @param interface_name The interface the properties is associated with. + * @return The properties mapped to their values. + */ + public Map GetAll (String interface_name); + } + /** + * Messages generated locally in the application. + */ + public interface Local extends DBusInterface + { + public class Disconnected extends DBusSignal + { + public Disconnected(String path) throws DBusException + { + super(path); + } + } + } + + /** + * Initial message to register ourselves on the Bus. + * @return The unique name of this connection to the Bus. + */ + public String Hello(); + /** + * Lists all connected names on the Bus. + * @return An array of all connected names. + */ + public String[] ListNames(); + /** + * Determine if a name has an owner. + * @param name The name to query. + * @return true if the name has an owner. + */ + public boolean NameHasOwner(String name); + /** + * Get the connection unique name that owns the given name. + * @param name The name to query. + * @return The connection which owns the name. + */ + public String GetNameOwner(String name); + /** + * Get the Unix UID that owns a connection name. + * @param connection_name The connection name. + * @return The Unix UID that owns it. + */ + public UInt32 GetConnectionUnixUser(String connection_name); + /** + * Start a service. If the given service is not provided + * by any application, it will be started according to the .service file + * for that service. + * @param name The service name to start. + * @param flags Unused. + * @return DBUS_START_REPLY constants. + */ + public UInt32 StartServiceByName(String name, UInt32 flags); + /** + * Request a name on the bus. + * @param name The name to request. + * @param flags DBUS_NAME flags. + * @return DBUS_REQUEST_NAME_REPLY constants. + */ + public UInt32 RequestName(String name, UInt32 flags); + /** + * Release a name on the bus. + * @param name The name to release. + * @return DBUS_RELEASE_NAME_REPLY constants. + */ + public UInt32 ReleaseName(String name); + + /** + * Add a match rule. + * Will cause you to receive messages that aren't directed to you which + * match this rule. + * @param matchrule The Match rule as a string. Format Undocumented. + */ + public void AddMatch(String matchrule) throws Error.MatchRuleInvalid; + + /** + * Remove a match rule. + * Will cause you to stop receiving messages that aren't directed to you which + * match this rule. + * @param matchrule The Match rule as a string. Format Undocumented. + */ + public void RemoveMatch(String matchrule) throws Error.MatchRuleInvalid; + + /** + * List the connections currently queued for a name. + * @param name The name to query + * @return A list of unique connection IDs. + */ + public String[] ListQueuedOwners(String name); + + /** + * Returns the proccess ID associated with a connection. + * @param connection_name The name of the connection + * @return The PID of the connection. + */ + public UInt32 GetConnectionUnixProcessID(String connection_name); + + /** + * Does something undocumented. + */ + public Byte[] GetConnectionSELinuxSecurityContext(String a); + + /** + * Does something undocumented. + */ + public void ReloadConfig(); + + /** + * Signal sent when the owner of a name changes + */ + public class NameOwnerChanged extends DBusSignal + { + public final String name; + public final String old_owner; + public final String new_owner; + public NameOwnerChanged(String path, String name, String old_owner, String new_owner) throws DBusException + { + super(path, new Object[] { name, old_owner, new_owner }); + this.name = name; + this.old_owner = old_owner; + this.new_owner = new_owner; + } + } + /** + * Signal sent to a connection when it loses a name + */ + public class NameLost extends DBusSignal + { + public final String name; + public NameLost(String path, String name) throws DBusException + { + super(path, name); + this.name = name; + } + } + /** + * Signal sent to a connection when it aquires a name + */ + public class NameAcquired extends DBusSignal + { + public final String name; + public NameAcquired(String path, String name) throws DBusException + { + super(path, name); + this.name = name; + } + } + /** + * Contains standard errors that can be thrown from methods. + */ + public interface Error + { + /** + * Thrown if the method called was unknown on the remote object + */ + @SuppressWarnings("serial") + public class UnknownMethod extends DBusExecutionException + { + public UnknownMethod(String message) + { + super(message); + } + } + /** + * Thrown if the object was unknown on a remote connection + */ + @SuppressWarnings("serial") + public class UnknownObject extends DBusExecutionException + { + public UnknownObject(String message) + { + super(message); + } + } + /** + * Thrown if the requested service was not available + */ + @SuppressWarnings("serial") + public class ServiceUnknown extends DBusExecutionException + { + public ServiceUnknown(String message) + { + super(message); + } + } + /** + * Thrown if the match rule is invalid + */ + @SuppressWarnings("serial") + public class MatchRuleInvalid extends DBusExecutionException + { + public MatchRuleInvalid(String message) + { + super(message); + } + } + /** + * Thrown if there is no reply to a method call + */ + @SuppressWarnings("serial") + public class NoReply extends DBusExecutionException + { + public NoReply(String message) + { + super(message); + } + } + /** + * Thrown if a message is denied due to a security policy + */ + @SuppressWarnings("serial") + public class AccessDenied extends DBusExecutionException + { + public AccessDenied(String message) + { + super(message); + } + } + } + /** + * Description of the interface or method, returned in the introspection data + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface Description + { + String value(); + } + /** + * Indicates that a DBus interface or method is deprecated + */ + @Retention(RetentionPolicy.RUNTIME) + public @interface Deprecated {} + /** + * Contains method-specific annotations + */ + public interface Method + { + /** + * Methods annotated with this do not send a reply + */ + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + public @interface NoReply {} + /** + * Give an error that the method can return + */ + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + public @interface Error + { + String value(); + } + } + /** + * Contains GLib-specific annotations + */ + public interface GLib + { + /** + * Define a C symbol to map to this method. Used by GLib only + */ + @Target(ElementType.METHOD) + @Retention(RetentionPolicy.RUNTIME) + public @interface CSymbol + { + String value(); + } + } + /** + * Contains Binding-test interfaces + */ + public interface Binding + { + public interface SingleTests extends DBusInterface + { + @Description("Returns the sum of the values in the input list") + public UInt32 Sum(byte[] a); + } + public interface TestClient extends DBusInterface + { + @Description("when the trigger signal is received, this method should be called on the sending process/object.") + public void Response(UInt16 a, double b); + @Description("Causes a callback") + public static class Trigger extends DBusSignal + { + public final UInt16 a; + public final double b; + public Trigger(String path, UInt16 a, double b) throws DBusException + { + super(path, a, b); + this.a = a; + this.b = b; + } + } + + } + public interface Tests extends DBusInterface + { + @Description("Returns whatever it is passed") + public Variant Identity(Variant input); + @Description("Returns whatever it is passed") + public byte IdentityByte(byte input); + @Description("Returns whatever it is passed") + public boolean IdentityBool(boolean input); + @Description("Returns whatever it is passed") + public short IdentityInt16(short input); + @Description("Returns whatever it is passed") + public UInt16 IdentityUInt16(UInt16 input); + @Description("Returns whatever it is passed") + public int IdentityInt32(int input); + @Description("Returns whatever it is passed") + public UInt32 IdentityUInt32(UInt32 input); + @Description("Returns whatever it is passed") + public long IdentityInt64(long input); + @Description("Returns whatever it is passed") + public UInt64 IdentityUInt64(UInt64 input); + @Description("Returns whatever it is passed") + public double IdentityDouble(double input); + @Description("Returns whatever it is passed") + public String IdentityString(String input); + @Description("Returns whatever it is passed") + public Variant[] IdentityArray(Variant[] input); + @Description("Returns whatever it is passed") + public byte[] IdentityByteArray(byte[] input); + @Description("Returns whatever it is passed") + public boolean[] IdentityBoolArray(boolean[] input); + @Description("Returns whatever it is passed") + public short[] IdentityInt16Array(short[] input); + @Description("Returns whatever it is passed") + public UInt16[] IdentityUInt16Array(UInt16[] input); + @Description("Returns whatever it is passed") + public int[] IdentityInt32Array(int[] input); + @Description("Returns whatever it is passed") + public UInt32[] IdentityUInt32Array(UInt32[] input); + @Description("Returns whatever it is passed") + public long[] IdentityInt64Array(long[] input); + @Description("Returns whatever it is passed") + public UInt64[] IdentityUInt64Array(UInt64[] input); + @Description("Returns whatever it is passed") + public double[] IdentityDoubleArray(double[] input); + @Description("Returns whatever it is passed") + public String[] IdentityStringArray(String[] input); + @Description("Returns the sum of the values in the input list") + public long Sum(int[] a); + @Description("Given a map of A => B, should return a map of B => a list of all the As which mapped to B") + public Map> InvertMapping(Map a); + @Description("This method returns the contents of a struct as separate values") + public Triplet DeStruct(TestStruct a); + @Description("Given any compound type as a variant, return all the primitive types recursively contained within as an array of variants") + public List> Primitize(Variant a); + @Description("inverts it's input") + public boolean Invert(boolean a); + @Description("triggers sending of a signal from the supplied object with the given parameter") + public void Trigger(String a, UInt64 b); + @Description("Causes the server to exit") + public void Exit(); + } + public interface TestSignals extends DBusInterface + { + @Description("Sent in response to a method call") + public static class Triggered extends DBusSignal + { + public final UInt64 a; + public Triggered(String path, UInt64 a) throws DBusException + { + super(path, a); + this.a = a; + } + } + } + public final class Triplet extends Tuple + { + @Position(0) + public final A a; + @Position(1) + public final B b; + @Position(2) + public final C c; + public Triplet(A a, B b, C c) + { + this.a = a; + this.b = b; + this.c = c; + } + } + public final class TestStruct extends Struct + { + @Position(0) + public final String a; + @Position(1) + public final UInt32 b; + @Position(2) + public final Short c; + public TestStruct(String a, UInt32 b, Short c) + { + this.a = a; + this.b = b; + this.c = c; + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/AbstractConnection.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/AbstractConnection.java new file mode 100755 index 0000000..3c2607e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/AbstractConnection.java @@ -0,0 +1,1075 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Type; + +import java.io.File; +import java.io.IOException; + +import java.text.MessageFormat; +import java.text.ParseException; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; +import java.util.Properties; +import java.util.Vector; + +import java.util.regex.Pattern; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.exceptions.NotConnected; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.FatalDBusException; +import org.freedesktop.dbus.exceptions.FatalException; + +import cx.ath.matthew.debug.Debug; + + +/** Handles a connection to DBus. + */ +public abstract class AbstractConnection +{ + protected class FallbackContainer + { + private Map fallbacks = new HashMap(); + public synchronized void add(String path, ExportedObject eo) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Adding fallback on "+path+" of "+eo); + fallbacks.put(path.split("/"), eo); + } + public synchronized void remove(String path) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Removing fallback on "+path); + fallbacks.remove(path.split("/")); + } + public synchronized ExportedObject get(String path) + { + int best = 0; + int i = 0; + ExportedObject bestobject = null; + String[] pathel = path.split("/"); + for (String[] fbpath: fallbacks.keySet()) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Trying fallback path "+Arrays.deepToString(fbpath)+" to match "+Arrays.deepToString(pathel)); + for (i = 0; i < pathel.length && i < fbpath.length; i++) + if (!pathel[i].equals(fbpath[i])) break; + if (i > 0 && i == fbpath.length && i > best) + bestobject = fallbacks.get(fbpath); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Matches "+i+" bestobject now "+bestobject); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "Found fallback for "+path+" of "+bestobject); + return bestobject; + } + } + protected class _thread extends Thread + { + public _thread() + { + setName("DBusConnection"); + } + public void run() + { + try { + Message m = null; + while (_run) { + m = null; + + // read from the wire + try { + // this blocks on outgoing being non-empty or a message being available. + m = readIncoming(); + if (m != null) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Got Incoming Message: "+m); + synchronized (this) { notifyAll(); } + + if (m instanceof DBusSignal) + handleMessage((DBusSignal) m); + else if (m instanceof MethodCall) + handleMessage((MethodCall) m); + else if (m instanceof MethodReturn) + handleMessage((MethodReturn) m); + else if (m instanceof Error) + handleMessage((Error) m); + + m = null; + } + } catch (Exception e) { + e.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + if (e instanceof FatalException) { + disconnect(); + } + } + + } + synchronized (this) { notifyAll(); } + } catch (Exception e) { + e.printStackTrace(); + if (Debug.debug && EXCEPTION_DEBUG) Debug.print(Debug.ERR, e); + } + } + } + private class _globalhandler implements org.freedesktop.DBus.Peer, org.freedesktop.DBus.Introspectable + { + private String objectpath; + public _globalhandler() + { + this.objectpath = null; + } + public _globalhandler(String objectpath) + { + this.objectpath = objectpath; + } + public boolean isRemote() { return false; } + public void Ping() { return; } + public String Introspect() + { + String intro = objectTree.Introspect(objectpath); + if (null == intro) { + ExportedObject eo = fallbackcontainer.get(objectpath); + if (null != eo) intro = eo.introspectiondata; + } + if (null == intro) + throw new DBus.Error.UnknownObject("Introspecting on non-existant object"); + else return + "\n"+intro; + } + } + protected class _workerthread extends Thread + { + private boolean _run = true; + public void halt() + { + _run = false; + } + public void run() + { + while (_run) { + Runnable r = null; + synchronized (runnables) { + while (runnables.size() == 0 && _run) + try { runnables.wait(); } catch (InterruptedException Ie) {} + if (runnables.size() > 0) + r = runnables.removeFirst(); + } + if (null != r) r.run(); + } + } + } + private class _sender extends Thread + { + public _sender() + { + setName("Sender"); + } + public void run() + { + Message m = null; + + if (Debug.debug) Debug.print(Debug.INFO, "Monitoring outbound queue"); + // block on the outbound queue and send from it + while (_run) { + if (null != outgoing) synchronized (outgoing) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Blocking"); + while (outgoing.size() == 0 && _run) + try { outgoing.wait(); } catch (InterruptedException Ie) {} + if (Debug.debug) Debug.print(Debug.VERBOSE, "Notified"); + if (outgoing.size() > 0) + m = outgoing.remove(); + if (Debug.debug) Debug.print(Debug.DEBUG, "Got message: "+m); + } + if (null != m) + sendMessage(m); + m = null; + } + + if (Debug.debug) Debug.print(Debug.INFO, "Flushing outbound queue and quitting"); + // flush the outbound queue before disconnect. + if (null != outgoing) do { + EfficientQueue ogq = outgoing; + synchronized (ogq) { + outgoing = null; + } + if (!ogq.isEmpty()) + m = ogq.remove(); + else m = null; + sendMessage(m); + } while (null != m); + + // close the underlying streams + } + } + /** + * Timeout in us on checking the BUS for incoming messages and sending outgoing messages + */ + protected static final int TIMEOUT = 100000; + /** Initial size of the pending calls map */ + private static final int PENDING_MAP_INITIAL_SIZE = 10; + static final String BUSNAME_REGEX = "^[-_a-zA-Z][-_a-zA-Z0-9]*(\\.[-_a-zA-Z][-_a-zA-Z0-9]*)*$"; + static final String CONNID_REGEX = "^:[0-9]*\\.[0-9]*$"; + static final String OBJECT_REGEX = "^/([-_a-zA-Z0-9]+(/[-_a-zA-Z0-9]+)*)?$"; + static final byte THREADCOUNT = 4; + static final int MAX_ARRAY_LENGTH = 67108864; + static final int MAX_NAME_LENGTH = 255; + + public static String currentSender = null; // pego + + protected Map exportedObjects; + private ObjectTree objectTree; + private _globalhandler _globalhandlerreference; + protected Map importedObjects; + protected Map>> handledSignals; + protected EfficientMap pendingCalls; + protected Map> pendingCallbacks; + protected Map> pendingCallbackReplys; + protected LinkedList runnables; + protected LinkedList<_workerthread> workers; + protected FallbackContainer fallbackcontainer; + protected boolean _run; + EfficientQueue outgoing; + LinkedList pendingErrors; + private static final Map infomap = new HashMap(); + protected _thread thread; + protected _sender sender; + protected Transport transport; + protected String addr; + protected boolean weakreferences = false; + static final Pattern dollar_pattern = Pattern.compile("[$]"); + public static final boolean EXCEPTION_DEBUG; + static final boolean FLOAT_SUPPORT; + protected boolean connected = false; + static { + FLOAT_SUPPORT = (null != System.getenv("DBUS_JAVA_FLOATS")); + EXCEPTION_DEBUG = (null != System.getenv("DBUS_JAVA_EXCEPTION_DEBUG")); + if (EXCEPTION_DEBUG) { + Debug.print("Debugging of internal exceptions enabled"); + Debug.setThrowableTraces(true); + } + if (Debug.debug) { + File f = new File("debug.conf"); + if (f.exists()) { + Debug.print("Loading debug config file: "+f); + try { + Debug.loadConfig(f); + } catch (IOException IOe) {} + } else { + Properties p = new Properties(); + p.setProperty("ALL", "INFO"); + Debug.print("debug config file "+f+" does not exist, not loading."); + } + Debug.setHexDump(true); + } + } + + protected AbstractConnection(String address) throws DBusException + { + exportedObjects = new HashMap(); + importedObjects = new HashMap(); + _globalhandlerreference = new _globalhandler(); + synchronized (exportedObjects) { + exportedObjects.put(null, new ExportedObject(_globalhandlerreference, weakreferences)); + } + handledSignals = new HashMap>>(); + pendingCalls = new EfficientMap(PENDING_MAP_INITIAL_SIZE); + outgoing = new EfficientQueue(PENDING_MAP_INITIAL_SIZE); + pendingCallbacks = new HashMap>(); + pendingCallbackReplys = new HashMap>(); + pendingErrors = new LinkedList(); + runnables = new LinkedList(); + workers = new LinkedList<_workerthread>(); + objectTree = new ObjectTree(); + fallbackcontainer = new FallbackContainer(); + synchronized (workers) { + for (int i = 0; i < THREADCOUNT; i++) { + _workerthread t = new _workerthread(); + t.start(); + workers.add(t); + } + } + _run = true; + addr = address; + } + + protected void listen() + { + // start listening + thread = new _thread(); + thread.start(); + sender = new _sender(); + sender.start(); + } + + /** + * Change the number of worker threads to receive method calls and handle signals. + * Default is 4 threads + * @param newcount The new number of worker Threads to use. + */ + public void changeThreadCount(byte newcount) + { + synchronized (workers) { + if (workers.size() > newcount) { + int n = workers.size() - newcount; + for (int i = 0; i < n; i++) { + _workerthread t = workers.removeFirst(); + t.halt(); + } + } else if (workers.size() < newcount) { + int n = newcount-workers.size(); + for (int i = 0; i < n; i++) { + _workerthread t = new _workerthread(); + t.start(); + workers.add(t); + } + } + } + } + private void addRunnable(Runnable r) + { + synchronized(runnables) { + runnables.add(r); + runnables.notifyAll(); + } + } + + String getExportedObject(DBusInterface i) throws DBusException + { + synchronized (exportedObjects) { + for (String s: exportedObjects.keySet()) + if (i.equals(exportedObjects.get(s).object.get())) + return s; + } + + String s = importedObjects.get(i).objectpath; + if (null != s) return s; + + throw new DBusException("Not an object exported or imported by this connection"); + } + + abstract DBusInterface getExportedObject(String source, String path) throws DBusException; + + /** + * Returns a structure with information on the current method call. + * @return the DBusCallInfo for this method call, or null if we are not in a method call. + */ + public static DBusCallInfo getCallInfo() + { + DBusCallInfo info; + synchronized (infomap) { + info = infomap.get(Thread.currentThread()); + } + return info; + } + + /** + * If set to true the bus will not hold a strong reference to exported objects. + * If they go out of scope they will automatically be unexported from the bus. + * The default is to hold a strong reference, which means objects must be + * explicitly unexported before they will be garbage collected. + */ + public void setWeakReferences(boolean weakreferences) + { + this.weakreferences = weakreferences; + } + + /** + * Export an object so that its methods can be called on DBus. + * @param objectpath The path to the object we are exposing. MUST be in slash-notation, like "/org/freedesktop/Local", + * and SHOULD end with a capitalised term. Only one object may be exposed on each path at any one time, but an object + * may be exposed on several paths at once. + * @param object The object to export. + * @throws DBusException If the objectpath is already exporting an object. + * or if objectpath is incorrectly formatted, + */ + public void exportObject(String objectpath, DBusInterface object) throws DBusException + { + if (null == objectpath || "".equals(objectpath)) + throw new DBusException(_("Must Specify an Object Path")); + if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + synchronized (exportedObjects) { + if (null != exportedObjects.get(objectpath)) + throw new DBusException(_("Object already exported")); + ExportedObject eo = new ExportedObject(object, weakreferences); + exportedObjects.put(objectpath, eo); + objectTree.add(objectpath, eo, eo.introspectiondata); + } + } + /** + * Export an object as a fallback object. + * This object will have it's methods invoked for all paths starting + * with this object path. + * @param objectprefix The path below which the fallback handles calls. + * MUST be in slash-notation, like "/org/freedesktop/Local", + * @param object The object to export. + * @throws DBusException If the objectpath is incorrectly formatted, + */ + public void addFallback(String objectprefix, DBusInterface object) throws DBusException + { + if (null == objectprefix || "".equals(objectprefix)) + throw new DBusException(_("Must Specify an Object Path")); + if (!objectprefix.matches(OBJECT_REGEX)||objectprefix.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectprefix); + ExportedObject eo = new ExportedObject(object, weakreferences); + fallbackcontainer.add(objectprefix, eo); + } + /** + * Remove a fallback + * @param objectprefix The prefix to remove the fallback for. + */ + public void removeFallback(String objectprefix) + { + fallbackcontainer.remove(objectprefix); + } + /** + * Stop Exporting an object + * @param objectpath The objectpath to stop exporting. + */ + public void unExportObject(String objectpath) + { + synchronized (exportedObjects) { + exportedObjects.remove(objectpath); + objectTree.remove(objectpath); + } + } + /** + * Return a reference to a remote object. + * This method will resolve the well known name (if given) to a unique bus name when you call it. + * This means that if a well known name is released by one process and acquired by another calls to + * objects gained from this method will continue to operate on the original process. + * @param busname The bus name to connect to. Usually a well known bus name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object.$ + * @param type The interface they are exporting it on. This type must have the same full class name and exposed method signatures + * as the interface the remote object is exporting. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted or type is not in a package. + */ + /** + * Send a signal. + * @param signal The signal to send. + */ + public void sendSignal(DBusSignal signal) + { + queueOutgoing(signal); + } + void queueOutgoing(Message m) + { + synchronized (outgoing) { + if (null == outgoing) return; + outgoing.add(m); + if (Debug.debug) Debug.print(Debug.DEBUG, "Notifying outgoing thread"); + outgoing.notifyAll(); + } + } + /** + * Remove a Signal Handler. + * Stops listening for this signal. + * @param type The signal to watch for. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + public void removeSigHandler(Class type, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + removeSigHandler(new DBusMatchRule(type), handler); + } + /** + * Remove a Signal Handler. + * Stops listening for this signal. + * @param type The signal to watch for. + * @param object The object emitting the signal. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + public void removeSigHandler(Class type, DBusInterface object, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + String objectpath = importedObjects.get(object).objectpath; + if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + removeSigHandler(new DBusMatchRule(type, null, objectpath), handler); + } + + protected abstract void removeSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException; + /** + * Add a Signal Handler. + * Adds a signal handler to call when a signal is received which matches the specified type and name. + * @param type The signal to watch for. + * @param handler The handler to call when a signal is received. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + @SuppressWarnings("unchecked") + public void addSigHandler(Class type, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + addSigHandler(new DBusMatchRule(type), (DBusSigHandler) handler); + } + /** + * Add a Signal Handler. + * Adds a signal handler to call when a signal is received which matches the specified type, name and object. + * @param type The signal to watch for. + * @param object The object from which the signal will be emitted + * @param handler The handler to call when a signal is received. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + @SuppressWarnings("unchecked") + public void addSigHandler(Class type, DBusInterface object, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + String objectpath = importedObjects.get(object).objectpath; + if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + addSigHandler(new DBusMatchRule(type, null, objectpath), (DBusSigHandler) handler); + } + + protected abstract void addSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException; + + // pego was protedted, made public + public void addSigHandlerWithoutMatch(Class signal, DBusSigHandler handler) throws DBusException + { + DBusMatchRule rule = new DBusMatchRule(signal); + SignalTuple key = new SignalTuple(rule.getInterface(), rule.getMember(), rule.getObject(), rule.getSource()); + synchronized (handledSignals) { + Vector> v = handledSignals.get(key); + if (null == v) { + v = new Vector>(); + v.add(handler); + handledSignals.put(key, v); + } else + v.add(handler); + } + } + + /** + * Disconnect from the Bus. + */ + public void disconnect() + { + connected = false; + if (Debug.debug) Debug.print(Debug.INFO, "Sending disconnected signal"); + try { + handleMessage(new org.freedesktop.DBus.Local.Disconnected("/")); + } catch (Exception ee) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, ee); + } + + if (Debug.debug) Debug.print(Debug.INFO, "Disconnecting Abstract Connection"); + // run all pending tasks. + while (runnables.size() > 0) + synchronized (runnables) { + runnables.notifyAll(); + } + + // stop the main thread + _run = false; + + // unblock the sending thread. + synchronized (outgoing) { + outgoing.notifyAll(); + } + + // disconnect from the trasport layer + try { + if (null != transport) { + transport.disconnect(); + transport = null; + } + } catch (IOException IOe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, IOe); + } + + // stop all the workers + synchronized(workers) { + for (_workerthread t: workers) + t.halt(); + } + + // make sure none are blocking on the runnables queue still + synchronized (runnables) { + runnables.notifyAll(); + } + } + + public void finalize() + { + disconnect(); + } + /** + * Return any DBus error which has been received. + * @return A DBusExecutionException, or null if no error is pending. + */ + public DBusExecutionException getError() + { + synchronized (pendingErrors) { + if (pendingErrors.size() == 0) return null; + else + return pendingErrors.removeFirst().getException(); + } + } + + /** + * Call a method asynchronously and set a callback. + * This handler will be called in a separate thread. + * @param object The remote object on which to call the method. + * @param m The name of the method on the interface to call. + * @param callback The callback handler. + * @param parameters The parameters to call the method with. + */ + @SuppressWarnings("unchecked") + public void callWithCallback(DBusInterface object, String m, CallbackHandler callback, Object... parameters) + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "callWithCallback("+object+","+m+", "+callback); + Class[] types = new Class[parameters.length]; + for (int i = 0; i < parameters.length; i++) + types[i] = parameters[i].getClass(); + RemoteObject ro = importedObjects.get(object); + + try { + Method me = null; + if (null == ro.iface) + me = object.getClass().getMethod(m, types); + else { + Method[] methods = ro.iface.getMethods(); + for (Method method: methods) { +// System.out.println(method.getName()); + for (Class parameterType: method.getParameterTypes()) { +// System.out.println("parameter: " + parameterType.getName()); + } + if (method.getName().equals(m)) { + me = method; + } + } +// Following code doesn't work: if actual paremeter is BasicEList and definition of parameter is List, the method is not found +// try { +// Method me2 = ro.iface.getMethod(m, types); +// } catch (NoSuchMethodException e) { +// System.out.println("NoSuchMethodException: method name = " + m); +// for (Class type: types) { +// System.out.println("type = " + type.getName()); +// } +// } + } + RemoteInvocationHandler.executeRemoteMethod(ro, me, this, RemoteInvocationHandler.CALL_TYPE_CALLBACK, callback, parameters); + } catch (DBusExecutionException DBEe) { + DBEe.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw DBEe; + } catch (Exception e) { + e.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusExecutionException(e.getMessage()); + } + } + + /** + * Call a method asynchronously and get a handle with which to get the reply. + * @param object The remote object on which to call the method. + * @param m The name of the method on the interface to call. + * @param parameters The parameters to call the method with. + * @return A handle to the call. + */ + @SuppressWarnings("unchecked") + public DBusAsyncReply callMethodAsync(DBusInterface object, String m, Object... parameters) + { + Class[] types = new Class[parameters.length]; + for (int i = 0; i < parameters.length; i++) + types[i] = parameters[i].getClass(); + RemoteObject ro = importedObjects.get(object); + + try { + Method me = null; + if (null == ro.iface) { +// System.out.println("ro.iface == null"); + me = object.getClass().getMethod(m, types); + } else { +// System.out.println("ro.iface != null"); + Method[] methods = ro.iface.getMethods(); + for (Method method: methods) { +// System.out.println(method.getName()); +// for (Class parameterType: method.getParameterTypes()) { +// System.out.println("parameter: " + parameterType.getName()); +// } + if (method.getName().equals(m)) { + me = method; + } + } +// me = ro.iface.getMethod(m, types); +// System.out.println("me = " + me); + } + return (DBusAsyncReply) RemoteInvocationHandler.executeRemoteMethod(ro, me, this, RemoteInvocationHandler.CALL_TYPE_ASYNC, null, parameters); + } catch (DBusExecutionException DBEe) { + DBEe.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw DBEe; + } catch (Exception e) { + e.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusExecutionException(e.getMessage()); + } + } + + private void handleMessage(final MethodCall m) throws DBusException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Handling incoming method call: "+m); + + currentSender = m.getSource(); // pego + ExportedObject eo = null; + Method meth = null; + Object o = null; + + if (null == m.getInterface() || + m.getInterface().equals("org.freedesktop.DBus.Peer") || + m.getInterface().equals("org.freedesktop.DBus.Introspectable")) { + synchronized (exportedObjects) { + eo = exportedObjects.get(null); + } + if (null != eo && null == eo.object.get()) { + unExportObject(null); + eo = null; + } + if (null != eo) { + meth = eo.methods.get(new MethodTuple(m.getName(), m.getSig())); + } + if (null != meth) + o = new _globalhandler(m.getPath()); + else + eo = null; + } + if (null == o) { + // now check for specific exported functions + + synchronized (exportedObjects) { + eo = exportedObjects.get(m.getPath()); + } + if (null != eo && null == eo.object.get()) { + if (Debug.debug) Debug.print(Debug.INFO, "Unexporting "+m.getPath()+" implicitly"); + unExportObject(m.getPath()); + eo = null; + } + + if (null == eo) { + eo = fallbackcontainer.get(m.getPath()); + } + + if (null == eo) { + try { + queueOutgoing(new Error(m, new DBus.Error.UnknownObject(m.getPath()+_(" is not an object provided by this process.")))); + } catch (DBusException DBe) {} + return; + } + if (Debug.debug) { + Debug.print(Debug.VERBOSE, "Searching for method "+m.getName()+" with signature "+m.getSig()); + Debug.print(Debug.VERBOSE, "List of methods on "+eo+":"); + for (MethodTuple mt: eo.methods.keySet()) + Debug.print(Debug.VERBOSE, " "+mt+" => "+eo.methods.get(mt)); + } + meth = eo.methods.get(new MethodTuple(m.getName(), m.getSig())); + if (null == meth) { + try { + queueOutgoing(new Error(m, new DBus.Error.UnknownMethod(MessageFormat.format(_("The method `{0}.{1}' does not exist on this object."), new Object[] { m.getInterface(), m.getName() })))); + } catch (DBusException DBe) {} + return; + } + o = eo.object.get(); + } + + // now execute it + final Method me = meth; + final Object ob = o; + final boolean noreply = (1 == (m.getFlags() & Message.Flags.NO_REPLY_EXPECTED)); + final DBusCallInfo info = new DBusCallInfo(m); + final AbstractConnection conn = this; + if (Debug.debug) Debug.print(Debug.VERBOSE, "Adding Runnable for method "+meth); + addRunnable(new Runnable() + { + private boolean run = false; + public synchronized void run() + { + if (run) return; + run = true; + if (Debug.debug) Debug.print(Debug.DEBUG, "Running method "+me+" for remote call"); + try { + Type[] ts = me.getGenericParameterTypes(); + m.setArgs(Marshalling.deSerializeParameters(m.getParameters(), ts, conn)); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserialised "+Arrays.deepToString(m.getParameters())+" to types "+Arrays.deepToString(ts)); + } catch (Exception e) { + e.printStackTrace(); + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + try { + conn.queueOutgoing(new Error(m, new DBus.Error.UnknownMethod(_("Failure in de-serializing message: ")+e))); + } catch (DBusException DBe) {} + return; + } + + try { + synchronized (infomap) { + infomap.put(Thread.currentThread(), info); + } + Object result; + try { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Invoking Method: "+me+" on "+ob+" with parameters "+Arrays.deepToString(m.getParameters())); + result = me.invoke(ob, m.getParameters()); + } catch (InvocationTargetException ITe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, ITe.getCause()); + throw ITe.getCause(); + } + synchronized (infomap) { + infomap.remove(Thread.currentThread()); + } + if (!noreply) { + MethodReturn reply; + if (Void.TYPE.equals(me.getReturnType())) + reply = new MethodReturn(m, null); + else { + StringBuffer sb = new StringBuffer(); + for (String s: Marshalling.getDBusType(me.getGenericReturnType())) + sb.append(s); + Object[] nr = Marshalling.convertParameters(new Object[] { result }, new Type[] {me.getGenericReturnType()}, conn); + + reply = new MethodReturn(m, sb.toString(),nr); + } + conn.queueOutgoing(reply); + } + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + try { + conn.queueOutgoing(new Error(m, DBEe)); + } catch (DBusException DBe) {} + } catch (Throwable e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + try { + conn.queueOutgoing(new Error(m, new DBusExecutionException(MessageFormat.format(_("Error Executing Method {0}.{1}: {2}"), new Object[] { m.getInterface(), m.getName(), e.getMessage() })))); + } catch (DBusException DBe) {} + } + } + }); + } + @SuppressWarnings({"unchecked","deprecation"}) + private void handleMessage(final DBusSignal s) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Handling incoming signal: "+s); + Vector> v = new Vector>(); + synchronized(handledSignals) { + Vector> t; + t = handledSignals.get(new SignalTuple(s.getInterface(), s.getName(), null, null)); + if (null != t) v.addAll(t); + t = handledSignals.get(new SignalTuple(s.getInterface(), s.getName(), s.getPath(), null)); + if (null != t) v.addAll(t); + t = handledSignals.get(new SignalTuple(s.getInterface(), s.getName(), null, s.getSource())); + if (null != t) v.addAll(t); + t = handledSignals.get(new SignalTuple(s.getInterface(), s.getName(), s.getPath(), s.getSource())); + if (null != t) v.addAll(t); + } + if (0 == v.size()) return; + final AbstractConnection conn = this; + for (final DBusSigHandler h: v) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Adding Runnable for signal "+s+" with handler "+h); + addRunnable(new Runnable() { + private boolean run = false; + public synchronized void run() + { + if (run) return; + run = true; + try { + DBusSignal rs; + if (s instanceof DBusSignal.internalsig || s.getClass().equals(DBusSignal.class)) + rs = s.createReal(conn); + else + rs = s; + ((DBusSigHandler)h).handle(rs); + } catch (DBusException DBe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + try { + conn.queueOutgoing(new Error(s, new DBusExecutionException("Error handling signal "+s.getInterface()+"."+s.getName()+": "+DBe.getMessage()))); + } catch (DBusException DBe2) {} + } + } + }); + } + } + private void handleMessage(final Error err) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Handling incoming error: "+err); + MethodCall m = null; + if (null == pendingCalls) return; + synchronized (pendingCalls) { + if (pendingCalls.contains(err.getReplySerial())) + m = pendingCalls.remove(err.getReplySerial()); + } + if (null != m) { + m.setReply(err); + CallbackHandler cbh = null; + DBusAsyncReply asr = null; + synchronized (pendingCallbacks) { + cbh = pendingCallbacks.remove(m); + if (Debug.debug) Debug.print(Debug.VERBOSE, cbh+" = pendingCallbacks.remove("+m+")"); + asr = pendingCallbackReplys.remove(m); + } + // queue callback for execution + if (null != cbh) { + final CallbackHandler fcbh = cbh; + if (Debug.debug) Debug.print(Debug.VERBOSE, "Adding Error Runnable with callback handler "+fcbh); + addRunnable(new Runnable() { + private boolean run = false; + public synchronized void run() + { + if (run) return; + run = true; + try { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Running Error Callback for "+err); + DBusCallInfo info = new DBusCallInfo(err); + synchronized (infomap) { + infomap.put(Thread.currentThread(), info); + } + + fcbh.handleError(err.getException()); + synchronized (infomap) { + infomap.remove(Thread.currentThread()); + } + + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + } + } + }); + } + + } + else + synchronized (pendingErrors) { + pendingErrors.addLast(err); } + } + @SuppressWarnings("unchecked") + private void handleMessage(final MethodReturn mr) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Handling incoming method return: "+mr); + MethodCall m = null; + if (null == pendingCalls) return; + synchronized (pendingCalls) { + if (pendingCalls.contains(mr.getReplySerial())) + m = pendingCalls.remove(mr.getReplySerial()); + } + if (null != m) { + m.setReply(mr); + mr.setCall(m); + CallbackHandler cbh = null; + DBusAsyncReply asr = null; + synchronized (pendingCallbacks) { + cbh = pendingCallbacks.remove(m); + if (Debug.debug) Debug.print(Debug.VERBOSE, cbh+" = pendingCallbacks.remove("+m+")"); + asr = pendingCallbackReplys.remove(m); + } + // queue callback for execution + if (null != cbh) { + final CallbackHandler fcbh = cbh; + final DBusAsyncReply fasr = asr; + if (Debug.debug) Debug.print(Debug.VERBOSE, "Adding Runnable for method "+fasr.getMethod()+" with callback handler "+fcbh); + addRunnable(new Runnable() { + private boolean run = false; + public synchronized void run() + { + if (run) return; + run = true; + try { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Running Callback for "+mr); + DBusCallInfo info = new DBusCallInfo(mr); + synchronized (infomap) { + infomap.put(Thread.currentThread(), info); + } + + fcbh.handle(RemoteInvocationHandler.convertRV(mr.getSig(), mr.getParameters(), fasr.getMethod(), fasr.getConnection())); + synchronized (infomap) { + infomap.remove(Thread.currentThread()); + } + + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + } + } + }); + } + + } else + try { + queueOutgoing(new Error(mr, new DBusExecutionException(_("Spurious reply. No message with the given serial id was awaiting a reply.")))); + } catch (DBusException DBe) {} + } + protected void sendMessage(Message m) + { + try { + if (!connected) throw new NotConnected(_("Disconnected")); + if (m instanceof DBusSignal) + ((DBusSignal) m).appendbody(this); + + if (m instanceof MethodCall) { + if (0 == (m.getFlags() & Message.Flags.NO_REPLY_EXPECTED)) + if (null == pendingCalls) + ((MethodCall) m).setReply(new Error("org.freedesktop.DBus.Local", "org.freedesktop.DBus.Local.Disconnected", 0, "s", new Object[] { _("Disconnected") })); + else synchronized (pendingCalls) { + pendingCalls.put(m.getSerial(),(MethodCall) m); + } + } + + transport.mout.writeMessage(m); + + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + if (m instanceof MethodCall && e instanceof NotConnected) + try { + ((MethodCall) m).setReply(new Error("org.freedesktop.DBus.Local", "org.freedesktop.DBus.Local.Disconnected", 0, "s", new Object[] { _("Disconnected") })); + } catch (DBusException DBe) {} + if (m instanceof MethodCall && e instanceof DBusExecutionException) + try { + ((MethodCall)m).setReply(new Error(m, e)); + } catch (DBusException DBe) {} + else if (m instanceof MethodCall) + try { + if (Debug.debug) Debug.print(Debug.INFO, "Setting reply to "+m+" as an error"); + ((MethodCall)m).setReply(new Error(m, new DBusExecutionException(_("Message Failed to Send: ")+e.getMessage()))); + } catch (DBusException DBe) {} + else if (m instanceof MethodReturn) + try { + transport.mout.writeMessage(new Error(m, e)); + } catch(IOException IOe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, IOe); + } catch(DBusException IOe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + } + if (e instanceof IOException) disconnect(); + } + } + private Message readIncoming() throws DBusException + { + if (!connected) throw new NotConnected(_("No transport present")); + Message m = null; + try { + m = transport.min.readMessage(); + } catch (IOException IOe) { + throw new FatalDBusException(IOe.getMessage()); + } + return m; + } + /** + * Returns the address this connection is connected to. + */ + public BusAddress getAddress() throws ParseException { return new BusAddress(addr); } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ArrayFrob.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ArrayFrob.java new file mode 100755 index 0000000..978b198 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ArrayFrob.java @@ -0,0 +1,173 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Array; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Hashtable; +import java.util.List; + +import cx.ath.matthew.debug.Debug; + +class ArrayFrob +{ + static Hashtable, Class> primitiveToWrapper = new Hashtable, Class>(); + static Hashtable, Class> wrapperToPrimitive = new Hashtable, Class>(); + static { + primitiveToWrapper.put( Boolean.TYPE, Boolean.class ); + primitiveToWrapper.put( Byte.TYPE, Byte.class ); + primitiveToWrapper.put( Short.TYPE, Short.class ); + primitiveToWrapper.put( Character.TYPE, Character.class ); + primitiveToWrapper.put( Integer.TYPE, Integer.class ); + primitiveToWrapper.put( Long.TYPE, Long.class ); + primitiveToWrapper.put( Float.TYPE, Float.class ); + primitiveToWrapper.put( Double.TYPE, Double.class ); + wrapperToPrimitive.put( Boolean.class, Boolean.TYPE ); + wrapperToPrimitive.put( Byte.class, Byte.TYPE ); + wrapperToPrimitive.put( Short.class, Short.TYPE ); + wrapperToPrimitive.put( Character.class, Character.TYPE ); + wrapperToPrimitive.put( Integer.class, Integer.TYPE ); + wrapperToPrimitive.put( Long.class, Long.TYPE ); + wrapperToPrimitive.put( Float.class, Float.TYPE ); + wrapperToPrimitive.put( Double.class, Double.TYPE ); + + } + @SuppressWarnings("unchecked") + public static T[] wrap(Object o) throws IllegalArgumentException + { + Class ac = o.getClass(); + if (!ac.isArray()) throw new IllegalArgumentException(_("Not an array")); + Class cc = ac.getComponentType(); + Class ncc = primitiveToWrapper.get(cc); + if (null == ncc) throw new IllegalArgumentException(_("Not a primitive type")); + T[] ns = (T[]) Array.newInstance(ncc, Array.getLength(o)); + for (int i = 0; i < ns.length; i++) + ns[i] = (T) Array.get(o, i); + return ns; + } + @SuppressWarnings("unchecked") + public static Object unwrap(T[] ns) throws IllegalArgumentException + { + Class ac = (Class) ns.getClass(); + Class cc = (Class) ac.getComponentType(); + Class ncc = wrapperToPrimitive.get(cc); + if (null == ncc) throw new IllegalArgumentException(_("Not a wrapper type")); + Object o = Array.newInstance(ncc, ns.length); + for (int i = 0; i < ns.length; i++) + Array.set(o, i, ns[i]); + return o; + } + public static List listify(T[] ns) throws IllegalArgumentException + { + return Arrays.asList(ns); + } + @SuppressWarnings("unchecked") + public static List listify(Object o) throws IllegalArgumentException + { + if (o instanceof Object[]) return listify((T[]) o); + if (!o.getClass().isArray()) throw new IllegalArgumentException(_("Not an array")); + List l = new ArrayList(Array.getLength(o)); + for (int i = 0; i < Array.getLength(o); i++) + l.add((T)Array.get(o, i)); + return l; + } + @SuppressWarnings("unchecked") + public static T[] delist(List l, Class c) throws IllegalArgumentException + { + return l.toArray((T[]) Array.newInstance(c, 0)); + } + public static Object delistprimitive(List l, Class c) throws IllegalArgumentException + { + Object o = Array.newInstance(c, l.size()); + for (int i = 0; i < l.size(); i++) + Array.set(o, i, l.get(i)); + return o; + } + @SuppressWarnings("unchecked") + public static Object convert(Object o, Class c) throws IllegalArgumentException + { + /* Possible Conversions: + * + ** List -> List + ** List -> int[] + ** List -> Integer[] + ** int[] -> int[] + ** int[] -> List + ** int[] -> Integer[] + ** Integer[] -> Integer[] + ** Integer[] -> int[] + ** Integer[] -> List + */ + try { + // List -> List + if (List.class.equals(c) + && o instanceof List) + return o; + + // int[] -> List + // Integer[] -> List + if (List.class.equals(c) + && o.getClass().isArray()) + return listify(o); + + // int[] -> int[] + // Integer[] -> Integer[] + if (o.getClass().isArray() + && c.isArray() + && o.getClass().getComponentType().equals(c.getComponentType())) + return o; + + // int[] -> Integer[] + if (o.getClass().isArray() + && c.isArray() + && o.getClass().getComponentType().isPrimitive()) + return wrap(o); + + // Integer[] -> int[] + if (o.getClass().isArray() + && c.isArray() + && c.getComponentType().isPrimitive()) + return unwrap((Object[]) o); + + // List -> int[] + if (o instanceof List + && c.isArray() + && c.getComponentType().isPrimitive()) + return delistprimitive((List) o, (Class) c.getComponentType()); + + // List -> Integer[] + if (o instanceof List + && c.isArray()) + return delist((List) o, (Class) c.getComponentType()); + + if (o.getClass().isArray() + && c.isArray()) + return type((Object[]) o, (Class) c.getComponentType()); + + } catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new IllegalArgumentException(e); + } + + throw new IllegalArgumentException(MessageFormat.format(_("Not An Expected Convertion type from {0} to {1}"), new Object[] { o.getClass(), c})); + } + public static Object[] type(Object[] old, Class c) + { + Object[] ns = (Object[]) Array.newInstance(c, old.length); + for (int i = 0; i < ns.length; i++) + ns[i] = old[i]; + return ns; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/BusAddress.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/BusAddress.java new file mode 100755 index 0000000..84594da --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/BusAddress.java @@ -0,0 +1,41 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +import static org.freedesktop.dbus.Gettext._; +import java.text.ParseException; +import java.util.Map; +import java.util.HashMap; +import cx.ath.matthew.debug.Debug; + +public class BusAddress +{ + private String type; + private Map parameters; + public BusAddress(String address) throws ParseException + { + if (null == address || "".equals(address)) throw new ParseException(_("Bus address is blank"), 0); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Parsing bus address: "+address); + String[] ss = address.split(":", 2); + if (ss.length < 2) throw new ParseException(_("Bus address is invalid: ")+address, 0); + type = ss[0]; + if (Debug.debug) Debug.print(Debug.VERBOSE, "Transport type: "+type); + String[] ps = ss[1].split(","); + parameters = new HashMap(); + for (String p: ps) { + String[] kv = p.split("=", 2); + parameters.put(kv[0], kv[1]); + } + if (Debug.debug) Debug.print(Debug.VERBOSE, "Transport options: "+parameters); + } + public String getType() { return type; } + public String getParameter(String key) { return parameters.get(key); } + public String toString() { return type+": "+parameters; } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/CallbackHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/CallbackHandler.java new file mode 100755 index 0000000..b05b500 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/CallbackHandler.java @@ -0,0 +1,22 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +/** + * Interface for callbacks in async mode + */ +public interface CallbackHandler +{ + public void handle(ReturnType r); + public void handleError(DBusExecutionException e); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Container.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Container.java new file mode 100755 index 0000000..d2efb67 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Container.java @@ -0,0 +1,88 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.lang.reflect.Field; +import java.lang.reflect.Type; + +/** + * This class is the super class of both Structs and Tuples + * and holds common methods. + */ +abstract class Container +{ + private static Map typecache = new HashMap(); + static void putTypeCache(Type k, Type[] v) + { + typecache.put(k, v); + } + static Type[] getTypeCache(Type k) + { + return typecache.get(k); + } + private Object[] parameters = null; + public Container() {} + private void setup() + { + Field[] fs = getClass().getDeclaredFields(); + Object[] args = new Object[fs.length]; + + int diff = 0; + for (Field f : fs) { + Position p = f.getAnnotation(Position.class); + if (null == p) { + diff++; + continue; + } + try { + args[p.value()] = f.get(this); + } catch (IllegalAccessException IAe) {} + } + + this.parameters = new Object[args.length - diff]; + System.arraycopy(args, 0, parameters, 0, parameters.length); + } + /** + * Returns the struct contents in order. + * @throws DBusException If there is a problem doing this. + */ + public final Object[] getParameters() + { + if (null != parameters) return parameters; + setup(); + return parameters; + } + /** Returns this struct as a string. */ + public final String toString() + { + String s = getClass().getName()+"<"; + if (null == parameters) + setup(); + if (0 == parameters.length) + return s+">"; + for (Object o: parameters) + s += o+", "; + return s.replaceAll(", $", ">"); + } + public final boolean equals(Object other) + { + if (other instanceof Container) { + Container that = (Container) other; + if (this.getClass().equals(that.getClass())) + return Arrays.equals(this.getParameters(), that.getParameters()); + else return false; + } + else return false; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusAsyncReply.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusAsyncReply.java new file mode 100755 index 0000000..252cf07 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusAsyncReply.java @@ -0,0 +1,111 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.freedesktop.DBus.Error.NoReply; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +import cx.ath.matthew.debug.Debug; + +/** + * A handle to an asynchronous method call. + */ +public class DBusAsyncReply +{ + /** + * Check if any of a set of asynchronous calls have had a reply. + * @param replies A Collection of handles to replies to check. + * @return A Collection only containing those calls which have had replies. + */ + public static Collection> hasReply(Collection> replies) + { + Collection> c = new ArrayList>(replies); + Iterator> i = c.iterator(); + while (i.hasNext()) + if (!i.next().hasReply()) i.remove(); + return c; + } + + private ReturnType rval = null; + private DBusExecutionException error = null; + private MethodCall mc; + private Method me; + private AbstractConnection conn; + DBusAsyncReply(MethodCall mc, Method me, AbstractConnection conn) + { + this.mc = mc; + this.me = me; + this.conn = conn; + } + @SuppressWarnings("unchecked") + private synchronized void checkReply() + { + if (mc.hasReply()) { + Message m = mc.getReply(); + if (m instanceof Error) + error = ((Error) m).getException(); + else if (m instanceof MethodReturn) { + try { + rval = (ReturnType) RemoteInvocationHandler.convertRV(m.getSig(), m.getParameters(), me, conn); + } catch (DBusExecutionException DBEe) { + error = DBEe; + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + error = new DBusExecutionException(DBe.getMessage()); + } + } + } + } + + /** + * Check if we've had a reply. + * @return True if we have a reply + */ + public boolean hasReply() + { + if (null != rval || null != error) return true; + checkReply(); + return null != rval || null != error; + } + + /** + * Get the reply. + * @return The return value from the method. + * @throws DBusExecutionException if the reply to the method was an error. + * @throws NoReply if the method hasn't had a reply yet + */ + public ReturnType getReply() throws DBusExecutionException + { + if (null != rval) return rval; + else if (null != error) throw error; + checkReply(); + if (null != rval) return rval; + else if (null != error) throw error; + else throw new NoReply(_("Async call has not had a reply")); + } + + public String toString() + { + return _("Waiting for: ")+mc; + } + Method getMethod() { return me; } + AbstractConnection getConnection() { return conn; } + MethodCall getCall() { return mc; } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusCallInfo.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusCallInfo.java new file mode 100755 index 0000000..d34ef4e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusCallInfo.java @@ -0,0 +1,51 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +/** + * Holds information on a method call + */ +public class DBusCallInfo +{ + /** + * Indicates the caller won't wait for a reply (and we won't send one). + */ + public static final int NO_REPLY = Message.Flags.NO_REPLY_EXPECTED; + public static final int ASYNC = 0x100; + private String source; + private String destination; + private String objectpath; + private String iface; + private String method; + private int flags; + DBusCallInfo(Message m) + { + this.source = m.getSource(); + this.destination = m.getDestination(); + this.objectpath = m.getPath(); + this.iface = m.getInterface(); + this.method = m.getName(); + this.flags = m.getFlags(); + } + + /** Returns the BusID which called the method */ + public String getSource() { return source; } + /** Returns the name with which we were addressed on the Bus */ + public String getDestination() { return destination; } + /** Returns the object path used to call this method */ + public String getObjectPath() { return objectpath; } + /** Returns the interface this method was called with */ + public String getInterface() { return iface; } + /** Returns the method name used to call this method */ + public String getMethod() { return method; } + /** Returns any flags set on this method call */ + public int getFlags() { return flags; } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusConnection.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusConnection.java new file mode 100755 index 0000000..6609833 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusConnection.java @@ -0,0 +1,780 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Proxy; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; + +import java.text.MessageFormat; +import java.text.ParseException; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.NotConnected; + +import cx.ath.matthew.debug.Debug; + +/** Handles a connection to DBus. + *

+ * This is a Singleton class, only 1 connection to the SYSTEM or SESSION busses can be made. + * Repeated calls to getConnection will return the same reference. + *

+ *

+ * Signal Handlers and method calls from remote objects are run in their own threads, you MUST handle the concurrency issues. + *

+ */ +public class DBusConnection extends AbstractConnection +{ + /** + * Add addresses of peers to a set which will watch for them to + * disappear and automatically remove them from the set. + */ + public class PeerSet implements Set, DBusSigHandler + { + private Set addresses; + public PeerSet() + { + addresses = new TreeSet(); + try { + addSigHandler(new DBusMatchRule(DBus.NameOwnerChanged.class, null, null), this); + } catch (DBusException DBe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + } + } + public void handle(DBus.NameOwnerChanged noc) + { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Received NameOwnerChanged("+noc.name+","+noc.old_owner+","+noc.new_owner+")"); + if ("".equals(noc.new_owner) && addresses.contains(noc.name)) + remove(noc.name); + } + public boolean add(String address) + { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Adding "+address); + synchronized (addresses) { + return addresses.add(address); + } + } + public boolean addAll(Collection addresses) + { + synchronized (this.addresses) { + return this.addresses.addAll(addresses); + } + } + public void clear() + { + synchronized (addresses) { + addresses.clear(); + } + } + public boolean contains(Object o) + { + return addresses.contains(o); + } + public boolean containsAll(Collection os) + { + return addresses.containsAll(os); + } + public boolean equals(Object o) + { + if (o instanceof PeerSet) + return ((PeerSet) o).addresses.equals(addresses); + else return false; + } + public int hashCode() + { + return addresses.hashCode(); + } + public boolean isEmpty() + { + return addresses.isEmpty(); + } + public Iterator iterator() + { + return addresses.iterator(); + } + public boolean remove(Object o) + { + if (Debug.debug) + Debug.print(Debug.DEBUG, "Removing "+o); + synchronized(addresses) { + return addresses.remove(o); + } + } + public boolean removeAll(Collection os) + { + synchronized(addresses) { + return addresses.removeAll(os); + } + } + public boolean retainAll(Collection os) + { + synchronized(addresses) { + return addresses.retainAll(os); + } + } + public int size() + { + return addresses.size(); + } + public Object[] toArray() + { + synchronized(addresses) { + return addresses.toArray(); + } + } + public T[] toArray(T[] a) + { + synchronized(addresses) { + return addresses.toArray(a); + } + } + } + private class _sighandler implements DBusSigHandler + { + public void handle(DBusSignal s) + { + if (s instanceof org.freedesktop.DBus.Local.Disconnected) { + if (Debug.debug) Debug.print(Debug.WARN, "Handling Disconnected signal from bus"); + try { + Error err = new Error( + "org.freedesktop.DBus.Local" , "org.freedesktop.DBus.Local.Disconnected", 0, "s", new Object[] { _("Disconnected") }); + if (null != pendingCalls) synchronized (pendingCalls) { + long[] set = pendingCalls.getKeys(); + for (long l: set) if (-1 != l) { + MethodCall m = pendingCalls.remove(l); + if (null != m) + m.setReply(err); + } + } + synchronized (pendingErrors) { + pendingErrors.add(err); + } + } catch (DBusException DBe) {} + } else if (s instanceof org.freedesktop.DBus.NameAcquired) { + busnames.add(((org.freedesktop.DBus.NameAcquired) s).name); + } + } + } + + /** + * System Bus + */ + public static final int SYSTEM = 0; + /** + * Session Bus + */ + public static final int SESSION = 1; + + public static final String DEFAULT_SYSTEM_BUS_ADDRESS = "unix:path=/var/run/dbus/system_bus_socket"; + + private List busnames; + + private static final Map conn = new HashMap(); + private int _refcount = 0; + private Object _reflock = new Object(); + private DBus _dbus; + + /** + * Connect to the BUS. If a connection already exists to the specified Bus, a reference to it is returned. + * @param address The address of the bus to connect to + * @throws DBusException If there is a problem connecting to the Bus. + */ + public static DBusConnection getConnection(String address) throws DBusException + { + synchronized (conn) { + DBusConnection c = conn.get(address); + if (null != c) { + synchronized (c._reflock) { c._refcount++; } + return c; + } + else { + c = new DBusConnection(address); + conn.put(address, c); + return c; + } + } + } + /** + * Connect to the BUS. If a connection already exists to the specified Bus, a reference to it is returned. + * @param bustype The Bus to connect to. + * @see #SYSTEM + * @see #SESSION + * @throws DBusException If there is a problem connecting to the Bus. + */ + public static DBusConnection getConnection(int bustype) throws DBusException + { + synchronized (conn) { + String s = null; + switch (bustype) { + case SYSTEM: + s = System.getenv("DBUS_SYSTEM_BUS_ADDRESS"); + if (null == s) s = DEFAULT_SYSTEM_BUS_ADDRESS; + break; + case SESSION: + s = System.getenv("DBUS_SESSION_BUS_ADDRESS"); + if (null == s) { + // address gets stashed in $HOME/.dbus/session-bus/`dbus-uuidgen --get`-`sed 's/:\(.\)\..*/\1/' <<< $DISPLAY` + String display = System.getenv("DISPLAY"); + if (null == display) throw new DBusException(_("Cannot Resolve Session Bus Address")); + File uuidfile = new File("/var/lib/dbus/machine-id"); + if (!uuidfile.exists()) throw new DBusException(_("Cannot Resolve Session Bus Address")); + try { + BufferedReader r = new BufferedReader(new FileReader(uuidfile)); + String uuid = r.readLine(); + String homedir = System.getProperty("user.home"); + File addressfile = new File(homedir + "/.dbus/session-bus", + uuid + "-" + display.replaceAll(":([0-9]*)\\..*", "$1")); + if (!addressfile.exists()) throw new DBusException(_("Cannot Resolve Session Bus Address")); + r = new BufferedReader(new FileReader(addressfile)); + String l; + while (null != (l = r.readLine())) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Reading D-Bus session data: "+l); + if (l.matches("DBUS_SESSION_BUS_ADDRESS.*")) { + s = l.replaceAll("^[^=]*=", ""); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Parsing "+l+" to "+s); + } + } + if (null == s || "".equals(s)) throw new DBusException(_("Cannot Resolve Session Bus Address")); + if (Debug.debug) Debug.print(Debug.INFO, "Read bus address "+s+" from file "+addressfile.toString()); + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(_("Cannot Resolve Session Bus Address")); + } + } + break; + default: + throw new DBusException(_("Invalid Bus Type: ")+bustype); + } + DBusConnection c = conn.get(s); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Getting bus connection for "+s+": "+c); + if (null != c) { + synchronized (c._reflock) { c._refcount++; } + return c; + } + else { + if (Debug.debug) Debug.print(Debug.DEBUG, "Creating new bus connection to: "+s); + c = new DBusConnection(s); + conn.put(s, c); + return c; + } + } + } + @SuppressWarnings("unchecked") + private DBusConnection(String address) throws DBusException + { + super(address); + busnames = new Vector(); + + synchronized (_reflock) { + _refcount = 1; + } + + try { + transport = new Transport(addr, AbstractConnection.TIMEOUT); + connected = true; + } catch (IOException IOe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, IOe); + disconnect(); + throw new DBusException(_("Failed to connect to bus ")+IOe.getMessage()); + } catch (ParseException Pe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, Pe); + disconnect(); + throw new DBusException(_("Failed to connect to bus ")+Pe.getMessage()); + } + + // start listening for calls + listen(); + + // register disconnect handlers + DBusSigHandler h = new _sighandler(); + addSigHandlerWithoutMatch(org.freedesktop.DBus.Local.Disconnected.class, h); + addSigHandlerWithoutMatch(org.freedesktop.DBus.NameAcquired.class, h); + + // register ourselves + _dbus = getRemoteObject("org.freedesktop.DBus", "/org/freedesktop/DBus", DBus.class); + try { + busnames.add(_dbus.Hello()); + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw new DBusException(DBEe.getMessage()); + } + } + + @SuppressWarnings("unchecked") + DBusInterface dynamicProxy(String source, String path) throws DBusException + { + if (Debug.debug) Debug.print(Debug.INFO, "Introspecting "+path+" on "+source+" for dynamic proxy creation"); + try { + DBus.Introspectable intro = getRemoteObject(source, path, DBus.Introspectable.class); + String data = intro.Introspect(); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Got introspection data: "+data); + String[] tags = data.split("[<>]"); + Vector ifaces = new Vector(); + for (String tag: tags) { + if (tag.startsWith("interface")) { + ifaces.add(tag.replaceAll("^interface *name *= *['\"]([^'\"]*)['\"].*$", "$1")); + } + } + Vector> ifcs = new Vector>(); + for(String iface: ifaces) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Trying interface "+iface); + int j = 0; + while (j >= 0) { + try { + Class ifclass = Class.forName(iface); + if (!ifcs.contains(ifclass)) + ifcs.add(ifclass); + break; + } catch (Exception e) {} + j = iface.lastIndexOf("."); + char[] cs = iface.toCharArray(); + if (j >= 0) { + cs[j] = '$'; + iface = String.valueOf(cs); + } + } + } + + if (ifcs.size() == 0) throw new DBusException(_("Could not find an interface to cast to")); + + RemoteObject ro = new RemoteObject(source, path, null, false); + DBusInterface newi = (DBusInterface) + Proxy.newProxyInstance(ifcs.get(0).getClassLoader(), + ifcs.toArray(new Class[0]), + new RemoteInvocationHandler(this, ro)); + importedObjects.put(newi, ro); + return newi; + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(MessageFormat.format(_("Failed to create proxy object for {0} exported by {1}. Reason: {2}"), new Object[] { path, source, e.getMessage() })); + } + } + + DBusInterface getExportedObject(String source, String path) throws DBusException + { + ExportedObject o = null; + synchronized (exportedObjects) { + o = exportedObjects.get(path); + } + if (null != o && null == o.object.get()) { + unExportObject(path); + o = null; + } + if (null != o) return o.object.get(); + if (null == source) throw new DBusException(_("Not an object exported by this connection and no remote specified")); + return dynamicProxy(source, path); + } + + /** + * Release a bus name. + * Releases the name so that other people can use it + * @param busname The name to release. MUST be in dot-notation like "org.freedesktop.local" + * @throws DBusException If the busname is incorrectly formatted. + */ + public void releaseBusName(String busname) throws DBusException + { + if (!busname.matches(BUSNAME_REGEX)||busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name")); + synchronized (this.busnames) { + UInt32 rv; + try { + rv = _dbus.ReleaseName(busname); + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw new DBusException(DBEe.getMessage()); + } + this.busnames.remove(busname); + } + } + /** + * Request a bus name. + * Request the well known name that this should respond to on the Bus. + * @param busname The name to respond to. MUST be in dot-notation like "org.freedesktop.local" + * @throws DBusException If the register name failed, or our name already exists on the bus. + * or if busname is incorrectly formatted. + */ + public void requestBusName(String busname) throws DBusException + { + if (!busname.matches(BUSNAME_REGEX)||busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name")); + synchronized (this.busnames) { + UInt32 rv; + try { + rv = _dbus.RequestName(busname, + new UInt32(DBus.DBUS_NAME_FLAG_REPLACE_EXISTING | + DBus.DBUS_NAME_FLAG_DO_NOT_QUEUE)); + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw new DBusException(DBEe.getMessage()); + } + switch (rv.intValue()) { + case DBus.DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER: break; + case DBus.DBUS_REQUEST_NAME_REPLY_IN_QUEUE: throw new DBusException(_("Failed to register bus name")); + case DBus.DBUS_REQUEST_NAME_REPLY_EXISTS: throw new DBusException(_("Failed to register bus name")); + case DBus.DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER: break; + default: break; + } + this.busnames.add(busname); + } + } + + /** + * Returns the unique name of this connection. + */ + public String getUniqueName() + { + return busnames.get(0); + } + /** + * Returns all the names owned by this connection. + */ + public String[] getNames() + { + Set names = new TreeSet(); + names.addAll(busnames); + return names.toArray(new String[0]); + } + public I getPeerRemoteObject(String busname, String objectpath, Class type) throws DBusException + { + return getPeerRemoteObject(busname, objectpath, type, true); + } + /** + * Return a reference to a remote object. + * This method will resolve the well known name (if given) to a unique bus name when you call it. + * This means that if a well known name is released by one process and acquired by another calls to + * objects gained from this method will continue to operate on the original process. + * + * This method will use bus introspection to determine the interfaces on a remote object and so + * may block and may fail. The resulting proxy object will, however, be castable + * to any interface it implements. It will also autostart the process if applicable. Also note + * that the resulting proxy may fail to execute the correct method with overloaded methods + * and that complex types may fail in interesting ways. Basically, if something odd happens, + * try specifying the interface explicitly. + * + * @param busname The bus name to connect to. Usually a well known bus name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object.$ + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted. + */ + public DBusInterface getPeerRemoteObject(String busname, String objectpath) throws DBusException + { + if (null == busname) throw new DBusException(_("Invalid bus name: null")); + + if ((!busname.matches(BUSNAME_REGEX) && !busname.matches(CONNID_REGEX)) + || busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+busname); + + String unique = _dbus.GetNameOwner(busname); + + return dynamicProxy(unique, objectpath); + } + + /** + * Return a reference to a remote object. + * This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. + * In particular this means that if a process providing the well known name disappears and is taken over by another process + * proxy objects gained by this method will make calls on the new proccess. + * + * This method will use bus introspection to determine the interfaces on a remote object and so + * may block and may fail. The resulting proxy object will, however, be castable + * to any interface it implements. It will also autostart the process if applicable. Also note + * that the resulting proxy may fail to execute the correct method with overloaded methods + * and that complex types may fail in interesting ways. Basically, if something odd happens, + * try specifying the interface explicitly. + * + * @param busname The bus name to connect to. Usually a well known bus name name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted. + */ + public DBusInterface getRemoteObject(String busname, String objectpath) throws DBusException + { + if (null == busname) throw new DBusException(_("Invalid bus name: null")); + if (null == objectpath) throw new DBusException(_("Invalid object path: null")); + + if ((!busname.matches(BUSNAME_REGEX) && !busname.matches(CONNID_REGEX)) + || busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+busname); + + if (!objectpath.matches(OBJECT_REGEX) || objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + + return dynamicProxy(busname, objectpath); + } + + /** + * Return a reference to a remote object. + * This method will resolve the well known name (if given) to a unique bus name when you call it. + * This means that if a well known name is released by one process and acquired by another calls to + * objects gained from this method will continue to operate on the original process. + * @param busname The bus name to connect to. Usually a well known bus name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object.$ + * @param type The interface they are exporting it on. This type must have the same full class name and exposed method signatures + * as the interface the remote object is exporting. + * @param autostart Disable/Enable auto-starting of services in response to calls on this object. + * Default is enabled; when calling a method with auto-start enabled, if the destination is a well-known name + * and is not owned the bus will attempt to start a process to take the name. When disabled an error is + * returned immediately. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted or type is not in a package. + */ + public I getPeerRemoteObject(String busname, String objectpath, Class type, boolean autostart) throws DBusException + { + if (null == busname) throw new DBusException(_("Invalid bus name: null")); + + if ((!busname.matches(BUSNAME_REGEX) && !busname.matches(CONNID_REGEX)) + || busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+busname); + + String unique = _dbus.GetNameOwner(busname); + + return getRemoteObject(unique, objectpath, type, autostart); + } + /** + * Return a reference to a remote object. + * This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. + * In particular this means that if a process providing the well known name disappears and is taken over by another process + * proxy objects gained by this method will make calls on the new proccess. + * @param busname The bus name to connect to. Usually a well known bus name name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object. + * @param type The interface they are exporting it on. This type must have the same full class name and exposed method signatures + * as the interface the remote object is exporting. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted or type is not in a package. + */ + public I getRemoteObject(String busname, String objectpath, Class type) throws DBusException + { + return getRemoteObject(busname, objectpath, type, true); + } + /** + * Return a reference to a remote object. + * This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. + * In particular this means that if a process providing the well known name disappears and is taken over by another process + * proxy objects gained by this method will make calls on the new proccess. + * @param busname The bus name to connect to. Usually a well known bus name name in dot-notation (such as "org.freedesktop.local") + * or may be a DBus address such as ":1-16". + * @param objectpath The path on which the process is exporting the object. + * @param type The interface they are exporting it on. This type must have the same full class name and exposed method signatures + * as the interface the remote object is exporting. + * @param autostart Disable/Enable auto-starting of services in response to calls on this object. + * Default is enabled; when calling a method with auto-start enabled, if the destination is a well-known name + * and is not owned the bus will attempt to start a process to take the name. When disabled an error is + * returned immediately. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted or type is not in a package. + */ + @SuppressWarnings("unchecked") + public I getRemoteObject(String busname, String objectpath, Class type, boolean autostart) throws DBusException + { + if (null == busname) throw new DBusException(_("Invalid bus name: null")); + if (null == objectpath) throw new DBusException(_("Invalid object path: null")); + if (null == type) throw new ClassCastException(_("Not A DBus Interface")); + + if ((!busname.matches(BUSNAME_REGEX) && !busname.matches(CONNID_REGEX)) + || busname.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+busname); + + if (!objectpath.matches(OBJECT_REGEX) || objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + + if (!DBusInterface.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Interface")); + + // don't let people import things which don't have a + // valid D-Bus interface name + if (type.getName().equals(type.getSimpleName())) + throw new DBusException(_("DBusInterfaces cannot be declared outside a package")); + + RemoteObject ro = new RemoteObject(busname, objectpath, type, autostart); + I i = (I) Proxy.newProxyInstance(type.getClassLoader(), + new Class[] { type }, new RemoteInvocationHandler(this, ro)); + importedObjects.put(i, ro); + return i; + } + /** + * Remove a Signal Handler. + * Stops listening for this signal. + * @param type The signal to watch for. + * @param source The source of the signal. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + public void removeSigHandler(Class type, String source, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + if (source.matches(BUSNAME_REGEX)) throw new DBusException(_("Cannot watch for signals based on well known bus name as source, only unique names.")); + if (!source.matches(CONNID_REGEX)||source.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+source); + removeSigHandler(new DBusMatchRule(type, source, null), handler); + } + /** + * Remove a Signal Handler. + * Stops listening for this signal. + * @param type The signal to watch for. + * @param source The source of the signal. + * @param object The object emitting the signal. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + public void removeSigHandler(Class type, String source, DBusInterface object, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + if (source.matches(BUSNAME_REGEX)) throw new DBusException(_("Cannot watch for signals based on well known bus name as source, only unique names.")); + if (!source.matches(CONNID_REGEX)||source.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+source); + String objectpath = importedObjects.get(object).objectpath; + if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + removeSigHandler(new DBusMatchRule(type, source, objectpath), handler); + } + protected void removeSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException + { + + SignalTuple key = new SignalTuple(rule.getInterface(), rule.getMember(), rule.getObject(), rule.getSource()); + synchronized (handledSignals) { + Vector> v = handledSignals.get(key); + if (null != v) { + v.remove(handler); + if (0 == v.size()) { + handledSignals.remove(key); + try { + _dbus.RemoveMatch(rule.toString()); + } catch (NotConnected NC) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, NC); + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw new DBusException(DBEe.getMessage()); + } + } + } + } + } + /** + * Add a Signal Handler. + * Adds a signal handler to call when a signal is received which matches the specified type, name and source. + * @param type The signal to watch for. + * @param source The process which will send the signal. This MUST be a unique bus name and not a well known name. + * @param handler The handler to call when a signal is received. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + @SuppressWarnings("unchecked") + public void addSigHandler(Class type, String source, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + if (source.matches(BUSNAME_REGEX)) throw new DBusException(_("Cannot watch for signals based on well known bus name as source, only unique names.")); + if (!source.matches(CONNID_REGEX)||source.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+source); + addSigHandler(new DBusMatchRule(type, source, null), (DBusSigHandler) handler); + } + /** + * Add a Signal Handler. + * Adds a signal handler to call when a signal is received which matches the specified type, name, source and object. + * @param type The signal to watch for. + * @param source The process which will send the signal. This MUST be a unique bus name and not a well known name. + * @param object The object from which the signal will be emitted + * @param handler The handler to call when a signal is received. + * @throws DBusException If listening for the signal on the bus failed. + * @throws ClassCastException If type is not a sub-type of DBusSignal. + */ + @SuppressWarnings("unchecked") + public void addSigHandler(Class type, String source, DBusInterface object, DBusSigHandler handler) throws DBusException + { + if (!DBusSignal.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Signal")); + if (source.matches(BUSNAME_REGEX)) throw new DBusException(_("Cannot watch for signals based on well known bus name as source, only unique names.")); + if (!source.matches(CONNID_REGEX)||source.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid bus name: ")+source); + String objectpath = importedObjects.get(object).objectpath; + if (!objectpath.matches(OBJECT_REGEX)||objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + addSigHandler(new DBusMatchRule(type, source, objectpath), (DBusSigHandler) handler); + } + protected void addSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException + { + try { + _dbus.AddMatch(rule.toString()); + } catch (DBusExecutionException DBEe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBEe); + throw new DBusException(DBEe.getMessage()); + } + SignalTuple key = new SignalTuple(rule.getInterface(), rule.getMember(), rule.getObject(), rule.getSource()); + synchronized (handledSignals) { + Vector> v = handledSignals.get(key); + if (null == v) { + v = new Vector>(); + v.add(handler); + handledSignals.put(key, v); + } else + v.add(handler); + } + } + /** + * Disconnect from the Bus. + * This only disconnects when the last reference to the bus has disconnect called on it + * or has been destroyed. + */ + public void disconnect() + { + synchronized (conn) { + synchronized (_reflock) { + if (0 == --_refcount) { + if (Debug.debug) Debug.print(Debug.INFO, "Disconnecting DBusConnection"); + // Set all pending messages to have an error. + try { + Error err = new Error( + "org.freedesktop.DBus.Local" , "org.freedesktop.DBus.Local.Disconnected", 0, "s", new Object[] { _("Disconnected") }); + synchronized (pendingCalls) { + long[] set = pendingCalls.getKeys(); + for (long l: set) if (-1 != l) { + MethodCall m = pendingCalls.remove(l); + if (null != m) + m.setReply(err); + } + pendingCalls = null; + } + synchronized (pendingErrors) { + pendingErrors.add(err); + } + } catch (DBusException DBe) {} + + conn.remove(addr); + super.disconnect(); + } + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterface.java new file mode 100755 index 0000000..7b0d30a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterface.java @@ -0,0 +1,31 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +/** + * Denotes a class as exportable or a remote interface which can be called. + *

+ * Any interface which should be exported or imported should extend this + * interface. All public methods from that interface are exported/imported + * with the given method signatures. + *

+ *

+ * All method calls on exported objects are run in their own threads. + * Application writers are responsible for any concurrency issues. + *

+ */ +public interface DBusInterface +{ + /** + * Returns true on remote objects. + * Local objects implementing this interface MUST return false. + */ + public boolean isRemote(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterfaceName.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterfaceName.java new file mode 100755 index 0000000..5400a92 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusInterfaceName.java @@ -0,0 +1,27 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Force the interface name to be different to the Java class name. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface DBusInterfaceName +{ + /** The replacement interface name. */ + String value(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMap.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMap.java new file mode 100755 index 0000000..b9d06d7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMap.java @@ -0,0 +1,152 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + +class DBusMap implements Map +{ + Object[][] entries; + public DBusMap(Object[][] entries) + { + this.entries=entries; + } + class Entry implements Map.Entry, Comparable + { + private int entry; + public Entry(int i) + { + this.entry = i; + } + public boolean equals(Object o) + { + if (null == o) return false; + if (!(o instanceof DBusMap.Entry)) return false; + return this.entry == ((Entry) o).entry; + } + @SuppressWarnings("unchecked") + public K getKey() + { + return (K) entries[entry][0]; + } + @SuppressWarnings("unchecked") + public V getValue() + { + return (V) entries[entry][1]; + } + public int hashCode() + { + return entries[entry][0].hashCode(); + } + public V setValue(V value) + { + throw new UnsupportedOperationException(); + } + public int compareTo(Entry e) + { + return entry - e.entry; + } + } + + public void clear() + { + throw new UnsupportedOperationException(); + } + public boolean containsKey(Object key) + { + for (int i = 0; i < entries.length; i++) + if (key == entries[i][0] || (key != null && key.equals(entries[i][0]))) + return true; + return false; + } + public boolean containsValue(Object value) + { + for (int i = 0; i < entries.length; i++) + if (value == entries[i][1] || (value != null && value.equals(entries[i][1]))) + return true; + return false; + } + public Set> entrySet() + { + Set> s = new TreeSet>(); + for (int i = 0; i < entries.length; i++) + s.add(new Entry(i)); + return s; + } + @SuppressWarnings("unchecked") + public V get(Object key) + { + for (int i = 0; i < entries.length; i++) + if (key == entries[i][0] || (key != null && key.equals(entries[i][0]))) + return (V) entries[i][1]; + return null; + } + public boolean isEmpty() + { + return entries.length == 0; + } + @SuppressWarnings("unchecked") + public Set keySet() + { + Set s = new TreeSet(); + for (Object[] entry: entries) + s.add((K) entry[0]); + return s; + } + public V put(K key, V value) + { + throw new UnsupportedOperationException(); + } + public void putAll(Map t) + { + throw new UnsupportedOperationException(); + } + public V remove(Object key) + { + throw new UnsupportedOperationException(); + } + public int size() + { + return entries.length; + } + @SuppressWarnings("unchecked") + public Collection values() + { + List l = new Vector(); + for (Object[] entry: entries) + l.add((V) entry[1]); + return l; + } + public int hashCode() + { + return Arrays.deepHashCode(entries); + } + @SuppressWarnings("unchecked") + public boolean equals(Object o) + { + if (null == o) return false; + if (!(o instanceof Map)) return false; + return ((Map) o).entrySet().equals(entrySet()); + } + public String toString() + { + String s = "{ "; + for (int i = 0; i < entries.length; i++) + s += entries[i][0] + " => " + entries[i][1] + ","; + return s.replaceAll(".$", " }"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMatchRule.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMatchRule.java new file mode 100755 index 0000000..fa1e0ca --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMatchRule.java @@ -0,0 +1,143 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +import java.util.HashMap; + +public class DBusMatchRule +{ + /* signal, error, method_call, method_reply */ + private String type; + private String iface; + private String member; + private String object; + private String source; + private static HashMap> signalTypeMap = + new HashMap>(); + static Class getCachedSignalType(String type) + { + return signalTypeMap.get(type); + } + public DBusMatchRule(String type, String iface, String member) + { + this.type = type; + this.iface = iface; + this.member = member; + } + public DBusMatchRule(DBusExecutionException e) throws DBusException + { + this(e.getClass()); + member = null; + type = "error"; + } + public DBusMatchRule(Message m) + { + iface = m.getInterface(); + member = m.getName(); + if (m instanceof DBusSignal) + type = "signal"; + else if (m instanceof Error) { + type = "error"; + member = null; + } + else if (m instanceof MethodCall) + type = "method_call"; + else if (m instanceof MethodReturn) + type = "method_reply"; + } + public DBusMatchRule(Class c, String method) throws DBusException + { + this(c); + member = method; + type = "method_call"; + } + public DBusMatchRule(Class c, String source, String object) throws DBusException + { + this(c); + this.source = source; + this.object = object; + } + @SuppressWarnings("unchecked") + public DBusMatchRule(Class c) throws DBusException + { + if (DBusInterface.class.isAssignableFrom(c)) { + if (null != c.getAnnotation(DBusInterfaceName.class)) + iface = c.getAnnotation(DBusInterfaceName.class).value(); + else + iface = AbstractConnection.dollar_pattern.matcher(c.getName()).replaceAll("."); + if (!iface.matches(".*\\..*")) + throw new DBusException(_("DBusInterfaces must be defined in a package.")); + member = null; + type = null; + } + else if (DBusSignal.class.isAssignableFrom(c)) { + if (null == c.getEnclosingClass()) + throw new DBusException(_("Signals must be declared as a member of a class implementing DBusInterface which is the member of a package.")); + else + if (null != c.getEnclosingClass().getAnnotation(DBusInterfaceName.class)) + iface = c.getEnclosingClass().getAnnotation(DBusInterfaceName.class).value(); + else + iface = AbstractConnection.dollar_pattern.matcher(c.getEnclosingClass().getName()).replaceAll("."); + // Don't export things which are invalid D-Bus interfaces + if (!iface.matches(".*\\..*")) + throw new DBusException(_("DBusInterfaces must be defined in a package.")); + if (c.isAnnotationPresent(DBusMemberName.class)) + member = c.getAnnotation(DBusMemberName.class).value(); + else + member = c.getSimpleName(); + signalTypeMap.put(iface+'$'+member, (Class) c); + type = "signal"; + } + else if (Error.class.isAssignableFrom(c)) { + if (null != c.getAnnotation(DBusInterfaceName.class)) + iface = c.getAnnotation(DBusInterfaceName.class).value(); + else + iface = AbstractConnection.dollar_pattern.matcher(c.getName()).replaceAll("."); + if (!iface.matches(".*\\..*")) + throw new DBusException(_("DBusInterfaces must be defined in a package.")); + member = null; + type = "error"; + } + else if (DBusExecutionException.class.isAssignableFrom(c)) { + if (null != c.getClass().getAnnotation(DBusInterfaceName.class)) + iface = c.getClass().getAnnotation(DBusInterfaceName.class).value(); + else + iface = AbstractConnection.dollar_pattern.matcher(c.getClass().getName()).replaceAll("."); + if (!iface.matches(".*\\..*")) + throw new DBusException(_("DBusInterfaces must be defined in a package.")); + member = null; + type = "error"; + } + else + throw new DBusException(_("Invalid type for match rule: ")+c); + } + public String toString() + { + String s = null; + if (null != type) s = null == s ? "type='"+type+"'" : s + ",type='"+type+"'"; + if (null != member) s = null == s ? "member='"+member+"'" : s + ",member='"+member+"'"; + if (null != iface) s = null == s ? "interface='"+iface+"'" : s + ",interface='"+iface+"'"; + if (null != source) s = null == s ? "sender='"+source+"'" : s + ",sender='"+source+"'"; + if (null != object) s = null == s ? "path='"+object+"'" : s + ",path='"+object+"'"; + return s; + } + public String getType() { return type; } + public String getInterface() { return iface; } + public String getMember() { return member; } + public String getSource() { return source; } + public String getObject() { return object; } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMemberName.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMemberName.java new file mode 100755 index 0000000..da7f8fd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusMemberName.java @@ -0,0 +1,27 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Force the member (method/signal) name on the bus to be different to the Java name. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE,ElementType.METHOD}) +public @interface DBusMemberName +{ + /** The replacement member name. */ + String value(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSerializable.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSerializable.java new file mode 100755 index 0000000..8e31137 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSerializable.java @@ -0,0 +1,38 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +import org.freedesktop.dbus.exceptions.DBusException; +/** + * Custom classes may be sent over DBus if they implement this interface. + *

+ * In addition to the serialize method, classes MUST implement + * a deserialize method which returns null and takes as it's arguments + * all the DBus types the class will be serialied to in order and + * with type parameterisation. They MUST also provide a + * zero-argument constructor. + *

+ *

+ * The serialize method should return the class properties you wish to + * serialize, correctly formatted for the wire + * (DBusConnection.convertParameters() can help with this), in order in an + * Object array. + *

+ *

+ * The deserialize method will be called once after the zero-argument + * constructor. This should contain all the code to initialise the object + * from the types. + *

+ */ +public interface DBusSerializable +{ + public Object[] serialize() throws DBusException; +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSigHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSigHandler.java new file mode 100755 index 0000000..a56d845 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSigHandler.java @@ -0,0 +1,25 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +/** Handle a signal on DBus. + * All Signal handlers are run in their own Thread. + * Application writers are responsible for managing any concurrency issues. + */ +public interface DBusSigHandler +{ + /** + * Handle a signal. + * @param s The signal to handle. If such a class exists, the + * signal will be an instance of the class with the correct type signature. + * Otherwise it will be an instance of DBusSignal + */ + public void handle(T s); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSignal.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSignal.java new file mode 100755 index 0000000..a776027 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DBusSignal.java @@ -0,0 +1,276 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Constructor; +import java.lang.reflect.GenericDeclaration; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.MessageFormatException; + +import cx.ath.matthew.debug.Debug; + +public class DBusSignal extends Message +{ + DBusSignal() { } + public DBusSignal(String source, String path, String iface, String member, String sig, Object... args) throws DBusException + { + super(Message.Endian.BIG, Message.MessageType.SIGNAL, (byte) 0); + + if (null == path || null == member || null == iface) + throw new MessageFormatException(_("Must specify object path, interface and signal name to Signals.")); + headers.put(Message.HeaderField.PATH,path); + headers.put(Message.HeaderField.MEMBER,member); + headers.put(Message.HeaderField.INTERFACE,iface); + + Vector hargs = new Vector(); + hargs.add(new Object[] { Message.HeaderField.PATH, new Object[] { ArgumentType.OBJECT_PATH_STRING, path } }); + hargs.add(new Object[] { Message.HeaderField.INTERFACE, new Object[] { ArgumentType.STRING_STRING, iface } }); + hargs.add(new Object[] { Message.HeaderField.MEMBER, new Object[] { ArgumentType.STRING_STRING, member } }); + + if (null != source) { + headers.put(Message.HeaderField.SENDER,source); + hargs.add(new Object[] { Message.HeaderField.SENDER, new Object[] { ArgumentType.STRING_STRING, source } }); + } + + if (null != sig) { + hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); + headers.put(Message.HeaderField.SIGNATURE,sig); + setArgs(args); + } + + blen = new byte[4]; + appendBytes(blen); + append("ua(yv)", ++serial, hargs.toArray()); + pad((byte)8); + + long c = bytecounter; + if (null != sig) append(sig, args); + marshallint(bytecounter-c, blen, 0, 4); + bodydone = true; + } + static class internalsig extends DBusSignal + { + public internalsig(String source, String objectpath, String type, String name, String sig, Object[] parameters, long serial) throws DBusException + { + super(source, objectpath, type, name, sig, parameters, serial); + } + } + private static Map, Type[]> typeCache = new HashMap, Type[]>(); + private static Map> classCache = new HashMap>(); + private static Map, Constructor> conCache = new HashMap, Constructor>(); + private static Map signames = new HashMap(); + private static Map intnames = new HashMap(); + private Class c; + private boolean bodydone = false; + private byte[] blen; + + static void addInterfaceMap(String java, String dbus) + { + intnames.put(dbus, java); + } + static void addSignalMap(String java, String dbus) + { + signames.put(dbus, java); + } + + static DBusSignal createSignal(Class c, String source, String objectpath, String sig, long serial, Object... parameters) throws DBusException + { + String type = ""; + if (null != c.getEnclosingClass()) { + if (null != c.getEnclosingClass().getAnnotation(DBusInterfaceName.class)) + type = c.getEnclosingClass().getAnnotation(DBusInterfaceName.class).value(); + else + type = AbstractConnection.dollar_pattern.matcher(c.getEnclosingClass().getName()).replaceAll("."); + + } else + throw new DBusException(_("Signals must be declared as a member of a class implementing DBusInterface which is the member of a package.")); + DBusSignal s = new internalsig(source, objectpath, type, c.getSimpleName(), sig, parameters, serial); + s.c = c; + return s; + } + @SuppressWarnings("unchecked") + private static Class createSignalClass(String intname, String signame) throws DBusException + { + String name = intname+'$'+signame; + Class c = classCache.get(name); + if (null == c) c = DBusMatchRule.getCachedSignalType(name); + if (null != c) return c; + do { + try { + c = (Class) Class.forName(name); + } catch (ClassNotFoundException CNFe) {} + name = name.replaceAll("\\.([^\\.]*)$", "\\$$1"); + } while (null == c && name.matches(".*\\..*")); + if (null == c) + throw new DBusException(_("Could not create class from signal ")+intname+'.'+signame); + classCache.put(name, c); + return c; + } + @SuppressWarnings("unchecked") + DBusSignal createReal(AbstractConnection conn) throws DBusException + { + String intname = intnames.get(getInterface()); + String signame = signames.get(getName()); + if (null == intname) intname = getInterface(); + if (null == signame) signame = getName(); + if (null == c) + c = createSignalClass(intname,signame); + if (Debug.debug) Debug.print(Debug.DEBUG, "Converting signal to type: "+c); + Type[] types = typeCache.get(c); + Constructor con = conCache.get(c); + if (null == types) { + con = (Constructor) c.getDeclaredConstructors()[0]; + conCache.put(c, con); + Type[] ts = con.getGenericParameterTypes(); + types = new Type[ts.length-1]; + for (int i = 1; i < ts.length; i++) + if (ts[i] instanceof TypeVariable) + for (Type b: ((TypeVariable) ts[i]).getBounds()) + types[i-1] = b; + else + types[i-1] = ts[i]; + typeCache.put(c, types); + } + + try { + DBusSignal s; + Object[] args = Marshalling.deSerializeParameters(getParameters(), types, conn); + if (null == args) s = (DBusSignal) con.newInstance(getPath()); + else { + Object[] params = new Object[args.length + 1]; + params[0] = getPath(); + System.arraycopy(args, 0, params, 1, args.length); + + if (Debug.debug) Debug.print(Debug.DEBUG, "Creating signal of type "+c+" with parameters "+Arrays.deepToString(params)); + s = (DBusSignal) con.newInstance(params); + } + s.headers = headers; + s.wiredata = wiredata; + s.bytecounter = wiredata.length; + return s; + } catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(e.getMessage()); + } + } + /** + * Create a new signal. + * This contructor MUST be called by all sub classes. + * @param objectpath The path to the object this is emitted from. + * @param args The parameters of the signal. + * @throws DBusException This is thrown if the subclass is incorrectly defined. + */ + @SuppressWarnings("unchecked") + protected DBusSignal(String objectpath, Object... args) throws DBusException + { + super(Message.Endian.BIG, Message.MessageType.SIGNAL, (byte) 0); + + String destination = null; // pego + StringTokenizer tokens = new StringTokenizer(objectpath, "&"); // pego + if (tokens.countTokens() > 1) { // pego + objectpath = tokens.nextToken(); // pego + destination = tokens.nextToken(); // pego +// System.out.println("DBusSignal: destination specified: objectpath = " + objectpath + ", destination = " + destination); + } else { // pego +// System.out.println("DBusSignal: NO destination specified: objectpath = " + objectpath); // pego + } // pego + + if (!objectpath.matches(AbstractConnection.OBJECT_REGEX)) throw new DBusException(_("Invalid object path: ")+objectpath); + + Class tc = getClass(); + String member; + if (tc.isAnnotationPresent(DBusMemberName.class)) + member = tc.getAnnotation(DBusMemberName.class).value(); + else + member = tc.getSimpleName(); + String iface = null; + Class enc = tc.getEnclosingClass(); + if (null == enc || + !DBusInterface.class.isAssignableFrom(enc) || + enc.getName().equals(enc.getSimpleName())) + throw new DBusException(_("Signals must be declared as a member of a class implementing DBusInterface which is the member of a package.")); + else + if (null != enc.getAnnotation(DBusInterfaceName.class)) + iface = enc.getAnnotation(DBusInterfaceName.class).value(); + else + iface = AbstractConnection.dollar_pattern.matcher(enc.getName()).replaceAll("."); + + if (destination != null) { // pego + headers.put(Message.HeaderField.DESTINATION, destination); // pego + } // pego + headers.put(Message.HeaderField.PATH,objectpath); + headers.put(Message.HeaderField.MEMBER,member); + headers.put(Message.HeaderField.INTERFACE,iface); + + Vector hargs = new Vector(); + if (destination != null) { // pego + hargs.add(new Object[] { Message.HeaderField.DESTINATION, new Object[] { ArgumentType.STRING_STRING, destination } }); + } // pego + hargs.add(new Object[] { Message.HeaderField.PATH, new Object[] { ArgumentType.OBJECT_PATH_STRING, objectpath } }); + hargs.add(new Object[] { Message.HeaderField.INTERFACE, new Object[] { ArgumentType.STRING_STRING, iface } }); + hargs.add(new Object[] { Message.HeaderField.MEMBER, new Object[] { ArgumentType.STRING_STRING, member } }); + + String sig = null; + if (0 < args.length) { + try { + Type[] types = typeCache.get(tc); + if (null == types) { + Constructor con = (Constructor) tc.getDeclaredConstructors()[0]; + conCache.put(tc, con); + Type[] ts = con.getGenericParameterTypes(); + types = new Type[ts.length-1]; + for (int i = 1; i <= types.length; i++) + if (ts[i] instanceof TypeVariable) + types[i-1] = ((TypeVariable) ts[i]).getBounds()[0]; + else + types[i-1] = ts[i]; + typeCache.put(tc, types); + } + sig = Marshalling.getDBusType(types); + hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); + headers.put(Message.HeaderField.SIGNATURE,sig); + setArgs(args); + } catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(_("Failed to add signal parameters: ")+e.getMessage()); + } + } + + blen = new byte[4]; + appendBytes(blen); + append("ua(yv)", ++serial, hargs.toArray()); + pad((byte)8); + } + void appendbody(AbstractConnection conn) throws DBusException + { + if (bodydone) return; + + Type[] types = typeCache.get(getClass()); + Object[] args = Marshalling.convertParameters(getParameters(), types, conn); + setArgs(args); + String sig = getSig(); + + long c = bytecounter; + if (null != args && 0 < args.length) append(sig, args); + marshallint(bytecounter-c, blen, 0, 4); + bodydone = true; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DirectConnection.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DirectConnection.java new file mode 100755 index 0000000..93ec03f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/DirectConnection.java @@ -0,0 +1,251 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Proxy; +import java.io.File; +import java.io.IOException; +import java.net.ServerSocket; +import java.text.MessageFormat; +import java.text.ParseException; +import java.util.Random; +import java.util.Vector; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.exceptions.DBusException; + +import cx.ath.matthew.debug.Debug; + +/** Handles a peer to peer connection between two applications withou a bus daemon. + *

+ * Signal Handlers and method calls from remote objects are run in their own threads, you MUST handle the concurrency issues. + *

+ */ +public class DirectConnection extends AbstractConnection +{ + /** + * Create a direct connection to another application. + * @param address The address to connect to. This is a standard D-Bus address, except that the additional parameter 'listen=true' should be added in the application which is creating the socket. + */ + public DirectConnection(String address) throws DBusException + { + super(address); + + try { + transport = new Transport(addr, AbstractConnection.TIMEOUT); + connected = true; + } catch (IOException IOe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, IOe); + throw new DBusException(_("Failed to connect to bus ")+IOe.getMessage()); + } catch (ParseException Pe) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, Pe); + throw new DBusException(_("Failed to connect to bus ")+Pe.getMessage()); + } + + listen(); + } + + /** + * Creates a bus address for a randomly generated tcp port. + * @return a random bus address. + */ + public static String createDynamicTCPSession() + { + String address = "tcp:host=localhost"; + int port; + try { + ServerSocket s = new ServerSocket(); + s.bind(null); + port = s.getLocalPort(); + s.close(); + } catch (Exception e) { + Random r = new Random(); + port = 32768 + (Math.abs(r.nextInt()) % 28232); + } + address += ",port="+port; + address += ",guid="+Transport.genGUID(); + if (Debug.debug) Debug.print("Created Session address: "+address); + return address; + } + + /** + * Creates a bus address for a randomly generated abstract unix socket. + * @return a random bus address. + */ + public static String createDynamicSession() + { + String address = "unix:"; + String path = "/tmp/dbus-XXXXXXXXXX"; + Random r = new Random(); + do { + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < 10; i++) + sb.append((char) ((Math.abs(r.nextInt()) % 26) + 65)); + path = path.replaceAll("..........$", sb.toString()); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Trying path "+path); + } while ((new File(path)).exists()); + address += "abstract="+path; + address += ",guid="+Transport.genGUID(); + if (Debug.debug) Debug.print("Created Session address: "+address); + return address; + } + DBusInterface dynamicProxy(String path) throws DBusException + { + try { + DBus.Introspectable intro = (DBus.Introspectable) getRemoteObject(path, DBus.Introspectable.class); + String data = intro.Introspect(); + String[] tags = data.split("[<>]"); + Vector ifaces = new Vector(); + for (String tag: tags) { + if (tag.startsWith("interface")) { + ifaces.add(tag.replaceAll("^interface *name *= *['\"]([^'\"]*)['\"].*$", "$1")); + } + } + Vector> ifcs = new Vector>(); + for(String iface: ifaces) { + int j = 0; + while (j >= 0) { + try { + ifcs.add(Class.forName(iface)); + break; + } catch (Exception e) {} + j = iface.lastIndexOf("."); + char[] cs = iface.toCharArray(); + if (j >= 0) { + cs[j] = '$'; + iface = String.valueOf(cs); + } + } + } + + if (ifcs.size() == 0) throw new DBusException(_("Could not find an interface to cast to")); + + RemoteObject ro = new RemoteObject(null, path, null, false); + DBusInterface newi = (DBusInterface) + Proxy.newProxyInstance(ifcs.get(0).getClassLoader(), + ifcs.toArray(new Class[0]), + new RemoteInvocationHandler(this, ro)); + importedObjects.put(newi, ro); + return newi; + } catch (Exception e) { + if (EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(MessageFormat.format(_("Failed to create proxy object for {0}; reason: {1}."), new Object[] { path, e.getMessage()})); + } + } + + DBusInterface getExportedObject(String path) throws DBusException + { + ExportedObject o = null; + synchronized (exportedObjects) { + o = exportedObjects.get(path); + } + if (null != o && null == o.object.get()) { + unExportObject(path); + o = null; + } + if (null != o) return o.object.get(); + return dynamicProxy(path); + } + + /** + * Return a reference to a remote object. + * This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. + * In particular this means that if a process providing the well known name disappears and is taken over by another process + * proxy objects gained by this method will make calls on the new proccess. + * + * This method will use bus introspection to determine the interfaces on a remote object and so + * may block and may fail. The resulting proxy object will, however, be castable + * to any interface it implements. It will also autostart the process if applicable. Also note + * that the resulting proxy may fail to execute the correct method with overloaded methods + * and that complex types may fail in interesting ways. Basically, if something odd happens, + * try specifying the interface explicitly. + * + * @param objectpath The path on which the process is exporting the object. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted. + */ + public DBusInterface getRemoteObject(String objectpath) throws DBusException + { + if (null == objectpath) throw new DBusException(_("Invalid object path: null")); + + if (!objectpath.matches(OBJECT_REGEX) || objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + + return dynamicProxy(objectpath); + } + + /** + * Return a reference to a remote object. + * This method will always refer to the well known name (if given) rather than resolving it to a unique bus name. + * In particular this means that if a process providing the well known name disappears and is taken over by another process + * proxy objects gained by this method will make calls on the new proccess. + * @param objectpath The path on which the process is exporting the object. + * @param type The interface they are exporting it on. This type must have the same full class name and exposed method signatures + * as the interface the remote object is exporting. + * @return A reference to a remote object. + * @throws ClassCastException If type is not a sub-type of DBusInterface + * @throws DBusException If busname or objectpath are incorrectly formatted or type is not in a package. + */ + public DBusInterface getRemoteObject(String objectpath, Class type) throws DBusException + { + if (null == objectpath) throw new DBusException(_("Invalid object path: null")); + if (null == type) throw new ClassCastException(_("Not A DBus Interface")); + + if (!objectpath.matches(OBJECT_REGEX) || objectpath.length() > MAX_NAME_LENGTH) + throw new DBusException(_("Invalid object path: ")+objectpath); + + if (!DBusInterface.class.isAssignableFrom(type)) throw new ClassCastException(_("Not A DBus Interface")); + + // don't let people import things which don't have a + // valid D-Bus interface name + if (type.getName().equals(type.getSimpleName())) + throw new DBusException(_("DBusInterfaces cannot be declared outside a package")); + + RemoteObject ro = new RemoteObject(null, objectpath, type, false); + DBusInterface i = (DBusInterface) Proxy.newProxyInstance(type.getClassLoader(), + new Class[] { type }, new RemoteInvocationHandler(this, ro)); + importedObjects.put(i, ro); + return i; + } + protected void removeSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException + { + SignalTuple key = new SignalTuple(rule.getInterface(), rule.getMember(), rule.getObject(), rule.getSource()); + synchronized (handledSignals) { + Vector> v = handledSignals.get(key); + if (null != v) { + v.remove(handler); + if (0 == v.size()) { + handledSignals.remove(key); + } + } + } + } + protected void addSigHandler(DBusMatchRule rule, DBusSigHandler handler) throws DBusException + { + SignalTuple key = new SignalTuple(rule.getInterface(), rule.getMember(), rule.getObject(), rule.getSource()); + synchronized (handledSignals) { + Vector> v = handledSignals.get(key); + if (null == v) { + v = new Vector>(); + v.add(handler); + handledSignals.put(key, v); + } else + v.add(handler); + } + } + DBusInterface getExportedObject(String source, String path) throws DBusException + { + return getExportedObject(path); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientMap.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientMap.java new file mode 100755 index 0000000..67a2484 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientMap.java @@ -0,0 +1,116 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +/** + * Provides a long => MethodCall map which doesn't allocate objects + * on insertion/removal. Keys must be inserted in ascending order. */ +class EfficientMap +{ + private long[] kv; + private MethodCall[] vv; + private int start; + private int end; + private int init_size; + public EfficientMap(int initial_size) + { + init_size = initial_size; + shrink(); + } + private void grow() + { + // create new vectors twice as long + long[] oldkv = kv; + kv = new long[oldkv.length*2]; + MethodCall[] oldvv = vv; + vv = new MethodCall[oldvv.length*2]; + + // copy start->length to the start of the new vector + System.arraycopy(oldkv,start,kv,0,oldkv.length-start); + System.arraycopy(oldvv,start,vv,0,oldvv.length-start); + // copy 0->end to the next part of the new vector + if (end != (oldkv.length-1)) { + System.arraycopy(oldkv,0,kv,oldkv.length-start,end+1); + System.arraycopy(oldvv,0,vv,oldvv.length-start,end+1); + } + // reposition pointers + start = 0; + end = oldkv.length; + } + // create a new vector with just the valid keys in and return it + public long[] getKeys() + { + int size; + if (start < end) size = end-start; + else size = kv.length-(start-end); + long[] lv = new long[size]; + int copya; + if (size > kv.length-start) copya = kv.length-start; + else copya = size; + System.arraycopy(kv,start,lv,0,copya); + if (copya < size) { + System.arraycopy(kv,0,lv,copya,size-copya); + } + return lv; + } + private void shrink() + { + if (null != kv && kv.length == init_size) return; + // reset to original size + kv = new long[init_size]; + vv = new MethodCall[init_size]; + start = 0; + end = 0; + } + public void put(long l, MethodCall m) + { + // put this at the end + kv[end] = l; + vv[end] = m; + // move the end + if (end == (kv.length-1)) end = 0; else end++; + // if we are out of space, grow. + if (end == start) grow(); + } + public MethodCall remove(long l) + { + // find the item + int pos = find(l); + // if we don't have it return null + if (-1 == pos) return null; + // get the value + MethodCall m = vv[pos]; + // set it as unused + vv[pos] = null; + kv[pos] = -1; + // move the pointer to the first full element + while (-1 == kv[start]) { + if (start == (kv.length-1)) start = 0; else start++; + // if we have emptied the list, shrink it + if (start == end) { shrink(); break; } + } + return m; + } + public boolean contains(long l) + { + // check if find succeeds + return -1 != find(l); + } + /* could binary search, but it's probably the first one */ + private int find(long l) + { + int i = start; + while (i != end && kv[i] != l) + if (i == (kv.length-1)) i = 0; else i++; + if (i == end) return -1; + return i; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientQueue.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientQueue.java new file mode 100755 index 0000000..5724730 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/EfficientQueue.java @@ -0,0 +1,107 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import cx.ath.matthew.debug.Debug; + +/** + * Provides a Message queue which doesn't allocate objects + * on insertion/removal. */ +class EfficientQueue +{ + private Message[] mv; + private int start; + private int end; + private int init_size; + public EfficientQueue(int initial_size) + { + init_size = initial_size; + shrink(); + } + private void grow() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Growing"); + // create new vectors twice as long + Message[] oldmv = mv; + mv = new Message[oldmv.length*2]; + + // copy start->length to the start of the new vector + System.arraycopy(oldmv,start,mv,0,oldmv.length-start); + // copy 0->end to the next part of the new vector + if (end != (oldmv.length-1)) { + System.arraycopy(oldmv,0,mv,oldmv.length-start,end+1); + } + // reposition pointers + start = 0; + end = oldmv.length; + } + // create a new vector with just the valid keys in and return it + public Message[] getKeys() + { + if (start == end) return new Message[0]; + Message[] lv; + if (start < end) { + int size = end-start; + lv = new Message[size]; + System.arraycopy(mv, start, lv, 0, size); + } else { + int size = mv.length-start+end; + lv = new Message[size]; + System.arraycopy(mv, start, lv, 0, mv.length-start); + System.arraycopy(mv, 0, lv, mv.length-start, end); + } + return lv; + } + private void shrink() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Shrinking"); + if (null != mv && mv.length == init_size) return; + // reset to original size + mv = new Message[init_size]; + start = 0; + end = 0; + } + public void add(Message m) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Enqueueing Message "+m); + // put this at the end + mv[end] = m; + // move the end + if (end == (mv.length-1)) end = 0; else end++; + // if we are out of space, grow. + if (end == start) grow(); + } + public Message remove() + { + if (start == end) return null; + // find the item + int pos = start; + // get the value + Message m = mv[pos]; + // set it as unused + mv[pos] = null; + if (start == (mv.length-1)) start = 0; else start++; + if (Debug.debug) Debug.print(Debug.DEBUG, "Dequeueing "+m); + return m; + } + public boolean isEmpty() + { + // check if find succeeds + return start == end; + } + public int size() + { + if (end >= start) + return end-start; + else + return mv.length-start+end; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Error.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Error.java new file mode 100755 index 0000000..9db1e07 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Error.java @@ -0,0 +1,142 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Constructor; +import java.util.Vector; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.MessageFormatException; +import org.freedesktop.dbus.exceptions.NotConnected; + +import cx.ath.matthew.debug.Debug; + +/** + * Error messages which can be sent over the bus. + */ +public class Error extends Message +{ + Error() { } + public Error(String dest, String errorName, long replyserial, String sig, Object... args) throws DBusException + { + this(null, dest, errorName, replyserial, sig, args); + } + public Error(String source, String dest, String errorName, long replyserial, String sig, Object... args) throws DBusException + { + super(Message.Endian.BIG, Message.MessageType.ERROR, (byte) 0); + + if (null == errorName) + throw new MessageFormatException(_("Must specify error name to Errors.")); + headers.put(Message.HeaderField.REPLY_SERIAL,replyserial); + headers.put(Message.HeaderField.ERROR_NAME,errorName); + + Vector hargs = new Vector(); + hargs.add(new Object[] { Message.HeaderField.ERROR_NAME, new Object[] { ArgumentType.STRING_STRING, errorName } }); + hargs.add(new Object[] { Message.HeaderField.REPLY_SERIAL, new Object[] { ArgumentType.UINT32_STRING, replyserial } }); + + if (null != source) { + headers.put(Message.HeaderField.SENDER,source); + hargs.add(new Object[] { Message.HeaderField.SENDER, new Object[] { ArgumentType.STRING_STRING, source } }); + } + + if (null != dest) { + headers.put(Message.HeaderField.DESTINATION,dest); + hargs.add(new Object[] { Message.HeaderField.DESTINATION, new Object[] { ArgumentType.STRING_STRING, dest } }); + } + + if (null != sig) { + hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); + headers.put(Message.HeaderField.SIGNATURE,sig); + setArgs(args); + } + + byte[] blen = new byte[4]; + appendBytes(blen); + append("ua(yv)", serial, hargs.toArray()); + pad((byte)8); + + long c = bytecounter; + if (null != sig) append(sig, args); + marshallint(bytecounter-c, blen, 0, 4); + } + public Error(String source, Message m, Throwable e) throws DBusException + { + this(source, m.getSource(), AbstractConnection.dollar_pattern.matcher(e.getClass().getName()).replaceAll("."), m.getSerial(), "s", e.getMessage()); + } + public Error(Message m, Throwable e) throws DBusException + { + this(m.getSource(), AbstractConnection.dollar_pattern.matcher(e.getClass().getName()).replaceAll("."), m.getSerial(), "s", e.getMessage()); + } + @SuppressWarnings("unchecked") + private static Class createExceptionClass(String name) + { + if (name == "org.freedesktop.DBus.Local.Disconnected") return NotConnected.class; + Class c = null; + do { + try { + c = (Class) Class.forName(name); + } catch (ClassNotFoundException CNFe) {} + name = name.replaceAll("\\.([^\\.]*)$", "\\$$1"); + } while (null == c && name.matches(".*\\..*")); + return c; + } + /** + * Turns this into an exception of the correct type + */ + public DBusExecutionException getException() + { + try { + Class c = createExceptionClass(getName()); + if (null == c || !DBusExecutionException.class.isAssignableFrom(c)) c = DBusExecutionException.class; + Constructor con = c.getConstructor(String.class); + DBusExecutionException ex; + Object[] args = getParameters(); + if (null == args || 0 == args.length) + ex = con.newInstance(""); + else { + String s = ""; + for (Object o: args) + s += o + " "; + ex = con.newInstance(s.trim()); + } + ex.setType(getName()); + return ex; + } catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug && null != e.getCause()) + Debug.print(Debug.ERR, e.getCause()); + DBusExecutionException ex; + Object[] args = null; + try { + args = getParameters(); + } catch (Exception ee) {} + if (null == args || 0 == args.length) + ex = new DBusExecutionException(""); + else { + String s = ""; + for (Object o: args) + s += o + " "; + ex = new DBusExecutionException(s.trim()); + } + ex.setType(getName()); + return ex; + } + } + /** + * Throw this as an exception of the correct type + */ + public void throwException() throws DBusExecutionException + { + throw getException(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ExportedObject.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ExportedObject.java new file mode 100755 index 0000000..3afa54b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ExportedObject.java @@ -0,0 +1,166 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.ref.Reference; +import java.lang.ref.WeakReference; + +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.Map; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +class ExportedObject +{ + @SuppressWarnings("unchecked") + private String getAnnotations(AnnotatedElement c) + { + String ans = ""; + for (Annotation a: c.getDeclaredAnnotations()) { + Class t = a.annotationType(); + String value = ""; + try { + Method m = t.getMethod("value"); + value = m.invoke(a).toString(); + } catch (NoSuchMethodException NSMe) { + } catch (InvocationTargetException ITe) { + } catch (IllegalAccessException IAe) {} + + ans += " \n"; + } + return ans; + } + @SuppressWarnings("unchecked") + private Map getExportedMethods(Class c) throws DBusException + { + if (DBusInterface.class.equals(c)) return new HashMap(); + Map m = new HashMap(); + for (Class i: c.getInterfaces()) + if (DBusInterface.class.equals(i)) { + // add this class's public methods + if (null != c.getAnnotation(DBusInterfaceName.class)) { + String name = ((DBusInterfaceName) c.getAnnotation(DBusInterfaceName.class)).value(); + introspectiondata += " \n"; + DBusSignal.addInterfaceMap(c.getName(), name); + } else { + // don't let people export things which don't have a + // valid D-Bus interface name + if (c.getName().equals(c.getSimpleName())) + throw new DBusException(_("DBusInterfaces cannot be declared outside a package")); + if (c.getName().length() > DBusConnection.MAX_NAME_LENGTH) + throw new DBusException(_("Introspected interface name exceeds 255 characters. Cannot export objects of type ")+c.getName()); + else + introspectiondata += " \n"; + } + introspectiondata += getAnnotations(c); + for (Method meth: c.getDeclaredMethods()) + if (Modifier.isPublic(meth.getModifiers())) { + String ms = ""; + String name; + if (meth.isAnnotationPresent(DBusMemberName.class)) + name = meth.getAnnotation(DBusMemberName.class).value(); + else + name = meth.getName(); + if (name.length() > DBusConnection.MAX_NAME_LENGTH) + throw new DBusException(_("Introspected method name exceeds 255 characters. Cannot export objects with method ")+name); + introspectiondata += " \n"; + introspectiondata += getAnnotations(meth); + for (Class ex: meth.getExceptionTypes()) + if (DBusExecutionException.class.isAssignableFrom(ex)) + introspectiondata += + " \n"; + for (Type pt: meth.getGenericParameterTypes()) + for (String s: Marshalling.getDBusType(pt)) { + introspectiondata += " \n"; + ms += s; + } + if (!Void.TYPE.equals(meth.getGenericReturnType())) { + if (Tuple.class.isAssignableFrom((Class) meth.getReturnType())) { + ParameterizedType tc = (ParameterizedType) meth.getGenericReturnType(); + Type[] ts = tc.getActualTypeArguments(); + + for (Type t: ts) + if (t != null) + for (String s: Marshalling.getDBusType(t)) + introspectiondata += " \n"; + } else if (Object[].class.equals(meth.getGenericReturnType())) { + throw new DBusException(_("Return type of Object[] cannot be introspected properly")); + } else + for (String s: Marshalling.getDBusType(meth.getGenericReturnType())) + introspectiondata += " \n"; + } + introspectiondata += " \n"; + m.put(new MethodTuple(name, ms), meth); + } + for (Class sig: c.getDeclaredClasses()) + if (DBusSignal.class.isAssignableFrom(sig)) { + String name; + if (sig.isAnnotationPresent(DBusMemberName.class)) { + name = ((DBusMemberName) sig.getAnnotation(DBusMemberName.class)).value(); + DBusSignal.addSignalMap(sig.getSimpleName(), name); + } else + name = sig.getSimpleName(); + if (name.length() > DBusConnection.MAX_NAME_LENGTH) + throw new DBusException(_("Introspected signal name exceeds 255 characters. Cannot export objects with signals of type ")+name); + introspectiondata += " \n"; + Constructor con = sig.getConstructors()[0]; + Type[] ts = con.getGenericParameterTypes(); + for (int j = 1; j < ts.length; j++) + for (String s: Marshalling.getDBusType(ts[j])) + introspectiondata += " \n"; + introspectiondata += getAnnotations(sig); + introspectiondata += " \n"; + + } + introspectiondata += " \n"; + } else { + // recurse + m.putAll(getExportedMethods(i)); + } + return m; + } + Map methods; + Reference object; + String introspectiondata; + public ExportedObject(DBusInterface object, boolean weakreferences) throws DBusException + { + if (weakreferences) + this.object = new WeakReference(object); + else + this.object = new StrongReference(object); + introspectiondata = ""; + methods = getExportedMethods(object.getClass()); + introspectiondata += + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"; + introspectiondata += + " \n"+ + " \n"+ + " \n"+ + " \n"; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Gettext.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Gettext.java new file mode 100755 index 0000000..5fd6de9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Gettext.java @@ -0,0 +1,31 @@ +/* + * Pescetti Pseudo-Duplimate Generator + * + * Copyright (C) 2007 Matthew Johnson + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License Version 2 as published by + * the Free Software Foundation. This program 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 Lesser General Public License for more details. You should have received a + * copy of the GNU Lesser General Public License along with this program; if not, + * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * To Contact me, please email src@matthew.ath.cx + * + */ +package org.freedesktop.dbus; + +import java.util.ResourceBundle; + +public class Gettext +{ +// private static ResourceBundle myResources = +// ResourceBundle.getBundle("dbusjava_localized"); pego + public static String _(String s) { +// return myResources.getString(s); pego + return s; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/InternalSignal.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/InternalSignal.java new file mode 100755 index 0000000..55954d5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/InternalSignal.java @@ -0,0 +1,20 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +import org.freedesktop.dbus.exceptions.DBusException; +class InternalSignal extends DBusSignal +{ + public InternalSignal(String source, String objectpath, String name, String iface, String sig, long serial, Object... parameters) throws DBusException + { + super(objectpath, iface, name, sig, parameters); + this.serial = serial; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java new file mode 100755 index 0000000..b561f19 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Marshalling.java @@ -0,0 +1,629 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.GenericArrayType; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.TypeVariable; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.types.DBusListType; +import org.freedesktop.dbus.types.DBusMapType; +import org.freedesktop.dbus.types.DBusStructType; + +import cx.ath.matthew.debug.Debug; + +/** + * Contains static methods for marshalling values. + */ +public class Marshalling +{ + private static Map typeCache = new HashMap(); + /** + * Will return the DBus type corresponding to the given Java type. + * Note, container type should have their ParameterizedType not their + * Class passed in here. + * @param c The Java types. + * @return The DBus types. + * @throws DBusException If the given type cannot be converted to a DBus type. + */ + public static String getDBusType(Type[] c) throws DBusException + { + StringBuffer sb = new StringBuffer(); + for (Type t: c) + for (String s: getDBusType(t)) + sb.append(s); + return sb.toString(); + } + /** + * Will return the DBus type corresponding to the given Java type. + * Note, container type should have their ParameterizedType not their + * Class passed in here. + * @param c The Java type. + * @return The DBus type. + * @throws DBusException If the given type cannot be converted to a DBus type. + */ + public static String[] getDBusType(Type c) throws DBusException + { + String[] cached = typeCache.get(c); + if (null != cached) return cached; + cached = getDBusType(c, false); + typeCache.put(c, cached); + return cached; + } + /** + * Will return the DBus type corresponding to the given Java type. + * Note, container type should have their ParameterizedType not their + * Class passed in here. + * @param c The Java type. + * @param basic If true enforces this to be a non-compound type. (compound types are Maps, Structs and Lists/arrays). + * @return The DBus type. + * @throws DBusException If the given type cannot be converted to a DBus type. + */ + public static String[] getDBusType(Type c, boolean basic) throws DBusException + { + return recursiveGetDBusType(c, basic, 0); + } + private static StringBuffer[] out = new StringBuffer[20]; // pego + @SuppressWarnings("unchecked") + public static String[] recursiveGetDBusType(Type c, boolean basic, int level) throws DBusException + { + if (out.length <= level) { + StringBuffer[] newout = new StringBuffer[out.length]; + System.arraycopy(out, 0, newout, 0, out.length); + out = newout; + } + if (null == out[level]) out[level] = new StringBuffer(); + else out[level].delete(0, out[level].length()); + + if (basic && !(c instanceof Class)) + throw new DBusException(c+_(" is not a basic type")); + + if (c instanceof TypeVariable) out[level].append((char) Message.ArgumentType.VARIANT); + else if (c instanceof GenericArrayType) { + out[level].append((char) Message.ArgumentType.ARRAY); + String[] s = recursiveGetDBusType(((GenericArrayType) c).getGenericComponentType(), false, level+1); + if (s.length != 1) throw new DBusException(_("Multi-valued array types not permitted")); + out[level].append(s[0]); + } else if ((c instanceof Class && + DBusSerializable.class.isAssignableFrom((Class) c)) || + (c instanceof ParameterizedType && + DBusSerializable.class.isAssignableFrom((Class) ((ParameterizedType) c).getRawType()))) { + // it's a custom serializable type + Type[] newtypes = null; + if (c instanceof Class) { + for (Method m: ((Class) c).getDeclaredMethods()) + if (m.getName().equals("deserialize")) + newtypes = m.getGenericParameterTypes(); + } + else + for (Method m: ((Class) ((ParameterizedType) c).getRawType()).getDeclaredMethods()) + if (m.getName().equals("deserialize")) + newtypes = m.getGenericParameterTypes(); + + if (null == newtypes) throw new DBusException(_("Serializable classes must implement a deserialize method")); + + String[] sigs = new String[newtypes.length]; + for (int j = 0; j < sigs.length; j++) { + String[] ss = recursiveGetDBusType(newtypes[j], false, level+1); + if (1 != ss.length) throw new DBusException(_("Serializable classes must serialize to native DBus types")); + sigs[j] = ss[0]; + } + return sigs; + } + else if (c instanceof ParameterizedType) { + ParameterizedType p = (ParameterizedType) c; + if (p.getRawType().equals(Map.class)) { + out[level].append("a{"); + Type[] t = p.getActualTypeArguments(); + try { + String[] s = recursiveGetDBusType(t[0], true, level+1); + if (s.length != 1) throw new DBusException(_("Multi-valued array types not permitted")); + out[level].append(s[0]); + s = recursiveGetDBusType(t[1], false, level+1); + if (s.length != 1) throw new DBusException(_("Multi-valued array types not permitted")); + out[level].append(s[0]); + } catch (ArrayIndexOutOfBoundsException AIOOBe) { + AIOOBe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, AIOOBe); + throw new DBusException(_("Map must have 2 parameters")); + } + out[level].append('}'); + } + else if (List.class.isAssignableFrom((Class) p.getRawType())) { + for (Type t: p.getActualTypeArguments()) { + if (Type.class.equals(t)) + out[level].append((char) Message.ArgumentType.SIGNATURE); + else { + String[] s = recursiveGetDBusType(t, false, level+1); + if (s.length != 1) throw new DBusException(_("Multi-valued array types not permitted")); + out[level].append((char) Message.ArgumentType.ARRAY); + out[level].append(s[0]); + } + } + } + else if (p.getRawType().equals(Variant.class)) { + out[level].append((char) Message.ArgumentType.VARIANT); + } + else if (DBusInterface.class.isAssignableFrom((Class) p.getRawType())) { + out[level].append((char) Message.ArgumentType.OBJECT_PATH); + } + else if (Tuple.class.isAssignableFrom((Class) p.getRawType())) { + Type[] ts = p.getActualTypeArguments(); + Vector vs = new Vector(); + for (Type t: ts) + for (String s: recursiveGetDBusType(t, false, level+1)) + vs.add(s); + return vs.toArray(new String[0]); + } + else + throw new DBusException(_("Exporting non-exportable parameterized type ")+c); + } + + else if (c.equals(Byte.class)) out[level].append((char) Message.ArgumentType.BYTE); + else if (c.equals(Byte.TYPE)) out[level].append((char) Message.ArgumentType.BYTE); + else if (c.equals(Boolean.class)) out[level].append((char) Message.ArgumentType.BOOLEAN); + else if (c.equals(Boolean.TYPE)) out[level].append((char) Message.ArgumentType.BOOLEAN); + else if (c.equals(Short.class)) out[level].append((char) Message.ArgumentType.INT16); + else if (c.equals(Short.TYPE)) out[level].append((char) Message.ArgumentType.INT16); + else if (c.equals(UInt16.class)) out[level].append((char) Message.ArgumentType.UINT16); + else if (c.equals(Integer.class)) out[level].append((char) Message.ArgumentType.INT32); + else if (c.equals(Integer.TYPE)) out[level].append((char) Message.ArgumentType.INT32); + else if (c.equals(UInt32.class)) out[level].append((char) Message.ArgumentType.UINT32); + else if (c.equals(Long.class)) out[level].append((char) Message.ArgumentType.INT64); + else if (c.equals(Long.TYPE)) out[level].append((char) Message.ArgumentType.INT64); + else if (c.equals(UInt64.class)) out[level].append((char) Message.ArgumentType.UINT64); + else if (c.equals(Double.class)) out[level].append((char) Message.ArgumentType.DOUBLE); + else if (c.equals(Double.TYPE)) out[level].append((char) Message.ArgumentType.DOUBLE); + else if (c.equals(Float.class) && AbstractConnection.FLOAT_SUPPORT) out[level].append((char) Message.ArgumentType.FLOAT); + else if (c.equals(Float.class)) out[level].append((char) Message.ArgumentType.DOUBLE); + else if (c.equals(Float.TYPE) && AbstractConnection.FLOAT_SUPPORT) out[level].append((char) Message.ArgumentType.FLOAT); + else if (c.equals(Float.TYPE)) out[level].append((char) Message.ArgumentType.DOUBLE); + else if (c.equals(String.class)) out[level].append((char) Message.ArgumentType.STRING); + else if (c.equals(Variant.class)) out[level].append((char) Message.ArgumentType.VARIANT); + else if (c instanceof Class && + DBusInterface.class.isAssignableFrom((Class) c)) out[level].append((char) Message.ArgumentType.OBJECT_PATH); + else if (c instanceof Class && + Path.class.equals((Class) c)) out[level].append((char) Message.ArgumentType.OBJECT_PATH); + else if (c instanceof Class && + ObjectPath.class.equals((Class) c)) out[level].append((char) Message.ArgumentType.OBJECT_PATH); + else if (c instanceof Class && + ((Class) c).isArray()) { + if (Type.class.equals(((Class) c).getComponentType())) + out[level].append((char) Message.ArgumentType.SIGNATURE); + else { + out[level].append((char) Message.ArgumentType.ARRAY); + String[] s = recursiveGetDBusType(((Class) c).getComponentType(), false, level+1); + if (s.length != 1) throw new DBusException(_("Multi-valued array types not permitted")); + out[level].append(s[0]); + } + } else if (c instanceof Class && + Struct.class.isAssignableFrom((Class) c)) { + out[level].append((char) Message.ArgumentType.STRUCT1); + Type[] ts = Container.getTypeCache(c); + if (null == ts) { + Field[] fs = ((Class) c).getDeclaredFields(); + ts = new Type[fs.length]; + for (Field f : fs) { + Position p = f.getAnnotation(Position.class); + if (null == p) continue; + ts[p.value()] = f.getGenericType(); + } + Container.putTypeCache(c, ts); + } + + for (Type t: ts) + if (t != null) + for (String s: recursiveGetDBusType(t, false, level+1)) + out[level].append(s); + out[level].append(')'); + } else { + throw new DBusException(_("Exporting non-exportable type ")+c); + } + + if (Debug.debug) Debug.print(Debug.VERBOSE, "Converted Java type: "+c+" to D-Bus Type: "+out[level]); + + return new String[] { out[level].toString() }; + } + + /** + * Converts a dbus type string into Java Type objects, + * @param dbus The DBus type or types. + * @param rv Vector to return the types in. + * @param limit Maximum number of types to parse (-1 == nolimit). + * @return number of characters parsed from the type string. + */ + public static int getJavaType(String dbus, List rv, int limit) throws DBusException + { + if (null == dbus || "".equals(dbus) || 0 == limit) return 0; + + try { + int i = 0; + for (; i < dbus.length() && (-1 == limit || limit > rv.size()); i++) + switch(dbus.charAt(i)) { + case Message.ArgumentType.STRUCT1: + int j = i+1; + for (int c = 1; c > 0; j++) { + if (')' == dbus.charAt(j)) c--; + else if (Message.ArgumentType.STRUCT1 == dbus.charAt(j)) c++; + } + + Vector contained = new Vector(); + int c = getJavaType(dbus.substring(i+1, j-1), contained, -1); + rv.add(new DBusStructType(contained.toArray(new Type[0]))); + i = j; + break; + case Message.ArgumentType.ARRAY: + if (Message.ArgumentType.DICT_ENTRY1 == dbus.charAt(i+1)) { + contained = new Vector(); + c = getJavaType(dbus.substring(i+2), contained, 2); + rv.add(new DBusMapType(contained.get(0), contained.get(1))); + i += (c+2); + } else { + contained = new Vector(); + c = getJavaType(dbus.substring(i+1), contained, 1); + rv.add(new DBusListType(contained.get(0))); + i += c; + } + break; + case Message.ArgumentType.VARIANT: + rv.add(Variant.class); + break; + case Message.ArgumentType.BOOLEAN: + rv.add(Boolean.class); + break; + case Message.ArgumentType.INT16: + rv.add(Short.class); + break; + case Message.ArgumentType.BYTE: + rv.add(Byte.class); + break; + case Message.ArgumentType.OBJECT_PATH: + rv.add(DBusInterface.class); + break; + case Message.ArgumentType.UINT16: + rv.add(UInt16.class); + break; + case Message.ArgumentType.INT32: + rv.add(Integer.class); + break; + case Message.ArgumentType.UINT32: + rv.add(UInt32.class); + break; + case Message.ArgumentType.INT64: + rv.add(Long.class); + break; + case Message.ArgumentType.UINT64: + rv.add(UInt64.class); + break; + case Message.ArgumentType.DOUBLE: + rv.add(Double.class); + break; + case Message.ArgumentType.FLOAT: + rv.add(Float.class); + break; + case Message.ArgumentType.STRING: + rv.add(String.class); + break; + case Message.ArgumentType.SIGNATURE: + rv.add(Type[].class); + break; + case Message.ArgumentType.DICT_ENTRY1: + rv.add(Map.Entry.class); + contained = new Vector(); + c = getJavaType(dbus.substring(i+1), contained, 2); + i+=c+1; + break; + default: + throw new DBusException(MessageFormat.format(_("Failed to parse DBus type signature: {0} ({1})."), new Object[] { dbus, dbus.charAt(i) })); + } + return i; + } catch (IndexOutOfBoundsException IOOBe) { + IOOBe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, IOOBe); + throw new DBusException(_("Failed to parse DBus type signature: ")+dbus); + } + } + /** + * Recursively converts types for serialization onto DBus. + * @param parameters The parameters to convert. + * @param types The (possibly generic) types of the parameters. + * @return The converted parameters. + * @throws DBusException Thrown if there is an error in converting the objects. + */ + @SuppressWarnings("unchecked") + public static Object[] convertParameters(Object[] parameters, Type[] types, AbstractConnection conn) throws DBusException + { + if (null == parameters) return null; + for (int i = 0; i < parameters.length; i++) { + if (Debug.debug) Debug.print(Debug.VERBOSE,"Converting "+i+" from "+parameters[i]+" to "+types[i]); + if (null == parameters[i]) continue; + + if (parameters[i] instanceof DBusSerializable) { + for (Method m: parameters[i].getClass().getDeclaredMethods()) + if (m.getName().equals("deserialize")) { + Type[] newtypes = m.getParameterTypes(); + Type[] expand = new Type[types.length + newtypes.length - 1]; + System.arraycopy(types, 0, expand, 0, i); + System.arraycopy(newtypes, 0, expand, i, newtypes.length); + System.arraycopy(types, i+1, expand, i+newtypes.length, types.length-i-1); + types = expand; + Object[] newparams = ((DBusSerializable) parameters[i]).serialize(); + Object[] exparams = new Object[parameters.length + newparams.length - 1]; + System.arraycopy(parameters, 0, exparams, 0, i); + System.arraycopy(newparams, 0, exparams, i, newparams.length); + System.arraycopy(parameters, i+1, exparams, i+newparams.length, parameters.length-i-1); + parameters = exparams; + } + i--; + } else if (parameters[i] instanceof Tuple) { + Type[] newtypes = ((ParameterizedType) types[i]).getActualTypeArguments(); + Type[] expand = new Type[types.length + newtypes.length - 1]; + System.arraycopy(types, 0, expand, 0, i); + System.arraycopy(newtypes, 0, expand, i, newtypes.length); + System.arraycopy(types, i+1, expand, i+newtypes.length, types. length-i-1); + types = expand; + Object[] newparams = ((Tuple) parameters[i]).getParameters(); + Object[] exparams = new Object[parameters.length + newparams.length - 1]; + System.arraycopy(parameters, 0, exparams, 0, i); + System.arraycopy(newparams, 0, exparams, i, newparams.length); + System.arraycopy(parameters, i+1, exparams, i+newparams.length, parameters.length-i-1); + parameters = exparams; + if (Debug.debug) Debug.print(Debug.VERBOSE, "New params: "+Arrays.deepToString(parameters)+" new types: "+Arrays.deepToString(types)); + i--; + } else if (types[i] instanceof TypeVariable && + !(parameters[i] instanceof Variant)) + // its an unwrapped variant, wrap it + parameters[i] = new Variant(parameters[i]); + else if (parameters[i] instanceof DBusInterface) + parameters[i] = conn.getExportedObject((DBusInterface) parameters[i]); + } + return parameters; + } + @SuppressWarnings("unchecked") + static Object deSerializeParameter(Object parameter, Type type, AbstractConnection conn) throws Exception + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserializing from "+parameter.getClass()+" to "+type.getClass()); + if (null == parameter) + return null; + + // its a wrapped variant, unwrap it + if (type instanceof TypeVariable + && parameter instanceof Variant) { + parameter = ((Variant)parameter).getValue(); + } + + // Turn a signature into a Type[] + if (type instanceof Class + && ((Class) type).isArray() + && ((Class) type).getComponentType().equals(Type.class) + && parameter instanceof String) { + Vector rv = new Vector(); + getJavaType((String) parameter, rv, -1); + parameter = rv.toArray(new Type[0]); + } + + // its an object path, get/create the proxy + if (parameter instanceof ObjectPath) { + if (type instanceof Class && DBusInterface.class.isAssignableFrom((Class) type)) + parameter = conn.getExportedObject( + ((ObjectPath) parameter).source, + ((ObjectPath) parameter).path); + else + parameter = new Path(((ObjectPath) parameter).path); + } + + // it should be a struct. create it + if (parameter instanceof Object[] && + type instanceof Class && + Struct.class.isAssignableFrom((Class) type)) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Creating Struct "+type+" from "+parameter); + Type[] ts = Container.getTypeCache(type); + if (null == ts) { + Field[] fs = ((Class) type).getDeclaredFields(); + ts = new Type[fs.length]; + for (Field f : fs) { + Position p = f.getAnnotation(Position.class); + if (null == p) continue; + ts[p.value()] = f.getGenericType(); + } + Container.putTypeCache(type, ts); + } + + // recurse over struct contents + parameter = deSerializeParameters((Object[]) parameter, ts, conn); + for (Constructor con: ((Class) type).getDeclaredConstructors()) { + try { + parameter = con.newInstance((Object[]) parameter); + break; + } catch (IllegalArgumentException IAe) {} + } + } + + // recurse over arrays + if (parameter instanceof Object[]) { + Type[] ts = new Type[((Object[]) parameter).length]; + Arrays.fill(ts, parameter.getClass().getComponentType()); + parameter = deSerializeParameters((Object[]) parameter, + ts, conn); + } + if (parameter instanceof List) { + Type type2; + if (type instanceof ParameterizedType) + type2 = ((ParameterizedType) type).getActualTypeArguments()[0]; + else if (type instanceof GenericArrayType) + type2 = ((GenericArrayType) type).getGenericComponentType(); + else if (type instanceof Class && ((Class) type).isArray()) + type2 = ((Class) type).getComponentType(); + else + type2 = null; + if (null != type2) + parameter = deSerializeParameters((List) parameter, type2, conn); + } + + // correct floats if appropriate + if (type.equals(Float.class) || type.equals(Float.TYPE)) + if (!(parameter instanceof Float)) + parameter = ((Number) parameter).floatValue(); + + // make sure arrays are in the correct format + if (parameter instanceof Object[] || + parameter instanceof List || + parameter.getClass().isArray()) { + if (type instanceof ParameterizedType) + parameter = ArrayFrob.convert(parameter, + (Class) ((ParameterizedType) type).getRawType()); + else if (type instanceof GenericArrayType) { + Type ct = ((GenericArrayType) type).getGenericComponentType(); + Class cc = null; + if (ct instanceof Class) + cc = (Class) ct; + if (ct instanceof ParameterizedType) + cc = (Class) ((ParameterizedType) ct).getRawType(); + Object o = Array.newInstance(cc, 0); + parameter = ArrayFrob.convert(parameter, + o.getClass()); + } else if (type instanceof Class && + ((Class) type).isArray()) { + Class cc = ((Class) type).getComponentType(); + if ((cc.equals(Float.class) || cc.equals(Float.TYPE)) + && (parameter instanceof double[])) { + double[] tmp1 = (double[]) parameter; + float[] tmp2 = new float[tmp1.length]; + for (int i = 0; i < tmp1.length; i++) + tmp2[i] = (float) tmp1[i]; + parameter = tmp2; + } + Object o = Array.newInstance(cc, 0); + parameter = ArrayFrob.convert(parameter, + o.getClass()); + } + } + if (parameter instanceof DBusMap) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserializing a Map"); + DBusMap dmap = (DBusMap) parameter; + Type[] maptypes = ((ParameterizedType) type).getActualTypeArguments(); + for (int i = 0; i < dmap.entries.length; i++) { + dmap.entries[i][0] = deSerializeParameter(dmap.entries[i][0], maptypes[0], conn); + dmap.entries[i][1] = deSerializeParameter(dmap.entries[i][1], maptypes[1], conn); + } + } + return parameter; + } + static List deSerializeParameters(List parameters, Type type, AbstractConnection conn) throws Exception + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserializing from "+parameters+" to "+type); + if (null == parameters) return null; + for (int i = 0; i < parameters.size(); i++) { + if (null == parameters.get(i)) continue; + + /* DO NOT DO THIS! IT'S REALLY NOT SUPPORTED! + * if (type instanceof Class && + DBusSerializable.class.isAssignableFrom((Class) types[i])) { + for (Method m: ((Class) types[i]).getDeclaredMethods()) + if (m.getName().equals("deserialize")) { + Type[] newtypes = m.getGenericParameterTypes(); + try { + Object[] sub = new Object[newtypes.length]; + System.arraycopy(parameters, i, sub, 0, newtypes.length); + sub = deSerializeParameters(sub, newtypes, conn); + DBusSerializable sz = (DBusSerializable) ((Class) types[i]).newInstance(); + m.invoke(sz, sub); + Object[] compress = new Object[parameters.length - newtypes.length + 1]; + System.arraycopy(parameters, 0, compress, 0, i); + compress[i] = sz; + System.arraycopy(parameters, i + newtypes.length, compress, i+1, parameters.length - i - newtypes.length); + parameters = compress; + } catch (ArrayIndexOutOfBoundsException AIOOBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, AIOOBe); + throw new DBusException("Not enough elements to create custom object from serialized data ("+(parameters.size()-i)+" < "+(newtypes.length)+")"); + } + } + } else*/ + parameters.set(i, deSerializeParameter(parameters.get(i), type, conn)); + } + return parameters; + } + + @SuppressWarnings("unchecked") + static Object[] deSerializeParameters(Object[] parameters, Type[] types, AbstractConnection conn) throws Exception + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Deserializing from "+Arrays.deepToString(parameters)+" to "+Arrays.deepToString(types)); + if (null == parameters) return null; + + if (types.length == 1 && types[0] instanceof ParameterizedType + && Tuple.class.isAssignableFrom((Class) ((ParameterizedType) types[0]).getRawType())) { + types = ((ParameterizedType) types[0]).getActualTypeArguments(); + } + + for (int i = 0; i < parameters.length; i++) { + // CHECK IF ARRAYS HAVE THE SAME LENGTH <-- has to happen after expanding parameters + if (i >= types.length) { + if (Debug.debug) { + for (int j = 0; j < parameters.length; j++) { + Debug.print(Debug.ERR, String.format("Error, Parameters difference (%1d, '%2s')", j, parameters[j].toString())); + } + } + throw new DBusException(_("Error deserializing message: number of parameters didn't match receiving signature")); + } + if (null == parameters[i]) continue; + + if ((types[i] instanceof Class && + DBusSerializable.class.isAssignableFrom((Class) types[i])) || + (types[i] instanceof ParameterizedType && + DBusSerializable.class.isAssignableFrom((Class) ((ParameterizedType) types[i]).getRawType()))) { + Class dsc; + if (types[i] instanceof Class) + dsc = (Class) types[i]; + else + dsc = (Class) ((ParameterizedType) types[i]).getRawType(); + for (Method m: dsc.getDeclaredMethods()) + if (m.getName().equals("deserialize")) { + Type[] newtypes = m.getGenericParameterTypes(); + try { + Object[] sub = new Object[newtypes.length]; + System.arraycopy(parameters, i, sub, 0, newtypes.length); + sub = deSerializeParameters(sub, newtypes, conn); + DBusSerializable sz = dsc.newInstance(); + m.invoke(sz, sub); + Object[] compress = new Object[parameters.length - newtypes.length + 1]; + System.arraycopy(parameters, 0, compress, 0, i); + compress[i] = sz; + System.arraycopy(parameters, i + newtypes.length, compress, i+1, parameters.length - i - newtypes.length); + parameters = compress; + } catch (ArrayIndexOutOfBoundsException AIOOBe) { + AIOOBe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, AIOOBe); + throw new DBusException(MessageFormat.format(_("Not enough elements to create custom object from serialized data ({0} < {1})."), + new Object[] { parameters.length-i, newtypes.length })); + } + } + } else + parameters[i] = deSerializeParameter(parameters[i], types[i], conn); + } + return parameters; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Message.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Message.java new file mode 100755 index 0000000..269ffab --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Message.java @@ -0,0 +1,1225 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Array; +import java.lang.reflect.Type; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import cx.ath.matthew.debug.Debug; +import cx.ath.matthew.utils.Hexdump; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.MarshallingException; +import org.freedesktop.dbus.exceptions.UnknownTypeCodeException; + +/** + * Superclass of all messages which are sent over the Bus. + * This class deals with all the marshalling to/from the wire format. + */ +public class Message +{ + /** Defines constants representing the endianness of the message. */ + public static interface Endian { + public static final byte BIG = 'B'; + public static final byte LITTLE = 'l'; + } + /** Defines constants representing the flags which can be set on a message. */ + public static interface Flags { + public static final byte NO_REPLY_EXPECTED = 0x01; + public static final byte NO_AUTO_START = 0x02; + public static final byte ASYNC = 0x40; + } + /** Defines constants for each message type. */ + public static interface MessageType { + public static final byte METHOD_CALL = 1; + public static final byte METHOD_RETURN = 2; + public static final byte ERROR = 3; + public static final byte SIGNAL = 4; + } + /** The current protocol major version. */ + public static final byte PROTOCOL = 1; + /** Defines constants for each valid header field type. */ + public static interface HeaderField { + public static final byte PATH = 1; + public static final byte INTERFACE = 2; + public static final byte MEMBER = 3; + public static final byte ERROR_NAME = 4; + public static final byte REPLY_SERIAL = 5; + public static final byte DESTINATION = 6; + public static final byte SENDER = 7; + public static final byte SIGNATURE = 8; + } + /** Defines constants for each argument type. + * There are two constants for each argument type, + * as a byte or as a String (the _STRING version) */ + public static interface ArgumentType { + public static final String BYTE_STRING="y"; + public static final String BOOLEAN_STRING="b"; + public static final String INT16_STRING="n"; + public static final String UINT16_STRING="q"; + public static final String INT32_STRING="i"; + public static final String UINT32_STRING="u"; + public static final String INT64_STRING="x"; + public static final String UINT64_STRING="t"; + public static final String DOUBLE_STRING="d"; + public static final String FLOAT_STRING="f"; + public static final String STRING_STRING="s"; + public static final String OBJECT_PATH_STRING="o"; + public static final String SIGNATURE_STRING="g"; + public static final String ARRAY_STRING="a"; + public static final String VARIANT_STRING="v"; + public static final String STRUCT_STRING="r"; + public static final String STRUCT1_STRING="("; + public static final String STRUCT2_STRING=")"; + public static final String DICT_ENTRY_STRING="e"; + public static final String DICT_ENTRY1_STRING="{"; + public static final String DICT_ENTRY2_STRING="}"; + + public static final byte BYTE='y'; + public static final byte BOOLEAN='b'; + public static final byte INT16='n'; + public static final byte UINT16='q'; + public static final byte INT32='i'; + public static final byte UINT32='u'; + public static final byte INT64='x'; + public static final byte UINT64='t'; + public static final byte DOUBLE='d'; + public static final byte FLOAT='f'; + public static final byte STRING='s'; + public static final byte OBJECT_PATH='o'; + public static final byte SIGNATURE='g'; + public static final byte ARRAY='a'; + public static final byte VARIANT='v'; + public static final byte STRUCT='r'; + public static final byte STRUCT1='('; + public static final byte STRUCT2=')'; + public static final byte DICT_ENTRY='e'; + public static final byte DICT_ENTRY1='{'; + public static final byte DICT_ENTRY2='}'; + } + /** Keep a static reference to each size of padding array to prevent allocation. */ + private static byte[][] padding; + static { + padding = new byte[][] { + null, + new byte[1], + new byte[2], + new byte[3], + new byte[4], + new byte[5], + new byte[6], + new byte[7] }; + } + /** Steps to increment the buffer array. */ + private static final int BUFFERINCREMENT = 20; + + private boolean big; + protected byte[][] wiredata; + protected long bytecounter; + protected Map headers; + protected static long globalserial = 0; + protected long serial; + protected byte type; + protected byte flags; + protected byte protover; + private Object[] args; + private byte[] body; + private long bodylen = 0; + private int preallocated = 0; + private int paofs = 0; + private byte[] pabuf; + private int bufferuse = 0; + + /** + * Returns the name of the given header field. + */ + public static String getHeaderFieldName(byte field) + { + switch (field) { + case HeaderField.PATH: return "Path"; + case HeaderField.INTERFACE: return "Interface"; + case HeaderField.MEMBER: return "Member"; + case HeaderField.ERROR_NAME: return "Error Name"; + case HeaderField.REPLY_SERIAL: return "Reply Serial"; + case HeaderField.DESTINATION: return "Destination"; + case HeaderField.SENDER: return "Sender"; + case HeaderField.SIGNATURE: return "Signature"; + default: return "Invalid"; + } + } + + /** + * Create a message; only to be called by sub-classes. + * @param endian The endianness to create the message. + * @param type The message type. + * @param flags Any message flags. + */ + protected Message(byte endian, byte type, byte flags) throws DBusException + { + wiredata = new byte[BUFFERINCREMENT][]; + headers = new HashMap(); + big = (Endian.BIG == endian); + bytecounter = 0; + synchronized (Message.class) { + serial = ++globalserial; + } + if (Debug.debug) Debug.print(Debug.DEBUG, "Creating message with serial "+serial); + this.type = type; + this.flags = flags; + preallocate(4); + append("yyyy", endian, type, flags, Message.PROTOCOL); + } + /** + * Create a blank message. Only to be used when calling populate. + */ + protected Message() + { + wiredata = new byte[BUFFERINCREMENT][]; + headers = new HashMap(); + bytecounter = 0; + } + /** + * Create a message from wire-format data. + * @param msg D-Bus serialized data of type yyyuu + * @param headers D-Bus serialized data of type a(yv) + * @param body D-Bus serialized data of the signature defined in headers. + */ + @SuppressWarnings("unchecked") + void populate(byte[] msg, byte[] headers, byte[] body) throws DBusException + { + big = (msg[0] == Endian.BIG); + type = msg[1]; + flags = msg[2]; + protover = msg[3]; + wiredata[0] = msg; + wiredata[1] = headers; + wiredata[2] = body; + this.body = body; + bufferuse = 3; + bodylen = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 4)[0]).longValue(); + serial = ((Number) extract(Message.ArgumentType.UINT32_STRING, msg, 8)[0]).longValue(); + bytecounter = msg.length+headers.length+body.length; + if (Debug.debug) Debug.print(Debug.VERBOSE, headers); + Object[] hs = extract("a(yv)", headers, 0); + if (Debug.debug) Debug.print(Debug.VERBOSE, Arrays.deepToString(hs)); + for (Object o: (Vector) hs[0]) { + this.headers.put((Byte) ((Object[])o)[0], ((Variant)((Object[])o)[1]).getValue()); + } + } + /** + * Create a buffer of num bytes. + * Data is copied to this rather than added to the buffer list. + */ + private void preallocate(int num) + { + preallocated = 0; + pabuf = new byte[num]; + appendBytes(pabuf); + preallocated = num; + paofs = 0; + } + /** + * Ensures there are enough free buffers. + * @param num number of free buffers to create. + */ + private void ensureBuffers(int num) + { + int increase = num - wiredata.length + bufferuse; + if (increase > 0) { + if (increase < BUFFERINCREMENT) increase = BUFFERINCREMENT; + if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing "+bufferuse); + byte[][] temp = new byte[wiredata.length+increase][]; + System.arraycopy(wiredata, 0, temp, 0, wiredata.length); + wiredata = temp; + } + } + /** + * Appends a buffer to the buffer list. + */ + protected void appendBytes(byte[] buf) + { + if (null == buf) return; + if (preallocated > 0) { + if (paofs+buf.length > pabuf.length) + throw new ArrayIndexOutOfBoundsException(MessageFormat.format(_("Array index out of bounds, paofs={0}, pabuf.length={1}, buf.length={2}."), new Object[] { paofs, pabuf.length, buf.length })); + System.arraycopy(buf, 0, pabuf, paofs, buf.length); + paofs += buf.length; + preallocated -= buf.length; + } else { + if (bufferuse == wiredata.length) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing "+bufferuse); + byte[][] temp = new byte[wiredata.length+BUFFERINCREMENT][]; + System.arraycopy(wiredata, 0, temp, 0, wiredata.length); + wiredata = temp; + } + wiredata[bufferuse++] = buf; + bytecounter += buf.length; + } + } + /** + * Appends a byte to the buffer list. + */ + protected void appendByte(byte b) + { + if (preallocated > 0) { + pabuf[paofs++] = b; + preallocated--; + } else { + if (bufferuse == wiredata.length) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Resizing "+bufferuse); + byte[][] temp = new byte[wiredata.length+BUFFERINCREMENT][]; + System.arraycopy(wiredata, 0, temp, 0, wiredata.length); + wiredata = temp; + } + wiredata[bufferuse++] = new byte[] { b }; + bytecounter++; + } + } + /** + * Demarshalls an integer of a given width from a buffer. + * Endianness is determined from the format of the message. + * @param buf The buffer to demarshall from. + * @param ofs The offset to demarshall from. + * @param width The byte-width of the int. + */ + public long demarshallint(byte[] buf, int ofs, int width) + { return big ? demarshallintBig(buf,ofs,width) : demarshallintLittle(buf,ofs,width); } + /** + * Demarshalls an integer of a given width from a buffer. + * @param buf The buffer to demarshall from. + * @param ofs The offset to demarshall from. + * @param endian The endianness to use in demarshalling. + * @param width The byte-width of the int. + */ + public static long demarshallint(byte[] buf, int ofs, byte endian, int width) + { return endian==Endian.BIG ? demarshallintBig(buf,ofs,width) : demarshallintLittle(buf,ofs,width); } + /** + * Demarshalls an integer of a given width from a buffer using big-endian format. + * @param buf The buffer to demarshall from. + * @param ofs The offset to demarshall from. + * @param width The byte-width of the int. + */ + public static long demarshallintBig(byte[] buf, int ofs, int width) + { + long l = 0; + for (int i = 0; i < width; i++) { + l <<=8; + l |= (buf[ofs+i] & 0xFF); + } + return l; + } + /** + * Demarshalls an integer of a given width from a buffer using little-endian format. + * @param buf The buffer to demarshall from. + * @param ofs The offset to demarshall from. + * @param width The byte-width of the int. + */ + public static long demarshallintLittle(byte[] buf, int ofs, int width) + { + long l = 0; + for (int i = (width-1); i >= 0; i--) { + l <<=8; + l |= (buf[ofs+i] & 0xFF); + } + return l; + } + /** + * Marshalls an integer of a given width and appends it to the message. + * Endianness is determined from the message. + * @param l The integer to marshall. + * @param width The byte-width of the int. + */ + public void appendint(long l, int width) + { + byte[] buf = new byte[width]; + marshallint(l, buf, 0, width); + appendBytes(buf); + } + /** + * Marshalls an integer of a given width into a buffer. + * Endianness is determined from the message. + * @param l The integer to marshall. + * @param buf The buffer to marshall to. + * @param ofs The offset to marshall to. + * @param width The byte-width of the int. + */ + public void marshallint(long l, byte[] buf, int ofs, int width) + { + if (big) marshallintBig(l, buf, ofs, width); else marshallintLittle(l, buf, ofs, width); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Marshalled int "+l+" to "+Hexdump.toHex(buf,ofs,width)); + } + /** + * Marshalls an integer of a given width into a buffer using big-endian format. + * @param l The integer to marshall. + * @param buf The buffer to marshall to. + * @param ofs The offset to marshall to. + * @param width The byte-width of the int. + */ + public static void marshallintBig(long l, byte[] buf, int ofs, int width) + { + for (int i = (width-1); i >= 0; i--) { + buf[i+ofs] = (byte) (l & 0xFF); + l >>= 8; + } + } + /** + * Marshalls an integer of a given width into a buffer using little-endian format. + * @param l The integer to marshall. + * @param buf The buffer to demarshall to. + * @param ofs The offset to demarshall to. + * @param width The byte-width of the int. + */ + public static void marshallintLittle(long l, byte[] buf, int ofs, int width) + { + for (int i = 0; i < width; i++) { + buf[i+ofs] = (byte) (l & 0xFF); + l >>= 8; + } + } + public byte[][] getWireData() + { + return wiredata; + } + /** + * Formats the message in a human-readable format. + */ + public String toString() + { + StringBuffer sb = new StringBuffer(); + sb.append(getClass().getSimpleName()); + sb.append ('('); + sb.append (flags); + sb.append (','); + sb.append(serial); + sb.append (')'); + sb.append (' '); + sb.append ('{'); + sb.append(' '); + if (headers.size() == 0) + sb.append('}'); + else { + for (Byte field: headers.keySet()) { + sb.append(getHeaderFieldName(field)); + sb.append('='); + sb.append('>'); + sb.append(headers.get(field).toString()); + sb.append(','); + sb.append(' '); + } + sb.setCharAt(sb.length()-2,' '); + sb.setCharAt(sb.length()-1,'}'); + } + sb.append(' '); + sb.append('{'); + sb.append(' '); + Object[] args = null; + try { + args = getParameters(); + } catch (DBusException DBe) { + DBe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + } + if (null == args || 0 == args.length) + sb.append('}'); + else { + for (Object o: args) { + if (o instanceof Object[]) + sb.append(Arrays.deepToString((Object[]) o)); + else if (o instanceof byte[]) + sb.append(Arrays.toString((byte[]) o)); + else if (o instanceof int[]) + sb.append(Arrays.toString((int[]) o)); + else if (o instanceof short[]) + sb.append(Arrays.toString((short[]) o)); + else if (o instanceof long[]) + sb.append(Arrays.toString((long[]) o)); + else if (o instanceof boolean[]) + sb.append(Arrays.toString((boolean[]) o)); + else if (o instanceof double[]) + sb.append(Arrays.toString((double[]) o)); + else if (o instanceof float[]) + sb.append(Arrays.toString((float[]) o)); + else + if (o != null) { // pego + sb.append(o.toString()); + } else { // pego + sb.append("null"); // pego + } // pego + sb.append(','); + sb.append(' '); + } + sb.setCharAt(sb.length()-2,' '); + sb.setCharAt(sb.length()-1,'}'); + } + return sb.toString(); + } + /** + * Returns the value of the header field of a given field. + * @param type The field to return. + * @return The value of the field or null if unset. + */ + public Object getHeader(byte type) { return headers.get(type); } + /** + * Appends a value to the message. + * The type of the value is read from a D-Bus signature and used to marshall + * the value. + * @param sigb A buffer of the D-Bus signature. + * @param sigofs The offset into the signature corresponding to this value. + * @param data The value to marshall. + * @return The offset into the signature of the end of this value's type. + */ + @SuppressWarnings("unchecked") + private int appendone(byte[] sigb, int sigofs, Object data) throws DBusException + { + try { + int i = sigofs; + if (Debug.debug) Debug.print(Debug.VERBOSE, (Object) bytecounter); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending type: "+((char)sigb[i])+" value: "+data); + + // pad to the alignment of this type. + pad(sigb[i]); + switch (sigb[i]) { + case ArgumentType.BYTE: + appendByte(((Number) data).byteValue()); + break; + case ArgumentType.BOOLEAN: + appendint(((Boolean) data).booleanValue() ? 1 : 0, 4); + break; + case ArgumentType.DOUBLE: + long l = Double.doubleToLongBits(((Number) data).doubleValue()); + appendint(l, 8); + break; + case ArgumentType.FLOAT: + int rf = Float.floatToIntBits(((Number) data).floatValue()); + appendint(rf, 4); + break; + case ArgumentType.UINT32: + appendint(((Number) data).longValue(), 4); + break; + case ArgumentType.INT64: + appendint(((Number) data).longValue(), 8); + break; + case ArgumentType.UINT64: + if (big) { + appendint(((UInt64) data).top(), 4); + appendint(((UInt64) data).bottom(), 4); + } else { + appendint(((UInt64) data).bottom(), 4); + appendint(((UInt64) data).top(), 4); + } + break; + case ArgumentType.INT32: + appendint(((Number) data).intValue(), 4); + break; + case ArgumentType.UINT16: + appendint(((Number) data).intValue(), 2); + break; + case ArgumentType.INT16: + appendint(((Number) data).shortValue(), 2); + break; + case ArgumentType.STRING: + case ArgumentType.OBJECT_PATH: + // Strings are marshalled as a UInt32 with the length, + // followed by the String, followed by a null byte. + String payload = data.toString(); + byte[] payloadbytes = null; + try { + payloadbytes = payload.getBytes("UTF-8"); + } catch (UnsupportedEncodingException UEe) { + UEe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(UEe); + throw new DBusException(_("System does not support UTF-8 encoding")); + } + if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending String of length "+payloadbytes.length); + appendint(payloadbytes.length, 4); + appendBytes(payloadbytes); + appendBytes(padding[1]); + //pad(ArgumentType.STRING);? do we need this? + break; + case ArgumentType.SIGNATURE: + // Signatures are marshalled as a byte with the length, + // followed by the String, followed by a null byte. + // Signatures are generally short, so preallocate the array + // for the string, length and null byte. + if (data instanceof Type[]) + payload = Marshalling.getDBusType((Type[]) data); + else + payload = (String) data; + byte[] pbytes = payload.getBytes(); + preallocate(2+pbytes.length); + appendByte((byte) pbytes.length); + appendBytes(pbytes); + appendByte((byte) 0); + break; + case ArgumentType.ARRAY: + // Arrays are given as a UInt32 for the length in bytes, + // padding to the element alignment, then elements in + // order. The length is the length from the end of the + // initial padding to the end of the last element. + if (Debug.debug) { + if (data instanceof Object[]) + Debug.print(Debug.VERBOSE, "Appending array: "+Arrays.deepToString((Object[])data)); + } + + byte[] alen = new byte[4]; + appendBytes(alen); + pad(sigb[++i]); + long c = bytecounter; + + // optimise primatives + if (data.getClass().isArray() && + data.getClass().getComponentType().isPrimitive()) { + byte[] primbuf; + int algn = getAlignment(sigb[i]); + int len = Array.getLength(data); + switch (sigb[i]) { + case ArgumentType.BYTE: + primbuf = (byte[]) data; + break; + case ArgumentType.INT16: + case ArgumentType.INT32: + case ArgumentType.INT64: + primbuf = new byte[len*algn]; + for (int j = 0, k = 0; j < len; j++, k += algn) + marshallint(Array.getLong(data, j), primbuf, k, algn); + break; + case ArgumentType.BOOLEAN: + primbuf = new byte[len*algn]; + for (int j = 0, k = 0; j < len; j++, k += algn) + marshallint(Array.getBoolean(data, j)?1:0, primbuf, k, algn); + break; + case ArgumentType.DOUBLE: + primbuf = new byte[len*algn]; + if (data instanceof float[]) + for (int j = 0, k = 0; j < len; j++, k += algn) + marshallint(Double.doubleToRawLongBits(((float[])data)[j]), + primbuf, k, algn); + else + for (int j = 0, k = 0; j < len; j++, k += algn) + marshallint(Double.doubleToRawLongBits(((double[])data)[j]), + primbuf, k, algn); + break; + case ArgumentType.FLOAT: + primbuf = new byte[len*algn]; + for (int j = 0, k = 0; j < len; j++, k += algn) + marshallint( + Float.floatToRawIntBits(((float[])data)[j]), + primbuf, k, algn); + break; + default: + throw new MarshallingException(_("Primative array being sent as non-primative array.")); + } + appendBytes(primbuf); + } else if (data instanceof List) { + Object[] contents = ((List) data).toArray(); + int diff = i; + ensureBuffers(contents.length*4); + for (Object o: contents) + diff = appendone(sigb, i, o); + i = diff; + if (contents.length == 0 && sigb[i] == '(') { // pego In case of zero length array of structs, the 'struct signature' still has to be skipped. +// System.out.println("PEGO: Going to skip signature for zero sized array."); + int nestingLevel = 1; + int sigSkipIndex = i; + boolean correspondingStruct2Found = false; + while (!correspondingStruct2Found) { + sigSkipIndex++; +// System.out.println("PEGO: sigSkipIndex = " + sigSkipIndex + ", byte = " + sigb[sigSkipIndex]); + switch (sigb[sigSkipIndex]) { + case ArgumentType.STRUCT1: + nestingLevel++; + break; + + case ArgumentType.STRUCT2: + nestingLevel--; + if (nestingLevel == 0) { + correspondingStruct2Found = true; + } + break; + + default: + // no action + } + } + i = sigSkipIndex; +// System.out.println("PEGO: setting i to: " + i); + } + } else if (data instanceof Map) { + int diff = i; + ensureBuffers(((Map) data).size()*6); + for (Map.Entry o: ((Map) data).entrySet()) + diff = appendone(sigb, i, o); + if (i == diff) { + // advance the type parser even on 0-size arrays. + Vector temp = new Vector(); + byte[] temp2 = new byte[sigb.length-diff]; + System.arraycopy(sigb, diff, temp2, 0, temp2.length); + String temp3 = new String(temp2); + int temp4 = Marshalling.getJavaType(temp3, temp, 1); + diff += temp4; + } + i = diff; + } else { + Object[] contents = (Object[]) data; + ensureBuffers(contents.length*4); + int diff = i; + for (Object o: contents) + diff = appendone(sigb, i, o); + i = diff; + } + if (Debug.debug) Debug.print(Debug.VERBOSE, "start: "+c+" end: "+bytecounter+" length: "+(bytecounter-c)); + marshallint(bytecounter-c, alen, 0, 4); + break; + case ArgumentType.STRUCT1: + // Structs are aligned to 8 bytes + // and simply contain each element marshalled in order + Object[] contents; + if (data instanceof Container) + contents = ((Container) data).getParameters(); + else + contents = (Object[]) data; + ensureBuffers(contents.length*4); + int j = 0; + for (i++; sigb[i] != ArgumentType.STRUCT2; i++) + i = appendone(sigb, i, contents[j++]); + break; + case ArgumentType.DICT_ENTRY1: + // Dict entries are the same as structs. + if (data instanceof Map.Entry) { + i++; + i = appendone(sigb, i, ((Map.Entry) data).getKey()); + i++; + i = appendone(sigb, i, ((Map.Entry) data).getValue()); + i++; + } else { + contents = (Object[]) data; + j = 0; + for (i++; sigb[i] != ArgumentType.DICT_ENTRY2; i++) + i = appendone(sigb, i, contents[j++]); + } + break; + case ArgumentType.VARIANT: + // Variants are marshalled as a signature + // followed by the value. + if (data instanceof Variant) { + Variant var = (Variant) data; + appendone(new byte[] {ArgumentType.SIGNATURE}, 0, var.getSig()); + appendone((var.getSig()).getBytes(), 0, var.getValue()); + } else if (data instanceof Object[]) { + contents = (Object[]) data; + appendone(new byte[] {ArgumentType.SIGNATURE}, 0, contents[0]); + appendone(((String) contents[0]).getBytes(), 0, contents[1]); + } else { + String sig = Marshalling.getDBusType(data.getClass())[0]; + appendone(new byte[] {ArgumentType.SIGNATURE}, 0, sig); + appendone((sig).getBytes(), 0, data); + } + break; + } + return i; + } catch (ClassCastException CCe) { + CCe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, CCe); + throw new MarshallingException(MessageFormat.format(_("Trying to marshall to unconvertable type (from {0} to {1})."), new Object[] { data.getClass().getName(), sigb[sigofs] })); + } + } + /** + * Pad the message to the proper alignment for the given type. + */ + public void pad(byte type) + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "padding for "+(char)type); + int a = getAlignment(type); + if (Debug.debug) Debug.print(Debug.VERBOSE, preallocated+" "+paofs+" "+bytecounter+" "+a); + int b = (int) ((bytecounter-preallocated)%a); + if (0 == b) return; + a = (a-b); + if (preallocated > 0) { + paofs += a; + preallocated -= a; + } else + appendBytes(padding[a]); + if (Debug.debug) Debug.print(Debug.VERBOSE, preallocated+" "+paofs+" "+bytecounter+" "+a); + } + /** + * Return the alignment for a given type. + */ + public static int getAlignment(byte type) + { + switch (type) { + case 2: + case ArgumentType.INT16: + case ArgumentType.UINT16: + return 2; + case 4: + case ArgumentType.BOOLEAN: + case ArgumentType.FLOAT: + case ArgumentType.INT32: + case ArgumentType.UINT32: + case ArgumentType.STRING: + case ArgumentType.OBJECT_PATH: + case ArgumentType.ARRAY: + return 4; + case 8: + case ArgumentType.INT64: + case ArgumentType.UINT64: + case ArgumentType.DOUBLE: + case ArgumentType.STRUCT: + case ArgumentType.DICT_ENTRY: + case ArgumentType.STRUCT1: + case ArgumentType.DICT_ENTRY1: + case ArgumentType.STRUCT2: + case ArgumentType.DICT_ENTRY2: + return 8; + case 1: + case ArgumentType.BYTE: + case ArgumentType.SIGNATURE: + case ArgumentType.VARIANT: + default: + return 1; + } + } + /** + * Append a series of values to the message. + * @param sig The signature(s) of the value(s). + * @param data The value(s). + */ + public void append(String sig, Object... data) throws DBusException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Appending sig: "+sig+" data: "+Arrays.deepToString(data)); + byte[] sigb = sig.getBytes(); + int j = 0; + for (int i = 0; i < sigb.length; i++) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Appending item: "+i+" "+((char)sigb[i])+" "+j); + i = appendone(sigb, i, data[j++]); + } + } + /** + * Align a counter to the given type. + * @param current The current counter. + * @param type The type to align to. + * @return The new, aligned, counter. + */ + public int align(int current, byte type) + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "aligning to "+(char)type); + int a = getAlignment(type); + if (0 == (current%a)) return current; + return current+(a-(current%a)); + } + /** + * Demarshall one value from a buffer. + * @param sigb A buffer of the D-Bus signature. + * @param buf The buffer to demarshall from. If null, no data will be read. + * This can be used to skip a part of the signature only, e.g. in + * case of a zero length array. pego + * @param ofs An array of two ints, the offset into the signature buffer + * and the offset into the data buffer. These values will be + * updated to the start of the next value after demarshalling. + * @param contained converts nested arrays to Lists + * @return The demarshalled value. + */ + private Object extractone(byte[] sigb, byte[] buf, int[] ofs, boolean contained) throws DBusException + { + if (Debug.debug) Debug.print(Debug.INFO, "Extracting type: "+((char)sigb[ofs[0]])+" from offset "+ofs[1]); + Object rv = null; + ofs[1] = align(ofs[1], sigb[ofs[0]]); + switch (sigb[ofs[0]]) { + case ArgumentType.BYTE: + if (buf != null) rv = buf[ofs[1]++]; + break; + case ArgumentType.UINT32: + if (buf != null) { + rv = new UInt32(demarshallint(buf, ofs[1], 4)); + ofs[1] += 4; + } + break; + case ArgumentType.INT32: + if (buf != null) { + rv = (int) demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + } + break; + case ArgumentType.INT16: + if (buf != null) { + rv = (short) demarshallint(buf, ofs[1], 2); + ofs[1] += 2; + } + break; + case ArgumentType.UINT16: + if (buf != null) { + rv = new UInt16((int) demarshallint(buf, ofs[1], 2)); + ofs[1] += 2; + } + break; + case ArgumentType.INT64: + if (buf != null) { + rv = demarshallint(buf, ofs[1], 8); + ofs[1] += 8; + } + break; + case ArgumentType.UINT64: + if (buf != null) { + long top; + long bottom; + if (big) { + top = demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + bottom = demarshallint(buf, ofs[1], 4); + } else { + bottom = demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + top = demarshallint(buf, ofs[1], 4); + } + rv = new UInt64(top, bottom); + ofs[1] += 4; + } + break; + case ArgumentType.DOUBLE: + if (buf != null) { + long l = demarshallint(buf, ofs[1], 8); + ofs[1] += 8; + rv = Double.longBitsToDouble(l); + } + break; + case ArgumentType.FLOAT: + if (buf != null) { + int rf = (int) demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + rv = Float.intBitsToFloat(rf); + } + break; + case ArgumentType.BOOLEAN: + if (buf != null) { + int rf = (int) demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + rv = (1==rf)?Boolean.TRUE:Boolean.FALSE; + } + break; + case ArgumentType.ARRAY: + if (buf != null) { + long size = demarshallint(buf, ofs[1], 4); + if (Debug.debug) Debug.print(Debug.INFO, "Reading array of size: "+size); + ofs[1] += 4; + byte algn = (byte) getAlignment(sigb[++ofs[0]]); + ofs[1] = align(ofs[1], sigb[ofs[0]]); + int length = (int) (size / algn); + if (length > DBusConnection.MAX_ARRAY_LENGTH) + throw new MarshallingException(_("Arrays must not exceed ")+DBusConnection.MAX_ARRAY_LENGTH); + // optimise primatives + switch (sigb[ofs[0]]) { + case ArgumentType.BYTE: + rv = new byte[length]; + System.arraycopy(buf, ofs[1], rv, 0, length); + ofs[1] += size; + break; + case ArgumentType.INT16: + rv = new short[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((short[]) rv)[j] = (short) demarshallint(buf, ofs[1], algn); + break; + case ArgumentType.INT32: + rv = new int[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((int[]) rv)[j] = (int) demarshallint(buf, ofs[1], algn); + break; + case ArgumentType.INT64: + rv = new long[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((long[]) rv)[j] = demarshallint(buf, ofs[1], algn); + break; + case ArgumentType.BOOLEAN: + rv = new boolean[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((boolean[]) rv)[j] = (1 == demarshallint(buf, ofs[1], algn)); + break; + case ArgumentType.FLOAT: + rv = new float[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((float[]) rv)[j] = + Float.intBitsToFloat((int)demarshallint(buf, ofs[1], algn)); + break; + case ArgumentType.DOUBLE: + rv = new double[length]; + for (int j = 0; j < length; j++, ofs[1] += algn) + ((double[]) rv)[j] = + Double.longBitsToDouble(demarshallint(buf, ofs[1], algn)); + break; + case ArgumentType.DICT_ENTRY1: +// if (0 == size) { +// // advance the type parser even on 0-size arrays. +// Vector temp = new Vector(); +// byte[] temp2 = new byte[sigb.length-ofs[0]]; +// System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length); +// String temp3 = new String(temp2); +// // ofs[0] gets incremented anyway. Leave one character on the stack +// int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1; +// ofs[0] += temp4; +// if (Debug.debug) Debug.print(Debug.VERBOSE, "Aligned type: "+temp3+" "+temp4+" "+ofs[0]); +// } + Vector entries = new Vector(); + if (size != 0) { + int ofssave = ofs[0]; + long end = ofs[1]+size; + while (ofs[1] < end) { + ofs[0] = ofssave; + entries.add((Object[]) extractone(sigb, buf, ofs, true)); + } + } else { + extractone(sigb, null, ofs, true); + } + rv = new DBusMap(entries.toArray(new Object[0][])); + break; + default: +// if (0 == size) { +// // advance the type parser even on 0-size arrays. +// Vector temp = new Vector(); +// byte[] temp2 = new byte[sigb.length-ofs[0]]; +// System.arraycopy(sigb, ofs[0], temp2, 0, temp2.length); +// String temp3 = new String(temp2); +// // ofs[0] gets incremented anyway. Leave one character on the stack +// int temp4 = Marshalling.getJavaType(temp3, temp, 1) - 1; +// ofs[0] += temp4; +// if (temp3.startsWith("(")) { // pego +// ofs[0]--; +// System.out.println("Zero length array of structs, decrementing ofs[0]"); +// } +// if (Debug.debug) Debug.print(Debug.VERBOSE, "Aligned type: "+temp3+" "+temp4+" "+ofs[0]); +// } + Vector contents = new Vector(); + if (size != 0) { + int ofssave = ofs[0]; + long end = ofs[1]+size; + while (ofs[1] < end) { + ofs[0] = ofssave; + contents.add(extractone(sigb, buf, ofs, true)); + } + } else { + extractone(sigb, null, ofs, true); + } + rv = contents; + } + } else { + if (Debug.debug) Debug.print(Debug.INFO, "Skipping array"); + } + if (contained && rv != null && !(rv instanceof List) && !(rv instanceof Map)) + rv = ArrayFrob.listify(rv); + break; + case ArgumentType.STRUCT1: + if (buf != null) { + Vector contents = new Vector(); + while (sigb[++ofs[0]] != ArgumentType.STRUCT2) + contents.add(extractone(sigb, buf, ofs, true)); + rv = contents.toArray(); + } else { + while (sigb[++ofs[0]] != ArgumentType.STRUCT2) + extractone(sigb, null, ofs, true); + } + break; + case ArgumentType.DICT_ENTRY1: + if (buf != null) { + Object[] decontents = new Object[2]; + if (Debug.debug) Debug.print(Debug.INFO, "Extracting Dict Entry ("+Hexdump.toAscii(sigb,ofs[0],sigb.length-ofs[0])+") from: "+Hexdump.toHex(buf,ofs[1],buf.length-ofs[1])); + ofs[0]++; + decontents[0] = extractone(sigb, buf, ofs, true); + ofs[0]++; + decontents[1] = extractone(sigb, buf, ofs, true); + ofs[0]++; + rv = decontents; + } else { + if (Debug.debug) Debug.print(Debug.INFO, "Skipping Dict Entry ("+Hexdump.toAscii(sigb,ofs[0],sigb.length-ofs[0])+")"); + ofs[0]++; + extractone(sigb, null, ofs, true); + ofs[0]++; + extractone(sigb, null, ofs, true); + ofs[0]++; + } + break; + case ArgumentType.VARIANT: + if (buf != null) { + int[] newofs = new int[] { 0, ofs[1] }; + String sig = (String) extract(ArgumentType.SIGNATURE_STRING, buf, newofs)[0]; + newofs[0] = 0; + rv = new Variant(extract(sig, buf, newofs)[0] , sig); + ofs[1] = newofs[1]; + } + break; + case ArgumentType.STRING: + if (buf != null) { + int length = (int) demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + try { + rv = new String(buf, ofs[1], length, "UTF-8"); + } catch (UnsupportedEncodingException UEe) { + UEe.printStackTrace(); // pego + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(UEe); + throw new DBusException(_("System does not support UTF-8 encoding")); + } + ofs[1] += length + 1; + } + break; + case ArgumentType.OBJECT_PATH: + if (buf != null) { + int length = (int) demarshallint(buf, ofs[1], 4); + ofs[1] += 4; + rv = new ObjectPath(getSource(), new String(buf, ofs[1], length)); + ofs[1] += length + 1; + } + break; + case ArgumentType.SIGNATURE: + if (buf != null) { + int length = (buf[ofs[1]++] & 0xFF); + rv = new String(buf, ofs[1], length); + ofs[1] += length + 1; + } + break; + default: + throw new UnknownTypeCodeException(sigb[ofs[0]]); + } + if (Debug.debug) if (rv instanceof Object[]) + Debug.print(Debug.INFO, "Extracted: "+Arrays.deepToString((Object[]) rv)+" (now at "+ofs[1]+")"); + else + Debug.print(Debug.INFO, "Extracted: "+rv+" (now at "+ofs[1]+")"); + return rv; + } + /** + * Demarshall values from a buffer. + * @param sig The D-Bus signature(s) of the value(s). + * @param buf The buffer to demarshall from. + * @param ofs The offset into the data buffer to start. + * @return The demarshalled value(s). + */ + public Object[] extract(String sig, byte[] buf, int ofs) throws DBusException + { + return extract(sig, buf, new int[] { 0, ofs }); + } + /** + * Demarshall values from a buffer. + * @param sig The D-Bus signature(s) of the value(s). + * @param buf The buffer to demarshall from. + * @param ofs An array of two ints, the offset into the signature + * and the offset into the data buffer. These values will be + * updated to the start of the next value ofter demarshalling. + * @return The demarshalled value(s). + */ + public Object[] extract(String sig, byte[] buf, int[] ofs) throws DBusException + { + if (Debug.debug) Debug.print(Debug.INFO, "extract("+sig+",#"+buf.length+", {"+ofs[0]+","+ofs[1]+"}"); + Vector rv = new Vector(); + byte[] sigb = sig.getBytes(); + for (int[] i = ofs; i[0] < sigb.length; i[0]++) { + rv.add(extractone(sigb, buf, i, false)); + } + return rv.toArray(); + } + /** + * Returns the Bus ID that sent the message. + */ + public String getSource() { return (String) headers.get(HeaderField.SENDER); } + /** + * Returns the destination of the message. + */ + public String getDestination() { return (String) headers.get(HeaderField.DESTINATION); } + /** + * Returns the interface of the message. + */ + public String getInterface() { return (String) headers.get(HeaderField.INTERFACE); } + /** + * Returns the object path of the message. + */ + public String getPath() + { + Object o = headers.get(HeaderField.PATH); + if (null == o) return null; + return o.toString(); + } + /** + * Returns the member name or error name this message represents. + */ + public String getName() + { + if (this instanceof Error) + return (String) headers.get(HeaderField.ERROR_NAME); + else + return (String) headers.get(HeaderField.MEMBER); + } + /** + * Returns the dbus signature of the parameters. + */ + public String getSig() { return (String) headers.get(HeaderField.SIGNATURE); } + /** + * Returns the message flags. + */ + public int getFlags() { return flags; } + /** + * Returns the message serial ID (unique for this connection) + * @return the message serial. + */ + public long getSerial() { return serial; } + /** + * If this is a reply to a message, this returns its serial. + * @return The reply serial, or 0 if it is not a reply. + */ + public long getReplySerial() + { + Number l = (Number) headers.get(HeaderField.REPLY_SERIAL); + if (null == l) return 0; + return l.longValue(); + } + /** + * Parses and returns the parameters to this message as an Object array. + */ + public Object[] getParameters() throws DBusException + { + if (null == args && null != body) { + String sig = (String) headers.get(HeaderField.SIGNATURE); + if (null != sig && 0 != body.length) { + args = extract(sig, body, 0); + } else args = new Object[0]; + } + return args; + } + protected void setArgs(Object[] args) { this.args = args; } + /** + * Warning, do not use this method unless you really know what you are doing. + */ + public void setSource(String source) throws DBusException + { + if (null != body) { + wiredata = new byte[BUFFERINCREMENT][]; + bufferuse = 0; + bytecounter = 0; + preallocate(12); + append("yyyyuu", big ? Endian.BIG : Endian.LITTLE, type, flags, protover, bodylen, serial); + headers.put(HeaderField.SENDER, source); + Object[][] newhead = new Object[headers.size()][]; + int i = 0; + for (Byte b: headers.keySet()) { + newhead[i] = new Object[2]; + newhead[i][0] = b; + newhead[i][1] = headers.get(b); + i++; + } + append("a(yv)", (Object) newhead); + pad((byte) 8); + appendBytes(body); + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageReader.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageReader.java new file mode 100755 index 0000000..49c69cd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageReader.java @@ -0,0 +1,175 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.io.BufferedInputStream; +import java.io.EOFException; +import java.io.InputStream; +import java.io.IOException; +import java.net.SocketTimeoutException; +import java.text.MessageFormat; + +import cx.ath.matthew.debug.Debug; +import cx.ath.matthew.utils.Hexdump; + +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.MessageTypeException; +import org.freedesktop.dbus.exceptions.MessageProtocolVersionException; + +public class MessageReader +{ + private InputStream in; + private byte[] buf = null; + private byte[] tbuf = null; + private byte[] header = null; + private byte[] body = null; + private int[] len = new int[4]; + public MessageReader(InputStream in) + { + this.in = new BufferedInputStream(in); + } + public Message readMessage() throws IOException, DBusException + { + int rv; + /* Read the 12 byte fixed header, retrying as neccessary */ + if (null == buf) { buf = new byte[12]; len[0] = 0; } + if (len[0] < 12) { + try { rv = in.read(buf, len[0], 12-len[0]); } + catch (SocketTimeoutException STe) { return null; } + if (-1 == rv) throw new EOFException(_("Underlying transport returned EOF")); + len[0] += rv; + } + if (len[0] == 0) return null; + if (len[0] < 12) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Only got "+len[0]+" of 12 bytes of header"); + return null; + } + + /* Parse the details from the header */ + byte endian = buf[0]; + byte type = buf[1]; + byte protover = buf[3]; + if (protover > Message.PROTOCOL) { + buf = null; + throw new MessageProtocolVersionException(MessageFormat.format(_("Protocol version {0} is unsupported"), new Object[] { protover })); + } + + /* Read the length of the variable header */ + if (null == tbuf) { tbuf = new byte[4]; len[1] = 0; } + if (len[1] < 4) { + try { rv = in.read(tbuf, len[1], 4-len[1]); } + catch (SocketTimeoutException STe) { return null; } + if (-1 == rv) throw new EOFException(_("Underlying transport returned EOF")); + len[1] += rv; + } + if (len[1] < 4) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Only got "+len[1]+" of 4 bytes of header"); + return null; + } + + /* Parse the variable header length */ + int headerlen = 0; + if (null == header) { + headerlen = (int) Message.demarshallint(tbuf, 0, endian, 4); + if (0 != headerlen % 8) + headerlen += 8-(headerlen%8); + } else + headerlen = header.length-8; + + /* Read the variable header */ + if (null == header) { + header = new byte[headerlen+8]; + System.arraycopy(tbuf, 0, header, 0, 4); + len[2] = 0; + } + if (len[2] < headerlen) { + try { rv = in.read(header, 8+len[2], headerlen-len[2]); } + catch (SocketTimeoutException STe) { return null; } + if (-1 == rv) throw new EOFException(_("Underlying transport returned EOF")); + len[2] += rv; + } + if (len[2] < headerlen) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Only got "+len[2]+" of "+headerlen+" bytes of header"); + return null; + } + + /* Read the body */ + int bodylen = 0; + if (null == body) bodylen = (int) Message.demarshallint(buf, 4, endian, 4); + if (null == body) { body=new byte[bodylen]; len[3] = 0; } + if (len[3] < body.length) { + try { rv = in.read(body, len[3], body.length-len[3]); } + catch (SocketTimeoutException STe) { return null; } + if (-1 == rv) throw new EOFException(_("Underlying transport returned EOF")); + len[3] += rv; + } + if (len[3] < body.length) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Only got "+len[3]+" of "+body.length+" bytes of body"); + return null; + } + + Message m; + switch (type) { + case Message.MessageType.METHOD_CALL: + m = new MethodCall(); + break; + case Message.MessageType.METHOD_RETURN: + m = new MethodReturn(); + break; + case Message.MessageType.SIGNAL: + m = new DBusSignal(); + break; + case Message.MessageType.ERROR: + m = new Error(); + break; + default: + throw new MessageTypeException(MessageFormat.format(_("Message type {0} unsupported"), new Object[] {type})); + } + if (Debug.debug) { + Debug.print(Debug.VERBOSE, Hexdump.format(buf)); + Debug.print(Debug.VERBOSE, Hexdump.format(tbuf)); + Debug.print(Debug.VERBOSE, Hexdump.format(header)); + Debug.print(Debug.VERBOSE, Hexdump.format(body)); + } + try { + m.populate(buf, header, body); + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + buf = null; + tbuf = null; + body = null; + header = null; + throw DBe; + } catch (RuntimeException Re) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, Re); + buf = null; + tbuf = null; + body = null; + header = null; + throw Re; + } + if (Debug.debug) { + Debug.print(Debug.INFO, "=> "+m); + } + buf = null; + tbuf = null; + body = null; + header = null; + return m; + } + public void close() throws IOException + { + if (Debug.debug) Debug.print(Debug.INFO, "Closing Message Reader"); + in.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageWriter.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageWriter.java new file mode 100755 index 0000000..bb22108 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MessageWriter.java @@ -0,0 +1,72 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.io.BufferedOutputStream; +import java.io.OutputStream; +import java.io.IOException; + +import cx.ath.matthew.debug.Debug; +import cx.ath.matthew.unix.USOutputStream; +import cx.ath.matthew.utils.Hexdump; + +public class MessageWriter +{ + private OutputStream out; + private boolean isunix; + public MessageWriter(OutputStream out) + { + this.out = out; + this.isunix = false; + try { + if (out instanceof USOutputStream) + this.isunix = true; + } catch (Throwable t) { + } + if (!this.isunix) + this.out = new BufferedOutputStream(this.out); + } + public void writeMessage(Message m) throws IOException + { + if (Debug.debug) { + Debug.print(Debug.INFO, "<= "+m); + } + if (null == m) return; + if (Debug.debug) Debug.print(Debug.INFO, "m in not null"); // pego + if (null == m.getWireData()) { + if (Debug.debug) Debug.print(Debug.WARN, "Message "+m+" wire-data was null!"); + return; + } + if (Debug.debug) Debug.print(Debug.INFO, "wire data in not null"); // pego + if (isunix) { + if (Debug.debug) { + Debug.print(Debug.INFO, "Writing all "+m.getWireData().length+" buffers simultaneously to Unix Socket"); + for (byte[] buf: m.getWireData()) + Debug.print(Debug.INFO, "("+buf+"):"+ (null==buf? "": Hexdump.format(buf))); + } + ((USOutputStream) out).write(m.getWireData()); + } else + for (byte[] buf: m.getWireData()) { + if (Debug.debug) + Debug.print(Debug.INFO, "("+buf+"):"+ (null==buf? "": Hexdump.format(buf))); + if (null == buf) break; + out.write(buf); + if (Debug.debug) Debug.print(Debug.INFO, "After write()"); // pego + } + out.flush(); + if (Debug.debug) Debug.print(Debug.INFO, "After flush()"); // pego + } + public void close() throws IOException + { + if (Debug.debug) Debug.print(Debug.INFO, "Closing Message Writer"); + out.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodCall.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodCall.java new file mode 100755 index 0000000..c10b1b0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodCall.java @@ -0,0 +1,126 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.util.Vector; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.MessageFormatException; +import cx.ath.matthew.debug.Debug; +import cx.ath.matthew.utils.Hexdump; + +public class MethodCall extends Message +{ + MethodCall() { } + public MethodCall(String dest, String path, String iface, String member, byte flags, String sig, Object... args) throws DBusException + { + this(null, dest, path, iface, member, flags, sig, args); + } + public MethodCall(String source, String dest, String path, String iface, String member, byte flags, String sig, Object... args) throws DBusException + { + super(Message.Endian.BIG, Message.MessageType.METHOD_CALL, flags); + + if (null == member || null == path) + throw new MessageFormatException(_("Must specify destination, path and function name to MethodCalls.")); + headers.put(Message.HeaderField.PATH,path); + headers.put(Message.HeaderField.MEMBER,member); + + Vector hargs = new Vector(); + + hargs.add(new Object[] { Message.HeaderField.PATH, new Object[] { ArgumentType.OBJECT_PATH_STRING, path } }); + + if (null != source) { + headers.put(Message.HeaderField.SENDER,source); + hargs.add(new Object[] { Message.HeaderField.SENDER, new Object[] { ArgumentType.STRING_STRING, source } }); + } + + if (null != dest) { + headers.put(Message.HeaderField.DESTINATION,dest); + hargs.add(new Object[] { Message.HeaderField.DESTINATION, new Object[] { ArgumentType.STRING_STRING, dest } }); + } + + if (null != iface) { + hargs.add(new Object[] { Message.HeaderField.INTERFACE, new Object[] { ArgumentType.STRING_STRING, iface } }); + headers.put(Message.HeaderField.INTERFACE,iface); + } + + hargs.add(new Object[] { Message.HeaderField.MEMBER, new Object[] { ArgumentType. STRING_STRING, member } }); + + if (null != sig) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Appending arguments with signature: "+sig); + hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); + headers.put(Message.HeaderField.SIGNATURE,sig); + setArgs(args); + } + + byte[] blen = new byte[4]; + appendBytes(blen); + append("ua(yv)", serial, hargs.toArray()); + pad((byte)8); + + long c = bytecounter; + if (null != sig) append(sig, args); + if (Debug.debug) Debug.print(Debug.DEBUG, "Appended body, type: "+sig+" start: "+c+" end: "+bytecounter+" size: "+(bytecounter-c)); + marshallint(bytecounter-c, blen, 0, 4); + if (Debug.debug) Debug.print("marshalled size ("+blen+"): "+Hexdump.format(blen)); + } + private static long REPLY_WAIT_TIMEOUT = 20000; + /** + * Set the default timeout for method calls. + * Default is 20s. + * @param timeout New timeout in ms. + */ + public static void setDefaultTimeout(long timeout) + { + REPLY_WAIT_TIMEOUT = timeout; + } + Message reply = null; + public synchronized boolean hasReply() + { + return null != reply; + } + /** + * Block (if neccessary) for a reply. + * @return The reply to this MethodCall, or null if a timeout happens. + * @param timeout The length of time to block before timing out (ms). + */ + public synchronized Message getReply(long timeout) + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Blocking on "+this); + if (null != reply) return reply; + try { + wait(timeout); + return reply; + } catch (InterruptedException Ie) { return reply; } + } + /** + * Block (if neccessary) for a reply. + * Default timeout is 20s, or can be configured with setDefaultTimeout() + * @return The reply to this MethodCall, or null if a timeout happens. + */ + public synchronized Message getReply() + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Blocking on "+this); + if (null != reply) return reply; + try { + wait(REPLY_WAIT_TIMEOUT); + return reply; + } catch (InterruptedException Ie) { return reply; } + } + protected synchronized void setReply(Message reply) + { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Setting reply to "+this+" to "+reply); + this.reply = reply; + notifyAll(); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodReturn.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodReturn.java new file mode 100755 index 0000000..b0f719a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodReturn.java @@ -0,0 +1,69 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.util.Vector; +import org.freedesktop.dbus.exceptions.DBusException; + +public class MethodReturn extends Message +{ + MethodReturn() { } + public MethodReturn(String dest, long replyserial, String sig, Object... args) throws DBusException + { + this(null, dest, replyserial, sig, args); + } + public MethodReturn(String source, String dest, long replyserial, String sig, Object... args) throws DBusException + { + super(Message.Endian.BIG, Message.MessageType.METHOD_RETURN, (byte) 0); + + headers.put(Message.HeaderField.REPLY_SERIAL,replyserial); + + Vector hargs = new Vector(); + hargs.add(new Object[] { Message.HeaderField.REPLY_SERIAL, new Object[] { ArgumentType.UINT32_STRING, replyserial } }); + + if (null != source) { + headers.put(Message.HeaderField.SENDER,source); + hargs.add(new Object[] { Message.HeaderField.SENDER, new Object[] { ArgumentType.STRING_STRING, source } }); + } + + if (null != dest) { + headers.put(Message.HeaderField.DESTINATION,dest); + hargs.add(new Object[] { Message.HeaderField.DESTINATION, new Object[] { ArgumentType.STRING_STRING, dest } }); + } + + if (null != sig) { + hargs.add(new Object[] { Message.HeaderField.SIGNATURE, new Object[] { ArgumentType.SIGNATURE_STRING, sig } }); + headers.put(Message.HeaderField.SIGNATURE,sig); + setArgs(args); + } + + byte[] blen = new byte[4]; + appendBytes(blen); + append("ua(yv)", serial, hargs.toArray()); + pad((byte)8); + + long c = bytecounter; + if (null != sig) append(sig, args); + marshallint(bytecounter-c, blen, 0, 4); + } + public MethodReturn(MethodCall mc, String sig, Object... args) throws DBusException + { + this(null, mc, sig, args); + } + public MethodReturn(String source, MethodCall mc, String sig, Object... args) throws DBusException + { + this(source, mc.getSource(), mc.getSerial(), sig, args); + this.call = mc; + } + MethodCall call; + public MethodCall getCall() { return call; } + protected void setCall(MethodCall call) { this.call = call; } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodTuple.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodTuple.java new file mode 100755 index 0000000..dd2c4a9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/MethodTuple.java @@ -0,0 +1,38 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import cx.ath.matthew.debug.Debug; + +class MethodTuple +{ + String name; + String sig; + public MethodTuple(String name, String sig) + { + this.name = name; + if (null != sig) + this.sig = sig; + else + this.sig = ""; + if (Debug.debug) Debug.print(Debug.VERBOSE, "new MethodTuple("+this.name+", "+this.sig+")"); + } + public boolean equals(Object o) + { + return o.getClass().equals(MethodTuple.class) + && ((MethodTuple) o).name.equals(this.name) + && ((MethodTuple) o).sig.equals(this.sig); + } + public int hashCode() + { + return name.hashCode()+sig.hashCode(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectPath.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectPath.java new file mode 100755 index 0000000..409d26d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectPath.java @@ -0,0 +1,23 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +class ObjectPath extends Path +{ + public String source; +// public DBusConnection conn; + public ObjectPath(String source, String path/*, DBusConnection conn*/) + { + super(path); + this.source = source; + // this.conn = conn; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectTree.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectTree.java new file mode 100755 index 0000000..f7d0591 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/ObjectTree.java @@ -0,0 +1,163 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import cx.ath.matthew.debug.Debug; + +import java.util.regex.Pattern; + +/** + * Keeps track of the exported objects for introspection data */ +class ObjectTree +{ + class TreeNode + { + String name; + ExportedObject object; + String data; + TreeNode right; + TreeNode down; + public TreeNode(String name) + { + this.name = name; + } + public TreeNode(String name, ExportedObject object, String data) + { + this.name = name; + this.object = object; + this.data = data; + } + } + private TreeNode root; + public ObjectTree() + { + root = new TreeNode(""); + } + public static final Pattern slashpattern = Pattern.compile("/"); + + private TreeNode recursiveFind(TreeNode current, String path) + { + if ("/".equals(path)) return current; + String[] elements = path.split("/", 2); + // this is us or a parent node + if (path.startsWith(current.name)) { + // this is us + if (path.equals(current.name)) { + return current; + } + // recurse down + else { + if (current.down == null) + return null; + else return recursiveFind(current.down, elements[1]); + } + } + else if (current.right == null) { + return null; + } + else if (0 > current.right.name.compareTo(elements[0])) { + return null; + } + // recurse right + else { + return recursiveFind(current.right, path); + } + } + private TreeNode recursiveAdd(TreeNode current, String path, ExportedObject object, String data) + { + String[] elements = slashpattern.split(path, 2); + // this is us or a parent node + if (path.startsWith(current.name)) { + // this is us + if (1 == elements.length || "".equals(elements[1])) { + current.object = object; + current.data = data; + } + // recurse down + else { + if (current.down == null) { + String[] el = elements[1].split("/", 2); + current.down = new TreeNode(el[0]); + } + current.down = recursiveAdd(current.down, elements[1], object, data); + } + } + // need to create a new sub-tree on the end + else if (current.right == null) { + current.right = new TreeNode(elements[0]); + current.right = recursiveAdd(current.right, path, object, data); + } + // need to insert here + else if (0 > current.right.name.compareTo(elements[0])) { + TreeNode t = new TreeNode(elements[0]); + t.right = current.right; + current.right = t; + current.right = recursiveAdd(current.right, path, object, data); + } + // recurse right + else { + current.right = recursiveAdd(current.right, path, object, data); + } + return current; + } + public void add(String path, ExportedObject object, String data) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Adding "+path+" to object tree"); + root = recursiveAdd(root, path, object, data); + } + public void remove(String path) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "Removing "+path+" from object tree"); + TreeNode t = recursiveFind(root, path); + t.object = null; + t.data = null; + } + + public String Introspect(String path) + { + TreeNode t = recursiveFind(root, path); + if (null == t) return null; + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + if (null != t.data) sb.append(t.data); + t = t.down; + while (null != t) { + sb.append("\n"); + t = t.right; + } + sb.append(""); + return sb.toString(); + } + + private String recursivePrint(TreeNode current) + { + String s = ""; + if (null != current) { + s += current.name; + if (null != current.object) + s += "*"; + if (null != current.down) + s += "/{"+recursivePrint(current.down)+"}"; + if (null != current.right) + s += ", "+recursivePrint(current.right); + } + return s; + } + + public String toString() + { + return recursivePrint(root); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Path.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Path.java new file mode 100755 index 0000000..baaa7a6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Path.java @@ -0,0 +1,40 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +public class Path implements Comparable +{ + protected String path; + public Path(String path) + { + this.path = path; + } + public String getPath() + { + return path; + } + public String toString() + { + return path; + } + public boolean equals(Object other) + { + return (other instanceof Path) && path.equals(((Path) other).path); + } + public int hashCode() + { + return path.hashCode(); + } + public int compareTo(Path that) + { + return path.compareTo(that.path); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Position.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Position.java new file mode 100755 index 0000000..45e68d8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Position.java @@ -0,0 +1,28 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Position annotation, to annotate Struct fields + * to be sent over DBus. + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Position +{ + /** The order of this field in the Struct. */ + int value(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteInvocationHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteInvocationHandler.java new file mode 100755 index 0000000..9e40495 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteInvocationHandler.java @@ -0,0 +1,191 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.lang.reflect.Type; +import java.text.MessageFormat; +import java.util.Arrays; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.NotConnected; + +import cx.ath.matthew.debug.Debug; + +class RemoteInvocationHandler implements InvocationHandler +{ + public static final int CALL_TYPE_SYNC = 0; + public static final int CALL_TYPE_ASYNC = 1; + public static final int CALL_TYPE_CALLBACK = 2; + public static Object convertRV(String sig, Object[] rp, Method m, AbstractConnection conn) throws DBusException + { + Class c = m.getReturnType(); + + if (null == rp) { + if(null == c || Void.TYPE.equals(c)) return null; + else throw new DBusExecutionException(_("Wrong return type (got void, expected a value)")); + } else { + try { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Converting return parameters from "+Arrays.deepToString(rp)+" to type "+m.getGenericReturnType()); + rp = Marshalling.deSerializeParameters(rp, + new Type[] { m.getGenericReturnType() }, conn); + } + catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusExecutionException(MessageFormat.format(_("Wrong return type (failed to de-serialize correct types: {0} )"), new Object[] { e.getMessage() })); + } + } + + switch (rp.length) { + case 0: + if (null == c || Void.TYPE.equals(c)) + return null; + else throw new DBusExecutionException(_("Wrong return type (got void, expected a value)")); + case 1: + return rp[0]; + default: + + // check we are meant to return multiple values + if (!Tuple.class.isAssignableFrom(c)) + throw new DBusExecutionException(_("Wrong return type (not expecting Tuple)")); + + Constructor cons = c.getConstructors()[0]; + try { + return cons.newInstance(rp); + } catch (Exception e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusException(e.getMessage()); + } + } + } + @SuppressWarnings("unchecked") + public static Object executeRemoteMethod(RemoteObject ro, Method m, AbstractConnection conn, int syncmethod, CallbackHandler callback, Object... args) throws DBusExecutionException + { + Type[] ts = m.getGenericParameterTypes(); + String sig = null; + if (ts.length > 0) try { + sig = Marshalling.getDBusType(ts); + args = Marshalling.convertParameters(args, ts, conn); + } catch (DBusException DBe) { + throw new DBusExecutionException(_("Failed to construct D-Bus type: ")+DBe.getMessage()); + } + MethodCall call; + byte flags = 0; + if (!ro.autostart) flags |= Message.Flags.NO_AUTO_START; + if (syncmethod == CALL_TYPE_ASYNC) flags |= Message.Flags.ASYNC; + if (m.isAnnotationPresent(DBus.Method.NoReply.class)) flags |= Message.Flags.NO_REPLY_EXPECTED; + try { + String name; + if (m.isAnnotationPresent(DBusMemberName.class)) + name = m.getAnnotation(DBusMemberName.class).value(); + else + name = m.getName(); + if (null == ro.iface) + call = new MethodCall(ro.busname, ro.objectpath, null, name,flags, sig, args); + else { + if (null != ro.iface.getAnnotation(DBusInterfaceName.class)) { + call = new MethodCall(ro.busname, ro.objectpath, ro.iface.getAnnotation(DBusInterfaceName.class).value(), name, flags, sig, args); + } else + call = new MethodCall(ro.busname, ro.objectpath, AbstractConnection.dollar_pattern.matcher(ro.iface.getName()).replaceAll("."), name, flags, sig, args); + } + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + throw new DBusExecutionException(_("Failed to construct outgoing method call: ")+DBe.getMessage()); + } + if (null == conn.outgoing) throw new NotConnected(_("Not Connected")); + + switch (syncmethod) { + case CALL_TYPE_ASYNC: + conn.queueOutgoing(call); + return new DBusAsyncReply(call, m, conn); + case CALL_TYPE_CALLBACK: + synchronized (conn.pendingCallbacks) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Queueing Callback "+callback+" for "+call); + conn.pendingCallbacks.put(call, callback); + conn.pendingCallbackReplys.put(call, new DBusAsyncReply(call, m, conn)); + } + conn.queueOutgoing(call); + return null; + case CALL_TYPE_SYNC: + conn.queueOutgoing(call); + break; + } + + // get reply + if (m.isAnnotationPresent(DBus.Method.NoReply.class)) return null; + + Message reply = call.getReply(); + if (null == reply) throw new DBus.Error.NoReply(_("No reply within specified time")); + + if (reply instanceof Error) + ((Error) reply).throwException(); + + try { + return convertRV(reply.getSig(), reply.getParameters(), m, conn); + } catch (DBusException e) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, e); + throw new DBusExecutionException(e.getMessage()); + } + } + + AbstractConnection conn; + RemoteObject remote; + public RemoteInvocationHandler(AbstractConnection conn, RemoteObject remote) + { + this.remote = remote; + this.conn = conn; + } + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable + { + if (method.getName().equals("isRemote")) return true; + else if (method.getName().equals("clone")) return null; + else if (method.getName().equals("equals")) { + try { + if (1 == args.length) + return new Boolean(remote.equals(((RemoteInvocationHandler) Proxy.getInvocationHandler(args[0])).remote)); + } catch (IllegalArgumentException IAe) { + return Boolean.FALSE; + } + } + else if (method.getName().equals("finalize")) return null; + else if (method.getName().equals("getClass")) return DBusInterface.class; + else if (method.getName().equals("hashCode")) return remote.hashCode(); + else if (method.getName().equals("notify")) { + remote.notify(); + return null; + } else if (method.getName().equals("notifyAll")) { + remote.notifyAll(); + return null; + } else if (method.getName().equals("wait")) { + if (0 == args.length) remote.wait(); + else if (1 == args.length + && args[0] instanceof Long) remote.wait((Long) args[0]); + else if (2 == args.length + && args[0] instanceof Long + && args[1] instanceof Integer) + remote.wait((Long) args[0], (Integer) args[1]); + if (args.length <= 2) + return null; + } + else if (method.getName().equals("toString")) + return remote.toString(); + + return executeRemoteMethod(remote, method, conn, CALL_TYPE_SYNC, null, args); + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteObject.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteObject.java new file mode 100755 index 0000000..8a1f620 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/RemoteObject.java @@ -0,0 +1,56 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +class RemoteObject +{ + String busname; + String objectpath; + Class iface; + boolean autostart; + public RemoteObject(String busname, String objectpath, Class iface, boolean autostart) + { + this.busname = busname; + this.objectpath = objectpath; + this.iface = iface; + this.autostart = autostart; + } + public boolean equals(Object o) + { + if (!(o instanceof RemoteObject)) return false; + RemoteObject them = (RemoteObject) o; + + if (!them.objectpath.equals(this.objectpath)) return false; + + if (null == this.busname && null != them.busname) return false; + if (null != this.busname && null == them.busname) return false; + if (null != them.busname && !them.busname.equals(this.busname)) return false; + + if (null == this.iface && null != them.iface) return false; + if (null != this.iface && null == them.iface) return false; + if (null != them.iface && !them.iface.equals(this.iface)) return false; + + return true; + } + public int hashCode() + { + return (null == busname ? 0 : busname.hashCode()) + objectpath.hashCode() + + (null == iface ? 0 : iface.hashCode()); + } + public boolean autoStarting() { return autostart; } + public String getBusName() { return busname; } + public String getObjectPath() { return objectpath; } + public Class getInterface() { return iface; } + public String toString() + { + return busname+":"+objectpath+":"+iface; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/SignalTuple.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/SignalTuple.java new file mode 100755 index 0000000..94cadee --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/SignalTuple.java @@ -0,0 +1,51 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; +class SignalTuple +{ + String type; + String name; + String object; + String source; + public SignalTuple(String type, String name, String object, String source) + { + this.type = type; + this.name = name; + this.object = object; + this.source = source; + } + public boolean equals(Object o) + { + if (!(o instanceof SignalTuple)) return false; + SignalTuple other = (SignalTuple) o; + if (null == this.type && null != other.type) return false; + if (null != this.type && !this.type.equals(other.type)) return false; + if (null == this.name && null != other.name) return false; + if (null != this.name && !this.name.equals(other.name)) return false; + if (null == this.object && null != other.object) return false; + if (null != this.object && !this.object.equals(other.object)) return false; + if (null == this.source && null != other.source) return false; + if (null != this.source && !this.source.equals(other.source)) return false; + return true; + } + public int hashCode() + { + return (null == type ? 0 : type.hashCode()) + + (null == name ? 0 : name.hashCode()) + + (null == source ? 0 : source.hashCode()) + + (null == object ? 0 : object.hashCode()); + } + public String toString() + { + return "SignalTuple("+type+","+name+","+object+","+source+")"; + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/StrongReference.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/StrongReference.java new file mode 100755 index 0000000..c4d142d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/StrongReference.java @@ -0,0 +1,43 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.lang.ref.WeakReference; + +/** + * An alternative to a WeakReference when you don't want + * that behaviour. + */ +public class StrongReference extends WeakReference +{ + T referant; + public StrongReference(T referant) + { + super(referant); + this.referant = referant; + } + public void clear() + { + referant = null; + } + public boolean enqueue() + { + return false; + } + public T get() + { + return referant; + } + public boolean isEnqueued() + { + return false; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Struct.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Struct.java new file mode 100755 index 0000000..7d37ed0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Struct.java @@ -0,0 +1,23 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +/** + * This class should be extended to create Structs. + * Any such class may be sent over DBus to a method which takes a Struct. + * All fields in the Struct which you wish to be serialized and sent to the + * remote method should be annotated with the org.freedesktop.dbus.Position + * annotation, in the order they should appear in to Struct to DBus. + */ +public abstract class Struct extends Container +{ + public Struct() {} +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Transport.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Transport.java new file mode 100755 index 0000000..ccde1e9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Transport.java @@ -0,0 +1,825 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.lang.reflect.Method; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.text.ParseException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.Collator; +import java.util.Arrays; +import java.util.Random; +import java.util.Vector; +import cx.ath.matthew.unix.UnixSocket; +import cx.ath.matthew.unix.UnixServerSocket; +import cx.ath.matthew.unix.UnixSocketAddress; +import cx.ath.matthew.utils.Hexdump; +import cx.ath.matthew.debug.Debug; + +public class Transport +{ + public static class SASL + { + public static class Command + { + private int command; + private int mechs; + private String data; + private String response; + public Command() + { + } + public Command(String s) throws IOException + { + String[] ss = s.split(" "); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Creating command from: "+Arrays.toString(ss)); + if (0 == col.compare(ss[0], "OK")) { + command = COMMAND_OK; + data = ss[1]; + } else if (0 == col.compare(ss[0], "AUTH")) { + command = COMMAND_AUTH; + if (ss.length > 1) { + if (0 == col.compare(ss[1], "EXTERNAL")) + mechs = AUTH_EXTERNAL; + else if (0 == col.compare(ss[1], "DBUS_COOKIE_SHA1")) + mechs = AUTH_SHA; + else if (0 == col.compare(ss[1], "ANONYMOUS")) + mechs = AUTH_ANON; + } + if (ss.length > 2) + data = ss[2]; + } else if (0 == col.compare(ss[0], "DATA")) { + command = COMMAND_DATA; + data = ss[1]; + } else if (0 == col.compare(ss[0], "REJECTED")) { + command = COMMAND_REJECTED; + for (int i = 1; i < ss.length; i++) + if (0 == col.compare(ss[i], "EXTERNAL")) + mechs |= AUTH_EXTERNAL; + else if (0 == col.compare(ss[i], "DBUS_COOKIE_SHA1")) + mechs |= AUTH_SHA; + else if (0 == col.compare(ss[i], "ANONYMOUS")) + mechs |= AUTH_ANON; + } else if (0 == col.compare(ss[0], "BEGIN")) { + command = COMMAND_BEGIN; + } else if (0 == col.compare(ss[0], "CANCEL")) { + command = COMMAND_CANCEL; + } else if (0 == col.compare(ss[0], "ERROR")) { + command = COMMAND_ERROR; + data = ss[1]; + } else { + throw new IOException(_("Invalid Command ")+ss[0]); + } + if (Debug.debug) Debug.print(Debug.VERBOSE, "Created command: "+this); + } + public int getCommand() { return command; } + public int getMechs() { return mechs; } + public String getData() { return data; } + public String getResponse() { return response; } + public void setResponse(String s) { response = s; } + public String toString() + { + return "Command("+command+", "+mechs+", "+data+", "+null+")"; + } + } + private static Collator col = Collator.getInstance(); + static { + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + } + public static final int LOCK_TIMEOUT = 1000; + public static final int NEW_KEY_TIMEOUT_SECONDS = 60 * 5; + public static final int EXPIRE_KEYS_TIMEOUT_SECONDS = NEW_KEY_TIMEOUT_SECONDS + (60 * 2); + public static final int MAX_TIME_TRAVEL_SECONDS = 60 * 5; + public static final int COOKIE_TIMEOUT = 240; + public static final String COOKIE_CONTEXT = "org_freedesktop_java"; + + private String findCookie(String context, String ID) throws IOException + { + String homedir = System.getProperty("user.home"); + File f = new File(homedir+"/.dbus-keyrings/"+context); + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(f))); + String s = null; + String cookie = null; + long now = System.currentTimeMillis()/1000; + while (null != (s = r.readLine())) { + String[] line = s.split(" "); + long timestamp = Long.parseLong(line[1]); + if (line[0].equals(ID) && (! (timestamp < 0 || + (now + MAX_TIME_TRAVEL_SECONDS) < timestamp || + (now - EXPIRE_KEYS_TIMEOUT_SECONDS) > timestamp))) { + cookie = line[2]; + break; + } + } + r.close(); + return cookie; + } + private void addCookie(String context, String ID, long timestamp, String cookie) throws IOException + { + String homedir = System.getProperty("user.home"); + File keydir = new File(homedir+"/.dbus-keyrings/"); + File cookiefile = new File(homedir+"/.dbus-keyrings/"+context); + File lock = new File(homedir+"/.dbus-keyrings/"+context+".lock"); + File temp = new File(homedir+"/.dbus-keyrings/"+context+".temp"); + + // ensure directory exists + if (!keydir.exists()) keydir.mkdirs(); + + // acquire lock + long start = System.currentTimeMillis(); + while (!lock.createNewFile() && LOCK_TIMEOUT > (System.currentTimeMillis()-start)); + + // read old file + Vector lines = new Vector(); + if (cookiefile.exists()) { + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(cookiefile))); + String s = null; + while (null != (s = r.readLine())) { + String[] line = s.split(" "); + long time = Long.parseLong(line[1]); + // expire stale cookies + if ((timestamp - time) < COOKIE_TIMEOUT) + lines.add(s); + } + r.close(); + } + + // add cookie + lines.add(ID+" "+timestamp+" "+cookie); + + // write temp file + PrintWriter w = new PrintWriter(new FileOutputStream(temp)); + for (String l: lines) + w.println(l); + w.close(); + + // atomically move to old file + if (!temp.renameTo(cookiefile)) { + cookiefile.delete(); + temp.renameTo(cookiefile); + } + + // remove lock + lock.delete(); + } + /** + * Takes the string, encodes it as hex and then turns it into a string again. + * No, I don't know why either. + */ + private String stupidlyEncode(String data) + { + return Hexdump.toHex(data.getBytes()).replaceAll(" ",""); + } + private String stupidlyEncode(byte[] data) + { + return Hexdump.toHex(data).replaceAll(" ",""); + } + private byte getNibble(char c) + { + switch (c) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + return (byte) (c-'0'); + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + return (byte) (c-'A'+10); + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + return (byte) (c-'a'+10); + default: + return 0; + } + } + private String stupidlyDecode(String data) + { + char[] cs = new char[data.length()]; + char[] res = new char[cs.length/2]; + data.getChars(0, data.length(), cs, 0); + for (int i = 0, j = 0; j < res.length; i += 2, j++) { + int b = 0; + b |= getNibble(cs[i])<<4; + b |= getNibble(cs[i+1]); + res[j] = (char) b; + } + return new String(res); + } + + public static final int MODE_SERVER=1; + public static final int MODE_CLIENT=2; + + public static final int AUTH_NONE=0; + public static final int AUTH_EXTERNAL=1; + public static final int AUTH_SHA=2; + public static final int AUTH_ANON=4; + + public static final int COMMAND_AUTH=1; + public static final int COMMAND_DATA=2; + public static final int COMMAND_REJECTED=3; + public static final int COMMAND_OK=4; + public static final int COMMAND_BEGIN=5; + public static final int COMMAND_CANCEL=6; + public static final int COMMAND_ERROR=7; + + public static final int INITIAL_STATE=0; + public static final int WAIT_DATA=1; + public static final int WAIT_OK=2; + public static final int WAIT_REJECT=3; + public static final int WAIT_AUTH=4; + public static final int WAIT_BEGIN=5; + public static final int AUTHENTICATED=6; + public static final int FAILED=7; + + public static final int OK=1; + public static final int CONTINUE=2; + public static final int ERROR=3; + public static final int REJECT=4; + + public Command receive(InputStream s) throws IOException + { + StringBuffer sb = new StringBuffer(); + top: while (true) { + int c = s.read(); + switch (c) { + case -1: + throw new IOException("Stream unexpectedly short (broken pipe)"); + case 0: + case '\r': + continue; + case '\n': + break top; + default: + sb.append((char) c); + } + } + if (Debug.debug) Debug.print(Debug.VERBOSE, "received: "+sb); + try { + return new Command(sb.toString()); + } catch (Exception e) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, e); + return new Command(); + } + } + public void send(OutputStream out, int command, String... data) throws IOException + { + StringBuffer sb = new StringBuffer(); + switch (command) { + case COMMAND_AUTH: + sb.append("AUTH"); + break; + case COMMAND_DATA: + sb.append("DATA"); + break; + case COMMAND_REJECTED: + sb.append("REJECTED"); + break; + case COMMAND_OK: + sb.append("OK"); + break; + case COMMAND_BEGIN: + sb.append("BEGIN"); + break; + case COMMAND_CANCEL: + sb.append("CANCEL"); + break; + case COMMAND_ERROR: + sb.append("ERROR"); + break; + default: + return; + } + for (String s: data) { + sb.append(' '); + sb.append(s); + } + sb.append('\r'); + sb.append('\n'); + if (Debug.debug) Debug.print(Debug.VERBOSE, "sending: "+sb); + out.write(sb.toString().getBytes()); + } + public int do_challenge(int auth, Command c) throws IOException + { + switch (auth) { + case AUTH_SHA: + String[] reply=stupidlyDecode(c.getData()).split(" "); + if (Debug.debug) Debug.print(Debug.VERBOSE, Arrays.toString(reply)); + if (3 != reply.length) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Reply is not length 3"); + return ERROR; + } + String context = reply[0]; + String ID = reply[1]; + String serverchallenge = reply[2]; + MessageDigest md = null; + try { + md = MessageDigest.getInstance("SHA"); + } catch (NoSuchAlgorithmException NSAe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, NSAe); + return ERROR; + } + byte[] buf = new byte[8]; + Message.marshallintBig(System.currentTimeMillis(), buf, 0, 8); + String clientchallenge = stupidlyEncode(md.digest(buf)); + md.reset(); + long start = System.currentTimeMillis(); + String cookie = null; + while (null == cookie && (System.currentTimeMillis()-start) < LOCK_TIMEOUT) + cookie = findCookie(context, ID); + if (null == cookie) { + if (Debug.debug) Debug.print(Debug.DEBUG, "Did not find a cookie in context "+context+" with ID "+ID); + return ERROR; + } + String response = serverchallenge+":"+clientchallenge+":"+cookie; + buf = md.digest(response.getBytes()); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Response: "+response+" hash: "+Hexdump.format(buf)); + response = stupidlyEncode(buf); + c.setResponse(stupidlyEncode(clientchallenge+" "+response)); + return OK; + default: + if (Debug.debug) Debug.print(Debug.DEBUG, "Not DBUS_COOKIE_SHA1 authtype."); + return ERROR; + } + } + public String challenge = ""; + public String cookie = ""; + public int do_response(int auth, String Uid, String kernelUid, Command c) + { + MessageDigest md = null; + try { + md = MessageDigest.getInstance("SHA"); + } catch (NoSuchAlgorithmException NSAe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, NSAe); + return ERROR; + } + switch (auth) { + case AUTH_NONE: + switch (c.getMechs()) { + case AUTH_ANON: + return OK; + case AUTH_EXTERNAL: + if (0 == col.compare(Uid, c.getData()) && + (null == kernelUid || 0 == col.compare(Uid, kernelUid))) + return OK; + else + return ERROR; + case AUTH_SHA: + String context = COOKIE_CONTEXT; + long id = System.currentTimeMillis(); + byte[] buf = new byte[8]; + Message.marshallintBig(id, buf, 0, 8); + challenge = stupidlyEncode(md.digest(buf)); + Random r = new Random(); + r.nextBytes(buf); + cookie = stupidlyEncode(md.digest(buf)); + try { addCookie(context, ""+id, id/1000, cookie); + } catch (IOException IOe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, IOe); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "Sending challenge: "+context+' '+id+' '+challenge); + c.setResponse(stupidlyEncode(context+' '+id+' '+challenge)); + return CONTINUE; + default: + return ERROR; + } + case AUTH_SHA: + String[] response = stupidlyDecode(c.getData()).split(" "); + if (response.length < 2) return ERROR; + String cchal = response[0]; + String hash = response[1]; + String prehash = challenge+":"+cchal+":"+cookie; + byte[] buf = md.digest(prehash.getBytes()); + String posthash = stupidlyEncode(buf); + if (Debug.debug) Debug.print(Debug.DEBUG, "Authenticating Hash; data="+prehash+" remote hash="+hash+" local hash="+posthash); + if (0 == col.compare(posthash, hash)) + return OK; + else + return ERROR; + default: + return ERROR; + } + } + public String[] getTypes(int types) + { + switch (types) { + case AUTH_EXTERNAL: + return new String[] { "EXTERNAL" }; + case AUTH_SHA: + return new String[] { "DBUS_COOKIE_SHA1" }; + case AUTH_ANON: + return new String[] { "ANONYMOUS" }; + case AUTH_SHA+AUTH_EXTERNAL: + return new String[] { "EXTERNAL", "DBUS_COOKIE_SHA1" }; + case AUTH_SHA+AUTH_ANON: + return new String[] { "ANONYMOUS", "DBUS_COOKIE_SHA1" }; + case AUTH_EXTERNAL+AUTH_ANON: + return new String[] { "ANONYMOUS", "EXTERNAL" }; + case AUTH_EXTERNAL+AUTH_ANON+AUTH_SHA: + return new String[] { "ANONYMOUS", "EXTERNAL", "DBUS_COOKIE_SHA1" }; + default: + return new String[] { }; + } + } + /** + * performs SASL auth on the given streams. + * Mode selects whether to run as a SASL server or client. + * Types is a bitmask of the available auth types. + * Returns true if the auth was successful and false if it failed. + */ + @SuppressWarnings("unchecked") + public boolean auth(int mode, int types, String guid, OutputStream out, InputStream in, UnixSocket us) throws IOException + { + String username = System.getProperty("user.name"); + String Uid = null; + String kernelUid = null; + try { + Class c = Class.forName("com.sun.security.auth.module.UnixSystem"); + Method m = c.getMethod("getUid"); + Object o = c.newInstance(); + long uid = (Long) m.invoke(o); + Uid = stupidlyEncode(""+uid); + } catch (Exception e) { + Uid = stupidlyEncode(username); + } + Command c; + int failed = 0; + int current = 0; + int state = INITIAL_STATE; + + while (state != AUTHENTICATED && state != FAILED) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "AUTH state: "+state); + switch (mode) { + case MODE_CLIENT: + switch (state) { + case INITIAL_STATE: + if (null == us) + out.write(new byte[] { 0 }); + else + us.sendCredentialByte((byte) 0); + send(out, COMMAND_AUTH); + state = WAIT_DATA; + break; + case WAIT_DATA: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_DATA: + switch (do_challenge(current, c)) { + case CONTINUE: + send(out, COMMAND_DATA, c.getResponse()); + break; + case OK: + send(out, COMMAND_DATA, c.getResponse()); + state = WAIT_OK; + break; + case ERROR: + send(out, COMMAND_ERROR, c.getResponse()); + break; + } + break; + case COMMAND_REJECTED: + failed |= current; + int available = c.getMechs() & (~failed); + if (0 != (available & AUTH_EXTERNAL)){ + send(out, COMMAND_AUTH, "EXTERNAL", Uid); + current = AUTH_EXTERNAL; + } else if (0 != (available & AUTH_SHA)) { + send(out, COMMAND_AUTH, "DBUS_COOKIE_SHA1", Uid); + current = AUTH_SHA; + } else if (0 != (available & AUTH_ANON)) { + send(out, COMMAND_AUTH, "ANONYMOUS"); + current = AUTH_ANON; + } + else state = FAILED; + break; + case COMMAND_ERROR: + send(out, COMMAND_CANCEL); + state = WAIT_REJECT; + break; + case COMMAND_OK: + send(out, COMMAND_BEGIN); + state = AUTHENTICATED; + break; + default: + send(out, COMMAND_ERROR, "Got invalid command"); + break; + } + break; + case WAIT_OK: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_OK: + send(out, COMMAND_BEGIN); + state = AUTHENTICATED; + break; + case COMMAND_ERROR: + case COMMAND_DATA: + send(out, COMMAND_CANCEL); + state = WAIT_REJECT; + break; + case COMMAND_REJECTED: + failed |= current; + int available = c.getMechs() & (~failed); + state = WAIT_DATA; + if (0 != (available & AUTH_EXTERNAL)) { + send(out, COMMAND_AUTH, "EXTERNAL", Uid); + current = AUTH_EXTERNAL; + } else if (0 != (available & AUTH_SHA)) { + send(out, COMMAND_AUTH, "DBUS_COOKIE_SHA1", Uid); + current = AUTH_SHA; + } else if (0 != (available & AUTH_ANON)) { + send(out, COMMAND_AUTH, "ANONYMOUS"); + current = AUTH_ANON; + } + else state = FAILED; + break; + default: + send(out, COMMAND_ERROR, "Got invalid command"); + break; + } + break; + case WAIT_REJECT: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_REJECTED: + failed |= current; + int available = c.getMechs() & (~failed); + if (0 != (available & AUTH_EXTERNAL)) { + send(out, COMMAND_AUTH, "EXTERNAL", Uid); + current = AUTH_EXTERNAL; + } else if (0 != (available & AUTH_SHA)) { + send(out, COMMAND_AUTH, "DBUS_COOKIE_SHA1", Uid); + current = AUTH_SHA; + } else if (0 != (available & AUTH_ANON)) { + send(out, COMMAND_AUTH, "ANONYMOUS"); + current = AUTH_ANON; + } + else state = FAILED; + break; + default: + state = FAILED; + break; + } + break; + default: + state = FAILED; + } + break; + case MODE_SERVER: + switch (state) { + case INITIAL_STATE: + byte[] buf = new byte[1]; + if (null == us) { + in.read(buf); + } else { + buf[0] = us.recvCredentialByte(); + int kuid = us.getPeerUID(); + if (kuid >= 0) + kernelUid = stupidlyEncode(""+kuid); + } + if (0 != buf[0]) state = FAILED; + else state = WAIT_AUTH; + break; + case WAIT_AUTH: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_AUTH: + if (null == c.getData()) { + send(out, COMMAND_REJECTED, getTypes(types)); + } else { + switch (do_response(current, Uid, kernelUid, c)) { + case CONTINUE: + send(out, COMMAND_DATA, c.getResponse()); + current = c.getMechs(); + state = WAIT_DATA; + break; + case OK: + send(out, COMMAND_OK, guid); + state = WAIT_BEGIN; + current = 0; + break; + case REJECT: + send(out, COMMAND_REJECTED, getTypes(types)); + current = 0; + break; + } + } + break; + case COMMAND_ERROR: + send(out, COMMAND_REJECTED, getTypes(types)); + break; + case COMMAND_BEGIN: + state = FAILED; + break; + default: + send(out, COMMAND_ERROR, "Got invalid command"); + break; + } + break; + case WAIT_DATA: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_DATA: + switch (do_response(current, Uid, kernelUid, c)) { + case CONTINUE: + send(out, COMMAND_DATA, c.getResponse()); + state = WAIT_DATA; + break; + case OK: + send(out, COMMAND_OK, guid); + state = WAIT_BEGIN; + current = 0; + break; + case REJECT: + send(out, COMMAND_REJECTED, getTypes(types)); + current = 0; + break; + } + break; + case COMMAND_ERROR: + case COMMAND_CANCEL: + send(out, COMMAND_REJECTED, getTypes(types)); + state = WAIT_AUTH; + break; + case COMMAND_BEGIN: + state = FAILED; + break; + default: + send(out, COMMAND_ERROR, "Got invalid command"); + break; + } + break; + case WAIT_BEGIN: + c = receive(in); + switch (c.getCommand()) { + case COMMAND_ERROR: + case COMMAND_CANCEL: + send(out, COMMAND_REJECTED, getTypes(types)); + state = WAIT_AUTH; + break; + case COMMAND_BEGIN: + state = AUTHENTICATED; + break; + default: + send(out, COMMAND_ERROR, "Got invalid command"); + break; + } + break; + default: + state = FAILED; + } + break; + default: + return false; + } + } + + return state == AUTHENTICATED; + } + } + public MessageReader min; + public MessageWriter mout; + public Transport() {} + public static String genGUID() + { + Random r = new Random(); + byte[] buf = new byte[16]; + r.nextBytes(buf); + String guid = Hexdump.toHex(buf); + return guid.replaceAll(" ", ""); + } + public Transport(BusAddress address) throws IOException + { + connect(address); + } + public Transport(String address) throws IOException, ParseException + { + connect(new BusAddress(address)); + } + public Transport(String address, int timeout) throws IOException, ParseException + { + connect(new BusAddress(address), timeout); + } + public void connect(String address) throws IOException, ParseException + { + connect(new BusAddress(address), 0); + } + public void connect(String address, int timeout) throws IOException, ParseException + { + connect(new BusAddress(address), timeout); + } + public void connect(BusAddress address) throws IOException + { + connect(address, 0); + } + public void connect(BusAddress address, int timeout) throws IOException + { + if (Debug.debug) Debug.print(Debug.INFO, "Connecting to "+address); + OutputStream out = null; + InputStream in = null; + UnixSocket us = null; + Socket s = null; + int mode = 0; + int types = 0; + if ("unix".equals(address.getType())) { + types = SASL.AUTH_EXTERNAL; + if (null != address.getParameter("listen")) { + mode = SASL.MODE_SERVER; + UnixServerSocket uss = new UnixServerSocket(); + if (null != address.getParameter("abstract")) + uss.bind(new UnixSocketAddress(address.getParameter("abstract"), true)); + else if (null != address.getParameter("path")) + uss.bind(new UnixSocketAddress(address.getParameter("path"), false)); + us = uss.accept(); + } else { + mode = SASL.MODE_CLIENT; + us = new UnixSocket(); + if (null != address.getParameter("abstract")) + us.connect(new UnixSocketAddress(address.getParameter("abstract"), true)); + else if (null != address.getParameter("path")) + us.connect(new UnixSocketAddress(address.getParameter("path"), false)); + } + us.setPassCred(true); + in = us.getInputStream(); + out = us.getOutputStream(); + } else if ("tcp".equals(address.getType())) { + types = SASL.AUTH_SHA; + if (null != address.getParameter("listen")) { + mode = SASL.MODE_SERVER; + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(address.getParameter("host"), Integer.parseInt(address.getParameter("port")))); + s = ss.accept(); + } else { + mode = SASL.MODE_CLIENT; + s = new Socket(); + s.connect(new InetSocketAddress(address.getParameter("host"), Integer.parseInt(address.getParameter("port")))); + } + in = s.getInputStream(); + out = s.getOutputStream(); + } else { + throw new IOException(_("unknown address type ")+address.getType()); + } + + if (!(new SASL()).auth(mode, types, address.getParameter("guid"), out, in, us)) { + out.close(); + throw new IOException(_("Failed to auth")); + } + if (null != us) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Setting timeout to "+timeout+" on Socket"); + if (timeout == 1) + us.setBlocking(false); + else + us.setSoTimeout(timeout); + } + if (null != s) { + if (Debug.debug) Debug.print(Debug.VERBOSE, "Setting timeout to "+timeout+" on Socket"); + s.setSoTimeout(timeout); + } + mout = new MessageWriter(out); + min = new MessageReader(in); + } + public void disconnect() throws IOException + { + if (Debug.debug) Debug.print(Debug.INFO, "Disconnecting Transport"); + min.close(); + mout.close(); + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Tuple.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Tuple.java new file mode 100755 index 0000000..becfc60 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Tuple.java @@ -0,0 +1,24 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +/** + * This class should be extended to create Tuples. + * Any such class may be used as the return type for a method + * which returns multiple values. + * All fields in the Tuple which you wish to be serialized and sent to the + * remote method should be annotated with the org.freedesktop.dbus.Position + * annotation, in the order they should appear to DBus. + */ +public abstract class Tuple extends Container +{ + public Tuple() {} +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/TypeSignature.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/TypeSignature.java new file mode 100755 index 0000000..c297821 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/TypeSignature.java @@ -0,0 +1,37 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import java.lang.reflect.Type; +import org.freedesktop.dbus.exceptions.DBusException; + +public class TypeSignature +{ + String sig; + public TypeSignature(String sig) + { + this.sig = sig; + } + public TypeSignature(Type[] types) throws DBusException + { + StringBuffer sb = new StringBuffer(); + for (Type t: types) { + String[] ts = Marshalling.getDBusType(t); + for (String s: ts) + sb.append(s); + } + this.sig = sb.toString(); + } + public String getSig() + { + return sig; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt16.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt16.java new file mode 100755 index 0000000..45af710 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt16.java @@ -0,0 +1,79 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.text.MessageFormat; + +/** + * Class to represent 16-bit unsigned integers. + */ +@SuppressWarnings("serial") +public class UInt16 extends Number implements Comparable +{ + /** Maximum possible value. */ + public static final int MAX_VALUE = 65535; + /** Minimum possible value. */ + public static final int MIN_VALUE = 0; + private int value; + /** Create a UInt16 from an int. + * @param value Must be within MIN_VALUE–MAX_VALUE + * @throws NumberFormatException if value is not between MIN_VALUE and MAX_VALUE + */ + public UInt16(int value) + { + if (value < MIN_VALUE || value > MAX_VALUE) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_VALUE})); + this.value = value; + } + /** Create a UInt16 from a String. + * @param value Must parse to a valid integer within MIN_VALUE–MAX_VALUE + * @throws NumberFormatException if value is not an integer between MIN_VALUE and MAX_VALUE + */ + public UInt16(String value) + { + this(Integer.parseInt(value)); + } + /** The value of this as a byte. */ + public byte byteValue() { return (byte) value; } + /** The value of this as a double. */ + public double doubleValue() { return (double) value; } + /** The value of this as a float. */ + public float floatValue() { return (float) value; } + /** The value of this as a int. */ + public int intValue() { return /*(int)*/ value; } + /** The value of this as a long. */ + public long longValue() { return (long) value; } + /** The value of this as a short. */ + public short shortValue(){ return (short) value; } + /** Test two UInt16s for equality. */ + public boolean equals(Object o) + { + return o instanceof UInt16 && ((UInt16) o).value == this.value; + } + public int hashCode() + { + return /*(int)*/ value; + } + /** Compare two UInt16s. + * @return 0 if equal, -ve or +ve if they are different. + */ + public int compareTo(UInt16 other) + { + return /*(int)*/ (this.value - other.value); + } + /** The value of this as a string. */ + public String toString() + { + return ""+value; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt32.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt32.java new file mode 100755 index 0000000..17b9f07 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt32.java @@ -0,0 +1,79 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.text.MessageFormat; + +/** + * Class to represent unsigned 32-bit numbers. + */ +@SuppressWarnings("serial") +public class UInt32 extends Number implements Comparable +{ + /** Maximum allowed value */ + public static final long MAX_VALUE = 4294967295L; + /** Minimum allowed value */ + public static final long MIN_VALUE = 0; + private long value; + /** Create a UInt32 from a long. + * @param value Must be a valid integer within MIN_VALUE–MAX_VALUE + * @throws NumberFormatException if value is not between MIN_VALUE and MAX_VALUE + */ + public UInt32(long value) + { + if (value < MIN_VALUE || value > MAX_VALUE) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_VALUE})); + this.value = value; + } + /** Create a UInt32 from a String. + * @param value Must parse to a valid integer within MIN_VALUE–MAX_VALUE + * @throws NumberFormatException if value is not an integer between MIN_VALUE and MAX_VALUE + */ + public UInt32(String value) + { + this(Long.parseLong(value)); + } + /** The value of this as a byte. */ + public byte byteValue() { return (byte) value; } + /** The value of this as a double. */ + public double doubleValue() { return (double) value; } + /** The value of this as a float. */ + public float floatValue() { return (float) value; } + /** The value of this as a int. */ + public int intValue() { return (int) value; } + /** The value of this as a long. */ + public long longValue() { return /*(long)*/ value; } + /** The value of this as a short. */ + public short shortValue(){ return (short) value; } + /** Test two UInt32s for equality. */ + public boolean equals(Object o) + { + return o instanceof UInt32 && ((UInt32) o).value == this.value; + } + public int hashCode() + { + return (int) value; + } + /** Compare two UInt32s. + * @return 0 if equal, -ve or +ve if they are different. + */ + public int compareTo(UInt32 other) + { + return (int) (this.value - other.value); + } + /** The value of this as a string */ + public String toString() + { + return ""+value; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt64.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt64.java new file mode 100755 index 0000000..b3e4cb9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/UInt64.java @@ -0,0 +1,151 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.math.BigInteger; + +import java.text.MessageFormat; + +/** + * Class to represent unsigned 64-bit numbers. + * Warning: Any functions which take or return a long + * are restricted to the range of a signed 64bit number. + * Use the BigInteger methods if you wish access to the full + * range. + */ +@SuppressWarnings("serial") +public class UInt64 extends Number implements Comparable +{ + /** Maximum allowed value (when accessed as a long) */ + public static final long MAX_LONG_VALUE = Long.MAX_VALUE; + /** Maximum allowed value (when accessed as a BigInteger) */ + public static final BigInteger MAX_BIG_VALUE = new BigInteger("18446744073709551615"); + /** Minimum allowed value */ + public static final long MIN_VALUE = 0; + private BigInteger value; + private long top; + private long bottom; + /** Create a UInt64 from a long. + * @param value Must be a valid integer within MIN_VALUE–MAX_VALUE + * @throws NumberFormatException if value is not between MIN_VALUE and MAX_VALUE + */ + public UInt64(long value) + { + if (value < MIN_VALUE || value > MAX_LONG_VALUE) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_LONG_VALUE})); + this.value = new BigInteger(""+value); + this.top = this.value.shiftRight(32).and(new BigInteger("4294967295")).longValue(); + this.bottom = this.value.and(new BigInteger("4294967295")).longValue(); + } + /** + * Create a UInt64 from two longs. + * @param top Most significant 4 bytes. + * @param bottom Least significant 4 bytes. + */ + public UInt64(long top, long bottom) + { + BigInteger a = new BigInteger(""+top); + a = a.shiftLeft(32); + a = a.add(new BigInteger(""+bottom)); + if (0 > a.compareTo(BigInteger.ZERO)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { a, MIN_VALUE, MAX_BIG_VALUE})); + if (0 < a.compareTo(MAX_BIG_VALUE)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { a, MIN_VALUE, MAX_BIG_VALUE})); + this.value = a; + this.top = top; + this.bottom = bottom; + } + /** Create a UInt64 from a BigInteger + * @param value Must be a valid BigInteger between MIN_VALUE–MAX_BIG_VALUE + * @throws NumberFormatException if value is not an integer between MIN_VALUE and MAX_BIG_VALUE + */ + public UInt64(BigInteger value) + { + if (null == value) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + if (0 > value.compareTo(BigInteger.ZERO)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + if (0 < value.compareTo(MAX_BIG_VALUE)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + this.value = value; + this.top = this.value.shiftRight(32).and(new BigInteger("4294967295")).longValue(); + this.bottom = this.value.and(new BigInteger("4294967295")).longValue(); + } + /** Create a UInt64 from a String. + * @param value Must parse to a valid integer within MIN_VALUE–MAX_BIG_VALUE + * @throws NumberFormatException if value is not an integer between MIN_VALUE and MAX_BIG_VALUE + */ + public UInt64(String value) + { + if (null == value) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + BigInteger a = new BigInteger(value); + if (0 > a.compareTo(BigInteger.ZERO)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + if (0 < a.compareTo(MAX_BIG_VALUE)) + throw new NumberFormatException(MessageFormat.format(_("{0} is not between {1} and {2}."), new Object[] { value, MIN_VALUE, MAX_BIG_VALUE})); + this.value = a; + this.top = this.value.shiftRight(32).and(new BigInteger("4294967295")).longValue(); + this.bottom = this.value.and(new BigInteger("4294967295")).longValue(); + } + /** The value of this as a BigInteger. */ + public BigInteger value() { return value; } + /** The value of this as a byte. */ + public byte byteValue() { return value.byteValue(); } + /** The value of this as a double. */ + public double doubleValue() { return value.doubleValue(); } + /** The value of this as a float. */ + public float floatValue() { return value.floatValue(); } + /** The value of this as a int. */ + public int intValue() { return value.intValue(); } + /** The value of this as a long. */ + public long longValue() { return value.longValue(); } + /** The value of this as a short. */ + public short shortValue(){ return value.shortValue(); } + /** Test two UInt64s for equality. */ + public boolean equals(Object o) + { + return o instanceof UInt64 && this.value.equals(((UInt64) o).value); + } + public int hashCode() + { + return value.hashCode(); + } + /** Compare two UInt32s. + * @return 0 if equal, -ve or +ve if they are different. + */ + public int compareTo(UInt64 other) + { + return this.value.compareTo(other.value); + } + /** The value of this as a string. */ + public String toString() + { + return value.toString(); + } + /** + * Most significant 4 bytes. + */ + public long top() + { + return top; + } + /** + * Least significant 4 bytes. + */ + public long bottom() + { + return bottom; + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Variant.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Variant.java new file mode 100755 index 0000000..621296a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/Variant.java @@ -0,0 +1,112 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus; + +import static org.freedesktop.dbus.Gettext._; + +import java.lang.reflect.Type; +import java.text.MessageFormat; +import java.util.Vector; +import org.freedesktop.dbus.exceptions.DBusException; + +import cx.ath.matthew.debug.Debug; + +/** + * A Wrapper class for Variant values. + * A method on DBus can send or receive a Variant. + * This will wrap another value whose type is determined at runtime. + * The Variant may be parameterized to restrict the types it may accept. + */ +public class Variant +{ + private final T o; + private final Type type; + private final String sig; + /** + * Create a Variant from a basic type object. + * @param o The wrapped value. + * @throws IllegalArugmentException If you try and wrap Null or an object of a non-basic type. + */ + public Variant(T o) throws IllegalArgumentException + { + if (null == o) throw new IllegalArgumentException(_("Can't wrap Null in a Variant")); + type = o.getClass(); + try { + String[] ss = Marshalling.getDBusType(o.getClass(), true); + if (ss.length != 1) + throw new IllegalArgumentException(_("Can't wrap a multi-valued type in a Variant: ")+type); + this.sig = ss[0]; + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + throw new IllegalArgumentException(MessageFormat.format(_("Can't wrap {0} in an unqualified Variant ({1})."), new Object[] { o.getClass(), DBe.getMessage() })); + } + this.o = o; + } + /** + * Create a Variant. + * @param o The wrapped value. + * @param type The explicit type of the value. + * @throws IllegalArugmentException If you try and wrap Null or an object which cannot be sent over DBus. + */ + public Variant(T o, Type type) throws IllegalArgumentException + { + if (null == o) throw new IllegalArgumentException(_("Can't wrap Null in a Variant")); + this.type = type; + try { + String[] ss = Marshalling.getDBusType(type); + if (ss.length != 1) + throw new IllegalArgumentException(_("Can't wrap a multi-valued type in a Variant: ")+type); + this.sig = ss[0]; + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + throw new IllegalArgumentException(MessageFormat.format(_("Can't wrap {0} in an unqualified Variant ({1})."), new Object[] { type, DBe.getMessage() })); + } + this.o = o; + } + /** + * Create a Variant. + * @param o The wrapped value. + * @param sig The explicit type of the value, as a dbus type string. + * @throws IllegalArugmentException If you try and wrap Null or an object which cannot be sent over DBus. + */ + public Variant(T o, String sig) throws IllegalArgumentException + { + if (null == o) throw new IllegalArgumentException(_("Can't wrap Null in a Variant")); + this.sig = sig; + try { + Vector ts = new Vector(); + Marshalling.getJavaType(sig, ts,1); + if (ts.size() != 1) + throw new IllegalArgumentException(_("Can't wrap multiple or no types in a Variant: ")+sig); + this.type = ts.get(0); + } catch (DBusException DBe) { + if (AbstractConnection.EXCEPTION_DEBUG && Debug.debug) Debug.print(Debug.ERR, DBe); + throw new IllegalArgumentException(MessageFormat.format(_("Can't wrap {0} in an unqualified Variant ({1})."), new Object[] { sig, DBe.getMessage() })); + } + this.o = o; + } + /** Return the wrapped value. */ + public T getValue() { return o; } + /** Return the type of the wrapped value. */ + public Type getType() { return type; } + /** Return the dbus signature of the wrapped value. */ + public String getSig() { return sig; } + /** Format the Variant as a string. */ + public String toString() { return "["+o+"]"; } + /** Compare this Variant with another by comparing contents */ + @SuppressWarnings("unchecked") + public boolean equals(Object other) + { + if (null == other) return false; + if (!(other instanceof Variant)) return false; + return this.o.equals(((Variant)other).o); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/Caller.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/Caller.java new file mode 100755 index 0000000..ecd6002 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/Caller.java @@ -0,0 +1,83 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Type; +import java.util.Arrays; +import java.util.Vector; +import java.io.File; +import org.freedesktop.dbus.BusAddress; +import org.freedesktop.dbus.Error; +import org.freedesktop.dbus.Marshalling; +import org.freedesktop.dbus.Message; +import org.freedesktop.dbus.MethodCall; +import org.freedesktop.dbus.Transport; +import cx.ath.matthew.debug.Debug; + +public class Caller +{ + @SuppressWarnings("unchecked") + public static void main(String[] args) + { + try { + if (Debug.debug) { + Debug.setHexDump(true); + Debug.loadConfig(new File("debug.conf")); + } + if (args.length < 4) { + System.out.println ("Syntax: Caller [ ]"); + System.exit(1); + } + String addr = System.getenv("DBUS_SESSION_BUS_ADDRESS"); + BusAddress address = new BusAddress(addr); + Transport conn = new Transport(address); + + Message m = new MethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "Hello", (byte) 0, null);; + conn.mout.writeMessage(m); + + if ("".equals(args[2])) args[2] = null; + if (args.length == 4) + m = new MethodCall(args[0], args[1], args[2], args[3], (byte) 0, null); + else { + Vector lts = new Vector(); + Marshalling.getJavaType(args[4],lts, -1); + Type[] ts = lts.toArray(new Type[0]); + Object[] os = new Object[args.length-5]; + for (int i = 5; i < args.length; i++) { + if (ts[i-5] instanceof Class) { + try { + Constructor c = ((Class) ts[i-5]).getConstructor(String.class); + os[i-5] = c.newInstance(args[i]); + } catch (Exception e) { + os[i-5] = args[i]; + } + } else + os[i-5] = args[i]; + } + m = new MethodCall(args[0], args[1], args[2], args[3], (byte) 0, args[4], os); + } + long serial = m.getSerial(); + conn.mout.writeMessage(m); + do { + m = conn.min.readMessage(); + } while (serial != m.getReplySerial()); + if (m instanceof Error) ((Error) m).throwException(); + else { + Object[] os = m.getParameters(); + System.out.println(Arrays.deepToString(os)); + } + } catch (Exception e) { + System.out.println (e.getClass().getSimpleName()+": "+e.getMessage()); + System.exit(1); + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/CreateInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/CreateInterface.java new file mode 100755 index 0000000..18769f9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/CreateInterface.java @@ -0,0 +1,711 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import static org.freedesktop.dbus.Gettext._; +import static org.freedesktop.dbus.bin.IdentifierMangler.mangle; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.PrintStream; +import java.io.Reader; +import java.io.StringReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.Marshalling; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.types.DBusStructType; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Converts a DBus XML file into Java interface definitions. + */ +public class CreateInterface +{ + @SuppressWarnings("unchecked") + private static String collapseType(Type t, Set imports, Map structs, boolean container, boolean fullnames) throws DBusException + { + if (t instanceof ParameterizedType) { + String s; + Class c = (Class) ((ParameterizedType) t).getRawType(); + if (null != structs && t instanceof DBusStructType) { + int num = 1; + String name = "Struct"; + while (null != structs.get(new StructStruct(name+num))) num++; + name = name+num; + structs.put(new StructStruct(name), ((ParameterizedType) t).getActualTypeArguments()); + return name; + } + if (null != imports) imports.add(c.getName()); + if (fullnames) return c.getName(); + else s = c.getSimpleName(); + s += '<'; + Type[] ts = ((ParameterizedType) t).getActualTypeArguments(); + for (Type st: ts) + s += collapseType(st, imports, structs, true, fullnames)+','; + s = s.replaceAll(",$", ">"); + return s; + } else if (t instanceof Class) { + Class c = (Class) t; + if (c.isArray()) { + return collapseType(c.getComponentType(), imports, structs, container, fullnames)+"[]"; + } else { + Package p = c.getPackage(); + if (null != imports && + !"java.lang".equals(p.getName())) imports.add(c.getName()); + if (container) { + if (fullnames) return c.getName(); + else return c.getSimpleName(); + } else { + try { + Field f = c.getField("TYPE"); + Class d = (Class) f.get(c); + return d.getSimpleName(); + } catch (Exception e) { + return c.getSimpleName(); + } + } + } + } else return ""; + } + private static String getJavaType(String dbus, Set imports, Map structs, boolean container, boolean fullnames) throws DBusException + { + if (null == dbus || "".equals(dbus)) return ""; + Vector v = new Vector(); + int c = Marshalling.getJavaType(dbus, v, 1); + Type t = v.get(0); + return collapseType(t, imports, structs, container, fullnames); + } + public String comment = ""; + boolean builtin; + + public CreateInterface(PrintStreamFactory factory, boolean builtin) + { + this.factory = factory; + this.builtin = builtin; + } + @SuppressWarnings("fallthrough") + String parseReturns(Vector out, Set imports, Map tuples, Map structs) throws DBusException + { + String[] names = new String[] { "Pair", "Triplet", "Quad", "Quintuple", "Sextuple", "Septuple" }; + String sig = ""; + String name = null; + switch (out.size()) { + case 0: + sig += "void "; + break; + case 1: + sig += getJavaType(out.get(0).getAttribute("type"), imports, structs, false, false)+" "; + break; + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + name = names[out.size() - 2]; + default: + if (null == name) + name = "NTuple"+out.size(); + + tuples.put(name, out.size()); + sig += name + "<"; + for (Element arg: out) + sig += getJavaType(arg.getAttribute("type"), imports, structs, true, false)+", "; + sig = sig.replaceAll(", $","> "); + break; + } + return sig; + } + String parseMethod(Element meth, Set imports, Map tuples, Map structs, Set exceptions, Set anns) throws DBusException + { + Vector in = new Vector(); + Vector out = new Vector(); + if (null == meth.getAttribute("name") || + "".equals(meth.getAttribute("name"))) { + System.err.println(_("ERROR: Method name was blank, failed")); + System.exit(1); + } + String annotations = ""; + String throwses = null; + + for (Node a: new IterableNodeList(meth.getChildNodes())) { + + if (Node.ELEMENT_NODE != a.getNodeType()) continue; + + checkNode(a, "arg", "annotation"); + + if ("arg".equals(a.getNodeName())) { + Element arg = (Element) a; + + // methods default to in + if ("out".equals(arg.getAttribute("direction"))) + out.add(arg); + else + in.add(arg); + } + else if ("annotation".equals(a.getNodeName())) { + Element e = (Element) a; + if (e.getAttribute("name").equals("org.freedesktop.DBus.Method.Error")) { + if (null == throwses) + throwses = e.getAttribute("value"); + else + throwses += ", " + e.getAttribute("value"); + exceptions.add(e.getAttribute("value")); + } else + annotations += parseAnnotation(e, imports, anns); + } + } + + String sig = ""; + comment = ""; + sig += parseReturns(out, imports, tuples, structs); + + sig += mangle(meth.getAttribute("name"))+"("; + + char defaultname = 'a'; + String params = ""; + for (Element arg: in) { + String type = getJavaType(arg.getAttribute("type"), imports, structs, false, false); + String name = arg.getAttribute("name"); + if (null == name || "".equals(name)) name = ""+(defaultname++); + params += type+" "+mangle(name)+", "; + } + return ("".equals(comment) ? "" : " /**\n" + comment + " */\n") + + annotations + " public " + sig + + params.replaceAll("..$", "")+")"+ + (null == throwses? "": " throws "+throwses)+";"; + } + String parseSignal(Element signal, Set imports, Map structs, Set anns) throws DBusException + { + Map params = new HashMap(); + Vector porder = new Vector(); + char defaultname = 'a'; + imports.add("org.freedesktop.dbus.DBusSignal"); + imports.add("org.freedesktop.dbus.exceptions.DBusException"); + String annotations = ""; + for (Node a: new IterableNodeList(signal.getChildNodes())) { + + if (Node.ELEMENT_NODE != a.getNodeType()) continue; + + checkNode(a, "arg", "annotation"); + + if ("annotation".equals(a.getNodeName())) + annotations += parseAnnotation((Element) a, imports, anns); + else { + Element arg = (Element) a; + String type = getJavaType(arg.getAttribute("type"), imports, structs, false, false); + String name = arg.getAttribute("name"); + if (null == name || "".equals(name)) name = ""+(defaultname++); + params.put(mangle(name), type); + porder.add(mangle(name)); + } + } + + String out = ""; + out += annotations; + out += " public static class "+signal.getAttribute("name"); + out += " extends DBusSignal\n {\n"; + for (String name: porder) + out += " public final "+params.get(name)+" "+name+";\n"; + out += " public "+signal.getAttribute("name")+"(String path"; + for (String name: porder) + out += ", "+params.get(name)+" "+name; + out += ") throws DBusException\n {\n super(path"; + for (String name: porder) + out += ", "+name; + out += ");\n"; + for (String name: porder) + out += " this."+name+" = "+name+";\n"; + out += " }\n"; + + out += " }\n"; + return out; + } + + String parseAnnotation(Element ann, Set imports, Set annotations) + { + String s = " @"+ann.getAttribute("name").replaceAll(".*\\.([^.]*)$","$1")+"("; + if (null != ann.getAttribute("value") + && !"".equals(ann.getAttribute("value"))) + s += '"'+ann.getAttribute("value")+'"'; + imports.add(ann.getAttribute("name")); + annotations.add(ann.getAttribute("name")); + return s += ")\n"; + } + + void parseInterface(Element iface, PrintStream out, Map tuples, Map structs, Set exceptions, Set anns) throws DBusException + { + if (null == iface.getAttribute("name") || + "".equals(iface.getAttribute("name"))) { + System.err.println(_("ERROR: Interface name was blank, failed")); + System.exit(1); + } + + out.println("package "+iface.getAttribute("name").replaceAll("\\.[^.]*$","")+";"); + + String methods = ""; + String signals = ""; + String annotations = ""; + Set imports = new TreeSet(); + imports.add("org.freedesktop.dbus.DBusInterface"); + for (Node meth: new IterableNodeList(iface.getChildNodes())) { + + if (Node.ELEMENT_NODE != meth.getNodeType()) continue; + + checkNode(meth, "method", "signal", "property", "annotation"); + + if ("method".equals(meth.getNodeName())) + methods += parseMethod((Element) meth, imports, tuples, structs, exceptions, anns) + "\n"; + else if ("signal".equals(meth.getNodeName())) + signals += parseSignal((Element) meth, imports, structs, anns); + else if ("property".equals(meth.getNodeName())) + System.err.println("WARNING: Ignoring property"); + else if ("annotation".equals(meth.getNodeName())) + annotations += parseAnnotation((Element) meth, imports, anns); + } + + if (imports.size() > 0) + for (String i: imports) + out.println("import "+i+";"); + + out.print(annotations); + out.print("public interface "+iface.getAttribute("name").replaceAll("^.*\\.([^.]*)$","$1")); + out.println(" extends DBusInterface"); + out.println("{"); + out.println(signals); + out.println(methods); + out.println("}"); + } + void createException(String name, String pack, PrintStream out) throws DBusException + { + out.println("package "+pack+";"); + out.println("import org.freedesktop.dbus.DBusExecutionException;"); + out.print("public class "+name); + out.println(" extends DBusExecutionException"); + out.println("{"); + out.println(" public "+name+"(String message)"); + out.println(" {"); + out.println(" super(message);"); + out.println(" }"); + out.println("}"); + } + void createAnnotation(String name, String pack, PrintStream out) throws DBusException + { + out.println("package "+pack+";"); + out.println("import java.lang.annotation.Retention;"); + out.println("import java.lang.annotation.RetentionPolicy;"); + out.println("@Retention(RetentionPolicy.RUNTIME)"); + out.println("public @interface "+name); + out.println("{"); + out.println(" String value();"); + out.println("}"); + } + void createStruct(String name, Type[] type, String pack, PrintStream out, Map existing) throws DBusException, IOException + { + out.println("package "+pack+";"); + + Set imports = new TreeSet(); + imports.add("org.freedesktop.dbus.Position"); + imports.add("org.freedesktop.dbus.Struct"); + Map structs = new HashMap(existing); + String[] types = new String[type.length]; + for (int i = 0; i < type.length; i++) + types[i] = collapseType(type[i], imports, structs, false, false); + + for (String im: imports) out.println("import "+im+";"); + + out.println("public final class "+name+" extends Struct"); + out.println("{"); + int i = 0; + char c = 'a'; + String params = ""; + for (String t: types) { + out.println(" @Position("+i++ +")"); + out.println(" public final "+t+" "+c+";"); + params += t+" "+c+", "; + c++; + } + out.println(" public "+name+"("+params.replaceAll("..$", "")+")"); + out.println(" {"); + for (char d = 'a'; d < c; d++) + out.println(" this."+d+" = "+d+";"); + + out.println(" }"); + out.println("}"); + + structs = StructStruct.fillPackages(structs, pack); + Map tocreate = new HashMap(structs); + for (StructStruct ss: existing.keySet()) tocreate.remove(ss); + createStructs(tocreate, structs); + } + void createTuple(String name, int num, String pack, PrintStream out) throws DBusException + { + out.println("package "+pack+";"); + out.println("import org.freedesktop.dbus.Position;"); + out.println("import org.freedesktop.dbus.Tuple;"); + out.println("/** Just a typed container class */"); + out.print("public final class "+name); + String types = " <"; + for (char v = 'A'; v < 'A'+num; v++) + types += v + ","; + out.print(types.replaceAll(",$","> ")); + out.println("extends Tuple"); + out.println("{"); + + char t = 'A'; + char n = 'a'; + for (int i = 0; i < num; i++,t++,n++) { + out.println(" @Position("+i+")"); + out.println(" public final "+t+" "+n+";"); + } + + out.print(" public "+name+"("); + String sig = ""; + t = 'A'; + n = 'a'; + for (int i = 0; i < num; i++,t++,n++) + sig += t+" "+n+", "; + out.println(sig.replaceAll(", $", ")")); + out.println(" {"); + for (char v = 'a'; v < 'a'+num; v++) + out.println(" this."+v+" = "+v+";"); + out.println(" }"); + + out.println("}"); + } + void parseRoot(Element root) throws DBusException, IOException + { + Map structs = new HashMap(); + Set exceptions = new TreeSet(); + Set annotations = new TreeSet(); + + for (Node iface: new IterableNodeList(root.getChildNodes())) { + + if (Node.ELEMENT_NODE != iface.getNodeType()) continue; + + checkNode(iface, "interface", "node"); + + if ("interface".equals(iface.getNodeName())) { + + Map tuples = new HashMap(); + String name = ((Element) iface).getAttribute("name"); + String file = name.replaceAll("\\.","/")+".java"; + String path = file.replaceAll("/[^/]*$", ""); + String pack = name.replaceAll("\\.[^.]*$",""); + + // don't create interfaces in org.freedesktop.DBus by default + if (pack.startsWith("org.freedesktop.DBus") && !builtin) continue; + + factory.init(file, path); + parseInterface((Element) iface, + factory.createPrintStream(file), tuples, structs, exceptions, annotations); + + structs = StructStruct.fillPackages(structs, pack); + createTuples(tuples, pack); + } + else if ("node".equals(iface.getNodeName())) + parseRoot((Element) iface); + else { + System.err.println(_("ERROR: Unknown node: ")+iface.getNodeName()); + System.exit(1); + } + } + + createStructs(structs, structs); + createExceptions(exceptions); + createAnnotations(annotations); + } + private void createAnnotations(Set annotations) throws DBusException, IOException + { + for (String fqn: annotations) { + String name = fqn.replaceAll("^.*\\.([^.]*)$", "$1"); + String pack = fqn.replaceAll("\\.[^.]*$",""); + // don't create things in org.freedesktop.DBus by default + if (pack.startsWith("org.freedesktop.DBus") && !builtin) + continue; + String path = pack.replaceAll("\\.", "/"); + String file = name.replaceAll("\\.","/")+".java"; + factory.init(file, path); + createAnnotation(name, pack, + factory.createPrintStream(path, name)); + } + } + private void createExceptions(Set exceptions) throws DBusException, IOException + { + for (String fqn: exceptions) { + String name = fqn.replaceAll("^.*\\.([^.]*)$", "$1"); + String pack = fqn.replaceAll("\\.[^.]*$",""); + // don't create things in org.freedesktop.DBus by default + if (pack.startsWith("org.freedesktop.DBus") && !builtin) + continue; + String path = pack.replaceAll("\\.", "/"); + String file = name.replaceAll("\\.","/")+".java"; + factory.init(file, path); + createException(name, pack, + factory.createPrintStream(path, name)); + } + } + private void createStructs(Map structs, Map existing) throws DBusException, IOException + { + for (StructStruct ss: structs.keySet()) { + String file = ss.name.replaceAll("\\.","/")+".java"; + String path = ss.pack.replaceAll("\\.", "/"); + factory.init(file, path); + createStruct(ss.name, structs.get(ss), ss.pack, + factory.createPrintStream(path, ss.name), existing); + } + } + + private void createTuples(Map typeMap, String pack) throws DBusException, IOException + { + for (String tname: typeMap.keySet()) + createTuple(tname, typeMap.get(tname), pack, + factory.createPrintStream(pack.replaceAll("\\.","/"), tname)); + } + + public static abstract class PrintStreamFactory + { + + public abstract void init(String file, String path); + + /** + * @param path + * @param tname + * @return PrintStream + * @throws IOException + */ + public PrintStream createPrintStream(String path, String tname) throws IOException + { + final String file = path+"/"+tname+".java"; + return createPrintStream(file); + } + + /** + * @param file + * @return PrintStream + * @throws IOException + */ + public abstract PrintStream createPrintStream(final String file) throws IOException; + + } + static class ConsoleStreamFactory extends PrintStreamFactory + { + + @Override + public + void init(String file, String path) + { + } + + @Override + public + PrintStream createPrintStream(String file) throws IOException + { + System.out.println("/* File: "+file+" */"); + return System.out; + } + + public PrintStream createPrintStream(String path, String tname) throws IOException + { + return super.createPrintStream(path, tname); + } + + } + + static class FileStreamFactory extends PrintStreamFactory + { + public void init(String file, String path) + { + new File(path).mkdirs(); + } + + + /** + * @param file + * @return + * @throws IOException + */ + public PrintStream createPrintStream(final String file) throws IOException + { + return new PrintStream(new FileOutputStream(file)); + } + + } + + static void checkNode(Node n, String... names) + { + String expected = ""; + for (String name: names) { + if (name.equals(n.getNodeName())) return; + expected += name + " or "; + } + System.err.println(MessageFormat.format(_("ERROR: Expected {0}, got {1}, failed."), new Object[] { expected.replaceAll("....$", ""), n.getNodeName() })); + System.exit(1); + } + + private final PrintStreamFactory factory; + + static class Config + { + int bus = DBusConnection.SESSION; + String busname = null; + String object = null; + File datafile = null; + boolean printtree = false; + boolean fileout = false; + boolean builtin = false; + } + + static void printSyntax() + { + printSyntax(System.err); + } + static void printSyntax(PrintStream o) + { + o.println("Syntax: CreateInterface [file | busname object]"); + o.println(" Options: --no-ignore-builtin --system -y --session -s --create-files -f --help -h --version -v"); + } + public static void version() + { + System.out.println("Java D-Bus Version "+System.getProperty("Version")); + System.exit(1); + } + + static Config parseParams(String[] args) + { + Config config = new Config(); + for (String p: args) { + if ("--system".equals(p) || "-y".equals(p)) + config.bus = DBusConnection.SYSTEM; + else if ("--session".equals(p) || "-s".equals(p)) + config.bus = DBusConnection.SESSION; + else if ("--no-ignore-builtin".equals(p)) + config.builtin = true; + else if ("--create-files".equals(p) || "-f".equals(p)) + config.fileout = true; + else if ("--print-tree".equals(p) || "-p".equals(p)) + config.printtree = true; + else if ("--help".equals(p) || "-h".equals(p)) { + printSyntax(System.out); + System.exit(0); + } else if ("--version".equals(p) || "-v".equals(p)) { + version(); + System.exit(0); + } else if (p.startsWith("-")) { + System.err.println(_("ERROR: Unknown option: ")+p); + printSyntax(); + System.exit(1); + } + else { + if (null == config.busname) config.busname = p; + else if (null == config.object) config.object = p; + else { + printSyntax(); + System.exit(1); + } + } + } + if (null == config.busname) { + printSyntax(); + System.exit(1); + } + else if (null == config.object) { + config.datafile = new File(config.busname); + config.busname = null; + } + return config; + } + + public static void main(String[] args) throws Exception + { + Config config = parseParams(args); + + Reader introspectdata = null; + + if (null != config.busname) try { + DBusConnection conn = DBusConnection.getConnection(config.bus); + Introspectable in = conn.getRemoteObject(config.busname, config.object, Introspectable.class); + String id = in.Introspect(); + if (null == id) { + System.err.println(_("ERROR: Failed to get introspection data")); + System.exit(1); + } + introspectdata = new StringReader(id); + conn.disconnect(); + } catch (DBusException DBe) { + System.err.println(_("ERROR: Failure in DBus Communications: ")+DBe.getMessage()); + System.exit(1); + } catch (DBusExecutionException DEe) { + System.err.println(_("ERROR: Failure in DBus Communications: ")+DEe.getMessage()); + System.exit(1); + + } else if (null != config.datafile) try { + introspectdata = new InputStreamReader(new FileInputStream(config.datafile)); + } catch (FileNotFoundException FNFe) { + System.err.println(_("ERROR: Could not find introspection file: ")+FNFe.getMessage()); + System.exit(1); + } + try { + PrintStreamFactory factory = config.fileout ? new FileStreamFactory() : new ConsoleStreamFactory(); + CreateInterface createInterface = new CreateInterface(factory, config.builtin); + createInterface.createInterface(introspectdata); + } catch (DBusException DBe) { + System.err.println("ERROR: "+DBe.getMessage()); + System.exit(1); + } + } + /** Output the interface for the supplied xml reader + * @param introspectdata The introspect data reader + * @throws ParserConfigurationException If the xml parser could not be configured + * @throws SAXException If a problem occurs reading the xml data + * @throws IOException If an IO error occurs + * @throws DBusException If the dbus related error occurs + */ + public void createInterface(Reader introspectdata) throws ParserConfigurationException, SAXException, IOException, DBusException + { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(new InputSource(introspectdata)); + + Element root = document.getDocumentElement(); + checkNode(root, "node"); + parseRoot(root); + + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/DBusDaemon.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/DBusDaemon.java new file mode 100755 index 0000000..1ecd77a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/DBusDaemon.java @@ -0,0 +1,878 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import static org.freedesktop.dbus.Gettext._; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.AbstractConnection; +import org.freedesktop.dbus.BusAddress; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.DirectConnection; +import org.freedesktop.dbus.Error; +import org.freedesktop.dbus.Marshalling; +import org.freedesktop.dbus.Message; +import org.freedesktop.dbus.MessageReader; +import org.freedesktop.dbus.MessageWriter; +import org.freedesktop.dbus.MethodCall; +import org.freedesktop.dbus.MethodReturn; +import org.freedesktop.dbus.Transport; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.FatalException; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.ref.WeakReference; +import java.lang.reflect.InvocationTargetException; +import java.net.InetAddress; +import java.net.ServerSocket; +import java.net.Socket; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import cx.ath.matthew.debug.Debug; +import cx.ath.matthew.unix.UnixServerSocket; +import cx.ath.matthew.unix.UnixSocket; +import cx.ath.matthew.unix.UnixSocketAddress; + +/** + * A replacement DBusDaemon + */ +public class DBusDaemon extends Thread +{ + public static final int QUEUE_POLL_WAIT = 500; + static class Connstruct + { + public UnixSocket usock; + public Socket tsock; + public MessageReader min; + public MessageWriter mout; + public String unique; + public Connstruct(UnixSocket sock) + { + this.usock = sock; + min = new MessageReader(sock.getInputStream()); + mout = new MessageWriter(sock.getOutputStream()); + } + public Connstruct(Socket sock) throws IOException + { + this.tsock = sock; + min = new MessageReader(sock.getInputStream()); + mout = new MessageWriter(sock.getOutputStream()); + } + public String toString() + { + return null == unique ? ":?-?" : unique; + } + } + static class MagicMap + { + private Map> m; + private LinkedList q; + private String name; + public MagicMap(String name) + { + m = new HashMap>(); + q = new LinkedList(); + this.name = name; + } + public A head() + { + return q.getFirst(); + } + public void putFirst(A a, B b) + { + if (Debug.debug) Debug.print("<"+name+"> Queueing {"+a+" => "+b+"}"); + if (m.containsKey(a)) + m.get(a).add(b); + else { + LinkedList l = new LinkedList(); + l.add(b); + m.put(a, l); + } + q.addFirst(a); + } + public void putLast(A a, B b) + { + if (Debug.debug) Debug.print("<"+name+"> Queueing {"+a+" => "+b+"}"); + if (m.containsKey(a)) + m.get(a).add(b); + else { + LinkedList l = new LinkedList(); + l.add(b); + m.put(a, l); + } + q.addLast(a); + } + public List remove(A a) + { + if (Debug.debug) Debug.print("<"+name+"> Removing {"+a+"}"); + q.remove(a); + return m.remove(a); + } + public int size() + { + return q.size(); + } + } + public class DBusServer extends Thread implements DBus, DBus.Introspectable, DBus.Peer + { + public DBusServer() + { + setName("Server"); + } + public Connstruct c; + public Message m; + public boolean isRemote() { return false; } + public String Hello() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + synchronized (c) { + if (null != c.unique) + throw new org.freedesktop.DBus.Error.AccessDenied(_("Connection has already sent a Hello message")); + synchronized (unique_lock) { + c.unique = ":1."+(++next_unique); + } + } + synchronized (names) { + names.put(c.unique, c); + } + + if (Debug.debug) Debug.print(Debug.WARN, "Client "+c.unique+" registered"); + + try { + send(c, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameAcquired", "s", c.unique)); + DBusSignal s = new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", "sss", c.unique, "", c.unique); + send(null, s); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return c.unique; + } + public String[] ListNames() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + String[] ns; + synchronized (names) { + Set nss = names.keySet(); + ns = nss.toArray(new String[0]); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return ns; + } + + public boolean NameHasOwner(String name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + boolean rv; + synchronized (names) { + rv = names.containsKey(name); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return rv; + } + public String GetNameOwner(String name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + Connstruct owner = names.get(name); + String o; + if (null == owner) + o = ""; + else + o = owner.unique; + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return o; + } + + public UInt32 GetConnectionUnixUser(String connection_name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new UInt32(0); + } + public UInt32 StartServiceByName(String name, UInt32 flags) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new UInt32(0); + } + public UInt32 RequestName(String name, UInt32 flags) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + + boolean exists = false; + synchronized (names) { + if (!(exists = names.containsKey(name))) + names.put(name, c); + } + + int rv; + if (exists) { + rv = DBus.DBUS_REQUEST_NAME_REPLY_EXISTS; + } else { + if (Debug.debug) Debug.print(Debug.WARN, "Client "+c.unique+" acquired name "+name); + rv = DBus.DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER; + try { + send(c, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameAcquired", "s", name)); + send(null, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", "sss", name, "", c.unique)); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + } + + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new UInt32(rv); + } + + public UInt32 ReleaseName(String name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + + boolean exists = false; + synchronized (names) { + if ((exists = (names.containsKey(name) && names.get(name).equals(c)))) + names.remove(name); + } + + int rv; + if (!exists) { + rv = DBus.DBUS_RELEASE_NAME_REPLY_NON_EXISTANT; + } else { + if (Debug.debug) Debug.print(Debug.WARN, "Client "+c.unique+" acquired name "+name); + rv = DBus.DBUS_RELEASE_NAME_REPLY_RELEASED; + try { + send(c, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameLost", "s", name)); + send(null, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", "sss", name, c.unique, "")); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + } + + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new UInt32(rv); + } + public void AddMatch(String matchrule) throws Error.MatchRuleInvalid + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Adding match rule: "+matchrule); + synchronized (sigrecips) { + if (!sigrecips.contains(c)) + sigrecips.add(c); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return; + } + public void RemoveMatch(String matchrule) throws Error.MatchRuleInvalid + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Removing match rule: "+matchrule); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return; + } + public String[] ListQueuedOwners(String name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new String[0]; + } + public UInt32 GetConnectionUnixProcessID(String connection_name) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new UInt32(0); + } + public Byte[] GetConnectionSELinuxSecurityContext(String a) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return new Byte[0]; + } + public void ReloadConfig() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return; + } + @SuppressWarnings("unchecked") + private void handleMessage(Connstruct c, Message m) throws DBusException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.VERBOSE, "Handling message "+m+" from "+c.unique); + if (!(m instanceof MethodCall)) return; + Object[] args = m.getParameters(); + + Class[] cs = new Class[args.length]; + + for (int i = 0; i < cs.length; i++) + cs[i] = args[i].getClass(); + + java.lang.reflect.Method meth = null; + Object rv = null; + + try { + meth = DBusServer.class.getMethod(m.getName(), cs); + try { + this.c = c; + this.m = m; + rv = meth.invoke(dbus_server, args); + if (null == rv) { + send(c, new MethodReturn("org.freedesktop.DBus", (MethodCall) m, null), true); + } else { + String sig = Marshalling.getDBusType(meth.getGenericReturnType())[0]; + send(c, new MethodReturn("org.freedesktop.DBus", (MethodCall) m, sig, rv), true); + } + } catch (InvocationTargetException ITe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, ITe); + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, ITe.getCause()); + send(c, new org.freedesktop.dbus.Error("org.freedesktop.DBus", m, ITe.getCause())); + } catch (DBusExecutionException DBEe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBEe); + send(c, new org.freedesktop.dbus.Error("org.freedesktop.DBus", m, DBEe)); + } catch (Exception e) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, e); + send(c,new org.freedesktop.dbus.Error("org.freedesktop.DBus", c.unique, "org.freedesktop.DBus.Error.GeneralError", m.getSerial(), "s", _("An error occurred while calling ")+m.getName())); + } + } catch (NoSuchMethodException NSMe) { + send(c,new org.freedesktop.dbus.Error("org.freedesktop.DBus", c.unique, "org.freedesktop.DBus.Error.UnknownMethod", m.getSerial(), "s", _("This service does not support ")+m.getName())); + } + + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + public String Introspect() + { + return "\n"+ + "\n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + " \n"+ + ""; + } + public void Ping() {} + + public void run() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + while (_run) { + Message m; + List> wcs; + // block on outqueue + synchronized (localqueue) { + while (localqueue.size() == 0) try { + localqueue.wait(); + } catch (InterruptedException Ie) { } + m = localqueue.head(); + wcs = localqueue.remove(m); + } + if (null != wcs) try { + for (WeakReference wc: wcs) { + Connstruct c = wc.get(); + if (null != c) { + if (Debug.debug) Debug.print(Debug.VERBOSE, " Got message "+m+" from "+c); + handleMessage(c, m); + } + } + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + else if (Debug.debug) Debug.print(Debug.INFO, "Discarding "+m+" connection reaped"); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + } + public class Sender extends Thread + { + public Sender() + { + setName("Sender"); + } + public void run() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + while (_run) { + + if (Debug.debug) Debug.print(Debug.VERBOSE, "Acquiring lock on outqueue and blocking for data"); + Message m = null; + List> wcs = null; + // block on outqueue + synchronized (outqueue) { + while (outqueue.size() == 0) try { + outqueue.wait(); + } catch (InterruptedException Ie) { } + + m = outqueue.head(); + wcs = outqueue.remove(m); + } + if (null != wcs) { + for (WeakReference wc: wcs) { + Connstruct c = wc.get(); + if (null != c) { + if (Debug.debug) Debug.print(Debug.VERBOSE, " Got message "+m+" for "+c.unique); + if (Debug.debug) Debug.print(Debug.INFO, "Sending message "+m+" to "+c.unique); + try { + c.mout.writeMessage(m); + } + catch (IOException IOe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, IOe); + removeConnection(c); + } + } + } + } + else if (Debug.debug) Debug.print(Debug.INFO, "Discarding "+m+" connection reaped"); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + } + public class Reader extends Thread + { + private Connstruct conn; + private WeakReference weakconn; + private boolean _lrun = true; + public Reader(Connstruct conn) + { + this.conn = conn; + weakconn = new WeakReference(conn); + setName("Reader"); + } + public void stopRunning() + { + _lrun = false; + } + public void run() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + while (_run && _lrun) { + + Message m = null; + try { + m = conn.min.readMessage(); + } catch (IOException IOe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, IOe); + removeConnection(conn); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + if (DBe instanceof FatalException) + removeConnection(conn); + } + + if (null != m) { + if (Debug.debug) Debug.print(Debug.INFO, "Read "+m+" from "+conn.unique); + synchronized (inqueue) { + inqueue.putLast(m, weakconn); + inqueue.notifyAll(); + } + } + } + conn = null; + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + } + + private Map conns = new HashMap(); + private HashMap names = new HashMap(); + private MagicMap> outqueue = new MagicMap>("out"); + private MagicMap> inqueue = new MagicMap>("in"); + private MagicMap> localqueue = new MagicMap>("local"); + private List sigrecips = new Vector(); + private boolean _run = true; + private int next_unique = 0; + private Object unique_lock = new Object(); + DBusServer dbus_server = new DBusServer(); + Sender sender = new Sender(); + + public DBusDaemon() + { + setName("Daemon"); + synchronized (names) { + names.put("org.freedesktop.DBus", null); + } + } + @SuppressWarnings("unchecked") + private void send(Connstruct c, Message m) + { + send (c, m, false); + } + private void send(Connstruct c, Message m, boolean head) + { + if (Debug.debug){ + Debug.print(Debug.DEBUG, "enter"); + if (null == c) + Debug.print(Debug.VERBOSE, "Queing message "+m+" for all connections"); + else + Debug.print(Debug.VERBOSE, "Queing message "+m+" for "+c.unique); + } + // send to all connections + if (null == c) { + synchronized (conns) { + synchronized (outqueue) { + for (Connstruct d: conns.keySet()) + if (head) + outqueue.putFirst(m, new WeakReference(d)); + else + outqueue.putLast(m, new WeakReference(d)); + outqueue.notifyAll(); + } + } + } else { + synchronized (outqueue) { + if (head) + outqueue.putFirst(m, new WeakReference(c)); + else + outqueue.putLast(m, new WeakReference(c)); + outqueue.notifyAll(); + } + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + @SuppressWarnings("unchecked") + private List findSignalMatches(DBusSignal sig) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + List l; + synchronized (sigrecips) { + l = new Vector(sigrecips); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + return l; + } + @SuppressWarnings("unchecked") + public void run() + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + while (_run) { + try { + Message m; + List> wcs; + synchronized (inqueue) { + while (0 == inqueue.size()) try { + inqueue.wait(); + } catch (InterruptedException Ie) {} + + m = inqueue.head(); + wcs = inqueue.remove(m); + } + if (null != wcs) { + for (WeakReference wc: wcs) { + Connstruct c = wc.get(); + if (null != c) { + if (Debug.debug) Debug.print(Debug.INFO, " Got message "+m+" from "+c.unique); + // check if they have hello'd + if (null == c.unique + && (!(m instanceof MethodCall) + || !"org.freedesktop.DBus".equals(m.getDestination()) + || !"Hello".equals(m.getName()))) { + send(c,new Error("org.freedesktop.DBus", null, "org.freedesktop.DBus.Error.AccessDenied", m.getSerial(), "s", _("You must send a Hello message"))); + } else { + try { + if (null != c.unique) m.setSource(c.unique); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + send(c,new Error("org.freedesktop.DBus", null, "org.freedesktop.DBus.Error.GeneralError", m.getSerial(), "s", _("Sending message failed"))); + } + + if ("org.freedesktop.DBus".equals(m.getDestination())) { + synchronized (localqueue) { + localqueue.putLast(m, wc); + localqueue.notifyAll(); + } + } else { + if (m instanceof DBusSignal) { + List list = findSignalMatches((DBusSignal) m); + for (Connstruct d: list) + send(d, m); + } else { + Connstruct dest = names.get(m.getDestination()); + + if (null == dest) { + send(c, new Error("org.freedesktop.DBus", null, "org.freedesktop.DBus.Error.ServiceUnknown", m.getSerial(), "s", MessageFormat.format(_("The name `{0}' does not exist"), new Object[] { m.getDestination() }))); + } else + send(dest, m); + } + } + } + } + } + } + } + catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + private void removeConnection(Connstruct c) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + boolean exists; + synchronized(conns) { + if ((exists = conns.containsKey(c))) { + Reader r = conns.get(c); + r.stopRunning(); + conns.remove(c); + } + } + if (exists) { + try { + if (null != c.usock) c.usock.close(); + if (null != c.tsock) c.tsock.close(); + } catch (IOException IOe) {} + synchronized(names) { + List toRemove = new Vector(); + for (String name: names.keySet()) + if (names.get(name) == c) { + toRemove.add(name); + try { + send(null, new DBusSignal("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "NameOwnerChanged", "sss", name, c.unique, "")); + } catch (DBusException DBe) { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.ERR, DBe); + } + } + for (String name: toRemove) + names.remove(name); + } + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + public void addSock(UnixSocket us) + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.WARN, "New Client"); + Connstruct c = new Connstruct(us); + Reader r = new Reader(c); + synchronized (conns) { + conns.put(c, r); + } + r.start(); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + public void addSock(Socket s) throws IOException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + if (Debug.debug) Debug.print(Debug.WARN, "New Client"); + Connstruct c = new Connstruct(s); + Reader r = new Reader(c); + synchronized (conns) { + conns.put(c, r); + } + r.start(); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + public static void syntax() + { + System.out.println("Syntax: DBusDaemon [--version] [-v] [--help] [-h] [--listen address] [-l address] [--print-address] [-r] [--pidfile file] [-p file] [--addressfile file] [-a file] [--unix] [-u] [--tcp] [-t] "); + System.exit(1); + } + public static void version() + { + System.out.println("D-Bus Java Version: "+System.getProperty("Version")); + System.exit(1); + } + public static void saveFile(String data, String file) throws IOException + { + PrintWriter w = new PrintWriter(new FileOutputStream(file)); + w.println(data); + w.close(); + } + public static void main(String args[]) throws Exception + { + if (Debug.debug && AbstractConnection.EXCEPTION_DEBUG) Debug.print(Debug.DEBUG, "enter"); + else if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + String addr = null; + String pidfile = null; + String addrfile = null; + boolean printaddress = false; + boolean unix = true; + boolean tcp = false; + + // parse options + try { + for (int i=0; i < args.length; i++) + if ("--help".equals(args[i]) || "-h".equals(args[i])) + syntax(); + else if ("--version".equals(args[i]) || "-v".equals(args[i])) + version(); + else if ("--listen".equals(args[i]) || "-l".equals(args[i])) + addr = args[++i]; + else if ("--pidfile".equals(args[i]) || "-p".equals(args[i])) + pidfile = args[++i]; + else if ("--addressfile".equals(args[i]) || "-a".equals(args[i])) + addrfile = args[++i]; + else if ("--print-address".equals(args[i]) || "-r".equals(args[i])) + printaddress = true; + else if ("--unix".equals(args[i]) || "-u".equals(args[i])) { + unix = true; + tcp = false; + } else if ("--tcp".equals(args[i]) || "-t".equals(args[i])) { + tcp = true; + unix = false; + } else syntax(); + } catch (ArrayIndexOutOfBoundsException AIOOBe) { + syntax(); + } + + // generate a random address if none specified + if (null == addr && unix) addr = DirectConnection.createDynamicSession(); + else if (null == addr && tcp) addr = DirectConnection.createDynamicTCPSession(); + + BusAddress address = new BusAddress(addr); + if (null == address.getParameter("guid")) { + addr += ",guid="+Transport.genGUID(); + address = new BusAddress(addr); + } + + // print address to stdout + if (printaddress) System.out.println(addr); + + // print address to file + if (null != addrfile) saveFile(addr, addrfile); + + // print PID to file + if (null != pidfile) saveFile(System.getProperty("Pid"), pidfile); + + // start the daemon + if (Debug.debug) Debug.print(Debug.WARN, "Binding to "+addr); + if ("unix".equals(address.getType())) + doUnix(address); + else if ("tcp".equals(address.getType())) + doTCP(address); + else throw new Exception("Unknown address type: "+address.getType()); + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + private static void doUnix(BusAddress address) throws IOException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + UnixServerSocket uss; + if (null != address. getParameter("abstract")) + uss = new UnixServerSocket(new UnixSocketAddress(address.getParameter("abstract"), true)); + else + uss = new UnixServerSocket(new UnixSocketAddress(address.getParameter("path"), false)); + DBusDaemon d = new DBusDaemon(); + d.start(); + d.sender.start(); + d.dbus_server.start(); + + // accept new connections + while (d._run) { + UnixSocket s = uss.accept(); + if ((new Transport.SASL()).auth(Transport.SASL.MODE_SERVER, Transport.SASL.AUTH_EXTERNAL, address.getParameter("guid"), s.getOutputStream(), s.getInputStream(), s)) { + // s.setBlocking(false); + d.addSock(s); + } else + s.close(); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } + private static void doTCP(BusAddress address) throws IOException + { + if (Debug.debug) Debug.print(Debug.DEBUG, "enter"); + ServerSocket ss = new ServerSocket(Integer.parseInt(address.getParameter("port")),10, InetAddress.getByName(address.getParameter("host"))); + DBusDaemon d = new DBusDaemon(); + d.start(); + d.sender.start(); + d.dbus_server.start(); + + // accept new connections + while (d._run) { + Socket s = ss.accept(); + boolean authOK=false; + try { + authOK = (new Transport.SASL()).auth(Transport.SASL.MODE_SERVER, Transport.SASL.AUTH_EXTERNAL, address.getParameter("guid"), s.getOutputStream(), s.getInputStream(), null); + } catch (Exception e) { + if (Debug.debug) Debug. print(Debug.DEBUG, e); + } + if (authOK) { + d.addSock(s); + } else + s.close(); + } + if (Debug.debug) Debug.print(Debug.DEBUG, "exit"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IdentifierMangler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IdentifierMangler.java new file mode 100755 index 0000000..db596f4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IdentifierMangler.java @@ -0,0 +1,43 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import java.util.Arrays; + +/** + * Checks identifiers for keywords etc and mangles them if so. + */ +public class IdentifierMangler +{ + private static String[] keywords; + static { + keywords = new String[] { + "true","false","null", + "abstract","continue","for","new","switch", + "assert","default","goto","package","synchronized", + "boolean","do","if","private","this", + "break","double","implements","protected","throw", + "byte","else","import","public","throws", + "case","enum","instanceof","return","transient", + "catch","extends","int","short","try", + "char","final","interface","static","void", + "class","finally","long","strictfp","volatile", + "const","float","native","super","while" + }; + Arrays.sort(keywords); + } + public static String mangle(String name) + { + if (Arrays.binarySearch(keywords, name) >= 0) + name = "_"+name; + return name; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IterableNodeList.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IterableNodeList.java new file mode 100755 index 0000000..ddd5884 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/IterableNodeList.java @@ -0,0 +1,29 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import java.util.Iterator; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +class IterableNodeList implements Iterable +{ + private NodeList nl; + public IterableNodeList(NodeList nl) + { + this.nl = nl; + } + public Iterator iterator() + { + return new NodeListIterator(nl); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/ListDBus.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/ListDBus.java new file mode 100755 index 0000000..93d4ad5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/ListDBus.java @@ -0,0 +1,74 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +/** + * This class lists all the names currently connected on the bus + */ +public class ListDBus +{ + public static void syntax() + { + System.out.println("Syntax: ListDBus [--version] [-v] [--help] [-h] [--owners] [-o] [--uids] [-u] [--session] [-s] [--system] [-y]"); + System.exit(1); + } + public static void version() + { + System.out.println("Java D-Bus Version "+System.getProperty("Version")); + System.exit(1); + } + public static void main(String args[]) throws Exception + { + boolean owners = false; + boolean users = false; + int connection = DBusConnection.SESSION; + + for (String a: args) + if ("--help".equals(a)) syntax(); + else if ("-h".equals(a)) syntax(); + else if ("--version".equals(a)) version(); + else if ("-v".equals(a)) version(); + else if ("-u".equals(a)) users = true; + else if ("--uids".equals(a)) users = true; + else if ("-o".equals(a)) owners = true; + else if ("--owners".equals(a)) owners = true; + else if ("--session".equals(a)) connection = DBusConnection.SESSION; + else if ("-s".equals(a)) connection = DBusConnection.SESSION; + else if ("--system".equals(a)) connection = DBusConnection.SYSTEM; + else if ("-y".equals(a)) connection = DBusConnection.SYSTEM; + else syntax(); + + DBusConnection conn = DBusConnection.getConnection(connection); + DBus dbus = conn.getRemoteObject("org.freedesktop.DBus", "/org/freedesktop/DBus", DBus.class); + String[] names = dbus.ListNames(); + for (String s: names) { + if (users) + try { + System.out.print(dbus.GetConnectionUnixUser(s)+"\t"); + } catch (DBusExecutionException DBEe) { + System.out.print("\t"); + } + System.out.print(s); + if (!s.startsWith(":") && owners) { + try { + System.out.print("\t"+dbus.GetNameOwner(s)); + } catch (DBusExecutionException DBEe) { + } + } + System.out.println(); + } + conn.disconnect(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/NodeListIterator.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/NodeListIterator.java new file mode 100755 index 0000000..ea2d23a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/NodeListIterator.java @@ -0,0 +1,38 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import java.util.Iterator; + +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +class NodeListIterator implements Iterator +{ + NodeList nl; + int i; + NodeListIterator(NodeList nl) + { + this.nl = nl; + i = 0; + } + public boolean hasNext() + { + return i < nl.getLength(); + } + public Node next() + { + Node n = nl.item(i); + i++; + return n; + } + public void remove() {}; +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/StructStruct.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/StructStruct.java new file mode 100755 index 0000000..f302f6d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/bin/StructStruct.java @@ -0,0 +1,54 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.bin; + +import java.lang.reflect.Type; +import java.util.Map; +import java.util.HashMap; + +class StructStruct +{ + public static Map fillPackages(Map structs, String pack) + { + Map newmap = new HashMap(); + for (StructStruct ss: structs.keySet()) { + Type[] type = structs.get(ss); + if (null == ss.pack) ss.pack = pack; + newmap.put(ss, type); + } + return newmap; + } + public String name; + public String pack; + public StructStruct(String name) + { + this.name = name; + } + public StructStruct(String name, String pack) + { + this.name = name; + this.pack = pack; + } + public int hashCode() + { + return name.hashCode(); + } + public boolean equals(Object o) + { + if (!(o instanceof StructStruct)) return false; + if (!name.equals(((StructStruct) o).name)) return false; + return true; + } + public String toString() + { + return "<"+name+", "+pack+">"; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusException.java new file mode 100755 index 0000000..15f46d0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusException.java @@ -0,0 +1,26 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +/** + * An exception within DBus. + */ +@SuppressWarnings("serial") +public class DBusException extends Exception +{ + /** + * Create an exception with the specified message + */ + public DBusException(String message) + { + super(message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusExecutionException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusExecutionException.java new file mode 100755 index 0000000..7dd54fd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/DBusExecutionException.java @@ -0,0 +1,40 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +/** + * An exception while running a remote method within DBus. + */ +@SuppressWarnings("serial") +public class DBusExecutionException extends RuntimeException +{ + private String type; + /** + * Create an exception with the specified message + */ + public DBusExecutionException(String message) + { + super(message); + } + public void setType(String type) + { + this.type = type; + } + /** + * Get the DBus type of this exception. Use if this + * was an exception we don't have a class file for. + */ + public String getType() + { + if (null == type) return getClass().getName(); + else return type; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalDBusException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalDBusException.java new file mode 100755 index 0000000..6f8d401 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalDBusException.java @@ -0,0 +1,20 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +@SuppressWarnings("serial") +public class FatalDBusException extends DBusException implements FatalException +{ + public FatalDBusException(String message) + { + super(message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalException.java new file mode 100755 index 0000000..d69efa5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/FatalException.java @@ -0,0 +1,15 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +public interface FatalException +{ +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/InternalMessageException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/InternalMessageException.java new file mode 100755 index 0000000..4113bca --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/InternalMessageException.java @@ -0,0 +1,20 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +@SuppressWarnings("serial") +public class InternalMessageException extends DBusExecutionException implements NonFatalException +{ + public InternalMessageException(String message) + { + super (message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MarshallingException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MarshallingException.java new file mode 100755 index 0000000..cf60d3b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MarshallingException.java @@ -0,0 +1,20 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +@SuppressWarnings("serial") +public class MarshallingException extends DBusException implements NonFatalException +{ + public MarshallingException(String message) + { + super(message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageFormatException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageFormatException.java new file mode 100755 index 0000000..b7efcf7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageFormatException.java @@ -0,0 +1,23 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +/** + * Thrown if a message is formatted incorrectly. + */ +@SuppressWarnings("serial") +public class MessageFormatException extends DBusException implements NonFatalException +{ + public MessageFormatException(String message) + { + super (message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageProtocolVersionException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageProtocolVersionException.java new file mode 100755 index 0000000..9f6e44e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageProtocolVersionException.java @@ -0,0 +1,22 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +import java.io.IOException; + +@SuppressWarnings("serial") +public class MessageProtocolVersionException extends IOException implements FatalException +{ + public MessageProtocolVersionException(String message) + { + super(message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageTypeException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageTypeException.java new file mode 100755 index 0000000..b36f30e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/MessageTypeException.java @@ -0,0 +1,22 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +import java.io.IOException; + +@SuppressWarnings("serial") +public class MessageTypeException extends IOException implements NonFatalException +{ + public MessageTypeException(String message) + { + super(message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NonFatalException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NonFatalException.java new file mode 100755 index 0000000..dc565f2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NonFatalException.java @@ -0,0 +1,15 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +public interface NonFatalException +{ +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NotConnected.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NotConnected.java new file mode 100755 index 0000000..71b8d44 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/NotConnected.java @@ -0,0 +1,23 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; + +/** + * Thrown if a DBus action is called when not connected to the Bus. + */ +@SuppressWarnings("serial") +public class NotConnected extends DBusExecutionException implements FatalException +{ + public NotConnected(String message) + { + super (message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/UnknownTypeCodeException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/UnknownTypeCodeException.java new file mode 100755 index 0000000..9441e70 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/exceptions/UnknownTypeCodeException.java @@ -0,0 +1,21 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.exceptions; +import static org.freedesktop.dbus.Gettext._; + +@SuppressWarnings("serial") +public class UnknownTypeCodeException extends DBusException implements NonFatalException +{ + public UnknownTypeCodeException(byte code) + { + super(_("Not a valid D-Bus type code: ") + code); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfileStruct.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfileStruct.java new file mode 100755 index 0000000..9fa963b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfileStruct.java @@ -0,0 +1,32 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.UInt32; + +public final class ProfileStruct extends Struct +{ + @Position(0) + public final String a; + @Position(1) + public final UInt32 b; + @Position(2) + public final long c; + + public ProfileStruct(String a, UInt32 b, long c) + { + this.a = a; + this.b = b; + this.c = c; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/Profiler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/Profiler.java new file mode 100755 index 0000000..efe9ab2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/Profiler.java @@ -0,0 +1,40 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.DBus.Method.NoReply; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; +import java.util.List; +import java.util.Map; + +public interface Profiler extends DBusInterface +{ + public class ProfileSignal extends DBusSignal + { + public ProfileSignal(String path) throws DBusException + { + super(path); + } + } + public void array(int[] v); + public void stringarray(String[] v); + public void map(Map m); + public void list(List l); + public void bytes(byte[] b); + public void struct(ProfileStruct ps); + public void string(String s); + public void NoReply(); + public void Pong(); +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfilerInstance.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfilerInstance.java new file mode 100755 index 0000000..b99d1b7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/ProfilerInstance.java @@ -0,0 +1,28 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.util.List; +import java.util.Map; + +public class ProfilerInstance implements Profiler +{ + public boolean isRemote() { return false; } + public void array(int[] v) { return; } + public void stringarray(String[] v) { return; } + public void map(Map m) { return; } + public void list(List l) { return; } + public void bytes(byte[] b) { return; } + public void struct(ProfileStruct ps) { return; } + public void string(String s) { return; } + public void NoReply() { return; } + public void Pong() { return; } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestException.java new file mode 100755 index 0000000..2314ec3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestException.java @@ -0,0 +1,24 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.DBus.Description; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +@Description("A test exception to throw over DBus") +@SuppressWarnings("serial") +public class TestException extends DBusExecutionException +{ + public TestException(String message) + { + super (message); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestNewInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestNewInterface.java new file mode 100755 index 0000000..4199403 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestNewInterface.java @@ -0,0 +1,26 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.DBus.Description; + +/** + * A sample remote interface which exports one method. + */ +public interface TestNewInterface extends DBusInterface +{ + /** + * A simple method with no parameters which returns a String + */ + @Description("Simple test method") + public String getName(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface.java new file mode 100755 index 0000000..a24ef43 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface.java @@ -0,0 +1,57 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.Path; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.DBus.Description; +import org.freedesktop.DBus.Method; + +import java.lang.reflect.Type; + +import java.util.Map; +import java.util.List; +/** + * A sample remote interface which exports one method. + */ +public interface TestRemoteInterface extends DBusInterface +{ + /** + * A simple method with no parameters which returns a String + */ + @Description("Simple test method") + public String getName(); + public String getNameAndThrow(); + @Description("Test of nested maps") + public int frobnicate(List n, Map> m, T v); + @Description("Throws a TestException when called") + public void throwme() throws TestException; + @Description("Waits then doesn't return") + @Method.NoReply() + public void waitawhile(); + @Description("Interface-overloaded method") + public int overload(); + @Description("Testing Type Signatures") + public void sig(Type[] s); + @Description("Testing object paths as Path objects") + public void newpathtest(Path p); + @Description("Testing the float type") + public float testfloat(float[] f); + @Description("Testing structs of structs") + public int[][] teststructstruct(TestStruct3 in); + @Description("Regression test for #13291") + public void reg13291(byte[] as, byte[] bs); + /* test lots of things involving Path */ + public Path pathrv(Path a); + public List pathlistrv(List a); + public Map pathmaprv(Map a); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface2.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface2.java new file mode 100755 index 0000000..a44d627 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestRemoteInterface2.java @@ -0,0 +1,54 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusInterfaceName; +import org.freedesktop.dbus.DBusMemberName; +import org.freedesktop.dbus.Variant; +import org.freedesktop.DBus.Description; + +import java.util.List; + +@Description("An example remote interface") +@DBusInterfaceName("org.freedesktop.dbus.test.AlternateTestInterface") +public interface TestRemoteInterface2 extends DBusInterface +{ + @Description("Test multiple return values and implicit variant parameters.") + public TestTuple,Boolean> show(A in); + @Description("Test passing structs and explicit variants, returning implicit variants") + public T dostuff(TestStruct foo); + @Description("Test arrays, boxed arrays and lists.") + public List sampleArray(List l, Integer[] is, long[] ls); + @Description("Test passing objects as object paths.") + public DBusInterface getThis(DBusInterface t); + @Description("Test bools work") + @DBusMemberName("checkbool") + public boolean check(); + @Description("Test Serializable Object") + public TestSerializable testSerializable(byte b, TestSerializable s, int i); + @Description("Call another method on itself from within a call") + public String recursionTest(); + @Description("Parameter-overloaded method (string)") + public int overload(String s); + @Description("Parameter-overloaded method (byte)") + public int overload(byte b); + @Description("Parameter-overloaded method (void)") + public int overload(); + @Description("Nested List Check") + public List> checklist(List> lli); + @Description("Get new objects as object paths.") + public TestNewInterface getNew(); + @Description("Test Complex Variants") + public void complexv(Variant v); + @Description("Test Introspect on a different interface") + public String Introspect(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSerializable.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSerializable.java new file mode 100755 index 0000000..8014299 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSerializable.java @@ -0,0 +1,48 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.util.List; +import java.util.Vector; + +import org.freedesktop.dbus.DBusSerializable; +import org.freedesktop.dbus.exceptions.DBusException; + +public class TestSerializable implements DBusSerializable +{ + private int a; + private String b; + private Vector c; + public TestSerializable(int a, A b, Vector c) + { + this.a = a; + this.b = b.toString(); + this.c = c; + } + public TestSerializable() {} + public void deserialize(int a, String b, List c) + { + this.a = a; + this.b = b; + this.c = new Vector(c); + } + public Object[] serialize() throws DBusException + { + return new Object[] { a, b, c }; + } + public int getInt() { return a; } + public String getString() { return b; } + public Vector getVector() { return c; } + public String toString() + { + return "TestSerializable{"+a+","+b+","+c+"}"; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface.java new file mode 100755 index 0000000..406ce36 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface.java @@ -0,0 +1,97 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.DBus.Description; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusMemberName; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.Path; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; + +import java.util.List; +import java.util.Map; + +/** + * A sample signal with two parameters + */ +@Description("Test interface containing signals") +public interface TestSignalInterface extends DBusInterface +{ + @Description("Test basic signal") + public static class TestSignal extends DBusSignal + { + public final String value; + public final UInt32 number; + /** + * Create a signal. + */ + public TestSignal(String path, String value, UInt32 number) throws DBusException + { + super(path, value, number); + this.value = value; + this.number = number; + } + } + public static class StringSignal extends DBusSignal + { + public final String aoeu; + public StringSignal(String path, String aoeu) throws DBusException + { + super(path, aoeu); + this.aoeu = aoeu; + } + } + public static class EmptySignal extends DBusSignal + { + public EmptySignal(String path) throws DBusException + { + super(path); + } + } + @Description("Test signal with arrays") + public static class TestArraySignal extends DBusSignal + { + public final List v; + public final Map m; + public TestArraySignal(String path, List v, Map m) throws DBusException + { + super(path, v, m); + this.v = v; + this.m = m; + } + } + @Description("Test signal sending an object path") + @DBusMemberName("TestSignalObject") + public static class TestObjectSignal extends DBusSignal + { + public final DBusInterface otherpath; + public TestObjectSignal(String path, DBusInterface otherpath) throws DBusException + { + super(path, otherpath); + this.otherpath = otherpath; + } + } + public static class TestPathSignal extends DBusSignal + { + public final Path otherpath; + public final List pathlist; + public final Map pathmap; + public TestPathSignal(String path, Path otherpath, List pathlist, Map pathmap) throws DBusException + { + super(path, otherpath, pathlist, pathmap); + this.otherpath = otherpath; + this.pathlist = pathlist; + this.pathmap = pathmap; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface2.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface2.java new file mode 100755 index 0000000..d5c9ac5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestSignalInterface2.java @@ -0,0 +1,45 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.DBus.Description; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusInterfaceName; +import org.freedesktop.dbus.DBusMemberName; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; + +import java.util.List; + +/** + * A sample signal with two parameters + */ +@Description("Test interface containing signals") +@DBusInterfaceName("some.other.interface.Name") +public interface TestSignalInterface2 extends DBusInterface +{ + @Description("Test basic signal") + public static class TestRenamedSignal extends DBusSignal + { + public final String value; + public final UInt32 number; + /** + * Create a signal. + */ + public TestRenamedSignal(String path, String value, UInt32 number) throws DBusException + { + super(path, value, number); + this.value = value; + this.number = number; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct.java new file mode 100755 index 0000000..ca5deac --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct.java @@ -0,0 +1,32 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.Variant; + +public final class TestStruct extends Struct +{ + @Position(0) + public final String a; + @Position(1) + public final UInt32 b; + @Position(2) + public final Variant c; + public TestStruct(String a, UInt32 b, Variant c) + { + this.a = a; + this.b = b; + this.c = c; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct2.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct2.java new file mode 100755 index 0000000..5c8797b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct2.java @@ -0,0 +1,31 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.Variant; +import org.freedesktop.dbus.exceptions.DBusException; + +import java.util.List; + +public final class TestStruct2 extends Struct +{ + @Position(0) + public final List a; + @Position(1) + public final Variant b; + public TestStruct2(List a, Variant b) throws DBusException + { + this.a = a; + this.b = b; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct3.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct3.java new file mode 100755 index 0000000..52edbe0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestStruct3.java @@ -0,0 +1,30 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.exceptions.DBusException; + +import java.util.List; + +public final class TestStruct3 extends Struct +{ + @Position(0) + public final TestStruct2 a; + @Position(1) + public final List> b; + public TestStruct3(TestStruct2 a, List> b) throws DBusException + { + this.a = a; + this.b = b; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestTuple.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestTuple.java new file mode 100755 index 0000000..1cf507a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TestTuple.java @@ -0,0 +1,30 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.Position; +import org.freedesktop.dbus.Tuple; + +public final class TestTuple extends Tuple +{ + @Position(0) + public final A a; + @Position(1) + public final B b; + @Position(2) + public final C c; + public TestTuple(A a, B b, C c) + { + this.a = a; + this.b = b; + this.c = c; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartInterface.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartInterface.java new file mode 100755 index 0000000..af214cf --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartInterface.java @@ -0,0 +1,29 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.exceptions.DBusException; + +public interface TwoPartInterface extends DBusInterface +{ + public TwoPartObject getNew(); + public class TwoPartSignal extends DBusSignal + { + public final TwoPartObject o; + public TwoPartSignal(String path, TwoPartObject o) throws DBusException + { + super (path, o); + this.o = o; + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartObject.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartObject.java new file mode 100755 index 0000000..3c7237b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/TwoPartObject.java @@ -0,0 +1,18 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusInterface; + +public interface TwoPartObject extends DBusInterface +{ + public String getName(); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_client.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_client.java new file mode 100755 index 0000000..af0d053 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_client.java @@ -0,0 +1,512 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.lang.reflect.Array; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.Struct; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.UInt64; +import org.freedesktop.dbus.Variant; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.types.DBusMapType; + +import cx.ath.matthew.debug.Debug; + +public class cross_test_client implements DBus.Binding.TestClient, DBusSigHandler +{ + private DBusConnection conn; + private static Set passed = new TreeSet(); + private static Map> failed = new HashMap>(); + private static cross_test_client ctc; + static { + List l = new Vector(); + l.add("Signal never arrived"); + failed.put("org.freedesktop.DBus.Binding.TestSignals.Triggered", l); + l = new Vector(); + l.add("Method never called"); + failed.put("org.freedesktop.DBus.Binding.TestClient.Response", l); + } + public cross_test_client(DBusConnection conn) + { + this.conn = conn; + } + public boolean isRemote() { return false; } + public void handle(DBus.Binding.TestSignals.Triggered t) + { + failed.remove("org.freedesktop.DBus.Binding.TestSignals.Triggered"); + if (new UInt64(21389479283L).equals(t.a) && "/Test".equals(t.getPath())) + pass("org.freedesktop.DBus.Binding.TestSignals.Triggered"); + else if (!new UInt64(21389479283L).equals(t.a)) + fail("org.freedesktop.DBus.Binding.TestSignals.Triggered", "Incorrect signal content; expected 21389479283 got "+t.a); + else if (!"/Test".equals(t.getPath())) + fail("org.freedesktop.DBus.Binding.TestSignals.Triggered", "Incorrect signal source object; expected /Test got "+t.getPath()); + } + public void Response(UInt16 a, double b) + { + failed.remove("org.freedesktop.DBus.Binding.TestClient.Response"); + if (a.equals(new UInt16(15)) && (b == 12.5)) + pass("org.freedesktop.DBus.Binding.TestClient.Response"); + else + fail("org.freedesktop.DBus.Binding.TestClient.Response", "Incorrect parameters; expected 15, 12.5 got "+a+", "+b); + } + public static void pass(String test) + { + passed.add(test.replaceAll("[$]", ".")); + } + public static void fail(String test, String reason) + { + test = test.replaceAll("[$]", "."); + List reasons = failed.get(test); + if (null == reasons) { + reasons = new Vector(); + failed.put(test, reasons); + } + reasons.add(reason); + } + @SuppressWarnings("unchecked") + public static void test(Class iface, Object proxy, String method, Object rv, Object... parameters) + { + try { + Method[] ms = iface.getMethods(); + Method m = null; + for (Method t: ms) { + if (t.getName().equals(method)) + m = t; + } + Object o = m.invoke(proxy, parameters); + + String msg = "Incorrect return value; sent ( "; + if (null != parameters) + for (Object po: parameters) + if (null != po) + msg += collapseArray(po) + ","; + msg = msg.replaceAll(".$",");"); + msg += " expected "+collapseArray(rv)+" got "+collapseArray(o); + + if (null != rv && rv.getClass().isArray()) { + compareArray(iface.getName()+"."+method, rv,o); + } else if (rv instanceof Map) { + if (o instanceof Map) { + Map a = (Map) o; + Map b = (Map) rv; + if (a.keySet().size() != b.keySet().size()) { + fail(iface.getName()+"."+method, msg); + } else for (Object k: a.keySet()) + if (a.get(k) instanceof List) { + if (b.get(k) instanceof List) + if (setCompareLists((List) a.get(k), (List) b.get(k))) + ; + else + fail(iface.getName()+"."+method, msg); + else + fail(iface.getName()+"."+method, msg); + } else if (!a.get(k).equals(b.get(k))) { + fail(iface.getName()+"."+method, msg); + return; + } + pass(iface.getName()+"."+method); + } else + fail(iface.getName()+"."+method, msg); + } else { + if (o == rv || (o != null && o.equals(rv))) + pass(iface.getName()+"."+method); + else + fail(iface.getName()+"."+method, msg); + } + } catch (DBusExecutionException DBEe) { + DBEe.printStackTrace(); + fail(iface.getName()+"."+method, "Error occurred during execution: "+DBEe.getClass().getName()+" "+DBEe.getMessage()); + } catch (InvocationTargetException ITe) { + ITe.printStackTrace(); + fail(iface.getName()+"."+method, "Error occurred during execution: "+ITe.getCause().getClass().getName()+" "+ITe.getCause().getMessage()); + } catch (Exception e) { + e.printStackTrace(); + fail(iface.getName()+"."+method, "Error occurred during execution: "+e.getClass().getName()+" "+e.getMessage()); + } + } + @SuppressWarnings("unchecked") + public static String collapseArray(Object array) + { + if (null == array) return "null"; + if (array.getClass().isArray()) { + String s = "{ "; + for (int i = 0; i < Array.getLength(array); i++) + s += collapseArray(Array.get(array, i))+","; + s = s.replaceAll(".$"," }"); + return s; + } else if (array instanceof List) { + String s = "{ "; + for (Object o: (List) array) + s += collapseArray(o)+","; + s = s.replaceAll(".$"," }"); + return s; + } else if (array instanceof Map) { + String s = "{ "; + for (Object o: ((Map) array).keySet()) + s += collapseArray(o)+" => "+collapseArray(((Map) array).get(o))+","; + s = s.replaceAll(".$"," }"); + return s; + } else return array.toString(); + } + public static boolean setCompareLists(List a, List b) + { + if (a.size() != b.size()) return false; + for (Object v: a) + if (!b.contains(v)) return false; + return true; + } + @SuppressWarnings("unchecked") + public static List> PrimitizeRecurse(Object a, Type t) + { + List> vs = new Vector>(); + if (t instanceof ParameterizedType) { + Class c = (Class) ((ParameterizedType) t).getRawType(); + if (List.class.isAssignableFrom(c)) { + Object os; + if (a instanceof List) + os = ((List) a).toArray(); + else + os = a; + Type[] ts = ((ParameterizedType) t).getActualTypeArguments(); + for (int i = 0; i < Array.getLength(os); i++) + vs.addAll(PrimitizeRecurse(Array.get(os, i), ts[0])); + } else if (Map.class.isAssignableFrom(c)) { + Object[] os = ((Map) a).keySet().toArray(); + Object[] ks = ((Map) a).values().toArray(); + Type[] ts = ((ParameterizedType) t).getActualTypeArguments(); + for (int i = 0; i < ks.length; i++) + vs.addAll(PrimitizeRecurse(ks[i], ts[0])); + for (int i = 0; i < os.length; i++) + vs.addAll(PrimitizeRecurse(os[i], ts[1])); + } else if (Struct.class.isAssignableFrom(c)) { + Object[] os = ((Struct) a).getParameters(); + Type[] ts = ((ParameterizedType) t).getActualTypeArguments(); + for (int i = 0; i < os.length; i++) + vs.addAll(PrimitizeRecurse(os[i], ts[i])); + + } else if (Variant.class.isAssignableFrom(c)) { + vs.addAll(PrimitizeRecurse(((Variant) a).getValue(), ((Variant) a).getType())); + } + } else if (Variant.class.isAssignableFrom((Class) t)) + vs.addAll(PrimitizeRecurse(((Variant) a).getValue(), ((Variant) a).getType())); + else if (t instanceof Class && ((Class) t).isArray()) { + Type t2 = ((Class) t).getComponentType(); + for (int i = 0; i < Array.getLength(a); i++) + vs.addAll(PrimitizeRecurse(Array.get(a, i), t2)); + } + else vs.add(new Variant(a)); + + return vs; + } + + @SuppressWarnings("unchecked") + public static List> Primitize(Variant a) + { + return PrimitizeRecurse(a.getValue(), a.getType()); + } + + @SuppressWarnings("unchecked") + public static void primitizeTest(DBus.Binding.Tests tests, Object input) + { + Variant in = new Variant(input); + List> vs = Primitize(in); + List> res; + + try { + + res = tests.Primitize(in); + if (setCompareLists(res, vs)) + pass("org.freedesktop.DBus.Binding.Tests.Primitize"); + else + fail("org.freedesktop.DBus.Binding.Tests.Primitize", "Wrong Return Value; expected "+collapseArray(vs)+" got "+collapseArray(res)); + + } catch (Exception e) { + if (Debug.debug) Debug.print(e); + fail("org.freedesktop.DBus.Binding.Tests.Primitize", "Exception occurred during test: ("+e.getClass().getName()+") "+e.getMessage()); + } + } + public static void doTests(DBus.Peer peer, DBus.Introspectable intro, DBus.Introspectable rootintro, DBus.Binding.Tests tests, DBus.Binding.SingleTests singletests) + { + Random r = new Random(); + int i; + test(DBus.Peer.class, peer, "Ping", null); + + try { if (intro.Introspect().startsWith("(new Integer(1)), new Variant(new Integer(1))); + test(DBus.Binding.Tests.class, tests, "Identity", new Variant("Hello"), new Variant("Hello")); + + test(DBus.Binding.Tests.class, tests, "IdentityBool", false, false); + test(DBus.Binding.Tests.class, tests, "IdentityBool", true, true); + + test(DBus.Binding.Tests.class, tests, "Invert", false, true); + test(DBus.Binding.Tests.class, tests, "Invert", true, false); + + test(DBus.Binding.Tests.class, tests, "IdentityByte", (byte) 0, (byte) 0); + test(DBus.Binding.Tests.class, tests, "IdentityByte", (byte) 1, (byte) 1); + test(DBus.Binding.Tests.class, tests, "IdentityByte", (byte) -1, (byte) -1); + test(DBus.Binding.Tests.class, tests, "IdentityByte", Byte.MAX_VALUE, Byte.MAX_VALUE); + test(DBus.Binding.Tests.class, tests, "IdentityByte", Byte.MIN_VALUE, Byte.MIN_VALUE); + i = r.nextInt(); + test(DBus.Binding.Tests.class, tests, "IdentityByte", (byte) i, (byte) i); + + test(DBus.Binding.Tests.class, tests, "IdentityInt16", (short) 0, (short) 0); + test(DBus.Binding.Tests.class, tests, "IdentityInt16", (short) 1, (short) 1); + test(DBus.Binding.Tests.class, tests, "IdentityInt16", (short) -1, (short) -1); + test(DBus.Binding.Tests.class, tests, "IdentityInt16", Short.MAX_VALUE, Short.MAX_VALUE); + test(DBus.Binding.Tests.class, tests, "IdentityInt16", Short.MIN_VALUE, Short.MIN_VALUE); + i = r.nextInt(); + test(DBus.Binding.Tests.class, tests, "IdentityInt16", (short) i, (short) i); + + test(DBus.Binding.Tests.class, tests, "IdentityInt32", 0, 0); + test(DBus.Binding.Tests.class, tests, "IdentityInt32", 1, 1); + test(DBus.Binding.Tests.class, tests, "IdentityInt32", -1, -1); + test(DBus.Binding.Tests.class, tests, "IdentityInt32", Integer.MAX_VALUE, Integer.MAX_VALUE); + test(DBus.Binding.Tests.class, tests, "IdentityInt32", Integer.MIN_VALUE, Integer.MIN_VALUE); + i = r.nextInt(); + test(DBus.Binding.Tests.class, tests, "IdentityInt32", i, i); + + + test(DBus.Binding.Tests.class, tests, "IdentityInt64", (long) 0, (long) 0); + test(DBus.Binding.Tests.class, tests, "IdentityInt64", (long) 1, (long) 1); + test(DBus.Binding.Tests.class, tests, "IdentityInt64", (long) -1, (long) -1); + test(DBus.Binding.Tests.class, tests, "IdentityInt64", Long.MAX_VALUE, Long.MAX_VALUE); + test(DBus.Binding.Tests.class, tests, "IdentityInt64", Long.MIN_VALUE, Long.MIN_VALUE); + i = r.nextInt(); + test(DBus.Binding.Tests.class, tests, "IdentityInt64", (long) i, (long) i); + + test(DBus.Binding.Tests.class, tests, "IdentityUInt16", new UInt16(0), new UInt16(0)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt16", new UInt16(1), new UInt16(1)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt16", new UInt16(UInt16.MAX_VALUE), new UInt16(UInt16.MAX_VALUE)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt16", new UInt16(UInt16.MIN_VALUE), new UInt16(UInt16.MIN_VALUE)); + i = r.nextInt(); + i = i > 0 ? i : -i; + test(DBus.Binding.Tests.class, tests, "IdentityUInt16", new UInt16(i%UInt16.MAX_VALUE), new UInt16(i%UInt16.MAX_VALUE)); + + test(DBus.Binding.Tests.class, tests, "IdentityUInt32", new UInt32(0), new UInt32(0)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt32", new UInt32(1), new UInt32(1)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt32", new UInt32(UInt32.MAX_VALUE), new UInt32(UInt32.MAX_VALUE)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt32", new UInt32(UInt32.MIN_VALUE), new UInt32(UInt32.MIN_VALUE)); + i = r.nextInt(); + i = i > 0 ? i : -i; + test(DBus.Binding.Tests.class, tests, "IdentityUInt32", new UInt32(i%UInt32.MAX_VALUE), new UInt32(i%UInt32.MAX_VALUE)); + + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(0), new UInt64(0)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(1), new UInt64(1)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(UInt64.MAX_LONG_VALUE), new UInt64(UInt64.MAX_LONG_VALUE)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(UInt64.MAX_BIG_VALUE), new UInt64(UInt64.MAX_BIG_VALUE)); + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(UInt64.MIN_VALUE), new UInt64(UInt64.MIN_VALUE)); + i = r.nextInt(); + i = i > 0 ? i : -i; + test(DBus.Binding.Tests.class, tests, "IdentityUInt64", new UInt64(i%UInt64.MAX_LONG_VALUE), new UInt64(i%UInt64.MAX_LONG_VALUE)); + + test(DBus.Binding.Tests.class, tests, "IdentityDouble", 0.0, 0.0); + test(DBus.Binding.Tests.class, tests, "IdentityDouble", 1.0, 1.0); + test(DBus.Binding.Tests.class, tests, "IdentityDouble", -1.0, -1.0); + test(DBus.Binding.Tests.class, tests, "IdentityDouble", Double.MAX_VALUE, Double.MAX_VALUE); + test(DBus.Binding.Tests.class, tests, "IdentityDouble", Double.MIN_VALUE, Double.MIN_VALUE); + i = r.nextInt(); + test(DBus.Binding.Tests.class, tests, "IdentityDouble", (double) i, (double) i); + + test(DBus.Binding.Tests.class, tests, "IdentityString", "", ""); + test(DBus.Binding.Tests.class, tests, "IdentityString", "The Quick Brown Fox Jumped Over The Lazy Dog", "The Quick Brown Fox Jumped Over The Lazy Dog"); + + testArray(DBus.Binding.Tests.class, tests, "IdentityBoolArray", Boolean.TYPE, null); + testArray(DBus.Binding.Tests.class, tests, "IdentityByteArray", Byte.TYPE, null); + testArray(DBus.Binding.Tests.class, tests, "IdentityInt16Array", Short.TYPE, null); + testArray(DBus.Binding.Tests.class, tests, "IdentityInt32Array", Integer.TYPE, null); + testArray(DBus.Binding.Tests.class, tests, "IdentityInt64Array", Long.TYPE, null); + testArray(DBus.Binding.Tests.class, tests, "IdentityDoubleArray", Double.TYPE, null); + + testArray(DBus.Binding.Tests.class, tests, "IdentityArray", Variant.class, new Variant("aoeu")); + testArray(DBus.Binding.Tests.class, tests, "IdentityUInt16Array", UInt16.class, new UInt16(12)); + testArray(DBus.Binding.Tests.class, tests, "IdentityUInt32Array", UInt32.class, new UInt32(190)); + testArray(DBus.Binding.Tests.class, tests, "IdentityUInt64Array", UInt64.class, new UInt64(103948)); + testArray(DBus.Binding.Tests.class, tests, "IdentityStringArray", String.class, "asdf"); + + int[] is = new int[0]; + test(DBus.Binding.Tests.class, tests, "Sum", 0L, is); + r = new Random(); + int len = (r.nextInt() % 100) + 15; + len = (len<0 ? -len: len)+15; + is = new int[len]; + long result = 0; + for (i = 0; i < len; i++) { + is[i] = r.nextInt(); + result += is[i]; + } + test(DBus.Binding.Tests.class, tests, "Sum", result, is); + + byte[] bs = new byte[0]; + test(DBus.Binding.SingleTests.class, singletests, "Sum", new UInt32(0), bs); + len = (r.nextInt() % 100); + len = (len<0 ? -len: len)+15; + bs = new byte[len]; + int res = 0; + for (i = 0; i < len; i++) { + bs[i] = (byte) r.nextInt(); + res += (bs[i] < 0 ? bs[i]+256 : bs[i]); + } + test(DBus.Binding.SingleTests.class, singletests, "Sum", new UInt32(res % (UInt32.MAX_VALUE+1)), bs); + + test(DBus.Binding.Tests.class, tests, "DeStruct", new DBus.Binding.Triplet("hi", new UInt32(12), new Short((short) 99)), new DBus.Binding.TestStruct("hi", new UInt32(12), new Short((short) 99))); + + Map in = new HashMap(); + Map> out = new HashMap>(); + test(DBus.Binding.Tests.class, tests, "InvertMapping", out, in); + + in.put("hi", "there"); + in.put("to", "there"); + in.put("from", "here"); + in.put("in", "out"); + List l = new Vector(); + l.add("hi"); + l.add("to"); + out.put("there", l); + l = new Vector(); + l.add("from"); + out.put("here", l); + l = new Vector(); + l.add("in"); + out.put("out", l); + test(DBus.Binding.Tests.class, tests, "InvertMapping", out, in); + + primitizeTest(tests, new Integer(1)); + primitizeTest(tests, + new Variant>>>( + new Variant>>( + new Variant>( + new Variant("Hi"))))); + primitizeTest(tests, new Variant>(in, new DBusMapType(String.class,String.class))); + + test(DBus.Binding.Tests.class, tests, "Trigger", null, "/Test", new UInt64(21389479283L)); + + try { + ctc.conn.sendSignal(new DBus.Binding.TestClient.Trigger("/Test", new UInt16(15), 12.5)); + } catch (DBusException DBe) { + if (Debug.debug) Debug.print(DBe); + throw new DBusExecutionException(DBe.getMessage()); + } + + try { Thread.sleep(10000); } catch (InterruptedException Ie) {} + + test(DBus.Binding.Tests.class, tests, "Exit", null); + } + public static void testArray(Class iface, Object proxy, String method, Class arrayType, Object content) + { + Object array = Array.newInstance(arrayType, 0); + test(iface, proxy, method, array, array); + Random r = new Random(); + int l = (r.nextInt() % 100); + array = Array.newInstance(arrayType, (l < 0 ? -l : l) + 15); + if (null != content) + Arrays.fill((Object[]) array, content); + test(iface, proxy, method, array, array); + } + public static void compareArray(String test, Object a, Object b) + { + if (!a.getClass().equals(b.getClass())) { + fail(test, "Incorrect return type; expected "+a.getClass()+" got "+b.getClass()); + return; + } + boolean pass = false; + + if (a instanceof Object[]) + pass = Arrays.equals((Object[]) a, (Object[]) b); + else if (a instanceof byte[]) + pass = Arrays.equals((byte[]) a, (byte[]) b); + else if (a instanceof boolean[]) + pass = Arrays.equals((boolean[]) a, (boolean[]) b); + else if (a instanceof int[]) + pass = Arrays.equals((int[]) a, (int[]) b); + else if (a instanceof short[]) + pass = Arrays.equals((short[]) a, (short[]) b); + else if (a instanceof long[]) + pass = Arrays.equals((long[]) a, (long[]) b); + else if (a instanceof double[]) + pass = Arrays.equals((double[]) a, (double[]) b); + + if (pass) + pass(test); + else { + String s = "Incorrect return value; expected "; + s += collapseArray(a); + s += " got "; + s += collapseArray(b); + fail(test, s); + } + } + + public static void main(String[] args) + { try { + /* init */ + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + ctc = new cross_test_client(conn); + conn.exportObject("/Test", ctc); + conn.addSigHandler(DBus.Binding.TestSignals.Triggered.class, ctc); + DBus.Binding.Tests tests = conn.getRemoteObject("org.freedesktop.DBus.Binding.TestServer", "/Test", DBus.Binding.Tests.class); + DBus.Binding.SingleTests singletests = conn.getRemoteObject("org.freedesktop.DBus.Binding.TestServer", "/Test", DBus.Binding.SingleTests.class); + DBus.Peer peer = conn.getRemoteObject("org.freedesktop.DBus.Binding.TestServer", "/Test", DBus.Peer.class); + DBus.Introspectable intro = conn.getRemoteObject("org.freedesktop.DBus.Binding.TestServer", "/Test", DBus.Introspectable.class); + + DBus.Introspectable rootintro = conn.getRemoteObject("org.freedesktop.DBus.Binding.TestServer", "/", DBus.Introspectable.class); + + doTests(peer, intro, rootintro, tests, singletests); + + /* report results */ + for (String s: passed) + System.out.println(s+" pass"); + int i = 1; + for (String s: failed.keySet()) + for (String r: failed.get(s)) { + System.out.println(s+" fail "+i); + System.out.println("report "+i+": "+r); + i++; + } + + conn.disconnect(); + } catch (DBusException DBe) { + DBe.printStackTrace(); + System.exit(1); + }} +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_server.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_server.java new file mode 100755 index 0000000..acfb2fa --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/cross_test_server.java @@ -0,0 +1,344 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeSet; +import java.util.Set; +import java.util.Vector; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.UInt64; +import org.freedesktop.dbus.Variant; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; + +public class cross_test_server implements DBus.Binding.Tests, DBus.Binding.SingleTests, DBusSigHandler +{ + private DBusConnection conn; + boolean run = true; + private Set done = new TreeSet(); + private Set notdone = new TreeSet(); + { + notdone.add("org.freedesktop.DBus.Binding.Tests.Identity"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityByte"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityBool"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt16"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt16"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt32"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt32"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt64"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt64"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityDouble"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityString"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityArray"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityByteArray"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityBoolArray"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt16Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt16Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt32Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt32Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityInt64Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt64Array"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityDoubleArray"); + notdone.add("org.freedesktop.DBus.Binding.Tests.IdentityStringArray"); + notdone.add("org.freedesktop.DBus.Binding.Tests.Sum"); + notdone.add("org.freedesktop.DBus.Binding.SingleTests.Sum"); + notdone.add("org.freedesktop.DBus.Binding.Tests.InvertMapping"); + notdone.add("org.freedesktop.DBus.Binding.Tests.DeStruct"); + notdone.add("org.freedesktop.DBus.Binding.Tests.Primitize"); + notdone.add("org.freedesktop.DBus.Binding.Tests.Invert"); + notdone.add("org.freedesktop.DBus.Binding.Tests.Trigger"); + notdone.add("org.freedesktop.DBus.Binding.Tests.Exit"); + notdone.add("org.freedesktop.DBus.Binding.TestClient.Trigger"); + } + + public cross_test_server(DBusConnection conn) + { + this.conn = conn; + } + public boolean isRemote() { return false; } + @SuppressWarnings("unchecked") + @DBus.Description("Returns whatever it is passed") + public Variant Identity(Variant input) + { + done.add("org.freedesktop.DBus.Binding.Tests.Identity"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Identity"); + return new Variant(input.getValue()); + } + @DBus.Description("Returns whatever it is passed") + public byte IdentityByte(byte input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityByte"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityByte"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public boolean IdentityBool(boolean input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityBool"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityBool"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public short IdentityInt16(short input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt16"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt16"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt16 IdentityUInt16(UInt16 input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt16"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt16"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public int IdentityInt32(int input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt32"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt32"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt32 IdentityUInt32(UInt32 input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt32"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt32"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public long IdentityInt64(long input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt64"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt64"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt64 IdentityUInt64(UInt64 input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt64"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt64"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public double IdentityDouble(double input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityDouble"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityDouble"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public String IdentityString(String input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityString"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityString"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public Variant[] IdentityArray(Variant[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityArray"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityArray"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public byte[] IdentityByteArray(byte[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityByteArray"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityByteArray"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public boolean[] IdentityBoolArray(boolean[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityBoolArray"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityBoolArray"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public short[] IdentityInt16Array(short[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt16Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt16Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt16[] IdentityUInt16Array(UInt16[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt16Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt16Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public int[] IdentityInt32Array(int[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt32Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt32Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt32[] IdentityUInt32Array(UInt32[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt32Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt32Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public long[] IdentityInt64Array(long[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityInt64Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityInt64Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public UInt64[] IdentityUInt64Array(UInt64[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityUInt64Array"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityUInt64Array"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public double[] IdentityDoubleArray(double[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityDoubleArray"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityDoubleArray"); + return input; + } + @DBus.Description("Returns whatever it is passed") + public String[] IdentityStringArray(String[] input) + { + done.add("org.freedesktop.DBus.Binding.Tests.IdentityStringArray"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.IdentityStringArray"); + return input; + } + @DBus.Description("Returns the sum of the values in the input list") + public long Sum(int[] a) + { + done.add("org.freedesktop.DBus.Binding.Tests.Sum"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Sum"); + long sum = 0; + for (int b: a) sum += b; + return sum; + } + @DBus.Description("Returns the sum of the values in the input list") + public UInt32 Sum(byte[] a) + { + done.add("org.freedesktop.DBus.Binding.SingleTests.Sum"); + notdone.remove("org.freedesktop.DBus.Binding.SingleTests.Sum"); + int sum = 0; + for (byte b: a) sum += (b < 0 ? b+256 : b); + return new UInt32(sum % (UInt32.MAX_VALUE+1)); + } + @DBus.Description("Given a map of A => B, should return a map of B => a list of all the As which mapped to B") + public Map> InvertMapping(Map a) + { + done.add("org.freedesktop.DBus.Binding.Tests.InvertMapping"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.InvertMapping"); + HashMap> m = new HashMap>(); + for (String s: a.keySet()) { + String b = a.get(s); + List l = m.get(b); + if (null == l) { + l = new Vector(); + m.put(b, l); + } + l.add(s); + } + return m; + } + @DBus.Description("This method returns the contents of a struct as separate values") + public DBus.Binding.Triplet DeStruct(DBus.Binding.TestStruct a) + { + done.add("org.freedesktop.DBus.Binding.Tests.DeStruct"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.DeStruct"); + return new DBus.Binding.Triplet(a.a, a.b, a.c); + } + @DBus.Description("Given any compound type as a variant, return all the primitive types recursively contained within as an array of variants") + @SuppressWarnings("unchecked") + public List> Primitize(Variant a) + { + done.add("org.freedesktop.DBus.Binding.Tests.Primitize"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Primitize"); + return cross_test_client.PrimitizeRecurse(a.getValue(), a.getType()); + } + @DBus.Description("inverts it's input") + public boolean Invert(boolean a) + { + done.add("org.freedesktop.DBus.Binding.Tests.Invert"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Invert"); + return !a; + } + @DBus.Description("triggers sending of a signal from the supplied object with the given parameter") + public void Trigger(String a, UInt64 b) + { + done.add("org.freedesktop.DBus.Binding.Tests.Trigger"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Trigger"); + try { + conn.sendSignal(new DBus.Binding.TestSignals.Triggered(a, b)); + } catch (DBusException DBe) { + throw new DBusExecutionException(DBe.getMessage()); + } + } + public void Exit() + { + done.add("org.freedesktop.DBus.Binding.Tests.Exit"); + notdone.remove("org.freedesktop.DBus.Binding.Tests.Exit"); + run = false; + synchronized (this) { + notifyAll(); + } + } + public void handle(DBus.Binding.TestClient.Trigger t) + { + done.add("org.freedesktop.DBus.Binding.TestClient.Trigger"); + notdone.remove("org.freedesktop.DBus.Binding.TestClient.Trigger"); + try { + DBus.Binding.TestClient cb = conn.getRemoteObject(t.getSource(), "/Test", DBus.Binding.TestClient.class); + cb.Response(t.a, t.b); + } catch (DBusException DBe) { + throw new DBusExecutionException(DBe.getMessage()); + } + } + + public static void main(String[] args) + { try { + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + conn.requestBusName("org.freedesktop.DBus.Binding.TestServer"); + cross_test_server cts = new cross_test_server(conn); + conn.addSigHandler(DBus.Binding.TestClient.Trigger.class, cts); + conn.exportObject("/Test", cts); + synchronized (cts) { + while (cts.run) { + try { + cts.wait(); + } catch (InterruptedException Ie) {} + } + } + for (String s: cts.done) + System.out.println(s+" ok"); + for (String s: cts.notdone) + System.out.println(s+" untested"); + conn.disconnect(); + System.exit(0); + } catch (DBusException DBe) { + DBe.printStackTrace(); + System.exit(1); + }} +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/profile.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/profile.java new file mode 100755 index 0000000..f998fa2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/profile.java @@ -0,0 +1,381 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.util.Random; +import java.util.HashMap; +import java.util.Vector; + +import org.freedesktop.DBus.Peer; +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.UInt32; + +class ProfileHandler implements DBusSigHandler +{ + public int c = 0; + public void handle(Profiler.ProfileSignal s) + { + if (0 == (c++%profile.SIGNAL_INNER)) System.out.print("-"); + } +} + +/** + * Profiling tests. + */ +public class profile +{ + public static final int SIGNAL_INNER = 100; + public static final int SIGNAL_OUTER = 100; + public static final int PING_INNER = 100; + public static final int PING_OUTER = 100; + public static final int BYTES = 2000000; + public static final int INTROSPECTION_OUTER = 100; + public static final int INTROSPECTION_INNER = 10; + public static final int STRUCT_OUTER = 100; + public static final int STRUCT_INNER = 10; + public static final int LIST_OUTER = 100; + public static final int LIST_INNER = 10; + public static final int LIST_LENGTH = 100; + public static final int MAP_OUTER = 100; + public static final int MAP_INNER = 10; + public static final int MAP_LENGTH = 100; + public static final int ARRAY_OUTER = 100; + public static final int ARRAY_INNER = 10; + public static final int ARRAY_LENGTH = 1000; + public static final int STRING_ARRAY_OUTER = 10; + public static final int STRING_ARRAY_INNER = 1; + public static final int STRING_ARRAY_LENGTH = 20000; + + public static class Log + { + private long last; + private int[] deltas; + private int current = 0; + public Log(int size) + { + deltas = new int[size]; + } + public void start() + { + last = System.currentTimeMillis(); + } + public void stop() + { + deltas[current] = (int) (System.currentTimeMillis()-last); + current++; + } + public double mean() + { + if (0 == current) return 0; + long sum = 0; + for (int i = 0; i < current; i++) + sum+=deltas[i]; + return sum /= current; + } + public long min() + { + int m = Integer.MAX_VALUE; + for (int i = 0; i < current; i++) + if (deltas[i] < m) m = deltas[i]; + return m; + } + public long max() + { + int m = 0; + for (int i = 0; i < current; i++) + if (deltas[i] > m) m = deltas[i]; + return m; + } + public double stddev() + { + double mean = mean(); + double sum = 0; + for (int i=0; i < current; i++) + sum += (deltas[i]-mean)*(deltas[i]-mean); + return Math.sqrt(sum / (current-1)); + } + } + public static void main(String[] args) + { + try { + if (0==args.length) { + System.out.println("You must specify a profile type."); + System.out.println("Syntax: profile "); + System.exit(1); + } + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + conn.requestBusName("org.freedesktop.DBus.java.profiler"); + if ("pings".equals(args[0])) { + int count = PING_INNER*PING_OUTER; + System.out.print("Sending "+count+" pings..."); + Peer p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < PING_OUTER; i++) { + for (int j = 0; j < PING_INNER; j++) { + l.start(); + p.Ping(); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("strings".equals(args[0])) { + int count = STRING_ARRAY_INNER*STRING_ARRAY_OUTER; + System.out.print("Sending array of "+STRING_ARRAY_LENGTH+" strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + String[] v = new String[STRING_ARRAY_LENGTH]; + Random r = new Random(); + for (int i = 0; i < STRING_ARRAY_LENGTH; i++) v[i] = ""+r.nextInt(); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < STRING_ARRAY_OUTER; i++) { + for (int j = 0; j < STRING_ARRAY_INNER; j++) { + l.start(); + p.stringarray(v); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("arrays".equals(args[0])) { + int count = ARRAY_INNER*ARRAY_OUTER; + System.out.print("Sending array of "+ARRAY_LENGTH+" ints "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + int[] v = new int[ARRAY_LENGTH]; + Random r = new Random(); + for (int i = 0; i < ARRAY_LENGTH; i++) v[i] = r.nextInt(); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < ARRAY_OUTER; i++) { + for (int j = 0; j < ARRAY_INNER; j++) { + l.start(); + p.array(v); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("maps".equals(args[0])) { + int count = MAP_INNER*MAP_OUTER; + System.out.print("Sending map of "+MAP_LENGTH+" string=>strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + HashMap m = new HashMap(); + for (int i = 0; i < MAP_LENGTH; i++) + m.put(""+i, "hello"); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < MAP_OUTER; i++) { + for (int j=0; j < MAP_INNER; j++) { + l.start(); + p.map(m); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("lists".equals(args[0])) { + int count = LIST_OUTER*LIST_INNER; + System.out.print("Sending list of "+LIST_LENGTH+" strings "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + Vector v = new Vector(); + for (int i = 0; i < LIST_LENGTH; i++) + v.add("hello "+i); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < LIST_OUTER; i++) { + for (int j=0; j < LIST_INNER; j++) { + l.start(); + p.list(v); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("structs".equals(args[0])) { + int count = STRUCT_OUTER*STRUCT_INNER; + System.out.print("Sending a struct "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + ProfileStruct ps = new ProfileStruct("hello", new UInt32(18), 500L); + Log l = new Log(count); + long t = System.currentTimeMillis(); + for (int i = 0; i < STRUCT_OUTER; i++) { + for (int j=0; j < STRUCT_INNER; j++) { + l.start(); + p.struct(ps); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + } else if ("introspect".equals(args[0])) { + int count = INTROSPECTION_OUTER*INTROSPECTION_INNER; + System.out.print("Recieving introspection data "+count+" times."); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Introspectable is = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Introspectable.class); + Log l = new Log(count); + long t = System.currentTimeMillis(); + String s = null; + for (int i = 0; i < INTROSPECTION_OUTER; i++) { + for (int j = 0; j < INTROSPECTION_INNER; j++) { + l.start(); + s = is.Introspect(); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + System.out.println("Introspect data: "+s); + } else if ("bytes".equals(args[0])) { + System.out.print("Sending "+BYTES+" bytes"); + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + byte[] bs = new byte[BYTES]; + for (int i = 0; i < BYTES; i++) + bs[i] = (byte) i; + long t = System.currentTimeMillis(); + p.bytes(bs); + System.out.println(" done in "+(System.currentTimeMillis()-t)+"ms."); + } else if ("rate".equals(args[0])) { + ProfilerInstance pi = new ProfilerInstance(); + conn.exportObject("/Profiler", pi); + Profiler p = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Profiler.class); + Peer peer = conn.getRemoteObject("org.freedesktop.DBus.java.profiler", "/Profiler", Peer.class); + conn.changeThreadCount((byte)1); + + long start = System.currentTimeMillis(); + int count = 0; + do { + p.Pong(); + count++; + } while(count < 10000); + long end = System.currentTimeMillis(); + System.out.println("No payload: "+((count*1000)/(end-start))+" RT/second"); + start = System.currentTimeMillis(); + count = 0; + do { + p.Pong(); + count++; + } while(count < 10000); + peer.Ping(); + end = System.currentTimeMillis(); + System.out.println("No payload, One way: "+((count*1000)/(end-start))+" /second"); + int len = 256; + while (len <= 32768) { + byte[] bs = new byte[len]; + count = 0; + start = System.currentTimeMillis(); + do { + p.bytes(bs); + count++; + } while(count < 1000); + end = System.currentTimeMillis(); + long ms = end-start; + double cps = (count*1000)/ms; + double rate = (len*cps)/(1024.0*1024.0); + System.out.println(len+" byte array) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); + len <<= 1; + } + len = 256; + while (len <= 32768) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < len; i++) sb.append('a'); + String s = sb.toString(); + end = System.currentTimeMillis()+500; + count = 0; + do { + p.string(s); + count++; + } while(count < 1000); + long ms = end-start; + double cps = (count*1000)/ms; + double rate = (len*cps)/(1024.0*1024.0); + System.out.println(len+" string) "+(count*len)+" bytes in "+ms+"ms (in "+count+" calls / "+(int)cps+" CPS): "+rate+"MB/s"); + len <<= 1; + } + } else if ("signals".equals(args[0])) { + int count = SIGNAL_OUTER*SIGNAL_INNER; + System.out.print("Sending "+count+" signals"); + ProfileHandler ph = new ProfileHandler(); + conn.addSigHandler(Profiler.ProfileSignal.class, ph); + Log l = new Log(count); + Profiler.ProfileSignal ps = new Profiler.ProfileSignal("/"); + long t = System.currentTimeMillis(); + for (int i = 0; i < SIGNAL_OUTER; i++) { + for (int j = 0; j < SIGNAL_INNER; j++) { + l.start(); + conn.sendSignal(ps); + l.stop(); + } + System.out.print("."); + } + t = System.currentTimeMillis()-t; + System.out.println(" done."); + System.out.println("min/max/avg (ms): "+l.min()+"/"+l.max()+"/"+l.mean()); + System.out.println("deviation: "+l.stddev()); + System.out.println("Total time: "+t+"ms"); + while (ph.c < count) try { Thread.sleep(100); } + catch (InterruptedException Ie) {}; + } else { + conn.disconnect(); + System.out.println("Invalid profile ``"+args[0]+"''."); + System.out.println("Syntax: profile "); + System.exit(1); + } + conn.disconnect(); + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test.java new file mode 100755 index 0000000..4ccd696 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test.java @@ -0,0 +1,965 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import java.text.Collator; + +import org.freedesktop.dbus.CallbackHandler; +import org.freedesktop.dbus.DBusAsyncReply; +import org.freedesktop.dbus.DBusCallInfo; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusInterface; +import org.freedesktop.dbus.DBusSigHandler; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.Marshalling; +import org.freedesktop.dbus.Path; +import org.freedesktop.dbus.UInt16; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.UInt64; +import org.freedesktop.dbus.Variant; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.freedesktop.dbus.exceptions.NotConnected; + +import org.freedesktop.DBus; +import org.freedesktop.DBus.Error.MatchRuleInvalid; +import org.freedesktop.DBus.Error.ServiceUnknown; +import org.freedesktop.DBus.Error.UnknownObject; +import org.freedesktop.DBus.Peer; +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.DBus.Properties; + +class testnewclass implements TestNewInterface +{ + public boolean isRemote() { return false; } + public String getName() + { + return toString(); + } +} + +class testclass implements TestRemoteInterface, TestRemoteInterface2, TestSignalInterface, TestSignalInterface2, Properties +{ + private DBusConnection conn; + public testclass(DBusConnection conn) + { + this.conn = conn; + } + public String Introspect() + { + return "Not XML"; + } + public int[][] teststructstruct(TestStruct3 in) + { + List> lli = in.b; + int[][] out = new int[lli.size()][]; + for (int j = 0; j < out.length; j++) { + out[j] = new int[lli.get(j).size()]; + for (int k = 0; k < out[j].length; k++) + out[j][k] = lli.get(j).get(k); + } + return out; + } + public float testfloat(float[] f) + { + if (f.length < 4 || + f[0] != 17.093f || + f[1] != -23f || + f[2] != 0.0f || + f[3] != 31.42f) + test.fail("testfloat got incorrect array"); + return f[0]; + } + public void newpathtest(Path p) + { + if (!p.toString().equals("/new/path/test")) + test.fail("new path test got wrong path"); + } + public void waitawhile() + { + System.out.println("Sleeping."); + try { + Thread.sleep(1000); + } catch (InterruptedException Ie) {} + System.out.println("Done sleeping."); + } + public TestTuple, Boolean> show(A in) + { + System.out.println("Showing Stuff: "+in.getClass()+"("+in+")"); + if (!(in instanceof Integer) || ((Integer) in).intValue() != 234) + test.fail("show received the wrong arguments"); + DBusCallInfo info = DBusConnection.getCallInfo(); + List l = new Vector(); + l.add(1953); + return new TestTuple, Boolean>(info.getSource(), l, true); + } + @SuppressWarnings("unchecked") + public T dostuff(TestStruct foo) + { + System.out.println("Doing Stuff "+foo); + System.out.println(" -- ("+foo.a.getClass()+", "+foo.b.getClass()+", "+foo.c.getClass()+")"); + if (!(foo instanceof TestStruct) || + !(foo.a instanceof String) || + !(foo.b instanceof UInt32) || + !(foo.c instanceof Variant) || + !"bar".equals(foo.a) || + foo.b.intValue() != 52 || + !(foo.c.getValue() instanceof Boolean) || + ((Boolean) foo.c.getValue()).booleanValue() != true) + test.fail("dostuff received the wrong arguments"); + return (T) foo.c.getValue(); + } + /** Local classes MUST implement this to return false */ + public boolean isRemote() { return false; } + /** The method we are exporting to the Bus. */ + public List sampleArray(List ss, Integer[] is, long[] ls) + { + System.out.println("Got an array:"); + for (String s: ss) + System.out.println("--"+s); + if (ss.size()!= 5 || + !"hi".equals(ss.get(0)) || + !"hello".equals(ss.get(1)) || + !"hej".equals(ss.get(2)) || + !"hey".equals(ss.get(3)) || + !"aloha".equals(ss.get(4))) + test.fail("sampleArray, String array contents incorrect"); + System.out.println("Got an array:"); + for (Integer i: is) + System.out.println("--"+i); + if (is.length != 4 || + is[0].intValue() != 1 || + is[1].intValue() != 5 || + is[2].intValue() != 7 || + is[3].intValue() != 9) + test.fail("sampleArray, Integer array contents incorrect"); + System.out.println("Got an array:"); + for (long l: ls) + System.out.println("--"+l); + if (ls.length != 4 || + ls[0] != 2 || + ls[1] != 6 || + ls[2] != 8 || + ls[3] != 12) + test.fail("sampleArray, Integer array contents incorrect"); + Vector v = new Vector(); + v.add(-1); + v.add(-5); + v.add(-7); + v.add(-12); + v.add(-18); + return v; + } + public String getName() + { + return "This Is A UTF-8 Name: س !!"; + } + public String getNameAndThrow() throws TestException + { + throw new TestException("test"); + } + public boolean check() + { + System.out.println("Being checked"); + return false; + } + public int frobnicate(List n, Map> m, T v) + { + if (null == n) + test.fail("List was null"); + if (n.size() != 3) + test.fail("List was wrong size (expected 3, actual "+n.size()+")"); + if (n.get(0) != 2L || + n.get(1) != 5L || + n.get(2) != 71L) + test.fail("List has wrong contents"); + if (!(v instanceof Integer)) + test.fail("v not an Integer"); + if (((Integer) v) != 13) + test.fail("v is incorrect"); + if (null == m) + test.fail("Map was null"); + if (m.size() != 1) + test.fail("Map was wrong size"); + if (!m.keySet().contains("stuff")) + test.fail("Incorrect key"); + Map mus = m.get("stuff"); + if (null == mus) + test.fail("Sub-Map was null"); + if (mus.size() != 3) + test.fail("Sub-Map was wrong size"); + if (!(new Short((short)5).equals(mus.get(new UInt16(4))))) + test.fail("Sub-Map has wrong contents"); + if (!(new Short((short)6).equals(mus.get(new UInt16(5))))) + test.fail("Sub-Map has wrong contents"); + if (!(new Short((short)7).equals(mus.get(new UInt16(6))))) + test.fail("Sub-Map has wrong contents"); + return -5; + } + public DBusInterface getThis(DBusInterface t) + { + if (!t.equals(this)) + test.fail("Didn't get this properly"); + return this; + } + public void throwme() throws TestException + { + throw new TestException("test"); + } + public TestSerializable testSerializable(byte b, TestSerializable s, int i) + { + System.out.println("Recieving TestSerializable: "+s); + if ( b != 12 + || i != 13 + || !(s.getInt() == 1) + || !(s.getString().equals("woo")) + || !(s.getVector().size() == 3) + || !(s.getVector().get(0) == 1) + || !(s.getVector().get(1) == 2) + || !(s.getVector().get(2) == 3) ) + test.fail("Error in recieving custom synchronisation"); + return s; + } + public String recursionTest() + { + try { + TestRemoteInterface tri = conn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class); + return tri.getName(); + } catch (DBusException DBe) { + test.fail("Failed with error: "+DBe); + return ""; + } + } + public int overload(String s) + { + return 1; + } + public int overload(byte b) + { + return 2; + } + public int overload() + { + DBusCallInfo info = DBusConnection.getCallInfo(); + if ("org.freedesktop.dbus.test.AlternateTestInterface".equals(info.getInterface())) + return 3; + else if ("org.freedesktop.dbus.test.TestRemoteInterface".equals(info.getInterface())) + return 4; + else + return -1; + } + public List> checklist(List> lli) + { + return lli; + } + public TestNewInterface getNew() + { + testnewclass n = new testnewclass(); + try { + conn.exportObject("/new", n); + } catch (DBusException DBe) + { throw new DBusExecutionException(DBe.getMessage()); } + return n; + } + public void sig(Type[] s) + { + if (s.length != 2 + || !s[0].equals(Byte.class) + || ! (s[1] instanceof ParameterizedType) + || ! Map.class.equals(((ParameterizedType) s[1]).getRawType()) + || ((ParameterizedType) s[1]).getActualTypeArguments().length != 2 + || ! String.class.equals(((ParameterizedType) s[1]).getActualTypeArguments()[0]) + || ! Integer.class.equals(((ParameterizedType) s[1]).getActualTypeArguments()[1])) + test.fail("Didn't send types correctly"); + } + @SuppressWarnings("unchecked") + public void complexv(Variant v) + { + if (!"a{ss}".equals(v.getSig()) + || ! (v.getValue() instanceof Map) + || ((Map) v.getValue()).size() != 1 + || !"moo".equals(((Map) v.getValue()).get("cow"))) + test.fail("Didn't send variant correctly"); + } + public void reg13291(byte[] as, byte[] bs) + { + if (as.length != bs.length) test.fail("didn't receive identical byte arrays"); + for (int i = 0; i < as.length; i++) + if (as[i] != bs[i]) test.fail("didn't receive identical byte arrays"); + } + @SuppressWarnings("unchecked") + public A Get (String interface_name, String property_name) + { + return (A) new Path("/nonexistant/path"); + } + public void Set (String interface_name, String property_name, A value) {} + public Map GetAll (String interface_name) { return new HashMap(); } + public Path pathrv(Path a) { return a; } + public List pathlistrv(List a) { return a; } + public Map pathmaprv(Map a) { return a; } +} + +/** + * Typed signal handler for renamed signal + */ +class renamedsignalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(TestSignalInterface2.TestRenamedSignal t) + { + if (false == test.done5) { + test.done5 = true; + } else { + test.fail("SignalHandler R has been run too many times"); + } + System.out.println("SignalHandler R Running"); + System.out.println("string("+t.value+") int("+t.number+")"); + if (!"Bar".equals(t.value) || !(new UInt32(42)).equals(t.number)) + test.fail("Incorrect TestRenamedSignal parameters"); + } +} + +/** + * Empty signal handler + */ +class emptysignalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(TestSignalInterface.EmptySignal t) + { + if (false == test.done7) { + test.done7 = true; + } else { + test.fail("SignalHandler E has been run too many times"); + } + System.out.println("SignalHandler E Running"); + } +} +/** + * Disconnect handler + */ +class disconnecthandler implements DBusSigHandler +{ + private DBusConnection conn; + private renamedsignalhandler sh; + public disconnecthandler(DBusConnection conn, renamedsignalhandler sh) + { + this.conn = conn; + this.sh = sh; + } + /** Handling a signal */ + public void handle(DBus.Local.Disconnected t) + { + if (false == test.done6) { + test.done6 = true; + System.out.println("Handling disconnect, unregistering handler"); + try { + conn.removeSigHandler(TestSignalInterface2.TestRenamedSignal.class, sh); + } catch (DBusException DBe) { + DBe.printStackTrace(); + test.fail("Disconnect handler threw an exception: "+DBe); + } + } + } +} + + +/** + * Typed signal handler + */ +class pathsignalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(TestSignalInterface.TestPathSignal t) + { + System.out.println("Path sighandler: "+t); + } +} + +/** + * Typed signal handler + */ +class signalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(TestSignalInterface.TestSignal t) + { + if (false == test.done1) { + test.done1 = true; + } else { + test.fail("SignalHandler 1 has been run too many times"); + } + System.out.println("SignalHandler 1 Running"); + System.out.println("string("+t.value+") int("+t.number+")"); + if (!"Bar".equals(t.value) || !(new UInt32(42)).equals(t.number)) + test.fail("Incorrect TestSignal parameters"); + } +} + +/** + * Untyped signal handler + */ +class arraysignalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(TestSignalInterface.TestArraySignal t) + { + try { + if (false == test.done2) { + test.done2 = true; + } else { + test.fail("SignalHandler 2 has been run too many times"); + } + System.out.println("SignalHandler 2 Running"); + if (t.v.size() != 1) test.fail("Incorrect TestArraySignal array length: should be 1, actually "+t.v.size()); + System.out.println("Got a test array signal with Parameters: "); + for (String str: t.v.get(0).a) + System.out.println("--"+str); + System.out.println(t.v.get(0).b.getType()); + System.out.println(t.v.get(0).b.getValue()); + if (!(t.v.get(0).b.getValue() instanceof UInt64) || + 567L != ((UInt64) t.v.get(0).b.getValue()).longValue() || + t.v.get(0).a.size() != 5 || + !"hi".equals(t.v.get(0).a.get(0)) || + !"hello".equals(t.v.get(0).a.get(1)) || + !"hej".equals(t.v.get(0).a.get(2)) || + !"hey".equals(t.v.get(0).a.get(3)) || + !"aloha".equals(t.v.get(0).a.get(4))) + test.fail("Incorrect TestArraySignal parameters"); + + if (t.m.keySet().size() != 2) test.fail("Incorrect TestArraySignal map size: should be 2, actually "+t.m.keySet().size()); + if (!(t.m.get(new UInt32(1)).b.getValue() instanceof UInt64) || + 678L != ((UInt64) t.m.get(new UInt32(1)).b.getValue()).longValue() || + !(t.m.get(new UInt32(42)).b.getValue() instanceof UInt64) || + 789L != ((UInt64) t.m.get(new UInt32(42)).b.getValue()).longValue()) + test.fail("Incorrect TestArraySignal parameters"); + + } catch (Exception e) { + e.printStackTrace(); + test.fail("SignalHandler 2 threw an exception: "+e); + } + } +} + +/** + * Object path signal handler + */ +class objectsignalhandler implements DBusSigHandler +{ + public void handle(TestSignalInterface.TestObjectSignal s) + { + if (false == test.done3) { + test.done3 = true; + } else { + test.fail("SignalHandler 3 has been run too many times"); + } + System.out.println(s.otherpath); + } +} + +/** + * handler which should never be called + */ +class badarraysignalhandler implements DBusSigHandler +{ + /** Handling a signal */ + public void handle(T s) + { + test.fail("This signal handler shouldn't be called"); + } +} + +/** + * Callback handler + */ +class callbackhandler implements CallbackHandler +{ + public void handle(String r) + { + System.out.println("Handling callback: "+r); + Collator col = Collator.getInstance(); + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", r)) + test.fail("call with callback, wrong return value"); + if (test.done4) test.fail("Already ran callback handler"); + test.done4 = true; + } + public void handleError(DBusExecutionException e) + { + System.out.println("Handling error callback: "+e+" message = '"+e.getMessage()+"'"); + if (!(e instanceof TestException)) test.fail("Exception is of the wrong sort"); + Collator col = Collator.getInstance(); + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + if (0 != col.compare("test", e.getMessage())) + test.fail("Exception has the wrong message"); + if (test.done8) test.fail("Already ran callback error handler"); + test.done8=true; + } +} + +/** + * This is a test program which sends and recieves a signal, implements, exports and calls a remote method. + */ +public class test +{ + public static boolean done1 = false; + public static boolean done2 = false; + public static boolean done3 = false; + public static boolean done4 = false; + public static boolean done5 = false; + public static boolean done6 = false; + public static boolean done7 = false; + public static boolean done8 = false; + public static void fail(String message) + { + System.out.println("Test Failed: "+message); + System.err.println("Test Failed: "+message); + if (null != serverconn) serverconn.disconnect(); + if (null != clientconn) clientconn.disconnect(); + System.exit(1); + } + static DBusConnection serverconn = null; + static DBusConnection clientconn = null; + @SuppressWarnings("unchecked") + public static void main(String[] args) + { try { + System.out.println("Creating Connection"); + serverconn = DBusConnection.getConnection(DBusConnection.SESSION); + clientconn = DBusConnection.getConnection(DBusConnection.SESSION); + serverconn.setWeakReferences(true); + clientconn.setWeakReferences(true); + + System.out.println("Registering Name"); + serverconn.requestBusName("foo.bar.Test"); + + /** This gets a remote object matching our bus name and exported object path. */ + Peer peer = clientconn.getRemoteObject("foo.bar.Test", "/Test", Peer.class); + DBus dbus = clientconn.getRemoteObject("org.freedesktop.DBus", "/org/freedesktop/DBus", DBus.class); + + System.out.print("Listening for signals..."); + signalhandler sigh = new signalhandler(); + renamedsignalhandler rsh = new renamedsignalhandler(); + try { + /** This registers an instance of the test class as the signal handler for the TestSignal class. */ + clientconn.addSigHandler(TestSignalInterface.EmptySignal.class, new emptysignalhandler()); + clientconn.addSigHandler(TestSignalInterface.TestSignal.class, sigh); + clientconn.addSigHandler(TestSignalInterface2.TestRenamedSignal.class, rsh); + clientconn.addSigHandler(DBus.Local.Disconnected.class, new disconnecthandler(clientconn, rsh)); + String source = dbus.GetNameOwner("foo.bar.Test"); + clientconn.addSigHandler(TestSignalInterface.TestArraySignal.class, source, peer, new arraysignalhandler()); + clientconn.addSigHandler(TestSignalInterface.TestObjectSignal.class, new objectsignalhandler()); + clientconn.addSigHandler(TestSignalInterface.TestPathSignal.class, new pathsignalhandler()); + badarraysignalhandler bash = new badarraysignalhandler(); + clientconn.addSigHandler(TestSignalInterface.TestSignal.class, bash); + clientconn.removeSigHandler(TestSignalInterface.TestSignal.class, bash); + System.out.println("done"); + } catch (MatchRuleInvalid MRI) { + test.fail("Failed to add handlers: "+MRI.getMessage()); + } catch (DBusException DBe) { + test.fail("Failed to add handlers: "+DBe.getMessage()); + } + + System.out.println("Listening for Method Calls"); + testclass tclass = new testclass(serverconn); + testclass tclass2 = new testclass(serverconn); + /** This exports an instance of the test class as the object /Test. */ + serverconn.exportObject("/Test", tclass); + serverconn.exportObject("/BadTest", tclass); + serverconn.exportObject("/BadTest2", tclass2); + serverconn.addFallback("/FallbackTest", tclass); + + // explicitly unexport object + serverconn.unExportObject("/BadTest"); + // implicitly unexport object + tclass2 = null; + System.gc(); + System.runFinalization(); + System.gc(); + System.runFinalization(); + System.gc(); + System.runFinalization(); + + System.out.println("Sending Signal"); + /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */ + serverconn.sendSignal(new TestSignalInterface.TestSignal("/foo/bar/Wibble", "Bar", new UInt32(42))); + serverconn.sendSignal(new TestSignalInterface.EmptySignal("/foo/bar/Wibble")); + serverconn.sendSignal(new TestSignalInterface2.TestRenamedSignal("/foo/bar/Wibble", "Bar", new UInt32(42))); + + System.out.println("These things are on the bus:"); + String[] names = dbus.ListNames(); + for (String name: names) + System.out.println("\t"+name); + + System.out.println("Getting our introspection data"); + /** This gets a remote object matching our bus name and exported object path. */ + Introspectable intro = clientconn.getRemoteObject("foo.bar.Test", "/", Introspectable.class); + /** Get introspection data */ + String data;/* = intro.Introspect(); + if (null == data || !data.startsWith(" peers = serverconn.new PeerSet(); + peers.add("org.freedesktop.DBus"); + clientconn.requestBusName("test.testclient"); + peers.add("test.testclient"); + clientconn.releaseBusName("test.testclient"); + + System.out.println("Pinging ourselves"); + /** Call ping. */ + for (int i = 0; i < 10; i++) { + long then = System.currentTimeMillis(); + peer.Ping(); + long now = System.currentTimeMillis(); + System.out.println("Ping returned in "+(now-then)+"ms."); + } + + System.out.println("Calling Method0/1"); + /** This gets a remote object matching our bus name and exported object path. */ + TestRemoteInterface tri = (TestRemoteInterface) clientconn.getPeerRemoteObject("foo.bar.Test", "/Test"); + System.out.println("Got Remote Object: "+tri); + /** Call the remote object and get a response. */ + String rname = tri.getName(); + System.out.println("Got Remote Name: "+rname); + + Path path = new Path("/nonexistantwooooooo"); + Path p = tri.pathrv(path); + System.out.println(path.toString()+" => "+p.toString()); + if (!path.equals(p)) fail("pathrv incorrect"); + List paths = new Vector(); + paths.add(path); + List ps = tri.pathlistrv(paths); + System.out.println(paths.toString()+" => "+ps.toString()); + if (!paths.equals(ps)) fail("pathlistrv incorrect"); + Map pathm = new HashMap(); + pathm.put(path, path); + Map pm = tri.pathmaprv(pathm); + System.out.println(pathm.toString()+" => "+pm.toString()); + System.out.println(pm.containsKey(path)+" "+pm.get(path)+" "+path.equals(pm.get(path))); + System.out.println(pm.containsKey(p)+" "+pm.get(p)+" "+p.equals(pm.get(p))); + for (Path q: pm.keySet()) { + System.out.println(q); + System.out.println(pm.get(q)); + } + if (!pm.containsKey(path) || !path.equals(pm.get(path))) fail("pathmaprv incorrect"); + + serverconn.sendSignal(new TestSignalInterface.TestPathSignal("/Test", path, paths, pathm)); + + Collator col = Collator.getInstance(); + col.setDecomposition(Collator.FULL_DECOMPOSITION); + col.setStrength(Collator.PRIMARY); + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!", rname)) + fail("getName return value incorrect"); + System.out.println("sending it to sleep"); + tri.waitawhile(); + System.out.println("testing floats"); + if (17.093f != tri.testfloat(new float[] { 17.093f, -23f, 0.0f, 31.42f })) + fail("testfloat returned the wrong thing"); + System.out.println("Structs of Structs"); + List> lli = new Vector>(); + List li = new Vector(); + li.add(1); + li.add(2); + li.add(3); + lli.add(li); + lli.add(li); + lli.add(li); + TestStruct3 ts3 = new TestStruct3(new TestStruct2(new Vector(), new Variant(0)), lli); + int[][] out = tri.teststructstruct(ts3); + if (out.length != 3) fail("teststructstruct returned the wrong thing: "+Arrays.deepToString(out)); + for (int[] o: out) + if (o.length != 3 + ||o[0] != 1 + ||o[1] != 2 + ||o[2] != 3) fail("teststructstruct returned the wrong thing: "+Arrays.deepToString(out)); + + System.out.println("frobnicating"); + List ls = new Vector(); + ls.add(2L); + ls.add(5L); + ls.add(71L); + Map mus = new HashMap(); + mus.put(new UInt16(4), (short) 5); + mus.put(new UInt16(5), (short) 6); + mus.put(new UInt16(6), (short) 7); + Map> msmus = new HashMap>(); + msmus.put("stuff", mus); + int rint = tri.frobnicate(ls, msmus, 13); + if (-5 != rint) + fail("frobnicate return value incorrect"); + + System.out.println("Doing stuff asynchronously with callback"); + clientconn.callWithCallback(tri, "getName", new callbackhandler()); + System.out.println("Doing stuff asynchronously with callback, which throws an error"); + clientconn.callWithCallback(tri, "getNameAndThrow", new callbackhandler()); + + /** call something that throws */ + try { + System.out.println("Throwing stuff"); + tri.throwme(); + test.fail("Method Execution should have failed"); + } catch (TestException Te) { + System.out.println("Remote Method Failed with: "+Te.getClass().getName()+" "+Te.getMessage()); + if (!Te.getMessage().equals("test")) + test.fail("Error message was not correct"); + } + + /* Test type signatures */ + Vector ts = new Vector(); + Marshalling.getJavaType("ya{si}", ts, -1); + tri.sig(ts.toArray(new Type[0])); + + tri.newpathtest(new Path("/new/path/test")); + + /** Try and call an invalid remote object */ + try { + System.out.println("Calling Method2"); + tri = clientconn.getRemoteObject("foo.bar.NotATest", "/Moofle", TestRemoteInterface.class); + System.out.println("Got Remote Name: "+tri.getName()); + test.fail("Method Execution should have failed"); + } catch (ServiceUnknown SU) { + System.out.println("Remote Method Failed with: "+SU.getClass().getName()+" "+SU.getMessage()); + } + + /** Try and call an invalid remote object */ + try { + System.out.println("Calling Method3"); + tri = clientconn.getRemoteObject("foo.bar.Test", "/Moofle", TestRemoteInterface.class); + System.out.println("Got Remote Name: "+tri.getName()); + test.fail("Method Execution should have failed"); + } catch (UnknownObject UO) { + System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage()); + } + + /** Try and call an explicitly unexported object */ + try { + System.out.println("Calling Method4"); + tri = clientconn.getRemoteObject("foo.bar.Test", "/BadTest", TestRemoteInterface.class); + System.out.println("Got Remote Name: "+tri.getName()); + test.fail("Method Execution should have failed"); + } catch (UnknownObject UO) { + System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage()); + } + + /** Try and call an implicitly unexported object */ + try { + System.out.println("Calling Method5"); + tri = clientconn.getRemoteObject("foo.bar.Test", "/BadTest2", TestRemoteInterface.class); + System.out.println("Got Remote Name: "+tri.getName()); + test.fail("Method Execution should have failed"); + } catch (UnknownObject UO) { + System.out.println("Remote Method Failed with: "+UO.getClass().getName()+" "+UO.getMessage()); + } + + System.out.println("Calling Method6"); + tri = clientconn.getRemoteObject("foo.bar.Test", "/FallbackTest/0/1", TestRemoteInterface.class); + intro = clientconn.getRemoteObject("foo.bar.Test", "/FallbackTest/0/4", Introspectable.class); + System.out.println("Got Fallback Name: "+tri.getName()); + System.out.println("Fallback Introspection Data: \n"+intro.Introspect()); + + System.out.println("Testing Properties returning Paths"); + Properties prop = clientconn.getRemoteObject("foo.bar.Test", "/Test", Properties.class); + Path prv = (Path) prop.Get("foo.bar", "foo"); + System.out.println("Got path "+prv); + System.out.println("Calling Method7--9"); + /** This gets a remote object matching our bus name and exported object path. */ + TestRemoteInterface2 tri2 = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface2.class); + System.out.print("Calling the other introspect method: "); + String intro2 = tri2.Introspect(); + System.out.println(intro2); + if (0 != col.compare("Not XML", intro2)) + fail("Introspect return value incorrect"); + + /** Call the remote object and get a response. */ + TestTuple,Boolean> rv = tri2.show(234); + System.out.println("Show returned: "+rv); + if (!serverconn.getUniqueName().equals(rv.a) || + 1 != rv.b.size() || + 1953 != rv.b.get(0) || + true != rv.c.booleanValue()) + fail("show return value incorrect ("+rv.a+","+rv.b+","+rv.c+")"); + + System.out.println("Doing stuff asynchronously"); + DBusAsyncReply stuffreply = (DBusAsyncReply) clientconn.callMethodAsync(tri2, "dostuff", new TestStruct("bar", new UInt32(52), new Variant(new Boolean(true)))); + + System.out.println("Checking bools"); + if (tri2.check()) fail("bools are broken"); + + List l = new Vector(); + l.add("hi"); + l.add("hello"); + l.add("hej"); + l.add("hey"); + l.add("aloha"); + System.out.println("Sampling Arrays:"); + List is = tri2.sampleArray(l, new Integer[] { 1, 5, 7, 9 }, new long[] { 2, 6, 8, 12 }); + System.out.println("sampleArray returned an array:"); + for (Integer i: is) + System.out.println("--"+i); + if (is.size() != 5 || + is.get(0).intValue() != -1 || + is.get(1).intValue() != -5 || + is.get(2).intValue() != -7 || + is.get(3).intValue() != -12 || + is.get(4).intValue() != -18) + fail("sampleArray return value incorrect"); + + System.out.println("Get This"); + if (!tclass.equals(tri2.getThis(tri2))) + fail("Didn't get the correct this"); + + Boolean b = stuffreply.getReply(); + System.out.println("Do stuff replied "+b); + if (true != b.booleanValue()) + fail("dostuff return value incorrect"); + + System.out.print("Sending Array Signal..."); + /** This creates an instance of the Test Signal, with the given object path, signal name and parameters, and broadcasts in on the Bus. */ + List tsl = new Vector(); + tsl.add(new TestStruct2(l, new Variant(new UInt64(567)))); + Map tsm = new HashMap(); + tsm.put(new UInt32(1), new TestStruct2(l, new Variant(new UInt64(678)))); + tsm.put(new UInt32(42), new TestStruct2(l, new Variant(new UInt64(789)))); + serverconn.sendSignal(new TestSignalInterface.TestArraySignal("/Test", tsl, tsm)); + + System.out.println("done"); + + System.out.print("testing custom serialization..."); + Vector v = new Vector(); + v.add(1); + v.add(2); + v.add(3); + TestSerializable s = new TestSerializable(1, "woo", v); + s = tri2.testSerializable((byte) 12, s, 13); + System.out.print("returned: "+s); + if (s.getInt() != 1 || + ! s.getString().equals("woo") || + s.getVector().size() != 3 || + s.getVector().get(0) != 1 || + s.getVector().get(1) != 2 || + s.getVector().get(2) != 3) + fail("Didn't get back the same TestSerializable"); + + System.out.println("done"); + + System.out.print("testing complex variants..."); + Map m = new HashMap(); + m.put("cow", "moo"); + tri2.complexv(new Variant(m, "a{ss}")); + System.out.println("done"); + + System.out.print("testing recursion..."); + + if (0 != col.compare("This Is A UTF-8 Name: ﺱ !!",tri2.recursionTest())) fail("recursion test failed"); + + System.out.println("done"); + + System.out.print("testing method overloading..."); + tri = clientconn.getRemoteObject("foo.bar.Test", "/Test", TestRemoteInterface.class); + if (1 != tri2.overload("foo")) test.fail("wrong overloaded method called"); + if (2 != tri2.overload((byte) 0)) test.fail("wrong overloaded method called"); + if (3 != tri2.overload()) test.fail("wrong overloaded method called"); + if (4 != tri.overload()) test.fail("wrong overloaded method called"); + System.out.println("done"); + + System.out.print("reg13291..."); + byte[] as = new byte[10]; + for (int i = 0; i < 10; i++) + as[i] = (byte) (100-i); + tri.reg13291(as, as); + System.out.println("done"); + + System.out.print("Testing nested lists..."); + lli = new Vector>(); + li = new Vector(); + li.add(1); + lli.add(li); + List> reti = tri2.checklist(lli); + if (reti.size() != 1 || + reti.get(0).size() != 1 || + reti.get(0).get(0) != 1) + test.fail("Failed to check nested lists"); + System.out.println("done"); + + System.out.print("Testing dynamic object creation..."); + TestNewInterface tni = tri2.getNew(); + System.out.print(tni.getName()+" "); + System.out.println("done"); + + /* send an object in a signal */ + serverconn.sendSignal(new TestSignalInterface.TestObjectSignal("/foo/bar/Wibble", tclass)); + + /** Pause while we wait for the DBus messages to go back and forth. */ + Thread.sleep(1000); + + // check that bus name set has been trimmed + if (peers.size() != 1) fail("peers hasn't been trimmed"); + if (!peers.contains("org.freedesktop.DBus")) fail ("peers contains the wrong name"); + + System.out.println("Checking for outstanding errors"); + DBusExecutionException DBEe = serverconn.getError(); + if (null != DBEe) throw DBEe; + DBEe = clientconn.getError(); + if (null != DBEe) throw DBEe; + + System.out.println("Disconnecting"); + /** Disconnect from the bus. */ + clientconn.disconnect(); + serverconn.disconnect(); + + System.out.println("Trying to do things after disconnection"); + + /** Remove sig handler */ + clientconn.removeSigHandler(TestSignalInterface.TestSignal.class, sigh); + + /** Call a method when disconnected */ + try { + System.out.println("getName() suceeded and returned: "+tri.getName()); + fail("Should not succeed when disconnected"); + } catch (NotConnected NC) { + System.out.println("getName() failed with exception "+NC); + } + clientconn = null; + serverconn = null; + + if (!done1) fail("Signal handler 1 failed to be run"); + if (!done2) fail("Signal handler 2 failed to be run"); + if (!done3) fail("Signal handler 3 failed to be run"); + if (!done4) fail("Callback handler failed to be run"); + if (!done5) fail("Signal handler R failed to be run"); + if (!done6) fail("Disconnect handler failed to be run"); + if (!done7) fail("Signal handler E failed to be run"); + if (!done8) fail("Error callback handler failed to be run"); + + } catch (Exception e) { + e.printStackTrace(); + fail("Unexpected Exception Occurred: "+e); + }} +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_low_level.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_low_level.java new file mode 100755 index 0000000..e65956d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_low_level.java @@ -0,0 +1,56 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; +import cx.ath.matthew.debug.Debug; +import org.freedesktop.dbus.BusAddress; +import org.freedesktop.dbus.DBusSignal; +import org.freedesktop.dbus.Message; +import org.freedesktop.dbus.MethodCall; +import org.freedesktop.dbus.Transport; + +public class test_low_level +{ + public static void main(String[] args) throws Exception + { + Debug.setHexDump(true); + String addr = System.getenv("DBUS_SESSION_BUS_ADDRESS"); + Debug.print(addr); + BusAddress address = new BusAddress(addr); + Debug.print(address); + + Transport conn = new Transport(address); + + Message m = new MethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "Hello", (byte) 0, null); + conn.mout.writeMessage(m); + m = conn.min.readMessage(); + Debug.print(m.getClass()); + Debug.print(m); + m = conn.min.readMessage(); + Debug.print(m.getClass()); + Debug.print(m); + m = conn.min.readMessage(); + Debug.print(""+m); + m = new MethodCall("org.freedesktop.DBus", "/", null, "Hello", (byte) 0, null); + conn.mout.writeMessage(m); + m = conn.min.readMessage(); + Debug.print(m); + + m = new MethodCall("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName", (byte) 0, "su", "org.testname", 0); + conn.mout.writeMessage(m); + m = conn.min.readMessage(); + Debug.print(m); + m = new DBusSignal(null, "/foo", "org.foo", "Foo", null); + conn.mout.writeMessage(m); + m = conn.min.readMessage(); + Debug.print(m); + conn.disconnect(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java new file mode 100755 index 0000000..aafbca4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_client.java @@ -0,0 +1,42 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; + +import org.freedesktop.DBus; +import org.freedesktop.dbus.DirectConnection; + +public class test_p2p_client +{ + public static void main(String[] args) throws Exception + { + BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream("address"))); + String address = r.readLine(); + DirectConnection dc = new DirectConnection(address); + System.out.println("Connected"); + TestRemoteInterface tri = (TestRemoteInterface) dc.getRemoteObject("/Test"); + System.out.println(tri.getName()); + System.out.println(tri.testfloat(new float[] { 17.093f, -23f, 0.0f, 31.42f })); + + try { + tri.throwme(); + } catch (TestException Te) { + System.out.println("Caught TestException"); + } + ((DBus.Peer) tri).Ping(); + System.out.println(((DBus.Introspectable) tri).Introspect()); + dc.disconnect(); + System.out.println("Disconnected"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_server.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_server.java new file mode 100755 index 0000000..6840694 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/test_p2p_server.java @@ -0,0 +1,94 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import java.lang.reflect.Type; +import java.io.FileOutputStream; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.freedesktop.dbus.DirectConnection; +import org.freedesktop.dbus.Path; +import org.freedesktop.dbus.UInt16; + +public class test_p2p_server implements TestRemoteInterface +{ + public int[][] teststructstruct(TestStruct3 in) + { + List> lli = in.b; + int[][] out = new int[lli.size()][]; + for (int j = 0; j < out.length; j++) { + out[j] = new int[lli.get(j).size()]; + for (int k = 0; k < out[j].length; k++) + out[j][k] = lli.get(j).get(k); + } + return out; + } + public String getNameAndThrow() + { + return getName(); + } + public String getName() + { + System.out.println("getName called"); + return "Peer2Peer Server"; + } + public int frobnicate(List n, Map> m, T v) + { + return 3; + } + public void throwme() throws TestException + { + System.out.println("throwme called"); + throw new TestException("BOO"); + } + public void waitawhile() + { + return; + } + public int overload() + { + return 1; + } + public void sig(Type[] s) + { + } + public void newpathtest(Path p) + { + } + public void reg13291(byte[] as, byte[] bs) + { + } + public Path pathrv(Path a) { return a; } + public List pathlistrv(List a) { return a; } + public Map pathmaprv(Map a) { return a; } + public boolean isRemote() { return false; } + public float testfloat(float[] f) + { + System.out.println("got float: "+Arrays.toString(f)); + return f[0]; + } + + public static void main(String[] args) throws Exception + { + String address = DirectConnection.createDynamicSession(); + //String address = "tcp:host=localhost,port=12344,guid="+Transport.genGUID(); + PrintWriter w = new PrintWriter(new FileOutputStream("address")); + w.println(address); + w.flush(); + w.close(); + DirectConnection dc = new DirectConnection(address+",listen=true"); + System.out.println("Connected"); + dc.exportObject("/Test", new test_p2p_server()); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_client.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_client.java new file mode 100755 index 0000000..f37e955 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_client.java @@ -0,0 +1,42 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusConnection; + +public class two_part_test_client +{ + public static class two_part_test_object implements TwoPartObject + { + public boolean isRemote() { return false; } + public String getName() + { + System.out.println("client name"); + return toString(); + } + } + public static void main(String[] args) throws Exception + { + System.out.println("get conn"); + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + System.out.println("get remote"); + TwoPartInterface remote = conn.getRemoteObject("org.freedesktop.dbus.test.two_part_server", "/", TwoPartInterface.class); + System.out.println("get object"); + TwoPartObject o = remote.getNew(); + System.out.println("get name"); + System.out.println(o.getName()); + two_part_test_object tpto = new two_part_test_object(); + conn.exportObject("/TestObject", tpto); + conn.sendSignal(new TwoPartInterface.TwoPartSignal("/FromObject", tpto)); + try { Thread.sleep(1000); } catch (InterruptedException Ie) {} + conn.disconnect(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_server.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_server.java new file mode 100755 index 0000000..7452303 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/test/two_part_test_server.java @@ -0,0 +1,55 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.test; + +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.DBusSigHandler; + +public class two_part_test_server implements TwoPartInterface, DBusSigHandler +{ + public class two_part_test_object implements TwoPartObject + { + public boolean isRemote() { return false; } + public String getName() + { + System.out.println("give name"); + return toString(); + } + } + private DBusConnection conn; + public two_part_test_server(DBusConnection conn) + { + this.conn = conn; + } + public boolean isRemote() { return false; } + public TwoPartObject getNew() + { + TwoPartObject o = new two_part_test_object(); + System.out.println("export new"); + try { conn.exportObject("/12345", o); } catch (Exception e) {} + System.out.println("give new"); + return o; + } + public void handle(TwoPartInterface.TwoPartSignal s) + { + System.out.println("Got: "+s.o); + } + public static void main(String[] args) throws Exception + { + DBusConnection conn = DBusConnection.getConnection(DBusConnection.SESSION); + conn.requestBusName("org.freedesktop.dbus.test.two_part_server"); + two_part_test_server server = new two_part_test_server(conn); + conn.exportObject("/", server); + conn.addSigHandler(TwoPartInterface.TwoPartSignal.class, server); + while (true) try { Thread.sleep(10000); } catch (InterruptedException Ie) {} + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusListType.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusListType.java new file mode 100755 index 0000000..f7711dc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusListType.java @@ -0,0 +1,44 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.types; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.List; + +/** + * The type of a list. + * Should be used whenever you need a Type variable for a list. + */ +public class DBusListType implements ParameterizedType +{ + private Type v; + /** + * Create a List type. + * @param v Type of the list contents. + */ + public DBusListType(Type v) + { + this.v = v; + } + public Type[] getActualTypeArguments() + { + return new Type[] { v }; + } + public Type getRawType() + { + return List.class; + } + public Type getOwnerType() + { + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusMapType.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusMapType.java new file mode 100755 index 0000000..825df7d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusMapType.java @@ -0,0 +1,47 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.types; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Map; + +/** + * The type of a map. + * Should be used whenever you need a Type variable for a map. + */ +public class DBusMapType implements ParameterizedType +{ + private Type k; + private Type v; + /** + * Create a map type. + * @param k The type of the keys. + * @param v The type of the values. + */ + public DBusMapType(Type k, Type v) + { + this.k = k; + this.v = v; + } + public Type[] getActualTypeArguments() + { + return new Type[] { k, v }; + } + public Type getRawType() + { + return Map.class; + } + public Type getOwnerType() + { + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusStructType.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusStructType.java new file mode 100755 index 0000000..86d7533 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/types/DBusStructType.java @@ -0,0 +1,44 @@ +/* + D-Bus Java Implementation + Copyright (c) 2005-2006 Matthew Johnson + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.types; + +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import org.freedesktop.dbus.Struct; + +/** + * The type of a struct. + * Should be used whenever you need a Type variable for a struct. + */ +public class DBusStructType implements ParameterizedType +{ + private Type[] contents; + /** + * Create a struct type. + * @param contents The types contained in this struct. + */ + public DBusStructType(Type... contents) + { + this.contents = contents; + } + public Type[] getActualTypeArguments() + { + return contents; + } + public Type getRawType() + { + return Struct.class; + } + public Type getOwnerType() + { + return null; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusEntry.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusEntry.java new file mode 100755 index 0000000..a71005e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusEntry.java @@ -0,0 +1,123 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.UInt32; + +/** A summary class for a dbus entry for use in a table model + * + * @author pete + * @since 10/02/2006 + */ +public class DBusEntry +{ + private String name; + + private String path; + + private UInt32 user; + + private String owner; + + private Introspectable introspectable; + + /** Assign the name + * + * @param name The name. + */ + public void setName(String name) + { + this.name = name; + } + + /** Retrieve the name + * + * @return The name. + */ + public String getName() + { + return name; + } + + /** Assign the user + * + * @param user The user. + */ + public void setUser(UInt32 user) + { + this.user = user; + } + + /** Retrieve the user + * + * @return The user. + */ + public UInt32 getUser() + { + return user; + } + + /** Assign the owner + * + * @param owner The owner. + */ + public void setOwner(String owner) + { + this.owner = owner; + } + + /** Retrieve the owner + * + * @return The owner. + */ + public String getOwner() + { + return owner; + } + + /** Assign the introspectable + * + * @param introspectable The introspectable. + */ + public void setIntrospectable(Introspectable introspectable) + { + this.introspectable = introspectable; + } + + /** Retrieve the introspectable + * + * @return The introspectable. + */ + public Introspectable getIntrospectable() + { + return introspectable; + } + + /** + * retrieve the path parameter + * + * @return + */ + public String getPath() { + return path; + } + + /** + * set the path parameter + * + * @param path + */ + public void setPath(String path) { + this.path = path; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusTableModel.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusTableModel.java new file mode 100755 index 0000000..d4363d4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusTableModel.java @@ -0,0 +1,127 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +@SuppressWarnings("serial") +class DBusTableModel extends AbstractTableModel +{ + private static final String INTROSPECTABLE = "introspectable?"; + + private static final String OWNER = "owner"; + + private static final String USER = "user"; + + private static final String NAME = "name"; + + private static final String PATH = "path"; + + final String[] columns = { NAME, PATH, USER, OWNER, INTROSPECTABLE }; + + private List entries = new ArrayList(); + + /** {@inheritDoc} */ + public int getRowCount() + { + return entries.size(); + } + /** Add a row to the table model + * + * @param entry The dbus entry to add + */ + public void add(DBusEntry entry) + { + entries.add(entry); + } + + /** {@inheritDoc} */ + public int getColumnCount() + { + return columns.length; + } + + /** {@inheritDoc} */ + @Override + public String getColumnName(int column) + { + return columns[column]; + } + + /** Get a row of the table + * @param row The row index + * @return The table row + */ + public DBusEntry getEntry(int row) + { + return entries.get(row); + } + + /** {@inheritDoc} */ + @Override + public Class getColumnClass(int columnIndex) + { + String columnName = getColumnName(columnIndex); + if (columnName.equals(NAME)) + { + return String.class; + } + if (columnName.equals(PATH)) + { + return String.class; + } + else if (columnName.equals(USER)) + { + return Object.class; + } + else if (columnName.equals(OWNER)) + { + return String.class; + } + else if (columnName.equals(INTROSPECTABLE)) + { + return Boolean.class; + } + return super.getColumnClass(columnIndex); + } + + /** {@inheritDoc} */ + public Object getValueAt(int rowIndex, int columnIndex) + { + DBusEntry entry = getEntry(rowIndex); + String columnName = getColumnName(columnIndex); + if (columnName.equals(NAME)) + { + return entry.getName(); + } + if (columnName.equals(PATH)) + { + return entry.getPath(); + } + else if (columnName.equals(USER)) + { + return entry.getUser(); + } + else if (columnName.equals(OWNER)) + { + return entry.getOwner(); + } + else if (columnName.equals(INTROSPECTABLE)) + { + return entry.getIntrospectable() != null; + } + return null; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusViewer.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusViewer.java new file mode 100755 index 0000000..4d7e1b8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/DBusViewer.java @@ -0,0 +1,363 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import static org.freedesktop.dbus.Gettext._; + +import java.awt.BorderLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.io.IOException; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.SwingUtilities; +import javax.swing.table.TableModel; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.freedesktop.DBus; +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.DBusConnection; +import org.freedesktop.dbus.UInt32; +import org.freedesktop.dbus.exceptions.DBusException; +import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * A viewer for DBus + * + * goal is to replicate the functionality of kdbus with Java smarts + * + * @author pete + * @since 29/01/2006 + */ +public class DBusViewer +{ + private static final Map CONNECTION_TYPES = new HashMap(); + + static + { + CONNECTION_TYPES.put("System", DBusConnection.SYSTEM); + CONNECTION_TYPES.put("Session", DBusConnection.SESSION); + } + + /** Create the DBusViewer + * + * @param connectionTypes The map of connection types + */ + public DBusViewer(final Map connectionTypes) + { + connections = new ArrayList(connectionTypes.size()); + + SwingUtilities.invokeLater(new Runnable() + { + @SuppressWarnings("synthetic-access") + public void run() + { + + final JTabbedPane tabbedPane = new JTabbedPane(); + addTabs(tabbedPane, connectionTypes); + final JFrame frame = new JFrame("Dbus Viewer"); + frame.setContentPane(tabbedPane); + frame.setSize(600, 400); + frame.addWindowListener(new WindowAdapter() + { + @Override + public void windowClosing(WindowEvent e) + { + frame.dispose(); + for (DBusConnection connection : connections) + { + connection.disconnect(); + } + System.exit(0); + } + }); + frame.setVisible(true); + } + }); + } + + private List connections; + + /** + * @param args + */ + public static void main(String[] args) + { + new DBusViewer(CONNECTION_TYPES); + } + + /** Add tabs for each supplied connection type + * @param tabbedPane The tabbed pane + * @param connectionTypes The connection + */ + private void addTabs(final JTabbedPane tabbedPane, + final Map connectionTypes) + { + for (final String key : connectionTypes.keySet()) + { + final JLabel label = new JLabel(_("Processing DBus for ") + key); + tabbedPane.addTab(key, label); + } + Runnable loader = new Runnable() + { + @SuppressWarnings("synthetic-access") + public void run() + { + boolean users = true, owners = true; + for (final String key : connectionTypes.keySet()) + { + try + { + DBusConnection conn = DBusConnection + .getConnection(connectionTypes.get(key)); + connections.add(conn); + + final TableModel tableModel = listDBusConnection(users, + owners, conn); + + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + int index = tabbedPane.indexOfTab(key); + final JTable table = new JTable(tableModel); + + + + JScrollPane scrollPane = new JScrollPane(table); + + JPanel tab = new JPanel(new BorderLayout()); + tab.add(scrollPane, BorderLayout.CENTER); + + JPanel southPanel = new JPanel(); + final JButton button = new JButton(new IntrospectAction(table)); + southPanel.add(button); + + tab.add(southPanel, BorderLayout.SOUTH); + + tabbedPane.setComponentAt(index, + tab); + + } + }); + } + catch (final DBusException e) + { + e.printStackTrace(); + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + int index = tabbedPane.indexOfTab(key); + JLabel label = (JLabel) tabbedPane + .getComponentAt(index); + label + .setText(_("Could not load Dbus information for ") + + key + ":" + e.getMessage()); + } + }); + } + catch (final DBusExecutionException e) + { + e.printStackTrace(); + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + int index = tabbedPane.indexOfTab(key); + JLabel label = (JLabel) tabbedPane + .getComponentAt(index); + label + .setText(_("Could not load Dbus information for ") + + key + ":" + e.getMessage()); + } + }); + } + } + } + }; + final Thread thread = new Thread(loader); + thread.setName("DBus Loader"); + thread.start(); + } + + /* based on code from org.freedesktop.dbus.ListDBus */ + private DBusTableModel listDBusConnection(boolean users, boolean owners, + DBusConnection conn) throws DBusException + { + DBusTableModel model = new DBusTableModel(); + + DBus dbus = conn.getRemoteObject("org.freedesktop.DBus", + "/org/freedesktop/DBus", DBus.class); + String[] names = dbus.ListNames(); + + ParsingContext p = new ParsingContext(conn); + + for (String name : names) + { + List results = new ArrayList(); + try + { + //String objectpath = '/' + name.replace('.', '/'); + + + p.visitNode(name,"/"); + } + catch (DBusException e) + { + e.printStackTrace(); + } + catch (DBusExecutionException e) + { + e.printStackTrace(); + } catch (SAXException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + results = p.getResult(); + p.reset(); + + if (results.size()>0) { + if (users) try + { + final UInt32 user = dbus.GetConnectionUnixUser(name); + for (DBusEntry entry : results) { + entry.setUser(user); + } + } + catch (DBusExecutionException DBEe) + { + } + if (!name.startsWith(":") && owners) + { + try + { + final String owner = dbus.GetNameOwner(name); + for (DBusEntry entry : results) { + entry.setOwner(owner); + } + } + catch (DBusExecutionException DBEe) + { + } + } + for (DBusEntry entry : results) { + model.add(entry); + } + } + } + return model; + } + private final static String DOC_TYPE = ""; + + class ParsingContext { + private DBusConnection conn; + private DocumentBuilder builder; + private List result; + + ParsingContext(DBusConnection conn) { + this.conn = conn; + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try { + builder = factory.newDocumentBuilder(); + } catch (ParserConfigurationException e1) { + // TODO Auto-generated catch block + throw new RuntimeException(_("Error during parser init: ")+e1.getMessage(),e1); + } + reset(); + + } + + DBusEntry addEntry(String name, String path) throws DBusException { + DBusEntry entry = new DBusEntry(); + entry.setName(name); + entry.setPath(path); + Introspectable introspectable = conn.getRemoteObject(name, path, Introspectable.class); + entry.setIntrospectable(introspectable); + + result.add(entry); + + return entry; + } + + public void visitNode(String name, String path) throws DBusException, SAXException, IOException { + System.out.println("visit "+name+":"+path); + if ("/org/freedesktop/DBus/Local".equals(path)) { + // this will disconnects us. + return; + } + DBusEntry e = addEntry(name, path); + String introspectData = e.getIntrospectable().Introspect(); + + + Document document = builder.parse(new InputSource(new StringReader(introspectData.replace(DOC_TYPE, "")))); + Element root = document.getDocumentElement(); + + NodeList children = root.getChildNodes(); + for (int i=0;i getResult() { + return result; + } + + void reset() { + result = new ArrayList(); + } + + + } + + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/FileSaver.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/FileSaver.java new file mode 100755 index 0000000..789aa65 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/FileSaver.java @@ -0,0 +1,191 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import static org.freedesktop.dbus.Gettext._; + +import java.awt.Component; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.Iterator; + +import javax.swing.JOptionPane; + +final class FileSaver implements Runnable +{ + private static final String CANCEL = "Cancel"; + + private static final String SKIP_ALL = "Skip All"; + + private static final String SKIP = "Skip"; + + private static final String OVERWRITE = "Overwrite"; + + private static final String OVERWRITE_ALL = "Overwrite All"; + + private final File parentDirectory; + + private final Component parentComponent; + + private final Iterable textFiles; + + FileSaver(Component parentComponent, File parentDirectory, + Iterable files) + { + this.parentComponent = parentComponent; + this.parentDirectory = parentDirectory; + this.textFiles = files; + } + + /** {@inheritDoc} */ + public void run() + { + saveFiles(); + } + + private void saveFiles() + { + String overwritePolicy = null; + final Iterator iterator = textFiles.iterator(); + while (iterator.hasNext()) + { + final TextFile textFile = iterator.next(); + String fileName = textFile.getFileName(); + File fileToSave = new File(parentDirectory, fileName); + File parentFile = fileToSave.getParentFile(); + if (parentFile.exists() || parentFile.mkdirs()) + { + boolean doSave = !fileToSave.exists() + || OVERWRITE_ALL.equals(overwritePolicy); + if (!doSave && !SKIP_ALL.equals(overwritePolicy)) + { + String[] selectionValues; + if (iterator.hasNext()) + { + selectionValues = new String[] { OVERWRITE, + OVERWRITE_ALL, SKIP, SKIP_ALL, CANCEL }; + } + else + { + selectionValues = new String[] { OVERWRITE, CANCEL }; + } + int option = JOptionPane.showOptionDialog(parentComponent, + "File exists: " + fileName, "Save", + JOptionPane.YES_NO_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE, null, + selectionValues, null); + if (option == -1) + { + break; + } + overwritePolicy = selectionValues[option]; + if (CANCEL.equals(overwritePolicy)) + { + break; + } + + doSave = OVERWRITE.equals(overwritePolicy) + || OVERWRITE_ALL.equals(overwritePolicy); + } + if (doSave) + { + try + { + String contents = textFile.getContents(); + writeFile(fileToSave, contents); + } + catch (final IOException ex) + { + /* Can't access parent directory for saving */ + final String errorMessage = "Could not save " + + fileName + ": " + ex.getLocalizedMessage(); + if (iterator.hasNext()) + { + + int confirm = JOptionPane.showConfirmDialog( + parentComponent, errorMessage + + ".\n"+_("Try saving other files?"), + _("Save Failed"), + JOptionPane.OK_CANCEL_OPTION, + JOptionPane.ERROR_MESSAGE); + if (confirm != JOptionPane.OK_OPTION) + { + break; + } + } + else + { + JOptionPane.showMessageDialog(parentComponent, + errorMessage + ".", _("Save Failed"), + JOptionPane.ERROR_MESSAGE); + } + } + } + } + else + { + + final String errorMessage = _("Could not access parent directory for ") + + fileName; + if (iterator.hasNext()) + { + + int confirm = JOptionPane.showConfirmDialog( + parentComponent, errorMessage + + ".\n"+_("Try saving other files?"), + _("Save Failed"), JOptionPane.OK_CANCEL_OPTION, + JOptionPane.ERROR_MESSAGE); + if (confirm != JOptionPane.OK_OPTION) + { + break; + } + } + else + { + JOptionPane.showMessageDialog(parentComponent, errorMessage + + ".", _("Save Failed"), JOptionPane.ERROR_MESSAGE); + } + } + } + } + + /** + * @param fileToSave + * @param contents + * @throws IOException + */ + private void writeFile(File fileToSave, String contents) throws IOException + { + FileWriter fileWriter = null; + try + { + fileWriter = new FileWriter(fileToSave); + BufferedWriter writer = new BufferedWriter(fileWriter); + writer.append(contents); + writer.flush(); + } + finally + { + if (fileWriter != null) + { + try + { + fileWriter.close(); + } + catch (IOException e1) + { + } + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/IntrospectAction.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/IntrospectAction.java new file mode 100755 index 0000000..d2110e9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/IntrospectAction.java @@ -0,0 +1,148 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.io.StringReader; + +import javax.swing.AbstractAction; +import javax.swing.JButton; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; + +import org.freedesktop.DBus.Introspectable; +import org.freedesktop.dbus.bin.CreateInterface; + +@SuppressWarnings("serial") +final class IntrospectAction extends AbstractAction implements ListSelectionListener +{ + private final JTable table; + + IntrospectAction(JTable table) + { + super("Introspect"); + setEnabled(false); + this.table = table; + + + ListSelectionModel selectionModel = table.getSelectionModel(); + selectionModel.addListSelectionListener(this); + selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + } + + /** {@inheritDoc} */ + public void valueChanged(ListSelectionEvent e) + { + if (!e.getValueIsAdjusting()) + { + DBusTableModel model = (DBusTableModel) table.getModel(); + int selection = table.getSelectedRow(); + if (selection > -1 && selection < model.getRowCount()) + { + DBusEntry entry = model.getEntry(selection); + final Introspectable introspectable = entry.getIntrospectable(); + setEnabled(introspectable != null); + } + } + } + + /** {@inheritDoc} */ + public void actionPerformed(ActionEvent e) + { + + int row = table.getSelectedRow(); + DBusTableModel model = (DBusTableModel) table.getModel(); + if (row > -1 && row < model.getRowCount()) + { + DBusEntry entry = model.getEntry(row); + final String xmlFile = entry.getName() + ".xml"; + final Introspectable introspectable = entry.getIntrospectable(); + new Thread(new Runnable() + { + public void run() + { + + StringStreamFactory factory = new StringStreamFactory(); + CreateInterface createInterface = new CreateInterface(factory, false); + try + { + String xml = introspectable.Introspect(); + + String docType = ""; + + createInterface.createInterface(new StringReader(xml.replace(docType, ""))); + final JTabbedPane tabbedPane = new JTabbedPane(); + + tabbedPane.addTab(xmlFile, createSourceTab(xmlFile, xml)); + + for (String file : factory.streamMap.keySet()) + { + final String source = factory.streamMap.get(file).toString(); + + tabbedPane.addTab(file, createSourceTab(file, source)); + } + tabbedPane.setPreferredSize(new Dimension(600, 400)); + + final JPanel introspectionPanel = new JPanel(new BorderLayout()); + introspectionPanel.add(tabbedPane, BorderLayout.CENTER); + + JPanel southPanel = new JPanel(); + southPanel.add(new JButton(new SaveFileAction(tabbedPane))); + southPanel.add(new JButton(new SaveAllAction(tabbedPane))); + introspectionPanel.add(southPanel, BorderLayout.SOUTH); + + SwingUtilities.invokeLater(new Runnable() + { + @SuppressWarnings("synthetic-access") + public void run() + { + JOptionPane.showMessageDialog(table, introspectionPanel, "Introspection", JOptionPane.PLAIN_MESSAGE); + } + }); + + } + catch (final Exception e) + { + e.printStackTrace(); + SwingUtilities.invokeLater(new Runnable() + { + @SuppressWarnings("synthetic-access") + public void run() + { + JOptionPane.showMessageDialog(table, e.getMessage(), "Introspection Failed", JOptionPane.ERROR_MESSAGE); + } + }); + } + } + + private JScrollPane createSourceTab(String file, final String source) + { + JTextArea area = new JTextArea(source); + area.setLineWrap(true); + area.setWrapStyleWord(true); + return new JScrollPane(area, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + } + }).start(); + + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveAllAction.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveAllAction.java new file mode 100755 index 0000000..d8bfb19 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveAllAction.java @@ -0,0 +1,62 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import javax.swing.JTabbedPane; + +@SuppressWarnings("serial") +class SaveAllAction extends TabbedSaveAction +{ + + private class TabIterator implements Iterator + { + private int i = 0; + /** {@inheritDoc} */ + public boolean hasNext() + { + return i < tabbedPane.getTabCount(); + } + + /** {@inheritDoc} */ + public TextFile next() + { + if (hasNext()) + { + int currentIndex = i; + i++; + return getTextFile(currentIndex); + } + throw new NoSuchElementException(); + } + + /** {@inheritDoc} */ + public void remove() + { + throw new UnsupportedOperationException(); + } + + } + + protected SaveAllAction(JTabbedPane tabbedPane) + { + super(tabbedPane, "Save All..."); + } + + /** {@inheritDoc} */ + public Iterator iterator() + { + return new TabIterator(); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveFileAction.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveFileAction.java new file mode 100755 index 0000000..487e22d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/SaveFileAction.java @@ -0,0 +1,85 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import static org.freedesktop.dbus.Gettext._; + +import java.util.Iterator; +import java.util.NoSuchElementException; + +import javax.swing.Action; +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; + +@SuppressWarnings("serial") +class SaveFileAction extends TabbedSaveAction implements ChangeListener +{ + private class SelectedTabIterator implements Iterator + { + boolean iterated = false; + /** {@inheritDoc} */ + public boolean hasNext() + { + return !iterated; + } + + /** {@inheritDoc} */ + public TextFile next() + { + if (iterated) + { + throw new NoSuchElementException(_("Already iterated")); + } + iterated = true; + return getTextFile(tabbedPane.getSelectedIndex()); + } + + /** {@inheritDoc} */ + public void remove() + { + throw new UnsupportedOperationException(); + } + + } + + SaveFileAction(JTabbedPane tabbedPane) + { + super(tabbedPane); + + enableAndSetName(); + + tabbedPane.addChangeListener(this); + } + + /** {@inheritDoc} */ + public void stateChanged(ChangeEvent e) + { + enableAndSetName(); + } + + /** + * Enable and set the name of the action based on the shown tab + */ + void enableAndSetName() + { + int selectedIndex = tabbedPane.getSelectedIndex(); + boolean enabled = selectedIndex > -1; + putValue(Action.NAME, _("Save ") + getFileName(selectedIndex) + "..."); + setEnabled(enabled); + } + + /** {@inheritDoc} */ + public Iterator iterator() + { + return new SelectedTabIterator(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/StringStreamFactory.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/StringStreamFactory.java new file mode 100755 index 0000000..b8c28ab --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/StringStreamFactory.java @@ -0,0 +1,47 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.HashMap; +import java.util.Map; + +import org.freedesktop.dbus.bin.CreateInterface.PrintStreamFactory; + +/** + * A factory using a byte array input stream + * + * + * @author pete + * @since 10/02/2006 + */ +final class StringStreamFactory extends PrintStreamFactory +{ + Map streamMap = new HashMap(); + + /** {@inheritDoc} */ + public void init(String file, String path) + { + + } + + /** {@inheritDoc} */ + @SuppressWarnings("unused") + public PrintStream createPrintStream(final String file) throws IOException + { + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + streamMap.put(file, stream); + return new PrintStream(stream); + + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TabbedSaveAction.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TabbedSaveAction.java new file mode 100755 index 0000000..1f49c6a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TabbedSaveAction.java @@ -0,0 +1,108 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +import static org.freedesktop.dbus.Gettext._; + +import java.awt.event.ActionEvent; +import java.io.File; + +import javax.swing.AbstractAction; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTabbedPane; +import javax.swing.text.JTextComponent; + +abstract class TabbedSaveAction extends AbstractAction implements Iterable +{ + /** File chooser component. + * Make static so that previous save location is stored + */ + private static JFileChooser chooser; + protected final JTabbedPane tabbedPane; + protected TabbedSaveAction(JTabbedPane tabbedPane) + { + super(); + this.tabbedPane = tabbedPane; + } + protected TabbedSaveAction(JTabbedPane tabbedPane, String name) + { + super(name); + this.tabbedPane = tabbedPane; + } + + /** Get the text file object associated with the supplied index + * @param index The tabbed pane index + * @return The text file object for the referenced tab + */ + protected TextFile getTextFile(int index) + { + JScrollPane scrollPane = (JScrollPane) tabbedPane.getComponentAt(index); + JTextComponent textComponent = (JTextComponent) scrollPane.getViewport().getView(); + final String sourceCode = textComponent.getText(); + + + + final String fileName = getFileName(index); + + + TextFile textFile = new TextFile(fileName, sourceCode); + return textFile; + } + + + /** Get the file name for the supplied index + * @param index The tabbed pane index + * @return The file name for the referenced tab + */ + protected String getFileName(int index) + { + return (index > -1) ? tabbedPane.getTitleAt(index) : ""; + } + + /** {@inheritDoc} */ + public final void actionPerformed(ActionEvent e) + { + + if (chooser == null) + { + /** Occurs on event dispatch thread, so no problems with lazy static init here */ + chooser = new JFileChooser(); + } + chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + chooser.setDialogTitle(_("Select parent directory for saving")); + + int result = chooser.showDialog(tabbedPane, "Select"); + + if (result == JFileChooser.APPROVE_OPTION) + { + File parentDirectory = chooser.getSelectedFile(); + if (parentDirectory.exists() || parentDirectory.mkdirs()) + { + if (parentDirectory.canWrite()) + { + Runnable runnable = new FileSaver(tabbedPane, parentDirectory, this); + + new Thread(runnable).start(); + } + else + { + JOptionPane.showMessageDialog(tabbedPane, _("Could not write to parent directory"), _("Invalid Parent Directory"), JOptionPane.ERROR_MESSAGE); + } + } + else + { + JOptionPane.showMessageDialog(tabbedPane, _("Could not access parent directory"), _("Invalid Parent Directory"), JOptionPane.ERROR_MESSAGE); + } + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TextFile.java b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TextFile.java new file mode 100755 index 0000000..ecff9a7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/org/freedesktop/dbus/viewer/TextFile.java @@ -0,0 +1,49 @@ +/* + D-Bus Java Viewer + Copyright (c) 2006 Peter Cox + + This program is free software; you can redistribute it and/or modify it + under the terms of either the GNU Lesser General Public License Version 2 or the + Academic Free Licence Version 2.1. + + Full licence texts are included in the COPYING file with this program. +*/ +package org.freedesktop.dbus.viewer; + +/** A Text file abstraction + * + * + * @author pete + * @since 10/02/2006 + */ +class TextFile +{ + final String fileName; + final String contents; + /** Create the TextFile + * + * @param fileName The file name + * @param contents The contents + */ + public TextFile(String fileName, String contents) + { + this.fileName = fileName; + this.contents = contents; + } + /** Retrieve the fileName + * + * @return The fileName. + */ + String getFileName() + { + return fileName; + } + /** Retrieve the contents + * + * @return The contents. + */ + String getContents() + { + return contents; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/tmp-session.conf b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/tmp-session.conf new file mode 100755 index 0000000..61279f0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/tmp-session.conf @@ -0,0 +1,31 @@ + + + + + + session + + unix:path=./tmp-session-bus + + + /usr/share/dbus-1/services + + + + + + + + + + + + session-local.conf + + contexts/dbus_contexts + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/translations/en_GB.po b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/translations/en_GB.po new file mode 100755 index 0000000..d619633 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.dbus-java/src/main/java/translations/en_GB.po @@ -0,0 +1,213 @@ +#java-format +msgid " is not a basic type" +msgstr " is not a basic type" +msgid " is not an object provided by this process." +msgstr " is not an object provided by this process." +msgid "Already iterated" +msgstr "Already iterated" +msgid "An error occurred while calling " +msgstr "An error occurred while calling " +msgid "Array index out of bounds, paofs={0}, pabuf.length={1}, buf.length={2}." +msgstr "Array index out of bounds, paofs={0}, pabuf.length={1}, buf.length={2}." +msgid "Arrays must not exceed " +msgstr "Arrays must not exceed " +msgid "Async call has not had a reply" +msgstr "Async call has not had a reply" +msgid "Bus address is blank" +msgstr "Bus address is blank" +msgid "Bus address is invalid: " +msgstr "Bus address is invalid: " +msgid "Can't wrap Null in a Variant" +msgstr "Can't wrap Null in a Variant" +msgid "Can't wrap a multi-valued type in a Variant: " +msgstr "Can't wrap a multi-valued type in a Variant: " +msgid "Can't wrap multiple or no types in a Variant: " +msgstr "Can't wrap multiple or no types in a Variant: " +msgid "Can't wrap {0} in an unqualified Variant ({1})." +msgstr "Can't wrap {0} in an unqualified Variant ({1})." +msgid "Cannot Resolve Session Bus Address" +msgstr "Cannot Resolve Session Bus Address" +msgid "Cannot watch for signals based on well known bus name as source, only unique names." +msgstr "Cannot watch for signals based on well known bus name as source, only unique names." +msgid "Connection has already sent a Hello message" +msgstr "Connection has already sent a Hello message" +msgid "Could not access parent directory for " +msgstr "Could not access parent directory for " +msgid "Could not create class from signal " +msgstr "Could not create class from signal " +msgid "Could not find an interface to cast to" +msgstr "Could not find an interface to cast to" +msgid "Could not load Dbus information for " +msgstr "Could not load Dbus information for " +msgid "DBusInterfaces cannot be declared outside a package" +msgstr "DBusInterfaces cannot be declared outside a package" +msgid "DBusInterfaces must be defined in a package." +msgstr "DBusInterfaces must be defined in a package." +msgid "Disconnected" +msgstr "Disconnected" +msgid "ERROR: Could not find introspection file: " +msgstr "ERROR: Could not find introspection file: " +msgid "ERROR: Expected {0}, got {1}, failed." +msgstr "ERROR: Expected {0}, got {1}, failed." +msgid "ERROR: Failed to get introspection data" +msgstr "ERROR: Failed to get introspection data" +msgid "ERROR: Failure in DBus Communications: " +msgstr "ERROR: Failure in DBus Communications: " +msgid "ERROR: Interface name was blank, failed" +msgstr "ERROR: Interface name was blank, failed" +msgid "ERROR: Method name was blank, failed" +msgstr "ERROR: Method name was blank, failed" +msgid "ERROR: Unknown node: " +msgstr "ERROR: Unknown node: " +msgid "ERROR: Unknown option: " +msgstr "ERROR: Unknown option: " +msgid "Error Executing Method {0}.{1}: {2}" +msgstr "Error Executing Method {0}.{1}: {2}" +msgid "Error deserializing message: number of parameters didn't match receiving signature" +msgstr "Error deserializing message: number of parameters didn't match receiving signature" +msgid "Error during parser init: " +msgstr "Error during parser init: " +msgid "Exporting non-exportable parameterized type " +msgstr "Exporting non-exportable parameterized type " +msgid "Exporting non-exportable type " +msgstr "Exporting non-exportable type " +msgid "Failed to add signal parameters: " +msgstr "Failed to add signal parameters: " +msgid "Failed to auth" +msgstr "Failed to auth" +msgid "Failed to connect to bus " +msgstr "Failed to connect to bus " +msgid "Failed to construct D-Bus type: " +msgstr "Failed to construct D-Bus type: " +msgid "Failed to construct outgoing method call: " +msgstr "Failed to construct outgoing method call: " +msgid "Failed to create proxy object for {0} exported by {1}. Reason: {2}" +msgstr "Failed to create proxy object for {0} exported by {1}. Reason: {2}" +msgid "Failed to create proxy object for {0}; reason: {1}." +msgstr "Failed to create proxy object for {0}; reason: {1}." +msgid "Failed to parse DBus type signature: " +msgstr "Failed to parse DBus type signature: " +msgid "Failed to parse DBus type signature: {0} ({1})." +msgstr "Failed to parse DBus type signature: {0} ({1})." +msgid "Failed to register bus name" +msgstr "Failed to register bus name" +msgid "Failure in de-serializing message: " +msgstr "Failure in de-serializing message: " +msgid "Introspected interface name exceeds 255 characters. Cannot export objects of type " +msgstr "Introspected interface name exceeds 255 characters. Cannot export objects of type " +msgid "Introspected method name exceeds 255 characters. Cannot export objects with method " +msgstr "Introspected method name exceeds 255 characters. Cannot export objects with method " +msgid "Introspected signal name exceeds 255 characters. Cannot export objects with signals of type " +msgstr "Introspected signal name exceeds 255 characters. Cannot export objects with signals of type " +msgid "Invalid Bus Type: " +msgstr "Invalid Bus Type: " +msgid "Invalid Command " +msgstr "Invalid Command " +msgid "Invalid Parent Directory" +msgstr "Invalid Parent Directory" +msgid "Invalid bus name" +msgstr "Invalid bus name" +msgid "Invalid bus name: " +msgstr "Invalid bus name: " +msgid "Invalid bus name: null" +msgstr "Invalid bus name: null" +msgid "Invalid object path: " +msgstr "Invalid object path: " +msgid "Invalid object path: null" +msgstr "Invalid object path: null" +msgid "Invalid type for match rule: " +msgstr "Invalid type for match rule: " +msgid "Map must have 2 parameters" +msgstr "Map must have 2 parameters" +msgid "Message Failed to Send: " +msgstr "Message Failed to Send: " +msgid "Message type {0} unsupported" +msgstr "Message type {0} unsupported" +msgid "Multi-valued array types not permitted" +msgstr "Multi-valued array types not permitted" +msgid "Must Specify an Object Path" +msgstr "Must Specify an Object Path" +msgid "Must specify destination, path and function name to MethodCalls." +msgstr "Must specify destination, path and function name to MethodCalls." +msgid "Must specify error name to Errors." +msgstr "Must specify error name to Errors." +msgid "Must specify object path, interface and signal name to Signals." +msgstr "Must specify object path, interface and signal name to Signals." +msgid "No reply within specified time" +msgstr "No reply within specified time" +msgid "No transport present" +msgstr "No transport present" +msgid "Not A DBus Interface" +msgstr "Not A DBus Interface" +msgid "Not A DBus Signal" +msgstr "Not A DBus Signal" +msgid "Not An Expected Convertion type from {0} to {1}" +msgstr "Not An Expected Convertion type from {0} to {1}" +msgid "Not Connected" +msgstr "Not Connected" +msgid "Not a primitive type" +msgstr "Not a primitive type" +msgid "Not a valid D-Bus type code: " +msgstr "Not a valid D-Bus type code: " +msgid "Not a wrapper type" +msgstr "Not a wrapper type" +msgid "Not an array" +msgstr "Not an array" +msgid "Not an object exported by this connection and no remote specified" +msgstr "Not an object exported by this connection and no remote specified" +msgid "Not enough elements to create custom object from serialized data ({0} < {1})." +msgstr "Not enough elements to create custom object from serialized data ({0} < {1})." +msgid "Object already exported" +msgstr "Object already exported" +msgid "Primative array being sent as non-primative array." +msgstr "Primative array being sent as non-primative array." +msgid "Processing DBus for " +msgstr "Processing DBus for " +msgid "Protocol version {0} is unsupported" +msgstr "Protocol version {0} is unsupported" +msgid "Return type of Object[] cannot be introspected properly" +msgstr "Return type of Object[] cannot be introspected properly" +msgid "Save " +msgstr "Save " +msgid "Save Failed" +msgstr "Save Failed" +msgid "Select parent directory for saving" +msgstr "Select parent directory for saving" +msgid "Sending message failed" +msgstr "Sending message failed" +msgid "Serializable classes must implement a deserialize method" +msgstr "Serializable classes must implement a deserialize method" +msgid "Serializable classes must serialize to native DBus types" +msgstr "Serializable classes must serialize to native DBus types" +msgid "Signals must be declared as a member of a class implementing DBusInterface which is the member of a package." +msgstr "Signals must be declared as a member of a class implementing DBusInterface which is the member of a package." +msgid "Spurious reply. No message with the given serial id was awaiting a reply." +msgstr "Spurious reply. No message with the given serial id was awaiting a reply." +msgid "System does not support UTF-8 encoding" +msgstr "System does not support UTF-8 encoding" +msgid "The method `{0}.{1}' does not exist on this object." +msgstr "The method `{0}.{1}' does not exist on this object." +msgid "The name `{0}' does not exist" +msgstr "The name `{0}' does not exist" +msgid "This service does not support " +msgstr "This service does not support " +msgid "Try saving other files?" +msgstr "Try saving other files?" +msgid "Trying to marshall to unconvertable type (from {0} to {1})." +msgstr "Trying to marshall to unconvertable type (from {0} to {1})." +msgid "Underlying transport returned EOF" +msgstr "Underlying transport returned EOF" +msgid "Waiting for: " +msgstr "Waiting for: " +msgid "Wrong return type (failed to de-serialize correct types: {0} )" +msgstr "Wrong return type (failed to de-serialize correct types: {0} )" +msgid "Wrong return type (got void, expected a value)" +msgstr "Wrong return type (got void, expected a value)" +msgid "Wrong return type (not expecting Tuple)" +msgstr "Wrong return type (not expecting Tuple)" +msgid "You must send a Hello message" +msgstr "You must send a Hello message" +msgid "unknown address type " +msgstr "unknown address type " +msgid "{0} is not between {1} and {2}." +msgstr "{0} is not between {1} and {2}." diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.classpath b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.classpath new file mode 100755 index 0000000..f197180 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.classpath @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.project b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.project new file mode 100755 index 0000000..07b56fe --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/.project @@ -0,0 +1,17 @@ + + + org.genivi.trafficinfo.demo + This project contains general classes used for demo's. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + com.soyatec.additional.Builder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/ReadMe.confluence new file mode 100755 index 0000000..a6c61ec --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/ReadMe.confluence @@ -0,0 +1,24 @@ +{toc:minLevel=2} + +h1. Introduction +This project contains components which can be used in demo's and prototypes. + +h1. Communication Channel + +What communication channels have in common, is that someone receives data. Therefore there is a common interace DataReceptionListener, which is to be implemented by a client that receives the data. +Based on this interface specific communication channels can be defined. For now there are a broadcast channel and an asynchronous two-way communication channel. The following diagram gives an overview. + +!uml/CommunicationChannel.png! + +h2. Broadcast Channel +In case of a broadcast there is one sending side and any number of clients can receive the data. + +h3. Sending side +For the sending side there's the interface Broadcast. This has just one method broadcast(Object object). + +h3. Receiving side +For the receiving side, there's the interface BroadcastReception. Via this interface a client can register (and unregister) itself for receiving any broadcasted data. The actual data is received via the dataReceived(Object object) method of the DataReceptionListener interface. + +h1. Logging +Class EclipseConsoleFormatter is a formatter, which creates a link to the Java code in Console output. Example:\\ +BroadcastFrameworkImplementation: nothing to broadcast +(BroadcastFrameworkImplementation.java:72)+ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/pom.xml b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/pom.xml new file mode 100755 index 0000000..d208541 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/pom.xml @@ -0,0 +1,22 @@ + + + 4.0.0 + org.genivi.trafficinfo + demo + jar + 1.0-SNAPSHOT + GENIVI Demo Related Classes + This project contains general classes used for demo's. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + + src + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/DataReceptionListener.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/DataReceptionListener.java new file mode 100755 index 0000000..1dcabe7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/DataReceptionListener.java @@ -0,0 +1,14 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel; + +public interface DataReceptionListener { + public void dataReceived(Object data); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelClient.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelClient.java new file mode 100755 index 0000000..19ff33c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelClient.java @@ -0,0 +1,16 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel; + + +public interface Async2WayCommunicationChannelClient { + public long sendRequest(String address, Object data, Async2WayCommunicationChannelDataReceptionListener responseListener); + +} \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelDataReceptionListener.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelDataReceptionListener.java new file mode 100755 index 0000000..bc63ba3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelDataReceptionListener.java @@ -0,0 +1,14 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel; + +public interface Async2WayCommunicationChannelDataReceptionListener { + public void dataReceived(long messageId, Object data); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelServer.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelServer.java new file mode 100755 index 0000000..38d5a6d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/Async2WayCommunicationChannelServer.java @@ -0,0 +1,21 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel; + + +public interface Async2WayCommunicationChannelServer { + public void sendResponse(long messageId, Object data); + + public void addRequestListener(String address, Async2WayCommunicationChannelDataReceptionListener requestListener); + + public void removeRequestListener(String address); + + public void removeRequestListener(Async2WayCommunicationChannelDataReceptionListener requestListener); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/impl/DummyAsyn2WayCommunicationChannel.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/impl/DummyAsyn2WayCommunicationChannel.java new file mode 100755 index 0000000..cc0f9be --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/async2waycommchannel/impl/DummyAsyn2WayCommunicationChannel.java @@ -0,0 +1,83 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel.impl; + +import java.util.HashMap; +import java.util.Map; + +import org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel.Async2WayCommunicationChannelClient; +import org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel.Async2WayCommunicationChannelDataReceptionListener; +import org.genivi.trafficinfo.demo.communicationchannel.async2waycommchannel.Async2WayCommunicationChannelServer; + + +public class DummyAsyn2WayCommunicationChannel implements Async2WayCommunicationChannelClient, Async2WayCommunicationChannelServer { + private static DummyAsyn2WayCommunicationChannel broadcastChannel = null; + + private Map requestListeners = + new HashMap(); + private Map openRequests = + new HashMap(); + private long nextMessageId = 1l; + + public static DummyAsyn2WayCommunicationChannel getInstance() { + if (broadcastChannel == null) { + broadcastChannel = new DummyAsyn2WayCommunicationChannel(); + } + + return broadcastChannel; + } + + @Override + public void addRequestListener(String address, Async2WayCommunicationChannelDataReceptionListener requestListener) { + requestListeners.put(address, requestListener); + } + + public void removeRequestListener(String address) { + requestListeners.remove(address); + } + + public void removeRequestListener(Async2WayCommunicationChannelDataReceptionListener requestListener) { + for (String address: requestListeners.keySet()) { + if (requestListeners.get(address).equals(requestListener)) { + requestListeners.remove(address); + } + } + } + + @Override + public long sendRequest(String address, Object data, Async2WayCommunicationChannelDataReceptionListener responseListener) { + Async2WayCommunicationChannelDataReceptionListener requestListener = getRequestListenerForAddress(address); + if (requestListener == null) { + throw new RuntimeException("No request listener for request sent to address: " + address); + } + long messageId = generateMessageId(); + openRequests.put(messageId, responseListener); + requestListener.dataReceived(messageId, data); + System.out.println("DummyAsyn2WayCommunicationChannel: sending request"); + + return messageId; + } + + + @Override + public void sendResponse(long messageId, Object data) { + System.out.println("DummyAsyn2WayCommunicationChannel: sending response"); + Async2WayCommunicationChannelDataReceptionListener dataReceptionListener = openRequests.remove(messageId); + dataReceptionListener.dataReceived(messageId, data); + } + + private long generateMessageId() { + return nextMessageId++; + } + + private Async2WayCommunicationChannelDataReceptionListener getRequestListenerForAddress(String address) { + return requestListeners.get(address); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/Broadcast.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/Broadcast.java new file mode 100755 index 0000000..937f7d0 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/Broadcast.java @@ -0,0 +1,15 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel; + +public interface Broadcast { +// public void broadcast(byte[] data); + public void broadcast(Object data); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/BroadcastReception.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/BroadcastReception.java new file mode 100755 index 0000000..eb41cc1 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/BroadcastReception.java @@ -0,0 +1,17 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel; + +import org.genivi.trafficinfo.demo.communicationchannel.DataReceptionListener; + +public interface BroadcastReception { + public void addBroadcastReceptionListener(DataReceptionListener broadcastReceptionListener); + public void removeBroadcastReceptionListener(DataReceptionListener broadcastReceptionListener); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/impl/DummyBroadcastChannel.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/impl/DummyBroadcastChannel.java new file mode 100755 index 0000000..fac8a76 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/communicationchannel/broadcastchannel/impl/DummyBroadcastChannel.java @@ -0,0 +1,65 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.genivi.trafficinfo.demo.communicationchannel.DataReceptionListener; +import org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.Broadcast; +import org.genivi.trafficinfo.demo.communicationchannel.broadcastchannel.BroadcastReception; + + +public class DummyBroadcastChannel implements Broadcast, BroadcastReception { + private final static Logger LOGGER = Logger.getLogger(DummyBroadcastChannel.class.getName()); + + private static DummyBroadcastChannel broadcastChannel = null; + + private List broadcastReceptionListeners = new ArrayList(); + + private DummyBroadcastChannel() { + LOGGER.setLevel(Level.SEVERE); + } + + public static DummyBroadcastChannel getInstance() { + if (broadcastChannel == null) { + broadcastChannel = new DummyBroadcastChannel(); + } + + return broadcastChannel; + } + + @Override + public void broadcast(Object data) { + LOGGER.info("DummyBroadcastChannel going to broadcasting data"); + for (DataReceptionListener broadcastReceptionListener: broadcastReceptionListeners) { + broadcastReceptionListener.dataReceived(data); + } + } + + @Override + public void addBroadcastReceptionListener( + DataReceptionListener broadcastReceptionListener) { + broadcastReceptionListeners.add(broadcastReceptionListener); + + LOGGER.info("DataReceptionListenerAdded(" + + broadcastReceptionListener.getClass().getName() + + ") : number of listeners = " + broadcastReceptionListeners.size()); + } + + @Override + public void removeBroadcastReceptionListener( + DataReceptionListener broadcastReceptionListener) { + broadcastReceptionListeners.remove(broadcastReceptionListener); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatter.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatter.java new file mode 100755 index 0000000..59b1f4e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatter.java @@ -0,0 +1,75 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.logging; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.logging.LogRecord; +import java.util.logging.SimpleFormatter; + +public class EclipseConsoleFormatter extends SimpleFormatter { + private final static String LOGGER = "java.util.logging.Logger"; + private static final String NEW_LINE = System.getProperty("line.separator"); + + @Override + public String format(LogRecord record) { + String fileName = null; + String className = null; + String methodName = null; + int lineNumber = -1; + + boolean loggerFound = false; + for ( StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace() ) { + className = stackTraceElement.getClassName(); + + if (!loggerFound) { + if (className.equals(LOGGER)) { + loggerFound = true; + continue; + } + } + + + if (loggerFound && !className.equals(LOGGER)) { + className = className.substring(className.lastIndexOf(".") + 1); + fileName = stackTraceElement.getFileName(); + methodName = stackTraceElement.getMethodName(); + lineNumber = stackTraceElement.getLineNumber(); + break; + } + } + + StringBuilder buf = new StringBuilder(); + buf.append(className); + buf.append("."); + buf.append(methodName); + buf.append(": "); + buf.append(formatMessage(record)); + + if (record.getThrown() != null) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + pw.println(); + record.getThrown().printStackTrace(pw); + pw.close(); + buf.append(sw.toString()); + } + + buf.append(" ("); + buf.append(fileName); + buf.append(":"); + buf.append(lineNumber); + buf.append(")"); + buf.append(NEW_LINE); + + return buf.toString(); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatterDemo.java b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatterDemo.java new file mode 100755 index 0000000..f7f71c8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/src/org/genivi/trafficinfo/demo/logging/EclipseConsoleFormatterDemo.java @@ -0,0 +1,43 @@ +/** + * + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ +package org.genivi.trafficinfo.demo.logging; + +import java.util.logging.Handler; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class EclipseConsoleFormatterDemo { + private final static Logger LOGGER = Logger.getLogger(EclipseConsoleFormatterDemo.class.getName()); + + public static void main(String args[]) { + EclipseConsoleFormatterDemo logTest = new EclipseConsoleFormatterDemo(); + logTest.logSetup(); + logTest.writeOutput(); + } + + private void logSetup() { + // Create Logger + Logger logger = Logger.getLogger(""); + logger.setLevel(Level.INFO); + + Handler consoleHandler = null; + for (Handler handler: logger.getHandlers()) { + if (handler.getClass().getName().equals("java.util.logging.ConsoleHandler")) { + consoleHandler = handler; + break; + } + } + consoleHandler.setFormatter(new EclipseConsoleFormatter()); + } + + private void writeOutput() { + LOGGER.info("Where am I?"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.demo/uml/CommunicationChannel.png b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/uml/CommunicationChannel.png new file mode 100755 index 0000000..7e24908 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo.demo/uml/CommunicationChannel.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.classpath b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.classpath new file mode 100755 index 0000000..7a338a5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.classpath @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.project b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.project new file mode 100755 index 0000000..30387d7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/.project @@ -0,0 +1,14 @@ + + + org.genivi.trafficinfo.libmatthew + Copy of libmatthew for easy testing. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/ReadMe.confluence new file mode 100755 index 0000000..27e5dc5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/ReadMe.confluence @@ -0,0 +1,4 @@ +This is an unmodified copy of the 'libmatthew' project by Matthew Johnson. +This project is copied here as it is used by the dbus-java project. + +The original project can be found at http://dbus.freedesktop.org/ \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/pom.xml b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/pom.xml new file mode 100755 index 0000000..71dcf04 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + org.genivi.trafficinfo + libmatthew + jar + 1.0-SNAPSHOT + GENIVI libmatthew copy + Copy of libmatthew for easy testing + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + + src/main/java + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/COPYING b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/COPYING new file mode 100755 index 0000000..75300cc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/COPYING @@ -0,0 +1,21 @@ +These Java libraries are Copyright Matthew Johnson 2006-2011 and are licenced +under the terms of the Expat license: + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/INSTALL b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/INSTALL new file mode 100755 index 0000000..d94da85 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/INSTALL @@ -0,0 +1,10 @@ +libmatthew-java installation guide +----------------------------- + +To compile libmatthew-java you will need a Java 1.4 or better JDK, and a +standard unix build environment including a C compiler. + +The libraries can be compiled and installed with `make' and `make install' +respectively. By default they will be installed into /usr/local/share/java and +/usr/local/lib/jni. This location can be configured by giving PREFIX, JARDIR +and LIBDIR variables to make. diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/Makefile b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/Makefile new file mode 100755 index 0000000..03c2e8a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/Makefile @@ -0,0 +1,142 @@ +JAVAC?=javac +JAVADOC?=javadoc +JAR?=jar +JAVAH?=javah +GCJ?=gcj +CC?=gcc +LD?=gcc +JPPFLAGS+=-C -P +CFLAGS+=-Wall -Os -pedantic -Werror +CSTD?=-std=c99 +CSHAREFLAG+=-fpic -fno-stack-protector +GCJJNIFLAG=-fjni +JVERCFLAGS+=-source 1.5 +JCFLAGS+= +INCLUDES+=-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux +JAVADOCFLAGS?=-quiet -author -link http://java.sun.com/j2se/1.4.2/docs/api/ + +LDVER?=$(shell ld -v | cut -d' ' -f1) +UNAME?=$(shell uname -s) + +ifeq ($(LDVER),GNU) +LDSHAREFLAGS+=-fpic -shared +else +LDSHAREFLAGS+=-lc +endif + +PREFIX?=/usr/local +JARDIR?=$(PREFIX)/share/java +DOCDIR?=$(PREFIX)/share/doc/libmatthew-java/ +LIBDIR?=$(PREFIX)/lib/jni + +MATTVER=0.8 +DEBUGVER=1.1 +UNIXVER=0.5 +CGIVER=0.6 +IOVER=0.1 +HEXVER=0.2 + +SRC=$(shell find cx -name '*.java' -and -not -name 'Debug.java') + +DEBUG?=disable + +.NOPARALLEL: +.NO_PARALLEL: +.NOTPARALLEL: + +all: unix-$(UNIXVER).jar cgi-$(CGIVER).jar debug-enable-$(DEBUGVER).jar debug-disable-$(DEBUGVER).jar io-$(IOVER).jar hexdump-$(HEXVER).jar libcgi-java.so libunix-java.so + +classes: .classes +.classes: $(SRC) + mkdir -p classes + $(MAKE) .$(DEBUG)debug + $(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -d classes -cp classes $^ + touch .classes +clean: + rm -rf classes doc + rm -f .classes .enabledebug .disabledebug *.o *.h *.so *.tar.gz *.jar *.cgi Manifest + rm -rf libmatthew-java-$(MATTVER) + +cgi-$(CGIVER).jar: .classes + (cd classes; $(JAR) cf ../$@ cx/ath/matthew/cgi/*class) +io-$(IOVER).jar: .classes + (cd classes; $(JAR) cf ../$@ cx/ath/matthew/io/*class) +unix-$(UNIXVER).jar: .classes +ifeq ($(DEBUG),enable) + echo "Class-Path: $(JARDIR)/debug-$(DEBUG).jar" > Manifest +else + echo "Class-Path: " > Manifest +endif + (cd classes; $(JAR) cfm ../$@ ../Manifest cx/ath/matthew/unix/*class) + +hexdump-$(HEXVER).jar: .classes + (cd classes; $(JAR) cf ../$@ cx/ath/matthew/utils/Hexdump.class) + +%.o: %.c %.h + $(CC) $(CFLAGS) $(CSTD) $(CSHAREFLAG) $(INCLUDES) -c -o $@ $< +lib%.so: %.o + $(CC) $(LDFLAGS) $(LDSHAREFLAGS) -o $@ $< +unix-java.h: .classes + $(JAVAH) -classpath classes -o $@ cx.ath.matthew.unix.UnixServerSocket cx.ath.matthew.unix.UnixSocket cx.ath.matthew.unix.USInputStream cx.ath.matthew.unix.USOutputStream +cgi-java.h: .classes + $(JAVAH) -classpath classes -o $@ cx.ath.matthew.cgi.CGI + +test.cgi: cgi-$(CGIVER).jar libcgi-java.so + $(GCJ) $(GCJFLAGS) $(GCJJNIFLAG) -L. -lcgi-java -o test.cgi --main=cx.ath.matthew.cgi.testcgi cgi-$(CGIVER).jar + +libmatthew-java-$(MATTVER).tar.gz: Makefile cx cgi-java.c unix-java.c README INSTALL COPYING changelog + mkdir -p libmatthew-java-$(MATTVER) + cp -a $^ libmatthew-java-$(MATTVER) + tar zcf $@ libmatthew-java-$(MATTVER) + +debug-enable-$(DEBUGVER).jar: cx/ath/matthew/debug/Debug.jpp + make .enabledebug + echo "Class-Path: $(JARDIR)/hexdump.jar" > Manifest + (cd classes;jar cfm ../$@ ../Manifest cx/ath/matthew/debug/*.class) +debug-disable-$(DEBUGVER).jar: cx/ath/matthew/debug/Debug.jpp + make .disabledebug + echo "Class-Path: $(JARDIR)/hexdump.jar" > Manifest + (cd classes;jar cfm ../$@ ../Manifest cx/ath/matthew/debug/*.class) +.enabledebug: cx/ath/matthew/debug/Debug.jpp + mkdir -p classes + cpp $(PPFLAGS) $(JPPFLAGS) -DDEBUGSETTING=true < cx/ath/matthew/debug/Debug.jpp > cx/ath/matthew/debug/Debug.java + $(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -cp classes -d classes cx/ath/matthew/debug/Debug.java cx/ath/matthew/utils/Hexdump.java + rm -f .disabledebug + touch .enabledebug +.disabledebug: cx/ath/matthew/debug/Debug.jpp + mkdir -p classes + cpp $(PPFLAGS) $(JPPFLAGS) -DDEBUGSETTING=false < cx/ath/matthew/debug/Debug.jpp > cx/ath/matthew/debug/Debug.java + $(JAVAC) $(JVERCFLAGS) $(JCFLAGS) -cp classes -d classes cx/ath/matthew/debug/Debug.java cx/ath/matthew/utils/Hexdump.java + rm -f .enabledebug + touch .disabledebug +cx/ath/matthew/debug/Debug.java: .disabledebug +doc/index.html: + $(JAVADOC) $(JAVADOCFLAGS) -d doc/ cx/ath/matthew/debug/Debug.java $(SRC) + +doc: doc/index.html + +install-doc: doc/index.html + install -d $(DESTDIR)$(DOCDIR) + cp -a doc $(DESTDIR)$(DOCDIR)/api + +install-native: libcgi-java.so libunix-java.so + install -d $(DESTDIR)$(LIBDIR) + install libcgi-java.so $(DESTDIR)$(LIBDIR) + install libunix-java.so $(DESTDIR)$(LIBDIR) + +install-jar: unix-$(UNIXVER).jar cgi-$(CGIVER).jar debug-enable-$(DEBUGVER).jar debug-disable-$(DEBUGVER).jar io-$(IOVER).jar hexdump-$(HEXVER).jar + install -d $(DESTDIR)$(JARDIR) + install -m 644 debug-enable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR) + install -m 644 debug-disable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR) + install -m 644 unix-$(UNIXVER).jar $(DESTDIR)$(JARDIR) + install -m 644 cgi-$(CGIVER).jar $(DESTDIR)$(JARDIR) + install -m 644 io-$(IOVER).jar $(DESTDIR)$(JARDIR) + install -m 644 hexdump-$(HEXVER).jar $(DESTDIR)$(JARDIR) + ln -sf debug-disable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)/debug-disable.jar + ln -sf debug-enable-$(DEBUGVER).jar $(DESTDIR)$(JARDIR)/debug-enable.jar + ln -sf unix-$(UNIXVER).jar $(DESTDIR)$(JARDIR)/unix.jar + ln -sf io-$(IOVER).jar $(DESTDIR)$(JARDIR)/io.jar + ln -sf cgi-$(CGIVER).jar $(DESTDIR)$(JARDIR)/cgi.jar + ln -sf hexdump-$(HEXVER).jar $(DESTDIR)$(JARDIR)/hexdump.jar + +install: install-native install-jar diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/README b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/README new file mode 100755 index 0000000..acdc874 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/README @@ -0,0 +1,41 @@ +libmatthew-java v0.1 +-------------------- + +These are a selection of libraries for Java which I have written because they +are useful and not provided with normal Java. They are available for download +here and are licensed under the GPL or LGPL. They all come with example +applications using the libraries. + +The ones I consider distribution-worthy are packaged up together. Several other +classes are available separately below. + +Unix Sockets Library + +This is a collection of classes and native code to allow you to read and write +Unix sockets in Java. + +Debug Library + +This is a comprehensive logging and debugging solution. + +CGI Library + +This is a collection of classes and native code to allow you to write CGI +applications in Java. + +I/O Library + +This provides a few much needed extensions to the Java I/O subsystem. Firstly, +there is a class which will connect and InputStream with an OutputStream and +copy data between them. + +Secondly there are two classes for inserting into an Input or OutputStream pipe +a command line command, so that everything is piped through that command. + +Thirdly there are a pair of classes for splitting streams in two. This can +either be to two OuputStreams, or to an OutputStream and a file. Equivelent to +the UNIX tool tee in UNIX pipes. + +Hexdump + +This class formats byte-arrays in hex and ascii for display. diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cgi-java.c b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cgi-java.c new file mode 100755 index 0000000..64aed24 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cgi-java.c @@ -0,0 +1,64 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +#include +#include "cgi-java.h" +#include +#include +#include + +extern char **environ; + +extern jobjectArray Java_cx_ath_matthew_cgi_CGI_getfullenv (JNIEnv *env, jobject obj, jclass type) +{ + int i; + for (i = 0; environ[i]; i++); + jobjectArray joa = (*env)->NewObjectArray(env, i+1, type, NULL); + for (i = 0; environ[i]; i++) + (*env)->SetObjectArrayElement(env, joa, i, (*env)->NewStringUTF(env, environ[i])); + return joa; +} + +extern jstring Java_cx_ath_matthew_cgi_CGI_getenv (JNIEnv *env, jobject obj, jstring ename) +{ + const char *estr = (*env)->GetStringUTFChars(env, ename, 0); + char *eval = getenv(estr); + (*env)->ReleaseStringUTFChars(env, ename, estr); + if (NULL == eval) + return NULL; + else + return (*env)->NewStringUTF(env, eval); +} + +extern void Java_cx_ath_matthew_cgi_CGI_setenv (JNIEnv *env, jobject obj, jstring var, jstring val) +{ +#ifdef setenv + const char *cvar = (*env)->GetStringUTFChars(env, var, 0); + const char *cval = (*env)->GetStringUTFChars(env, val, 0); + setenv(cvar, cval, 1); +#endif +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/changelog b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/changelog new file mode 100755 index 0000000..e7a2183 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/changelog @@ -0,0 +1,73 @@ +Version 0.8: + + * Change to expat licence + + * Patches to the CGI libraries from Andy Canfield + +Version 0.7.3: + + * Patch from 石頭成 to avoid a + memory leak + +Version 0.7.2: + + * Also add .NO_PARALLEL and .NOTPARALLEL because I have no idea + which one is correct + * Apply patch from Omair Majid + which make overriding CFLAGS easier + * Use -source 1.5 rather than -source 5.0, the former works with more + Java compilers + * Add -fno-stack-protector to fix compilation issues in various distros + * Fix spin-on-disconnection bug (Spotted by Christopher Armstrong + ) + +Version 0.7.1: + + * Fix compiler warning on 64bit systems (spotted by + serkankaba -at- gmail -dot- com) + * Fix compilation with glibc 2.8 (patch from Omair Majid + ) + +Version 0.7: + + * use += not ?= when setting *FLAGS + * Possible SIGSEGV in native_close, possible fix + * Don't include debug-disable in any manifests + * Fix some compiler warnings. Setenv doesn't exist on all platforms. + +Version 0.6: + + * Add toByteArray to Hexdump for creating byte-array-literals in + generated code. + * UnixSocket output streams can now send multiple byte[] at once + to use scatter-gather for efficiency + * Add fuctions to get peer credentials + * Work on BSD + +Version 0.5: + + * Add licence headers to files which are missing + * fix javadoc calls so that -link is replacable with local docs + * add .NOPARALLEL: to disable parallel building. Fails to get debugging + right + +Version 0.4: + + * Add javadoc target + * Add Manifest with Class-Path to relevant jars + +Version 0.2: + + * Fix Unix Sockets not to lose reference if IO streams are still + referenced. + * Add methods to Debug to set the config manually + * update Debug defaults + * add ALL as a class name to Debug + * write installation guide + * fix UnixSocket.setBlocking + * add UnixSocket.setSoTimeout + +Version 0.1: + + * Initial code and packaging. diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGI.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGI.java new file mode 100755 index 0000000..b63fffa --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGI.java @@ -0,0 +1,565 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; +import java.util.Vector; +import java.text.DateFormat; +import java.text.SimpleDateFormat; + +/** + * This is the main class you have to extend with your CGI program. + * You should implement the cgi() method. + * + * @author Matthew Johnson <src@matthew.ath.cx> + */ +abstract public class CGI +{ + private CGIErrorHandler errorhandler = new DefaultErrorHandler(); + private boolean headers_sent = false; + private HashMap headers = new HashMap(); + private Vector cookies = new Vector(); + private LinkedList pagedata = new LinkedList(); + private LinkedList rawdata = new LinkedList(); + + private native String getenv(String var); + /** MUST pass String.class and ALWAYS returns a String[] */ + private native Object[] getfullenv(Class c); + private native void setenv(String var, String value); + { + System.loadLibrary("cgi-java"); + } + + /** + * Called by CGIs to send a header to the output + * + * @param variable The header variable to set. + * @param value The value of the variable. + * + * @throws CGIHeaderSentException if the headers have already been sent. + * + * @see #flush + */ + public final void header(String variable, String value) throws CGIHeaderSentException + { + // only send headers once + if (headers_sent) throw new CGIHeaderSentException(); + + // buffer the variable (Map so that each header is only set once) + headers.put(variable.toLowerCase(), value); + } + + /** + * Sets a Cookie in the web browser, with extended attributes. + * Calls header() so must be called before sending any output. + * + * A parameter will not be sent if it is null. + * + * @param variable The cookie variable to set. + * @param value The value of the variable. + * @param path The path that the cookie will be returned for. + * @param domain The domain that the cookie will be returned for. + * @param expires The expiry date of the cookie. + * @param secure Will only send the cookie over HTTPS if this is true. + * + * @throws CGIHeaderSentException if the headers have already been sent. + * + * @see #flush + * @see #header + */ + public final void setcookie(String variable, String value, String path, String domain, Date expires, boolean secure) throws CGIHeaderSentException + { + if (headers_sent) throw new CGIHeaderSentException(); + + //Set-Cookie: NAME=VALUE; expires=DATE; + //path=PATH; domain=DOMAIN_NAME; secure + //Wdy, DD-Mon-YYYY HH:MM:SS GMT + DateFormat df = new SimpleDateFormat("E, dd-MMM-yyyy HH:mm:ss zzz"); + String cookie = variable+"="+value; + if (null != path) cookie += "; path="+path; + if (null != domain) cookie += "; domain="+domain; + if (null != expires) cookie += "; expires="+df.format(expires); + if (secure) cookie += "; secure"; + cookies.add("Set-Cookie: "+ cookie); + } + + /** + * Sets a Cookie in the web browser. + * Calls header() so must be called before sending any output. + * + * @param variable The cookie variable to set. + * @param value The value of the variable. + * + * @throws CGIHeaderSentException if the headers have already been sent. + * + * @see #flush + * @see #header + */ + public final void setcookie(String variable, String value) throws CGIHeaderSentException + { + if (headers_sent) throw new CGIHeaderSentException(); + + //Set-Cookie: NAME=VALUE; expires=DATE; + //path=PATH; domain=DOMAIN_NAME; secure + cookies.add("Set-Cookie: "+ variable+"="+value); + } + + /** + * Called by CGIs to send byte data to the output. + * The data is buffered until the CGI exits, or a call of flush. + * + * @param data The page data. + * @throws CGIInvalidContentFormatException if text data has already been sent. + * + * @see #flush + */ + public final void out(byte[] data) throws CGIInvalidContentFormatException + { + if (pagedata.size() > 0) throw new CGIInvalidContentFormatException(); + rawdata.add(data); + } + + /** + * Called by CGIs to send a string to the output. + * The data is buffered until the CGI exits, or a call of flush. + * + * @param data The page data. + * @throws CGIInvalidContentFormatException if raw data has already been sent. + * + * @see #flush + */ + public final void out(String data) throws CGIInvalidContentFormatException + { + if (rawdata.size() > 0) throw new CGIInvalidContentFormatException(); + pagedata.add(data); + } + + /** + * This will return an OutputStream that you can write data + * directly to. Calling this method will cause the output to be + * flushed and the Headers sent. At the moment this is not buffered + * and will be sent directly to the client. Subsequent calls + * to out() will appear after data written to the output stream. + * + * @see #out + * @return an OutputStream + */ + public final OutputStream getOutputStream() throws IOException + { + flush(); + return System.out; + } + + /** + * Flushes the output. + * Note that you cannot send a header after a flush. + * If you want to send both text and binary data in a page + * you may do so either side of a flush. + * + * @see #header + */ + public final void flush() throws IOException + { + if (!headers_sent) { + // don't send headers again + headers_sent = true; + // send headers + Iterator i = headers.keySet().iterator(); + while (i.hasNext()) { + String key = (String) i.next(); + String value = (String) headers.get(key); + System.out.println(key + ": " + value); + } + // send cookies + i = cookies.iterator(); + while (i.hasNext()) { + System.out.println((String) i.next()); + } + System.out.println(); + } + + // send data + if (pagedata.size() >0) { + Iterator j = pagedata.iterator(); + while (j.hasNext()) { + System.out.println((String) j.next()); + } + pagedata.clear(); + } else if (rawdata.size() > 0) { + Iterator j = rawdata.iterator(); + while (j.hasNext()) { + System.out.write((byte[]) j.next()); + } + pagedata.clear(); + } + System.out.flush(); + } + + /** + * Sets a custom exception handler. + * Gets called when an exception is thrown. + * The default error handler prints the error nicely in HTML + * and then exits gracefully. + * + * @param handler The new exception handler + */ + protected final void setErrorHandler(CGIErrorHandler handler) + { + errorhandler = handler; + } + + /** + * Override this method in your CGI program. + * + * @param POST A Map of variable =$gt; value for the POST variables. + * @param GET A Map of variable =$gt; value for the GET variables. + * @param ENV A Map of variable =$gt; value for the Webserver environment variables. + * @param COOKIES A Map of variable =$gt; value for the browser-sent cookies. + * @param params An array of parameters passed to the CGI (GET with no variable assignments) + * + * @throws Exception You can throw anything, it will be caught by the error handler. + */ + abstract protected void cgi(Map POST, Map GET, Map ENV, Map COOKIES, String[] params) throws Exception; + + /** + * Reads variables from a String like a=b&c=d to a Map {a => b, c => d}. + * + * @param s String to read from. + * @param seperator seperator character between variables (eg &) + * @param values whether or not this string has values for variables + * + * @return a Map with values, a Vector without + */ + private Object readVariables(String s, char seperator, boolean values) + { + HashMap vars = new HashMap(); + Vector varv = new Vector(); + String temp = ""; + String variable = null; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c == seperator) { // new variable + if (null != temp) temp = temp.trim(); + if (values) { + if (variable == null) {variable = temp; temp = "";} + else variable.trim(); + if (!variable.equals("")) { + Object o = vars.get(variable); + if (o == null) + vars.put(variable.trim(), temp); + else if (o instanceof String) { + LinkedList l = new LinkedList(); + l.add(o); + l.add(temp); + vars.put(variable.trim(), l); + } else if (o instanceof LinkedList) + ((LinkedList) o).add(temp); + } + temp = ""; + } + else { + varv.add(temp); + temp = ""; + } + variable = null; + continue; + } + if (values && c == '=') { + variable = temp; + temp = ""; + continue; + } + switch (c) { + case '%': // escaped character + try { + char a = s.charAt(++i); + char b = s.charAt(++i); + int ch = 0; + switch (a) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + ch += 0x10 * (a - '0'); + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + ch += 0x10 * (a - 'a' + 0xa); + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + ch += 0x10 * (a - 'A' + 0xA); + break; + } + switch (b) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + ch += (b - '0'); + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + ch += (b - 'a' + 0xa); + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + ch += (b - 'A' + 0xA); + break; + } + temp += (char) ch; + } catch (StringIndexOutOfBoundsException SIOOBe) { + // this means someone has included an invalid escape sequence. + // Invalid URIs can just be thrown on the floor. + } + break; + // + is a space + case '+': + temp += ' '; + break; + default: + temp += c; + } + } + if (values) { + if (variable == null) {variable = temp; temp = "";} + else variable.trim(); + //out("DEBUG variable read: "+variable+"/"+temp); + if (!variable.equals("")) { + Object o = vars.get(variable); + if (o == null) + vars.put(variable.trim(), temp); + else if (o instanceof String) { + LinkedList l = new LinkedList(); + l.add(o); + l.add(temp); + vars.put(variable.trim(), l); + } else if (o instanceof LinkedList) + ((LinkedList) o).add(temp); + } + + return vars; + } + else { + varv.add(temp); + return varv; + } + } + + /** + * Sets up the POST variables + */ + private Map getPOST() + { + try { + String s = ""; + while(System.in.available() > 0) + s += (char) System.in.read(); + //out("DEBUG: POST STRING: "+s); + return (Map) readVariables(s, '&', true); + } catch (IOException IOe) { + try { + out("ERROR: IOException: "+IOe); + } catch (CGIInvalidContentFormatException CGIICFe) { + System.err.println("ERROR: IOException: "+IOe); + } + return new HashMap(); + } + } + + /** + * Sets up the COOKIEs + */ + private Map getCOOKIE() + { + String s = getenv("HTTP_COOKIE"); + if (null == s) + return new HashMap(); + else + return (Map) readVariables(s, ';', true); + } + + /** + * Sets up the GET variables + */ + private Map getGET() + { + String s = getenv("QUERY_STRING"); + if (null == s) + return new HashMap(); + else + return (Map) readVariables(s, '&', true); + } + + /** + * Sets up the ENV variables + */ + private Map getENV() + { + Map m = new HashMap(); + String[] env = (String[]) getfullenv(String.class); + for (int i = 0; i < env.length; i++){ + if (null == env[i]) continue; + String[] e = env[i].split("="); + if (1 == e.length) + m.put(e[0], ""); + else + m.put(e[0], e[1]); + } + +/* + m.put("SERVER_SOFTWARE", getenv("SERVER_SOFTWARE")); + m.put("SERVER_NAME", getenv("SERVER_NAME")); + m.put("GATEWAY_INTERFACE", getenv("GATEWAY_INTERFACE")); + m.put("SERVER_PROTOCOL", getenv("SERVER_PROTOCOL")); + m.put("SERVER_PORT", getenv("SERVER_PORT")); + m.put("REQUEST_METHOD", getenv("REQUEST_METHOD")); + m.put("PATH_INFO", getenv("PATH_INFO")); + m.put("PATH_TRANSLATED", getenv("PATH_TRANSLATED")); + m.put("SCRIPT_NAME", getenv("SCRIPT_NAME")); + m.put("QUERY_STRING", getenv("QUERY_STRING")); + m.put("REMOTE_HOST", getenv("REMOTE_HOST")); + m.put("REMOTE_ADDR", getenv("REMOTE_ADDR")); + m.put("AUTH_TYPE", getenv("AUTH_TYPE")); + m.put("REMOTE_USER", getenv("REMOTE_USER")); + m.put("REMOTE_IDENT", getenv("REMOTE_IDENT")); + m.put("CONTENT_TYPE", getenv("CONTENT_TYPE")); + m.put("CONTENT_LENGTH", getenv("CONTENT_LENGTH")); + m.put("HTTP_ACCEPT", getenv("HTTP_ACCEPT")); + m.put("HTTP_USER_AGENT", getenv("HTTP_USER_AGENT")); + m.put("HTTP_COOKIE", getenv("HTTP_COOKIE")); + m.put("HTTP_ACCEPT_CHARSET", getenv("HTTP_ACCEPT_CHARSET")); + m.put("HTTP_ACCEPT_ENCODING", getenv("HTTP_ACCEPT_ENCODING")); + m.put("HTTP_CACHE_CONTROL", getenv("HTTP_CACHE_CONTROL")); + m.put("HTTP_REFERER", getenv("HTTP_REFERER")); + m.put("HTTP_X_FORWARDED_FOR", getenv("HTTP_X_FORWARDED_FOR")); + m.put("HTTP_HOST", getenv("HTTP_HOST")); + m.put("REQUEST_URI", getenv("REQUEST_URI")); + m.put("DOCUMENT_ROOT", getenv("DOCUMENT_ROOT")); + m.put("PATH", getenv("PATH")); + m.put("SERVER_ADDR", getenv("SERVER_ADDR")); + m.put("SCRIPT_FILENAME", getenv("SCRIPT_FILENAME")); + m.put("HTTP_COOKIE2", getenv("HTTP_COOKIE2")); + m.put("HTTP_CONNECTION", getenv("HTTP_CONNECTION")); + m.put("LANG", getenv("LANG")); + m.put("REDIRECT_LANG", getenv("REDIRECT_LANG")); + */ + return m; + } + + /** + * Sets up the param variables + */ + private String[] getParams(String args) + { + Vector v = (Vector) readVariables(args, ',', false); + String[] params = new String[v.size()]; + Iterator i = v.iterator(); + for (int j = 0; j < params.length; j++) + params[j] = (String) i.next(); + return params; + } + + /** + * This method sets up all the CGI variables and calls the cgi() method, then writes out the page data. + */ + public final void doCGI(String[] args) + { + CGI cgiclass = null; + // wrap everything in a try, we need to handle all our own errors. + try { + // setup the CGI variables + Map POST = getPOST(); + Map GET = getGET(); + Map ENV = getENV(); + Map COOKIE = getCOOKIE(); + String[] params = new String[] {}; + if (args.length >= 1) + params = getParams(args[0]); + + // instantiate CGI class + /* Class c = Class.forName(args[0]); + cgiclass = (CGI) c.newInstance(); */ + + // set default headers + /*cgiclass.*/header("Content-type", "text/html"); + + // execute the CGI + /*cgiclass.*/cgi(POST, GET, ENV, COOKIE, params); + + // send the output / remaining output + /*cgiclass.*/flush(); + } + + // yes, we really want to do this. CGI programs can't send errors. Print nicely to the screen. + catch (Exception e) { + errorhandler.print(/*null == cgiclass ? false : cgiclass.*/headers_sent, e); + } + catch (Throwable t) { + t.printStackTrace(); // this is bad enough to produce stderr errors + errorhandler.print(/*null == cgiclass ? false : cgiclass.*/headers_sent, new Exception(t.toString())); + } + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java new file mode 100755 index 0000000..e0798cb --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIErrorHandler.java @@ -0,0 +1,41 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +/** + * Interface to handle exceptions in the CGI. + */ +public interface CGIErrorHandler +{ + /** + * This is called if an exception is not caught in the CGI. + * It should handle printing the error message nicely to the user, + * and then exit gracefully. + */ + public void print(boolean headers_sent, Exception e); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java new file mode 100755 index 0000000..4df8cc7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIHeaderSentException.java @@ -0,0 +1,39 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +/** + * Thrown if the headers have already been sent and CGI.header is called. + */ +public class CGIHeaderSentException extends Exception +{ + public CGIHeaderSentException() + { + super("Headers already sent by CGI"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java new file mode 100755 index 0000000..281533d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGIInvalidContentFormatException.java @@ -0,0 +1,39 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +/** + * Thrown if both raw and text data are set in the same page. + */ +public class CGIInvalidContentFormatException extends Exception +{ + public CGIInvalidContentFormatException() + { + super("Cannot send both raw and text data"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGITools.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGITools.java new file mode 100755 index 0000000..9a37945 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CGITools.java @@ -0,0 +1,48 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +abstract class CGITools +{ + /** + * Escape a character in a string. + * @param in String to escape in. + * @param c Character to escape. + * @return in with c replaced with \c + */ + public static String escapeChar(String in, char c) + { + String out = ""; + for (int i = 0; i < in.length(); i++) { + if (in.charAt(i) == c) out += '\\'; + out += in.charAt(i); + } + return out; + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CheckBox.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CheckBox.java new file mode 100755 index 0000000..350390d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/CheckBox.java @@ -0,0 +1,46 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class CheckBox extends Field +{ + boolean checked; + public CheckBox(String name, String label, boolean checked) + { + this.name = name; + this.label = label; + this.checked = checked; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java new file mode 100755 index 0000000..f5b812f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DefaultErrorHandler.java @@ -0,0 +1,67 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +/** + * Interface to handle exceptions in the CGI. + */ +public class DefaultErrorHandler implements CGIErrorHandler +{ + /** + * This is called if an exception is not caught in the CGI. + * It should handle printing the error message nicely to the user, + * and then exit gracefully. + */ + public void print(boolean headers_sent, Exception e) + { + if (!headers_sent) { + System.out.println("Content-type: text/html"); + System.out.println(""); + System.out.println(""); + System.out.println(""); + System.out.println("Exception in CGI"); + System.out.println(""); + } + System.out.println("
"); + System.out.println("

"+e.getClass().toString()+"

"); + System.out.println("

"); + System.out.println("Exception Message: "+e.getMessage()); + System.out.println("

"); + System.out.println("

"); + System.out.println("Stack Trace:"); + System.out.println("

"); + System.out.println("
");
+      e.printStackTrace(System.out);
+      System.out.println("
"); + System.out.println("
"); + if (!headers_sent) { + System.out.println(""); + } + System.exit(1); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DisplayField.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DisplayField.java new file mode 100755 index 0000000..ec62a7f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DisplayField.java @@ -0,0 +1,46 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class DisplayField extends Field +{ + String value; + public DisplayField(String label, String value) + { + this.name = ""; + this.label = label; + this.value = value; + } + protected String print() + { + return value; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DropDown.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DropDown.java new file mode 100755 index 0000000..bdc4534 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/DropDown.java @@ -0,0 +1,131 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +import java.util.List; + +public class DropDown extends Field +{ + Object[] values; + Object defval; + boolean indexed = false; + /** + * Create a new DropDown list. + * + * @param name The HTML field name. + * @param label The label to display + * @param values The values for the drop down list + * @param defval If this parameter is set then this element will be selected by default. + * @param indexed If this is set to true, then indexes will be returned, rather than values. + */ + public DropDown(String name, String label, Object[] values, Object defval, boolean indexed) + { + this.name = name; + this.label = label; + this.values = values; + this.indexed = indexed; + this.defval = defval; + } + /** + * Create a new DropDown list. + * + * @param name The HTML field name. + * @param label The label to display + * @param values The values for the drop down list + * @param defval If this parameter is set then this element will be selected by default. + * @param indexed If this is set to true, then indexes will be returned, rather than values. + */ + public DropDown(String name, String label, Object[] values, int defval, boolean indexed) + { + this.name = name; + this.label = label; + this.values = values; + if (defval < 0) + this.defval = null; + else + this.defval = values[defval]; + this.indexed = indexed; + } + /** + * Create a new DropDown list. + * + * @param name The HTML field name. + * @param label The label to display + * @param values The values for the drop down list + * @param defval If this parameter is set then this element will be selected by default. + * @param indexed If this is set to true, then indexes will be returned, rather than values. + */ + public DropDown(String name, String label, List values, Object defval, boolean indexed) + { + this.name = name; + this.label = label; + this.values = (Object[]) values.toArray(new Object[] {}); + this.defval = defval; + this.indexed = indexed; + } + /** + * Create a new DropDown list. + * + * @param name The HTML field name. + * @param label The label to display + * @param values The values for the drop down list + * @param defval If this parameter is set then this element will be selected by default. + * @param indexed If this is set to true, then indexes will be returned, rather than values. + */ + public DropDown(String name, String label, List values, int defval, boolean indexed) + { + this.name = name; + this.label = label; + this.values = (Object[]) values.toArray(new Object[] {}); + if (defval < 0) + this.defval = null; + else + this.defval = values.get(defval); + this.indexed = indexed; + } + protected String print() + { + String s = ""; + s += "\n"; + return s; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Field.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Field.java new file mode 100755 index 0000000..d859952 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Field.java @@ -0,0 +1,38 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public abstract class Field +{ + protected String name; + protected String label; + protected abstract String print(); +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HTMLForm.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HTMLForm.java new file mode 100755 index 0000000..0a39739 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HTMLForm.java @@ -0,0 +1,141 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +import java.util.Iterator; +import java.util.Vector; + + +/** + * Class to manage drawing HTML forms + */ +public class HTMLForm +{ + private String target; + private String submitlabel; + private String tableclass; + private Vector fields; + private boolean post = true; + + /** + * @param target The module to submit to + */ + public HTMLForm(String target) + { + this(target, "Submit", null); + } + + /** + * @param target The module to submit to + * @param submitlabel The string to display on the submit button + */ + public HTMLForm(String target, String submitlabel) + { + this(target, submitlabel, null); + } + + /** + * @param target The module to submit to + * @param submitlabel The string to display on the submit button + * @param tableclass The class= parameter for the generated table + */ + public HTMLForm(String target, String submitlabel, String tableclass) + { + this.target = target; + this.submitlabel = submitlabel; + this.tableclass = tableclass; + fields = new Vector(); + } + + /** + * Add a field to be displayed in the form. + * + * @param field A Field subclass. + */ + public void addField(Field field) + { + fields.add(field); + } + + /** + * Set GET method rather than POST + * @param enable Enable/Disable GET + */ + public void setGET(boolean enable) + { + post = !enable; + } + + /** + * Shows the form. + * @param cgi The CGI instance that is handling output + */ + public void display(CGI cgi) + { + try { + cgi.out("
"); + if (null == tableclass) + cgi.out(""); + else + cgi.out("
"); + + Iterator i = fields.iterator(); + while (i.hasNext()) { + Field f = (Field) i.next(); + if (f instanceof NewTable) { + cgi.out(f.print()); + } + if (!(f instanceof HiddenField) && !(f instanceof SubmitButton) && !(f instanceof NewTable)) { + cgi.out(" "); + cgi.out(" "); + cgi.out(" "); + cgi.out(" "); + } + } + cgi.out(" "); + cgi.out(" "); + cgi.out(" "); + cgi.out("
"+f.label+""+f.print()+"
"); + i = fields.iterator(); + while (i.hasNext()) { + Field f = (Field) i.next(); + if (f instanceof HiddenField || f instanceof SubmitButton) { + cgi.out(" "+f.print()); + } + } + cgi.out(" "); + cgi.out("
"); + cgi.out("
"); + } catch (CGIInvalidContentFormatException CGIICFe) {} + } +} + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HiddenField.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HiddenField.java new file mode 100755 index 0000000..523f85b --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/HiddenField.java @@ -0,0 +1,46 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class HiddenField extends Field +{ + String value; + public HiddenField(String name, String value) + { + this.name = name; + this.label = ""; + this.value = value; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/MultipleDropDown.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/MultipleDropDown.java new file mode 100755 index 0000000..39904bd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/MultipleDropDown.java @@ -0,0 +1,115 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +/* + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package cx.ath.matthew.cgi; + +import java.util.List; + +/** + * @author Agent + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class MultipleDropDown extends DropDown { + + /** + * @param name + * @param label + * @param values + * @param defval + * @param indexed + */ + public MultipleDropDown(String name, String label, String[] values, + String defval, boolean indexed) { + super(name, label, values, defval, indexed); + // TODO Auto-generated constructor stub + } + + /** + * @param name + * @param label + * @param values + * @param defval + * @param indexed + */ + public MultipleDropDown(String name, String label, String[] values, + int defval, boolean indexed) { + super(name, label, values, defval, indexed); + // TODO Auto-generated constructor stub + } + + /** + * @param name + * @param label + * @param values + * @param defval + * @param indexed + */ + public MultipleDropDown(String name, String label, List values, + String defval, boolean indexed) { + super(name, label, values, defval, indexed); + // TODO Auto-generated constructor stub + } + + /** + * @param name + * @param label + * @param values + * @param defval + * @param indexed + */ + public MultipleDropDown(String name, String label, List values, int defval, + boolean indexed) { + super(name, label, values, defval, indexed); + // TODO Auto-generated constructor stub + } + + protected String print() + { + String s = ""; + s += "\n"; + return s; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/NewTable.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/NewTable.java new file mode 100755 index 0000000..1638b74 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/NewTable.java @@ -0,0 +1,42 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; +public class NewTable extends Field { + + private String name; + private String cssClass; + + public NewTable (String name, String css) { + this.name = name; + this.cssClass = css; + } + + protected String print() { + return "\n"; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Password.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Password.java new file mode 100755 index 0000000..046fc0c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Password.java @@ -0,0 +1,46 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class Password extends Field +{ + String defval; + public Password(String name, String label, String defval) + { + this.name = name; + this.label = label; + this.defval = defval; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Radio.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Radio.java new file mode 100755 index 0000000..3a0d80e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/Radio.java @@ -0,0 +1,46 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class Radio extends Field +{ + boolean checked; + public Radio(String name, String label, boolean checked) + { + this.name = name; + this.label = label; + this.checked = checked; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/SubmitButton.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/SubmitButton.java new file mode 100755 index 0000000..ff97e1c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/SubmitButton.java @@ -0,0 +1,54 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +/* + * + * TODO To change the template for this generated file go to + * Window - Preferences - Java - Code Style - Code Templates + */ +package cx.ath.matthew.cgi; + +/** + * @author Agent + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class SubmitButton extends Field { + + public SubmitButton(String name, String label) { + this.name = name; + this.label = label; + } + /* (non-Javadoc) + * @see cx.ath.matthew.cgi.Field#print() + */ + protected String print() { + return ""; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextArea.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextArea.java new file mode 100755 index 0000000..6a924c4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextArea.java @@ -0,0 +1,57 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + +public class TextArea extends Field +{ + String defval; + int cols; + int rows; + public TextArea(String name, String label, String defval) + { + this(name, label, defval, 30, 4); + } + public TextArea(String name, String label, String defval, int cols, int rows) + { + this.name = name; + this.label = label; + if (null == defval) + this.defval = ""; + else + this.defval = defval; + this.cols = cols; + this.rows = rows; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextField.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextField.java new file mode 100755 index 0000000..124ce3e --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/TextField.java @@ -0,0 +1,69 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +package cx.ath.matthew.cgi; + + +public class TextField extends Field +{ + String defval; + int length; + public TextField(String name, String label) + { + this.name = name; + this.label = label; + this.defval = ""; + this.length = 0; + } + public TextField(String name, String label, String defval) + { + this.name = name; + this.label = label; + if (null == defval) + this.defval = ""; + else + this.defval = defval; + this.length = 0; + } + public TextField(String name, String label, String defval, int length) + { + this.name = name; + this.label = label; + if (null == defval) + this.defval = ""; + else + this.defval = defval; + this.length = length; + } + protected String print() + { + return ""; + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/testcgi.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/testcgi.java new file mode 100755 index 0000000..563447d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/cgi/testcgi.java @@ -0,0 +1,78 @@ +/* + * Java CGI Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.cgi; + +import java.util.Iterator; +import java.util.Map; + +class testcgi extends CGI +{ + protected void cgi(Map POST, Map GET, Map ENV, Map COOKIE, String[] params) throws Exception + { + header("Content-type", "text/plain"); + setcookie("testcgi", "You have visited us already"); + out("This is a test CGI program"); + out("These are the params:"); + for (int i=0; i < params.length; i++) + out("-- "+params[i]); + + out("These are the POST vars:"); + Iterator i = POST.keySet().iterator(); + while (i.hasNext()) { + String s = (String) i.next(); + out("-- "+s+" => "+POST.get(s)); + } + + out("These are the GET vars:"); + i = GET.keySet().iterator(); + while (i.hasNext()) { + String s = (String) i.next(); + out("-- "+s+" => "+GET.get(s)); + } + + out("These are the ENV vars:"); + i = ENV.keySet().iterator(); + while (i.hasNext()) { + String s = (String) i.next(); + out("-- "+s+" => "+ENV.get(s)); + } + + out("These are the COOKIEs:"); + i = COOKIE.keySet().iterator(); + while (i.hasNext()) { + String s = (String) i.next(); + out("-- "+s+" => "+COOKIE.get(s)); + } + } + + public static void main(String[] args) + { + CGI cgi = new testcgi(); + cgi.doCGI(args); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.class b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.class new file mode 100755 index 0000000..9afabe6 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.class differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.java new file mode 100755 index 0000000..6aae72f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.java @@ -0,0 +1,597 @@ +/* + * Java Debug Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.debug; + +import cx.ath.matthew.utils.Hexdump; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +/** + Add debugging to your program, has support for large projects with multiple + classes and debug levels per class. Supports optional enabling of debug + per-level per-class and debug targets of files, Streams or stderr. + Also supports timing between debug outputs, printing of stack traces for Throwables + and files/line numbers on each message. +

+ Debug now automatically figures out which class it was called from, so all + methods passing in the calling class are deprecated. +

+

+ The defaults are to print all messages to stderr with class and method name. +

+

+ Should be called like this: +

+
+   if (Debug.debug) Debug.print(Debug.INFO, "Debug Message");
+  
+ */ +public class Debug +{ + /** + This interface can be used to provide custom printing filters + for certain classes. + */ + public static interface FilterCommand + { + /** + Called to print debug messages with a custom filter. + @param output The PrintStream to output to. + @param level The debug level of this message. + @param location The textual location of the message. + @param extra Extra information such as timing details. + @param message The debug message. + @param lines Other lines of a multiple-line debug message. + */ + public void filter(PrintStream output, int level, String location, String extra, String message, String[] lines); + } + /** Highest priority messages */ + public static final int CRIT = 1; + /** Error messages */ + public static final int ERR = 2; + /** Warnings */ + public static final int WARN = 3; + /** Information */ + public static final int INFO = 4; + /** Debug messages */ + public static final int DEBUG = 5; + /** Verbose debug messages */ + public static final int VERBOSE = 6; + /** Set this to false to disable compilation of Debug statements */ +// public static final boolean debug = false; + public static final boolean debug = false; // pego + /** The current output stream (defaults to System.err) */ + public static PrintStream debugout = System.err; + private static Properties prop = null; + private static boolean timing = false; + private static boolean ttrace = false; + private static boolean lines = false; + private static boolean hexdump = false; + private static long last = 0; + private static int balen = 36; + private static int bawidth = 80; + private static Class saveclass = null; + //TODO: 1.5 private static Map, FilterCommand> filterMap = new HashMap, FilterCommand>(); + private static Map filterMap = new HashMap(); + /** + Set properties to configure debugging. + Format of properties is class => level, e.g. +
+      cx.ath.matthew.io.TeeOutputStream = INFO
+      cx.ath.matthew.io.DOMPrinter = DEBUG
+     
+ The debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which + correspond to all messages up to that level. The special words YES, ALL and TRUE + cause all messages to be printed regardless of level. All other terms disable + messages for that class. CRIT and ERR messages are always printed if debugging is enabled + unless explicitly disabled. + The special class name ALL can be used to set the default level for all classes. + @param prop Properties object to use. + */ + public static void setProperties(Properties prop) + { + Debug.prop = prop; + } + /** + Read which class to debug on at which level from the given File. + Syntax the same as Java Properties files: +
+     <class> = <debuglevel>
+     
+ E.G. +
+      cx.ath.matthew.io.TeeOutputStream = INFO
+      cx.ath.matthew.io.DOMPrinter = DEBUG
+     
+ The debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which + correspond to all messages up to that level. The special words YES, ALL and TRUE + cause all messages to be printed regardless of level. All other terms disable + messages for that class. CRIT and ERR messages are always printed if debugging is enabled + unless explicitly disabled. + The special class name ALL can be used to set the default level for all classes. + @param f File to read from. + */ + public static void loadConfig(File f) throws IOException + { + prop = new Properties(); + prop.load(new FileInputStream(f)); + } + /** @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. */ + //TODO: 1.5 @Deprecated() + public static boolean debugging(Class c, int loglevel) + { + if (debug) { + if (null == c) return true; + return debugging(c.getName(), loglevel); + } + return false; + } + public static boolean debugging(String s, int loglevel) + { + return loglevel <= INFO; // pego +// if (debug) { +// try { +// if (null == s) return true; +// if (null == prop) return loglevel <= DEBUG; +// String d = prop.getProperty(s); +// if (null == d || "".equals(d)) d = prop.getProperty("ALL"); +// if (null == d) return loglevel <= ERR; +// if ("".equals(d)) return loglevel <= ERR; +// d = d.toLowerCase(); +// if ("true".equals(d)) return true; +// if ("yes".equals(d)) return true; +// if ("all".equals(d)) return true; +// if ("verbose".equals(d)) return loglevel <= VERBOSE; +// if ("debug".equals(d)) return loglevel <= DEBUG; +// if ("info".equals(d)) return loglevel <= INFO; +// if ("warn".equals(d)) return loglevel <= WARN; +// if ("err".equals(d)) return loglevel <= ERR; +// if ("crit".equals(d)) return loglevel <= CRIT; +// int i = Integer.parseInt(d); return i >= loglevel; +// } catch (Exception e) { return false; } +// } +// return false; + } + + /** + Output to the given Stream */ + public static void setOutput(PrintStream p) throws IOException + { + debugout = p; + } + /** + Output to the given file */ + public static void setOutput(String filename) throws IOException + { + debugout = new PrintStream(new FileOutputStream(filename, true)); + } + + /** + Output to the default debug.log */ + public static void setOutput() throws IOException { + setOutput("./debug.log"); + } + /** + Log at DEBUG + @param d The object to log */ + public static void print(Object d) + { + if (debug) { + if (d instanceof String) + print(DEBUG, (String) d); + else if (d instanceof Throwable) + print(DEBUG, (Throwable) d); + else if (d instanceof byte[]) + print(DEBUG, (byte[]) d); + else if (d instanceof Map) + printMap(DEBUG, (Map) d); + else print(DEBUG, d); + } + } + /** + Log at DEBUG + @param o The object doing the logging + @param d The object to log + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, Object d) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(d); + } + } + + /** + Log an Object + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param d The object to log with d.toString() + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, Object d) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, d); + } + } + /** + Log a String + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The log message + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, String s) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, s); + } + } + /** + Log a Throwable + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, Throwable t) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, t); + } + } + + /** + Log a Throwable + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, Throwable t) + { + if (debug) { + saveclass = c; + print(loglevel, t); + } + } + /** + Log a Throwable + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @see #setThrowableTraces to turn on stack traces. + */ + public static void print(int loglevel, Throwable t) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + String[] lines = null; + if (ttrace) { + StackTraceElement[] ste = t.getStackTrace(); + lines = new String[ste.length]; + for (int i = 0; i < ste.length; i++) + lines[i] = "\tat "+ste[i].toString(); + } + _print(t.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, t.toString(), lines); + } + } + } + + /** + Log a byte array + @param loglevel The level to log at (DEBUG, WARN, etc) + @param b The byte array to print. + @see #setHexDump to enable hex dumping. + @see #setByteArrayCount to change how many bytes are printed. + @see #setByteArrayWidth to change the formatting width of hex. */ + public static void print(int loglevel, byte[] b) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + String[] lines = null; + if (hexdump) { + if (balen >= b.length) + lines = Hexdump.format(b, bawidth).split("\n"); + else { + byte[] buf = new byte[balen]; + System.arraycopy(b, 0, buf, 0, balen); + lines = Hexdump.format(buf, bawidth).split("\n"); + } + } + _print(b.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, b.length+" bytes", lines); + } + } + } + /** + Log a String + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The string to log with d.toString() + */ + public static void print(int loglevel, String s) + { + if (debug) + print(loglevel, (Object) s); + } + /** + Log an Object + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param d The object to log with d.toString() + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, Object d) + { + if (debug) { + saveclass = c; + print(loglevel, d); + } + } + /** + Log a String + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The log message + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, String s) + { + if (debug) { + saveclass = c; + print(loglevel, s); + } + } + private static String[] getTraceElements() + { + String[] data = new String[] { "", "", "" }; + try { + Method m = Thread.class.getMethod("getStackTrace", new Class[0]); + StackTraceElement[] stes = (StackTraceElement[]) m.invoke(Thread.currentThread(), new Object[0]); + for (StackTraceElement ste: stes) { + if (Debug.class.getName().equals(ste.getClassName())) continue; + if (Thread.class.getName().equals(ste.getClassName())) continue; + if (Method.class.getName().equals(ste.getClassName())) continue; + if (ste.getClassName().startsWith("sun.reflect")) continue; + data[0] = ste.getClassName(); + data[1] = ste.getMethodName(); + if (lines) + data[2] = " "+ste.getFileName()+":"+ste.getLineNumber(); + break; + } + } catch (NoSuchMethodException NSMe) { + if (null != saveclass) + data[0] = saveclass.getName(); + } catch (IllegalAccessException IAe) { + } catch (InvocationTargetException ITe) { + } + return data; + } + /** + Log an Object + @param loglevel The level to log at (DEBUG, WARN, etc) + @param o The object to log + */ + public static void print(int loglevel, Object o) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + _print(o.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, o.toString(), null); + } + } + } + + /** + Log a Map + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void printMap(Object o, int loglevel, Map m) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + printMap(loglevel, m); + } + } + /** + Log a Map + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void printMap(Class c, int loglevel, Map m) + { + if (debug) { + saveclass = c; + printMap(loglevel, m); + } + } + /** + Log a Map at DEBUG log level + @param m The Map to print out + */ + public static void printMap(Map m) + { + printMap(DEBUG, m); + } + /** + Log a Map + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + */ + public static void printMap(int loglevel, Map m) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + Iterator i = m.keySet().iterator(); + String[] lines = new String[m.size()]; + int j = 0; + while (i.hasNext()) { + Object key = i.next(); + lines[j++] = "\t\t- "+key+" => "+m.get(key); + } + _print(m.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, "Map:", lines); + } + } + } + /** + Enable or disable stack traces in Debuging throwables. + */ + public static void setThrowableTraces(boolean ttrace) + { + Debug.ttrace = ttrace; + } + /** + Enable or disable timing in Debug messages. + */ + public static void setTiming(boolean timing) + { + Debug.timing = timing; + } + /** + Enable or disable line numbers. + */ + public static void setLineNos(boolean lines) + { + Debug.lines = lines; + } + /** + Enable or disable hexdumps. + */ + public static void setHexDump(boolean hexdump) + { + Debug.hexdump = hexdump; + } + /** + Set the size of hexdumps. + (Default: 36) + */ + public static void setByteArrayCount(int count) + { + Debug.balen = count; + } + /** + Set the formatted width of hexdumps. + (Default: 80 chars) + */ + public static void setByteArrayWidth(int width) + { + Debug.bawidth = width; + } + /** + Add a filter command for a specific type. + This command will be called with the output stream + and the text to be sent. It should perform any + changes necessary to the text and then print the + result to the output stream. + */ + public static void addFilterCommand(Class c, FilterCommand f) + //TODO 1.5: public static void addFilterCommand(Class c, FilterCommand f) + { + filterMap.put(c, f); + } + private static void _print(Class c, int level, String loc, String extra, String message, String[] lines) + { + //TODO 1.5: FilterCommand f = filterMap.get(c); + FilterCommand f = (FilterCommand) filterMap.get(c); + if (null == f) { + debugout.println("["+loc+"] " +extra + message); + if (null != lines) + for (String s: lines) + debugout.println(s); + } else + f.filter(debugout, level, loc, extra, message, lines); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.jpp b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.jpp new file mode 100755 index 0000000..56fd4ac --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/debug/Debug.jpp @@ -0,0 +1,597 @@ +/* + * Java Debug Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.debug; + +import cx.ath.matthew.utils.Hexdump; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.PrintStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; + +/** + Add debugging to your program, has support for large projects with multiple + classes and debug levels per class. Supports optional enabling of debug + per-level per-class and debug targets of files, Streams or stderr. + Also supports timing between debug outputs, printing of stack traces for Throwables + and files/line numbers on each message. +

+ Debug now automatically figures out which class it was called from, so all + methods passing in the calling class are deprecated. +

+

+ The defaults are to print all messages to stderr with class and method name. +

+

+ Should be called like this: +

+
+   if (Debug.debug) Debug.print(Debug.INFO, "Debug Message");
+  
+ */ +public class Debug +{ + /** + This interface can be used to provide custom printing filters + for certain classes. + */ + public static interface FilterCommand + { + /** + Called to print debug messages with a custom filter. + @param output The PrintStream to output to. + @param level The debug level of this message. + @param location The textual location of the message. + @param extra Extra information such as timing details. + @param message The debug message. + @param lines Other lines of a multiple-line debug message. + */ + public void filter(PrintStream output, int level, String location, String extra, String message, String[] lines); + } + /** Highest priority messages */ + public static final int CRIT = 1; + /** Error messages */ + public static final int ERR = 2; + /** Warnings */ + public static final int WARN = 3; + /** Information */ + public static final int INFO = 4; + /** Debug messages */ + public static final int DEBUG = 5; + /** Verbose debug messages */ + public static final int VERBOSE = 6; + /** Set this to false to disable compilation of Debug statements */ + public static final boolean debug = DEBUGSETTING; + /** The current output stream (defaults to System.err) */ + public static PrintStream debugout = System.err; + private static Properties prop = null; + private static boolean timing = false; + private static boolean ttrace = false; + private static boolean lines = false; + private static boolean hexdump = false; + private static long last = 0; + private static int balen = 36; + private static int bawidth = 80; + private static Class saveclass = null; + //TODO: 1.5 private static Map, FilterCommand> filterMap = new HashMap, FilterCommand>(); + private static Map filterMap = new HashMap(); + /** + Set properties to configure debugging. + Format of properties is class => level, e.g. +
+      cx.ath.matthew.io.TeeOutputStream = INFO
+      cx.ath.matthew.io.DOMPrinter = DEBUG
+     
+ The debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which + correspond to all messages up to that level. The special words YES, ALL and TRUE + cause all messages to be printed regardless of level. All other terms disable + messages for that class. CRIT and ERR messages are always printed if debugging is enabled + unless explicitly disabled. + The special class name ALL can be used to set the default level for all classes. + @param prop Properties object to use. + */ + public static void setProperties(Properties prop) + { + Debug.prop = prop; + } + /** + Read which class to debug on at which level from the given File. + Syntax the same as Java Properties files: +
+     <class> = <debuglevel>
+     
+ E.G. +
+      cx.ath.matthew.io.TeeOutputStream = INFO
+      cx.ath.matthew.io.DOMPrinter = DEBUG
+     
+ The debug level can be one of CRIT, ERR, WARN, INFO, DEBUG or VERBOSE which + correspond to all messages up to that level. The special words YES, ALL and TRUE + cause all messages to be printed regardless of level. All other terms disable + messages for that class. CRIT and ERR messages are always printed if debugging is enabled + unless explicitly disabled. + The special class name ALL can be used to set the default level for all classes. + @param f File to read from. + */ + public static void loadConfig(File f) throws IOException + { + prop = new Properties(); + prop.load(new FileInputStream(f)); + } + /** @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. */ + //TODO: 1.5 @Deprecated() + public static boolean debugging(Class c, int loglevel) + { + if (debug) { + if (null == c) return true; + return debugging(c.getName(), loglevel); + } + return false; + } + public static boolean debugging(String s, int loglevel) + { + if (debug) { + try { + if (null == s) return true; + if (null == prop) return loglevel <= DEBUG; + String d = prop.getProperty(s); + if (null == d || "".equals(d)) d = prop.getProperty("ALL"); + if (null == d) return loglevel <= ERR; + if ("".equals(d)) return loglevel <= ERR; + d = d.toLowerCase(); + if ("true".equals(d)) return true; + if ("yes".equals(d)) return true; + if ("all".equals(d)) return true; + if ("verbose".equals(d)) return loglevel <= VERBOSE; + if ("debug".equals(d)) return loglevel <= DEBUG; + if ("info".equals(d)) return loglevel <= INFO; + if ("warn".equals(d)) return loglevel <= WARN; + if ("err".equals(d)) return loglevel <= ERR; + if ("crit".equals(d)) return loglevel <= CRIT; + int i = Integer.parseInt(d); return i >= loglevel; + } catch (Exception e) { return false; } + } + return false; + } + + /** + Output to the given Stream */ + public static void setOutput(PrintStream p) throws IOException + { + debugout = p; + } + /** + Output to the given file */ + public static void setOutput(String filename) throws IOException + { + debugout = new PrintStream(new FileOutputStream(filename, true)); + } + + /** + Output to the default debug.log */ + public static void setOutput() throws IOException { + setOutput("./debug.log"); + } + /** + Log at DEBUG + @param d The object to log */ + public static void print(Object d) + { + if (debug) { + if (d instanceof String) + print(DEBUG, (String) d); + else if (d instanceof Throwable) + print(DEBUG, (Throwable) d); + else if (d instanceof byte[]) + print(DEBUG, (byte[]) d); + else if (d instanceof Map) + printMap(DEBUG, (Map) d); + else print(DEBUG, d); + } + } + /** + Log at DEBUG + @param o The object doing the logging + @param d The object to log + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, Object d) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(d); + } + } + + /** + Log an Object + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param d The object to log with d.toString() + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, Object d) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, d); + } + } + /** + Log a String + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The log message + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, String s) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, s); + } + } + /** + Log a Throwable + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Object o, int loglevel, Throwable t) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + print(loglevel, t); + } + } + + /** + Log a Throwable + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, Throwable t) + { + if (debug) { + saveclass = c; + print(loglevel, t); + } + } + /** + Log a Throwable + @param loglevel The level to log at (DEBUG, WARN, etc) + @param t The throwable to log with .toString and .printStackTrace + @see #setThrowableTraces to turn on stack traces. + */ + public static void print(int loglevel, Throwable t) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + String[] lines = null; + if (ttrace) { + StackTraceElement[] ste = t.getStackTrace(); + lines = new String[ste.length]; + for (int i = 0; i < ste.length; i++) + lines[i] = "\tat "+ste[i].toString(); + } + _print(t.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, t.toString(), lines); + } + } + } + + /** + Log a byte array + @param loglevel The level to log at (DEBUG, WARN, etc) + @param b The byte array to print. + @see #setHexDump to enable hex dumping. + @see #setByteArrayCount to change how many bytes are printed. + @see #setByteArrayWidth to change the formatting width of hex. */ + public static void print(int loglevel, byte[] b) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + String[] lines = null; + if (hexdump) { + if (balen >= b.length) + lines = Hexdump.format(b, bawidth).split("\n"); + else { + byte[] buf = new byte[balen]; + System.arraycopy(b, 0, buf, 0, balen); + lines = Hexdump.format(buf, bawidth).split("\n"); + } + } + _print(b.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, b.length+" bytes", lines); + } + } + } + /** + Log a String + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The string to log with d.toString() + */ + public static void print(int loglevel, String s) + { + if (debug) + print(loglevel, (Object) s); + } + /** + Log an Object + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param d The object to log with d.toString() + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, Object d) + { + if (debug) { + saveclass = c; + print(loglevel, d); + } + } + /** + Log a String + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param s The log message + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void print(Class c, int loglevel, String s) + { + if (debug) { + saveclass = c; + print(loglevel, s); + } + } + private static String[] getTraceElements() + { + String[] data = new String[] { "", "", "" }; + try { + Method m = Thread.class.getMethod("getStackTrace", new Class[0]); + StackTraceElement[] stes = (StackTraceElement[]) m.invoke(Thread.currentThread(), new Object[0]); + for (StackTraceElement ste: stes) { + if (Debug.class.getName().equals(ste.getClassName())) continue; + if (Thread.class.getName().equals(ste.getClassName())) continue; + if (Method.class.getName().equals(ste.getClassName())) continue; + if (ste.getClassName().startsWith("sun.reflect")) continue; + data[0] = ste.getClassName(); + data[1] = ste.getMethodName(); + if (lines) + data[2] = " "+ste.getFileName()+":"+ste.getLineNumber(); + break; + } + } catch (NoSuchMethodException NSMe) { + if (null != saveclass) + data[0] = saveclass.getName(); + } catch (IllegalAccessException IAe) { + } catch (InvocationTargetException ITe) { + } + return data; + } + /** + Log an Object + @param loglevel The level to log at (DEBUG, WARN, etc) + @param o The object to log + */ + public static void print(int loglevel, Object o) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + _print(o.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, o.toString(), null); + } + } + } + + /** + Log a Map + @param o The object doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void printMap(Object o, int loglevel, Map m) + { + if (debug) { + if (o instanceof Class) + saveclass = (Class) o; + else + saveclass = o.getClass(); + printMap(loglevel, m); + } + } + /** + Log a Map + @param c The class doing the logging + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + @deprecated In Java 1.5 calling class is automatically identified, no need to pass it in. + */ + //TODO: 1.5 @Deprecated() + public static void printMap(Class c, int loglevel, Map m) + { + if (debug) { + saveclass = c; + printMap(loglevel, m); + } + } + /** + Log a Map at DEBUG log level + @param m The Map to print out + */ + public static void printMap(Map m) + { + printMap(DEBUG, m); + } + /** + Log a Map + @param loglevel The level to log at (DEBUG, WARN, etc) + @param m The Map to print out + */ + public static void printMap(int loglevel, Map m) + { + if (debug) { + String timestr = ""; + String[] data = getTraceElements(); + if (debugging(data[0], loglevel)) { + if (timing) { + long now = System.currentTimeMillis(); + timestr = "{" + (now-last) + "} "; + last = now; + } + Iterator i = m.keySet().iterator(); + String[] lines = new String[m.size()]; + int j = 0; + while (i.hasNext()) { + Object key = i.next(); + lines[j++] = "\t\t- "+key+" => "+m.get(key); + } + _print(m.getClass(), loglevel, data[0]+"."+data[1]+"()" + data[2], timestr, "Map:", lines); + } + } + } + /** + Enable or disable stack traces in Debuging throwables. + */ + public static void setThrowableTraces(boolean ttrace) + { + Debug.ttrace = ttrace; + } + /** + Enable or disable timing in Debug messages. + */ + public static void setTiming(boolean timing) + { + Debug.timing = timing; + } + /** + Enable or disable line numbers. + */ + public static void setLineNos(boolean lines) + { + Debug.lines = lines; + } + /** + Enable or disable hexdumps. + */ + public static void setHexDump(boolean hexdump) + { + Debug.hexdump = hexdump; + } + /** + Set the size of hexdumps. + (Default: 36) + */ + public static void setByteArrayCount(int count) + { + Debug.balen = count; + } + /** + Set the formatted width of hexdumps. + (Default: 80 chars) + */ + public static void setByteArrayWidth(int width) + { + Debug.bawidth = width; + } + /** + Add a filter command for a specific type. + This command will be called with the output stream + and the text to be sent. It should perform any + changes necessary to the text and then print the + result to the output stream. + */ + public static void addFilterCommand(Class c, FilterCommand f) + //TODO 1.5: public static void addFilterCommand(Class c, FilterCommand f) + { + filterMap.put(c, f); + } + private static void _print(Class c, int level, String loc, String extra, String message, String[] lines) + { + //TODO 1.5: FilterCommand f = filterMap.get(c); + FilterCommand f = (FilterCommand) filterMap.get(c); + if (null == f) { + debugout.println("["+loc+"] " +extra + message); + if (null != lines) + for (String s: lines) + debugout.println(s); + } else + f.filter(debugout, level, loc, extra, message, lines); + } +} + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/DOMPrinter.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/DOMPrinter.java new file mode 100755 index 0000000..e61fa77 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/DOMPrinter.java @@ -0,0 +1,114 @@ +/* + * Java DOM Printing Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; + +import org.w3c.dom.Document; +import org.w3c.dom.DocumentType; +import org.w3c.dom.Element; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * Print a DOM tree to the given OutputStream + */ +public class DOMPrinter +{ + /** + * Print the given node and all its children. + * @param n The Node to print. + * @param os The Stream to print to. + */ + public static void printNode(Node n, OutputStream os) + { + PrintStream p = new PrintStream(os); + printNode(n, p); + } + /** + * Print the given node and all its children. + * @param n The Node to print. + * @param p The Stream to print to. + */ + public static void printNode(Node n, PrintStream p) + { + if (null != n.getNodeValue()) p.print(n.getNodeValue()); + else { + p.print("<"+n.getNodeName()); + if (n.hasAttributes()) { + NamedNodeMap nnm = n.getAttributes(); + for (int i = 0; i < nnm.getLength(); i++) { + Node attr = nnm.item(i); + p.print(" "+attr.getNodeName()+"='"+attr.getNodeValue()+"'"); + } + } + if (n.hasChildNodes()) { + p.print(">"); + NodeList nl = n.getChildNodes(); + for (int i = 0; i < nl.getLength(); i++) + printNode(nl.item(i), p); + p.print(""); + } else { + p.print("/>"); + } + } + } + /** + * Print the given document and all its children. + * @param d The Document to print. + * @param p The Stream to print to. + */ + public static void printDOM(Document d, PrintStream p) + { + DocumentType dt = d.getDoctype(); + if (null != dt) { + p.print(""); + } + Element e = d.getDocumentElement(); + printNode(e, p); + } + /** + * Print the given document and all its children. + * @param d The Document to print. + * @param os The Stream to print to. + */ + public static void printDOM(Document d, OutputStream os) + { + PrintStream p = new PrintStream(os); + printDOM(d, p); + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecInputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecInputStream.java new file mode 100755 index 0000000..517cded --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecInputStream.java @@ -0,0 +1,142 @@ +/* + * Java Exec Pipe Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.FilterInputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class to pipe an InputStream through a command using stdin/stdout. + * E.g. + *
+ *    Reader r = new InputStreamReader(new ExecInputStream(new FileInputStream("file"), "command"));
+ * 
+ */ +public class ExecInputStream extends FilterInputStream +{ + private Process proc; + private InputStream stdout; + private OutputStream stdin; + private InOutCopier copy; + + /** + * Create a new ExecInputStream on the given InputStream + * using the process to filter the stream. + * @param is Reads from this InputStream + * @param p Filters data through stdin/out on this Process + */ + public ExecInputStream(InputStream is, Process p) throws IOException + { + super(is); + proc = p; + stdin = p.getOutputStream(); + stdout = p.getInputStream(); + copy = new InOutCopier(in, stdin); + copy.start(); + } + /** + * Create a new ExecInputStream on the given InputStream + * using the process to filter the stream. + * @param is Reads from this InputStream + * @param cmd Creates a Process from this string to filter data through stdin/out + */ + public ExecInputStream(InputStream is, String cmd) throws IOException + { this(is, Runtime.getRuntime().exec(cmd)); } + /** + * Create a new ExecInputStream on the given InputStream + * using the process to filter the stream. + * @param is Reads from this InputStream + * @param cmd Creates a Process from this string array (command, arg, ...) to filter data through stdin/out + */ + public ExecInputStream(InputStream is, String[] cmd) throws IOException + { this(is, Runtime.getRuntime().exec(cmd)); } + /** + * Create a new ExecInputStream on the given InputStream + * using the process to filter the stream. + * @param is Reads from this InputStream + * @param cmd Creates a Process from this string to filter data through stdin/out + * @param env Setup the environment for the command + */ + public ExecInputStream(InputStream is, String cmd, String[] env) throws IOException + { this(is, Runtime.getRuntime().exec(cmd, env)); } + /** + * Create a new ExecInputStream on the given InputStream + * using the process to filter the stream. + * @param is Reads from this InputStream + * @param cmd Creates a Process from this string array (command, arg, ...) to filter data through stdin/out + * @param env Setup the environment for the command + */ + public ExecInputStream(InputStream is, String[] cmd, String[] env) throws IOException + { this(is, Runtime.getRuntime().exec(cmd, env)); } + + public void close() throws IOException + { + try { + proc.waitFor(); + } catch (InterruptedException Ie) {} + //copy.close(); + try { + copy.join(); + } catch (InterruptedException Ie) {} + stdin.close(); + in.close(); + stdout.close(); + } + public void flush() throws IOException + { + copy.flush(); + } + public int available() throws IOException + { return stdout.available(); } + public int read() throws IOException + { return stdout.read(); } + public int read(byte[] b) throws IOException + { return stdout.read(b); } + public int read(byte[] b, int off, int len) throws IOException + { return stdout.read(b, off, len); } + public long skip(long n) throws IOException + { return stdout.skip(n); } + public void mark(int readlimit) + {} + public boolean markSupported() + { return false; } + public void reset() + {} + + public void finalize() + { + try { + close(); + } catch (Exception e) {} + } +} + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecOutputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecOutputStream.java new file mode 100755 index 0000000..9ee92d6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/ExecOutputStream.java @@ -0,0 +1,137 @@ +/* + * Java Exec Pipe Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.FilterOutputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class to pipe an OutputStream through a command using stdin/stdout. + * E.g. + *
+ *    Writer w = new OutputStreamWriter(new ExecOutputStream(new FileOutputStream("file"), "command"));
+ * 
+ */ +public class ExecOutputStream extends FilterOutputStream +{ + private Process proc; + private InputStream stdout; + private OutputStream stdin; + private InOutCopier copy; + + /** + * Create a new ExecOutputStream on the given OutputStream + * using the process to filter the stream. + * @param os Writes to this OutputStream + * @param p Filters data through stdin/out on this Process + */ + public ExecOutputStream(OutputStream os, Process p) throws IOException + { + super(os); + proc = p; + stdin = p.getOutputStream(); + stdout = p.getInputStream(); + copy = new InOutCopier(stdout, out); + copy.start(); + } + /** + * Create a new ExecOutputStream on the given OutputStream + * using the process to filter the stream. + * @param os Writes to this OutputStream + * @param cmd Creates a Process from this string to filter data through stdin/out + */ + public ExecOutputStream(OutputStream os, String cmd) throws IOException + { this(os, Runtime.getRuntime().exec(cmd)); } + /** + * Create a new ExecOutputStream on the given OutputStream + * using the process to filter the stream. + * @param os Writes to this OutputStream + * @param cmd Creates a Process from this string array (command, arg, ...) to filter data through stdin/out + */ + public ExecOutputStream(OutputStream os, String[] cmd) throws IOException + { this(os, Runtime.getRuntime().exec(cmd)); } + /** + * Create a new ExecOutputStream on the given OutputStream + * using the process to filter the stream. + * @param os Writes to this OutputStream + * @param cmd Creates a Process from this string to filter data through stdin/out + * @param env Setup the environment for the command + */ + public ExecOutputStream(OutputStream os, String cmd, String[] env) throws IOException + { this(os, Runtime.getRuntime().exec(cmd, env)); } + /** + * Create a new ExecOutputStream on the given OutputStream + * using the process to filter the stream. + * @param os Writes to this OutputStream + * @param cmd Creates a Process from this string array (command, arg, ...) to filter data through stdin/out + * @param env Setup the environment for the command + */ + public ExecOutputStream(OutputStream os, String[] cmd, String[] env) throws IOException + { this(os, Runtime.getRuntime().exec(cmd, env)); } + + public void close() throws IOException + { + stdin.close(); + try { + proc.waitFor(); + } catch (InterruptedException Ie) {} + //copy.close(); + try { + copy.join(); + } catch (InterruptedException Ie) {} + stdout.close(); + out.close(); + } + public void flush() throws IOException + { + stdin.flush(); + copy.flush(); + out.flush(); + } + public void write(byte[] b) throws IOException + { + stdin.write(b); + } + public void write(byte[] b, int off, int len) throws IOException + { + stdin.write(b, off, len); + } + public void write(int b) throws IOException + { + stdin.write(b); + } + public void finalize() + { + try { + close(); + } catch (Exception e) {} + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/InOutCopier.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/InOutCopier.java new file mode 100755 index 0000000..4968853 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/InOutCopier.java @@ -0,0 +1,115 @@ +/* + * Java Exec Pipe Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +/** + * Copies from an input stream to an output stream using a Thread. + * example: + * + *
+ * InputStream a = getInputStream();
+ * OutputStream b = getOutputStream();
+ * InOutCopier copier = new InOutCopier(a, b);
+ * copier.start();
+ * <do stuff that writes to the inputstream>
+ * 
+ */ +public class InOutCopier extends Thread +{ + private static final int BUFSIZE=1024; + private static final int POLLTIME=100; + private BufferedInputStream is; + private OutputStream os; + private boolean enable; + /** + * Create a copier from an inputstream to an outputstream + * @param is The stream to copy from + * @param os the stream to copy to + */ + public InOutCopier(InputStream is, OutputStream os) throws IOException + { + this.is = new BufferedInputStream(is); + this.os = os; + this.enable = true; + } + /** + * Force close the stream without waiting for EOF on the source + */ + public void close() + { + enable = false; + interrupt(); + } + /** + * Flush the outputstream + */ + public void flush() throws IOException + { + os.flush(); + } + /** Start the thread and wait to make sure its really started */ + public synchronized void start() + { + super.start(); + try { + wait(); + } catch (InterruptedException Ie) {} + } + /** + * Copies from the inputstream to the outputstream + * until EOF on the inputstream or explicitly closed + * @see #close() + */ + public void run() + { + byte[] buf = new byte[BUFSIZE]; + synchronized (this) { + notifyAll(); + } + while (enable) + try { + int n = is.read(buf); + if (0 > n) + break; + if (0 < n) { + os.write(buf, 0, (n> BUFSIZE? BUFSIZE:n)); + os.flush(); + } + } catch (IOException IOe) { + break; + } + try { os.close(); } catch (IOException IOe) {} + } +} + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeInputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeInputStream.java new file mode 100755 index 0000000..f769b11 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeInputStream.java @@ -0,0 +1,155 @@ +/* + * Java Tee Stream Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilterInputStream; +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Class to copy a stream to a file or another stream as it is being sent through a stream pipe + * E.g. + *
+ *    Reader r = new InputStreamReader(new TeeInputStream(new FileInputStream("file"), new File("otherfile")));
+ * 
+ */ +public class TeeInputStream extends FilterInputStream +{ + private InputStream in; + private OutputStream fos; + /** + * Create a new TeeInputStream on the given InputStream + * and copy the stream to the given File. + * @param is Reads from this InputStream + * @param tos Write to this OutputStream + */ + public TeeInputStream(InputStream is, OutputStream tos) throws IOException + { + super(is); + this.in = is; + this.fos = tos; + } + /** + * Create a new TeeInputStream on the given InputStream + * and copy the stream to the given File. + * @param is Reads from this InputStream + * @param f Write to this File + * @param append Append to file not overwrite + */ + public TeeInputStream(InputStream is, File f, boolean append) throws IOException + { + super(is); + this.in = is; + this.fos = new FileOutputStream(f, append); + } + /** + * Create a new TeeInputStream on the given InputStream + * and copy the stream to the given File. + * @param is Reads from this InputStream + * @param f Write to this File + */ + public TeeInputStream(InputStream is, File f) throws IOException + { + super(is); + this.in = is; + this.fos = new FileOutputStream(f); + } + /** + * Create a new TeeInputStream on the given InputStream + * and copy the stream to the given File. + * @param is Reads from this InputStream + * @param f Write to this File + * @param append Append to file not overwrite + */ + public TeeInputStream(InputStream is, String f, boolean append) throws IOException + { + this(is, new File(f), append); + } + /** + * Create a new TeeInputStream on the given InputStream + * and copy the stream to the given File. + * @param is Reads from this InputStream + * @param f Write to this File + */ + public TeeInputStream(InputStream is, String f) throws IOException + { + this(is, new File(f)); + } + public void close() throws IOException + { + in.close(); + fos.close(); + } + public void flush() throws IOException + { + fos.flush(); + } + public int available() throws IOException + { + return in.available(); + } + public int read() throws IOException + { + int i = in.read(); + if (-1 != i) fos.write(i); + return i; + } + public int read(byte[] b) throws IOException + { + int c = in.read(b); + if (-1 != c) fos.write(b, 0, c); + return c; + } + public int read(byte[] b, int off, int len) throws IOException + { + int c = in.read(b, off, len); + if (-1 != c) fos.write(b, off, c); + return c; + } + public long skip(long n) throws IOException + { return in.skip(n); } + public void mark(int readlimit) + {} + public boolean markSupported() + { return false; } + public void reset() throws IOException + { in.reset(); } + + public void finalize() + { + try { + close(); + } catch (Exception e) {} + } +} + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeOutputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeOutputStream.java new file mode 100755 index 0000000..3050923 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/TeeOutputStream.java @@ -0,0 +1,141 @@ +/* + * Java Tee Stream Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilterOutputStream; +import java.io.OutputStream; +import java.io.IOException; + +/** + * Class to copy a stream to another stream or file as it is being sent through a stream pipe + * E.g. + *
+ *    PrintWriter r = new PrintWriter(new TeeOutputStream(new FileOutputStream("file"), new File("otherfile")));
+ * 
+ */ +public class TeeOutputStream extends FilterOutputStream +{ + private File f; + private OutputStream out; + private OutputStream fos; + /** + * Create a new TeeOutputStream on the given OutputStream + * and copy the stream to the other OuputStream. + * @param os Writes to this OutputStream + * @param tos Write to this OutputStream + */ + public TeeOutputStream(OutputStream os, OutputStream tos) throws IOException + { + super(os); + this.out = os; + this.fos = tos; + } + /** + * Create a new TeeOutputStream on the given OutputStream + * and copy the stream to the given File. + * @param os Writes to this OutputStream + * @param f Write to this File + * @param append Append to file not overwrite + */ + public TeeOutputStream(OutputStream os, File f, boolean append) throws IOException + { + super(os); + this.out = os; + this.fos = new FileOutputStream(f, append); + } + /** + * Create a new TeeOutputStream on the given OutputStream + * and copy the stream to the given File. + * @param os Writes to this OutputStream + * @param f Write to this File + */ + public TeeOutputStream(OutputStream os, File f) throws IOException + { + super(os); + this.out = os; + this.fos = new FileOutputStream(f); + } + /** + * Create a new TeeOutputStream on the given OutputStream + * and copy the stream to the given File. + * @param os Writes to this OutputStream + * @param f Write to this File + * @param append Append to file not overwrite + */ + public TeeOutputStream(OutputStream os, String f, boolean append) throws IOException + { + this(os, new File(f), append); + } + /** + * Create a new TeeOutputStream on the given OutputStream + * and copy the stream to the given File. + * @param os Writes to this OutputStream + * @param f Write to this File + */ + public TeeOutputStream(OutputStream os, String f) throws IOException + { + this(os, new File(f)); + } + public void close() throws IOException + { + out.close(); + fos.close(); + } + public void flush() throws IOException + { + fos.flush(); + out.flush(); + } + public void write(int b) throws IOException + { + fos.write(b); + out.write(b); + } + public void write(byte[] b) throws IOException + { + fos.write(b); + out.write(b); + } + public void write(byte[] b, int off, int len) throws IOException + { + fos.write(b, off, len); + out.write(b, off, len); + } + + public void finalize() + { + try { + close(); + } catch (Exception e) {} + } +} + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test.java new file mode 100755 index 0000000..0f3c9e4 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test.java @@ -0,0 +1,48 @@ +/* + * Java IO Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; +import java.io.PrintWriter; +import java.io.OutputStreamWriter; +class test +{ + public static void main(String[] args) throws Exception + { + PrintWriter out = new PrintWriter(new OutputStreamWriter(new ExecOutputStream(System.out, "xsltproc mcr.xsl -")));///java cx.ath.matthew.io.findeof"))); + + out.println(""); + out.println(" "); + out.println(" "); + out.println(" TEST"); + out.println(" "); + out.println("hello, he is helping tie up helen's lemmings"); + out.println("we are being followed and we break out"); + out.println(" "); + out.println(" "); + out.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test2.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test2.java new file mode 100755 index 0000000..bd7a047 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test2.java @@ -0,0 +1,39 @@ +/* + * Java IO Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; +import java.io.BufferedReader; +import java.io.InputStreamReader; +class test2 +{ + public static void main(String[] args) throws Exception + { + BufferedReader in = new BufferedReader(new InputStreamReader(new ExecInputStream(System.in, "xsltproc mcr.xsl -"))); + String s; + while (null != (s = in.readLine())) System.out.println(s); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test3.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test3.java new file mode 100755 index 0000000..5d40214 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/io/test3.java @@ -0,0 +1,45 @@ +/* + * Java IO Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.io; +import java.io.PrintWriter; +import java.io.BufferedReader; +import java.io.InputStreamReader; +class test3 +{ + public static void main(String[] args) throws Exception + { + String file = args[0]; + PrintWriter p = new PrintWriter(new TeeOutputStream(System.out, file)); + BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); + String s; + while (null != (s = r.readLine())) + p.println(s); + p.close(); + r.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/NotConnectedException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/NotConnectedException.java new file mode 100755 index 0000000..7f5c4e7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/NotConnectedException.java @@ -0,0 +1,37 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.net.SocketException; + +public class NotConnectedException extends SocketException +{ + public NotConnectedException() + { + super("The Socket is Not Connected"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USInputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USInputStream.java new file mode 100755 index 0000000..95a95e6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USInputStream.java @@ -0,0 +1,84 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.io.InputStream; +import java.io.IOException; + +public class USInputStream extends InputStream +{ + public static final int MSG_DONTWAIT = 0x40; + private native int native_recv(int sock, byte[] b, int off, int len, int flags, int timeout) throws IOException; + private int sock; + boolean closed = false; + private byte[] onebuf = new byte[1]; + private UnixSocket us; + private boolean blocking = true; + private int flags = 0; + private int timeout = 0; + public USInputStream(int sock, UnixSocket us) + { + this.sock = sock; + this.us = us; + } + public void close() throws IOException + { + closed = true; + us.close(); + } + public boolean markSupported() { return false; } + public int read() throws IOException + { + int rv = 0; + while (0 >= rv) rv = read(onebuf); + if (-1 == rv) return -1; + return 0 > onebuf[0] ? -onebuf[0] : onebuf[0]; + } + public int read(byte[] b, int off, int len) throws IOException + { + if (closed) throw new NotConnectedException(); + int count = native_recv(sock, b, off, len, flags, timeout); + /* Yes, I really want to do this. Recv returns 0 for 'connection shut down'. + * read() returns -1 for 'end of stream. + * Recv returns -1 for 'EAGAIN' (all other errors cause an exception to be raised) + * whereas read() returns 0 for '0 bytes read', so yes, I really want to swap them here. + */ + if (0 == count) return -1; + else if (-1 == count) return 0; + else return count; + } + public boolean isClosed() { return closed; } + public UnixSocket getSocket() { return us; } + public void setBlocking(boolean enable) + { + flags = enable ? 0 : MSG_DONTWAIT; + } + public void setSoTimeout(int timeout) + { + this.timeout = timeout; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USOutputStream.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USOutputStream.java new file mode 100755 index 0000000..7e06289 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/USOutputStream.java @@ -0,0 +1,69 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.io.IOException; +import java.io.OutputStream; + +public class USOutputStream extends OutputStream +{ + private native int native_send(int sock, byte[] b, int off, int len) throws IOException; + private native int native_send(int sock, byte[][] b) throws IOException; + private int sock; + boolean closed = false; + private byte[] onebuf = new byte[1]; + private UnixSocket us; + public USOutputStream(int sock, UnixSocket us) + { + this.sock = sock; + this.us = us; + } + public void close() throws IOException + { + closed = true; + us.close(); + } + public void flush() {} // no-op, we do not buffer + public void write(byte[][] b) throws IOException + { + if (closed) throw new NotConnectedException(); + native_send(sock, b); + } + public void write(byte[] b, int off, int len) throws IOException + { + if (closed) throw new NotConnectedException(); + native_send(sock, b, off, len); + } + public void write(int b) throws IOException + { + onebuf[0] = (byte) (b % 0x7F); + if (1 == (b % 0x80)) onebuf[0] = (byte) -onebuf[0]; + write(onebuf); + } + public boolean isClosed() { return closed; } + public UnixSocket getSocket() { return us; } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixIOException.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixIOException.java new file mode 100755 index 0000000..61cdc12 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixIOException.java @@ -0,0 +1,44 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.io.IOException; + +/** + * An IO Exception which occurred during UNIX Socket IO + */ +public class UnixIOException extends IOException +{ + private int no; + private String message; + public UnixIOException(int no, String message) + { + super(message); + this.message = message; + this.no = no; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixServerSocket.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixServerSocket.java new file mode 100755 index 0000000..082978c --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixServerSocket.java @@ -0,0 +1,129 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.io.IOException; + +/** + * Represents a listening UNIX Socket. + */ +public class UnixServerSocket +{ + static { System.loadLibrary("unix-java"); } + private native int native_bind(String address, boolean abs) throws IOException; + private native void native_close(int sock) throws IOException; + private native int native_accept(int sock) throws IOException; + private UnixSocketAddress address = null; + private boolean bound = false; + private boolean closed = false; + private int sock; + /** + * Create an un-bound server socket. + */ + public UnixServerSocket() + { + } + /** + * Create a server socket bound to the given address. + * @param address Path to the socket. + */ + public UnixServerSocket(UnixSocketAddress address) throws IOException + { + bind(address); + } + /** + * Create a server socket bound to the given address. + * @param address Path to the socket. + */ + public UnixServerSocket(String address) throws IOException + { + this(new UnixSocketAddress(address)); + } + /** + * Accepts a connection on the ServerSocket. + * @return A UnixSocket connected to the accepted connection. + */ + public UnixSocket accept() throws IOException + { + int client_sock = native_accept(sock); + return new UnixSocket(client_sock, address); + } + /** + * Closes the ServerSocket. + */ + public synchronized void close() throws IOException + { + native_close(sock); + sock = 0; + closed = true; + bound = false; + } + /** + * Binds a server socket to the given address. + * @param address Path to the socket. + */ + public void bind(UnixSocketAddress address) throws IOException + { + if (bound) close(); + sock = native_bind(address.path, address.abs); + bound = true; + closed = false; + this.address = address; + } + /** + * Binds a server socket to the given address. + * @param address Path to the socket. + */ + public void bind(String address) throws IOException + { + bind(new UnixSocketAddress(address)); + } + /** + * Return the address this socket is bound to. + * @return The UnixSocketAddress if bound or null if unbound. + */ + public UnixSocketAddress getAddress() + { + return address; + } + /** + * Check the status of the socket. + * @return True if closed. + */ + public boolean isClosed() + { + return closed; + } + /** + * Check the status of the socket. + * @return True if bound. + */ + public boolean isBound() + { + return bound; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocket.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocket.java new file mode 100755 index 0000000..f652614 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocket.java @@ -0,0 +1,320 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +import java.io.InputStream; +import java.io.IOException; +import java.io.OutputStream; + +import cx.ath.matthew.debug.Debug; + +/** + * Represents a UnixSocket. + */ +public class UnixSocket +{ + static { System.loadLibrary("unix-java"); } + private native void native_set_pass_cred(int sock, boolean passcred) throws IOException; + private native int native_connect(String address, boolean abs) throws IOException; + private native void native_close(int sock) throws IOException; + private native int native_getPID(int sock); + private native int native_getUID(int sock); + private native int native_getGID(int sock); + private native void native_send_creds(int sock, byte data) throws IOException; + private native byte native_recv_creds(int sock, int[] creds) throws IOException; + + private UnixSocketAddress address = null; + private USOutputStream os = null; + private USInputStream is = null; + private boolean closed = false; + private boolean connected = false; + private boolean passcred = false; + private int sock = 0; + private boolean blocking = true; + private int uid = -1; + private int pid = -1; + private int gid = -1; + UnixSocket(int sock, UnixSocketAddress address) + { + this.sock = sock; + this.address = address; + this.connected = true; + this.os = new USOutputStream(sock, this); + this.is = new USInputStream(sock, this); + } + /** + * Create an unconnected socket. + */ + public UnixSocket() + { + } + /** + * Create a socket connected to the given address. + * @param address The Unix Socket address to connect to + */ + public UnixSocket(UnixSocketAddress address) throws IOException + { + connect(address); + } + /** + * Create a socket connected to the given address. + * @param address The Unix Socket address to connect to + */ + public UnixSocket(String address) throws IOException + { + this(new UnixSocketAddress(address)); + } + /** + * Connect the socket to this address. + * @param address The Unix Socket address to connect to + */ + public void connect(UnixSocketAddress address) throws IOException + { + if (connected) close(); + this.sock = native_connect(address.path, address.abs); + this.os = new USOutputStream(this.sock, this); + this.is = new USInputStream(this.sock, this); + this.address = address; + this.connected = true; + this.closed = false; + this.is.setBlocking(blocking); + } + /** + * Connect the socket to this address. + * @param address The Unix Socket address to connect to + */ + public void connect(String address) throws IOException + { + connect(new UnixSocketAddress(address)); + } + public void finalize() + { + try { + close(); + } catch (IOException IOe) {} + } + /** + * Closes the connection. + */ + public synchronized void close() throws IOException + { + if (Debug.debug) Debug.print(Debug.INFO, "Closing socket"); + native_close(sock); + sock = 0; + this.closed = true; + this.connected = false; + os = null; + is = null; + } + /** + * Returns an InputStream for reading from the socket. + * @return An InputStream connected to this socket. + */ + public InputStream getInputStream() + { + return is; + } + /** + * Returns an OutputStream for writing to the socket. + * @return An OutputStream connected to this socket. + */ + public OutputStream getOutputStream() + { + return os; + } + /** + * Returns the address this socket is connected to. + * Returns null if the socket is unconnected. + * @return The UnixSocketAddress the socket is connected to + */ + public UnixSocketAddress getAddress() + { + return address; + } + /** + * Send a single byte of data with credentials. + * (Works on BSDs) + * @param data The byte of data to send. + */ + public void sendCredentialByte(byte data) throws IOException + { + if (!connected) throw new NotConnectedException(); + native_send_creds(sock, data); + } + /** + * Receive a single byte of data, with credentials. + * (Works on BSDs) + * @see getPeerUID + * @see getPeerPID + * @see getPeerGID + * @param data The byte of data to send. + */ + public byte recvCredentialByte() throws IOException + { + if (!connected) throw new NotConnectedException(); + int[] creds = new int[] { -1, -1, -1 }; + byte data = native_recv_creds(sock, creds); + pid = creds[0]; + uid = creds[1]; + gid = creds[2]; + return data; + } + /** + * Get the credential passing status. + * (only effective on linux) + * @return The current status of credential passing. + * @see setPassCred + */ + public boolean getPassCred() + { + return passcred; + } + /** + * Return the uid of the remote process. + * Some data must have been received on the socket to do this. + * Either setPassCred must be called on Linux first, or recvCredentialByte + * on BSD. + * @return the UID or -1 if it is not available + */ + public int getPeerUID() + { + if (-1 == uid) + uid = native_getUID(sock); + return uid; + } + /** + * Return the gid of the remote process. + * Some data must have been received on the socket to do this. + * Either setPassCred must be called on Linux first, or recvCredentialByte + * on BSD. + * @return the GID or -1 if it is not available + */ + public int getPeerGID() + { + if (-1 == gid) + gid = native_getGID(sock); + return gid; + } + /** + * Return the pid of the remote process. + * Some data must have been received on the socket to do this. + * Either setPassCred must be called on Linux first, or recvCredentialByte + * on BSD. + * @return the PID or -1 if it is not available + */ + public int getPeerPID() + { + if (-1 == pid) + pid = native_getPID(sock); + return pid; + } + /** + * Set the credential passing status. + * (Only does anything on linux, for other OS, you need + * to use send/recv credentials) + * @param enable Set to true for credentials to be passed. + */ + public void setPassCred(boolean enable) throws IOException + { + native_set_pass_cred(sock, enable); + passcred = enable; + } + /** + * Get the blocking mode. + * @return true if reads are blocking. + * @see setBlocking + */ + public boolean getBlocking() + { + return blocking; + } + /** + * Set the blocking mode. + * @param enable Set to false for non-blocking reads. + */ + public void setBlocking(boolean enable) + { + blocking = enable; + if (null != is) is.setBlocking(enable); + } + + /** + * Check the socket status. + * @return true if closed. + */ + public boolean isClosed() + { + return closed; + } + /** + * Check the socket status. + * @return true if connected. + */ + public boolean isConnected() + { + return connected; + } + /** + * Check the socket status. + * @return true if the input stream has been shutdown + */ + public boolean isInputShutdown() + { + return is.isClosed(); + } + /** + * Check the socket status. + * @return true if the output stream has been shutdown + */ + public boolean isOutputShutdown() + { + return os.isClosed(); + } + /** + * Shuts down the input stream. + * Subsequent reads on the associated InputStream will fail. + */ + public void shutdownInput() + { + is.closed = true; + } + /** + * Shuts down the output stream. + * Subsequent writes to the associated OutputStream will fail. + */ + public void shutdownOutput() + { + os.closed = true; + } + /** + * Set timeout of read requests. + */ + public void setSoTimeout(int timeout) + { + is.setSoTimeout(timeout); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocketAddress.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocketAddress.java new file mode 100755 index 0000000..319cd60 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/UnixSocketAddress.java @@ -0,0 +1,85 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2004 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ +package cx.ath.matthew.unix; + +/** + * Represents an address for a Unix Socket + */ +public class UnixSocketAddress +{ + String path; + boolean abs; + /** + * Create the address. + * @param path The path to the Unix Socket. + * @param abs True if this should be an abstract socket. + */ + public UnixSocketAddress(String path, boolean abs) + { + this.path = path; + this.abs = abs; + } + /** + * Create the address. + * @param path The path to the Unix Socket. + */ + public UnixSocketAddress(String path) + { + this.path = path; + this.abs = false; + } + /** + * Return the path. + */ + public String getPath() + { + return path; + } + /** + * Returns true if this an address for an abstract socket. + */ + public boolean isAbstract() + { + return abs; + } + /** + * Return the Address as a String. + */ + public String toString() + { + return "unix"+(abs?":abstract":"")+":path="+path; + } + public boolean equals(Object o) + { + if (!(o instanceof UnixSocketAddress)) return false; + return ((UnixSocketAddress) o).path.equals(this.path); + } + public int hashCode() + { + return path.hashCode(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/java-unix.h b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/java-unix.h new file mode 100755 index 0000000..f0d1ebe --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/java-unix.h @@ -0,0 +1,112 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class cx_ath_matthew_unix_UnixServerSocket */ + +#ifndef _Included_cx_ath_matthew_unix_UnixServerSocket +#define _Included_cx_ath_matthew_unix_UnixServerSocket +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_bind + * Signature: (Ljava/lang/String;Z)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1bind + (JNIEnv *, jobject, jstring, jboolean); + +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_close + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1close + (JNIEnv *, jobject, jint); + +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_accept + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1accept + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class cx_ath_matthew_unix_UnixSocket */ + +#ifndef _Included_cx_ath_matthew_unix_UnixSocket +#define _Included_cx_ath_matthew_unix_UnixSocket +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_set_pass_cred + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1set_1pass_1cred + (JNIEnv *, jobject, jint, jboolean); + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_connect + * Signature: (Ljava/lang/String;Z)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1connect + (JNIEnv *, jobject, jstring, jboolean); + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_close + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1close + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class cx_ath_matthew_unix_USInputStream */ + +#ifndef _Included_cx_ath_matthew_unix_USInputStream +#define _Included_cx_ath_matthew_unix_USInputStream +#ifdef __cplusplus +extern "C" { +#endif +#undef cx_ath_matthew_unix_USInputStream_SKIP_BUFFER_SIZE +#define cx_ath_matthew_unix_USInputStream_SKIP_BUFFER_SIZE 2048L +/* + * Class: cx_ath_matthew_unix_USInputStream + * Method: native_recv + * Signature: (I[BII)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_USInputStream_native_1recv + (JNIEnv *, jobject, jint, jbyteArray, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif +/* Header for class cx_ath_matthew_unix_USOutputStream */ + +#ifndef _Included_cx_ath_matthew_unix_USOutputStream +#define _Included_cx_ath_matthew_unix_USOutputStream +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: cx_ath_matthew_unix_USOutputStream + * Method: native_send + * Signature: (I[BII)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_USOutputStream_native_1send + (JNIEnv *, jobject, jint, jbyteArray, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testclient.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testclient.java new file mode 100755 index 0000000..f390b4a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testclient.java @@ -0,0 +1,51 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.unix; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; + +public class testclient +{ + public static void main(String args[]) throws IOException + { + UnixSocket s = new UnixSocket(new UnixSocketAddress("testsock", true)); + OutputStream os = s.getOutputStream(); + PrintWriter o = new PrintWriter(os); + BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); + String l; + while (null != (l = r.readLine())) { + byte[] buf = (l+"\n").getBytes(); + os.write(buf, 0, buf.length); + } + s.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testserver.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testserver.java new file mode 100755 index 0000000..5e1d416 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/unix/testserver.java @@ -0,0 +1,55 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.unix; + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.IOException; + +public class testserver +{ + public static void main(String args[]) throws IOException + { + UnixServerSocket ss = new UnixServerSocket(new UnixSocketAddress("testsock", true)); + UnixSocket s = ss.accept(); + BufferedReader r = new BufferedReader(new InputStreamReader(s.getInputStream())); + String l; + while (null != (l = r.readLine())) + System.out.println(l);/* + InputStream is = s.getInputStream(); + int r; + do { + r = is.read(); + System.out.print((char)r); + } while (-1 != r);*/ + s.close(); + ss.close(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/utils/Hexdump.java b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/utils/Hexdump.java new file mode 100755 index 0000000..02cf5c6 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/cx/ath/matthew/utils/Hexdump.java @@ -0,0 +1,149 @@ +/* + * Java Hexdump Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + +package cx.ath.matthew.utils; + +import java.io.PrintStream; + +public class Hexdump +{ + public static final char[] hexchars = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + public static String toHex(byte[] buf) + { + return toHex(buf, 0, buf.length); + } + public static String toHex(byte[] buf, int ofs, int len) + { + StringBuffer sb = new StringBuffer(); + int j = ofs+len; + for (int i = ofs; i < j; i++) { + if (i < buf.length) { + sb.append(hexchars[(buf[i] & 0xF0) >> 4]); + sb.append(hexchars[buf[i] & 0x0F]); + sb.append(' '); + } else { + sb.append(' '); + sb.append(' '); + sb.append(' '); + } + } + return sb.toString(); + } + + public static String toAscii(byte[] buf) + { + return toAscii(buf, 0, buf.length); + } + public static String toAscii(byte[] buf, int ofs, int len) + { + StringBuffer sb = new StringBuffer(); + int j = ofs+len; + for (int i = ofs; i < j ; i++) { + if (i < buf.length) { + if (20 <= buf[i] && 126 >= buf[i]) + sb.append((char) buf[i]); + else + sb.append('.'); + } else + sb.append(' '); + } + return sb.toString(); + } + public static String format(byte[] buf) + { + return format(buf, 80); + } + public static String format(byte[] buf, int width) + { + int bs = (width - 8) / 4; + int i = 0; + StringBuffer sb = new StringBuffer(); + do { + for (int j = 0; j < 6; j++) { + sb.append(hexchars[(i << (j*4) & 0xF00000) >> 20]); + } + sb.append('\t'); + sb.append(toHex(buf, i, bs)); + sb.append(' '); + sb.append(toAscii(buf, i, bs)); + sb.append('\n'); + i += bs; + } while (i < buf.length); + return sb.toString(); + } + public static void print(byte[] buf) + { + print(buf, System.err); + } + public static void print(byte[] buf, int width) + { + print(buf, width, System.err); + } + public static void print(byte[] buf, int width, PrintStream out) + { + out.print(format(buf, width)); + } + public static void print(byte[] buf, PrintStream out) + { + out.print(format(buf)); + } + /** + * Returns a string which can be written to a Java source file as part + * of a static initializer for a byte array. + * Returns data in the format 0xAB, 0xCD, .... + * use like: + * javafile.print("byte[] data = {") + * javafile.print(Hexdump.toByteArray(data)); + * javafile.println("};"); + */ + public static String toByteArray(byte[] buf) + { + return toByteArray(buf, 0, buf.length); + } + /** + * Returns a string which can be written to a Java source file as part + * of a static initializer for a byte array. + * Returns data in the format 0xAB, 0xCD, .... + * use like: + * javafile.print("byte[] data = {") + * javafile.print(Hexdump.toByteArray(data)); + * javafile.println("};"); + */ + public static String toByteArray(byte[] buf, int ofs, int len) + { + StringBuffer sb = new StringBuffer(); + for (int i = ofs; i < len && i < buf.length; i++) { + sb.append('0'); + sb.append('x'); + sb.append(hexchars[(buf[i] & 0xF0) >> 4]); + sb.append(hexchars[buf[i] & 0x0F]); + if ((i+1) < len && (i+1) < buf.length) + sb.append(','); + } + return sb.toString(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/unix-java.c b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/unix-java.c new file mode 100755 index 0000000..4c49b0f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.libmatthew/src/main/java/unix-java.c @@ -0,0 +1,464 @@ +/* + * Java Unix Sockets Library + * + * Copyright (c) Matthew Johnson 2005 + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * To Contact the author, please email src@matthew.ath.cx + * + */ + + +/* _GNU_SOURCE is required to use struct ucred in glibc 2.8 */ +#define _GNU_SOURCE + +#include "unix-java.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef IOV_MAX +#define IOV_MAX 1024 +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + +void throw(JNIEnv* env, int err, const char* msg) +{ + jstring jmsg = (*env)->NewStringUTF(env, msg); + jclass exc = (*env)->FindClass(env, "cx/ath/matthew/unix/UnixIOException"); + jmethodID cons = (*env)->GetMethodID(env, exc, "", "(ILjava/lang/String;)V"); + jobject exo = (*env)->NewObject(env, exc, cons, err, jmsg); + (*env)->DeleteLocalRef(env, exc); + (*env)->DeleteLocalRef(env, jmsg); + (*env)->Throw(env, exo); + (*env)->DeleteLocalRef(env, exo); +} + +void handleerrno(JNIEnv *env) +{ + if (0 == errno) return; + int err = errno; + if (EAGAIN == err) return; // we read 0 bytes due to a timeout + const char* msg = strerror(err); + throw(env, err, msg); +} + +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_bind + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1bind + (JNIEnv *env, jobject o, jstring address, jboolean abstract) +{ + int sock = socket(PF_UNIX, SOCK_STREAM, 0); + if (-1 == sock) { handleerrno(env); return -1; } + const char* caddr = (*env)->GetStringUTFChars(env, address, 0); + int slen = (*env)->GetStringUTFLength(env, address)+1; + struct sockaddr_un *sad = malloc(sizeof(sa_family_t)+slen); + if (abstract) { + char* shifted = sad->sun_path+1; + strncpy(shifted, caddr, slen-1); + sad->sun_path[0] = 0; + } else + strncpy(sad->sun_path, caddr, slen); + (*env)->ReleaseStringUTFChars(env, address, caddr); + sad->sun_family = AF_UNIX; + int rv = bind(sock, (const struct sockaddr*) sad, sizeof(sa_family_t)+slen); + free(sad); + if (-1 == rv) { handleerrno(env); return -1; } + rv = listen(sock, 10); + if (-1 == rv) { handleerrno(env); return -1; } + return sock; +} + +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_close + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1close + (JNIEnv * env, jobject o, jint sock) +{ + if (0 == sock) return; + int rv = shutdown(sock, SHUT_RDWR); + if (-1 == rv) { handleerrno(env); } + else { + rv = close(sock); + if (-1 == rv) { handleerrno(env); } + } +} + +/* + * Class: cx_ath_matthew_unix_UnixServerSocket + * Method: native_accept + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixServerSocket_native_1accept + (JNIEnv * env, jobject o, jint sock) +{ + int newsock = accept(sock, NULL, NULL); + if (-1 == newsock) handleerrno(env); + return newsock; +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_set_pass_cred + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1set_1pass_1cred + (JNIEnv *env, jobject o, jint sock, jboolean enable) +{ +#ifdef SO_PASSCRED + int opt = enable; + int rv = setsockopt(sock, SOL_SOCKET, SO_PASSCRED, &opt, sizeof(int)); + if (-1 == rv) { handleerrno(env);} +#endif +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_connect + * Signature: (Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1connect + (JNIEnv *env, jobject o, jstring address, jboolean abstract) +{ + int sock = socket(PF_UNIX, SOCK_STREAM, 0); + if (-1 == sock) { handleerrno(env); return -1; } + const char* caddr = (*env)->GetStringUTFChars(env, address, 0); + int slen = (*env)->GetStringUTFLength(env, address)+1; + struct sockaddr_un *sad = malloc(sizeof(sa_family_t)+slen); + if (abstract) { + char* shifted = sad->sun_path+1; + strncpy(shifted, caddr, slen-1); + sad->sun_path[0] = 0; + } else + strncpy(sad->sun_path, caddr, slen); + (*env)->ReleaseStringUTFChars(env, address, caddr); + sad->sun_family = AF_UNIX; + int rv = connect(sock, (const struct sockaddr*) sad, sizeof(sa_family_t)+slen); + free(sad); + if (-1 == rv) { handleerrno(env); return -1; } + return sock; +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_close + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1close + (JNIEnv *env, jobject o, jint sock) +{ + if (0 == sock) return; + int rv = shutdown(sock, SHUT_RDWR); + if (-1 == rv) { handleerrno(env); } + else { + rv = close(sock); + if (-1 == rv) { handleerrno(env); } + } +} + +/* + * Class: cx_ath_matthew_unix_USInputStream + * Method: native_recv + * Signature: ([BII)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_USInputStream_native_1recv + (JNIEnv *env, jobject o, jint sock, jbyteArray buf, jint offs, jint len, jint flags, jint timeout) +{ + fd_set rfds; + struct timeval tv; + jbyte* cbuf = (*env)->GetByteArrayElements(env, buf, NULL); + void* recvb = cbuf + offs; + int rv; + + if (timeout > 0) { + FD_ZERO(&rfds); + FD_SET(sock, &rfds); + tv.tv_sec = 0; + tv.tv_usec = timeout; + rv = select(sock+1, &rfds, NULL, NULL, &tv); + rv = recv(sock, recvb, len, flags); + if (-1 == rv) { handleerrno(env); rv = -1; } + (*env)->ReleaseByteArrayElements(env, buf, cbuf, 0); + return rv; + } else { + rv = recv(sock, recvb, len, flags); + (*env)->ReleaseByteArrayElements(env, buf, cbuf, 0); + if (-1 == rv) { handleerrno(env); return -1; } + return rv; + } +} + +/* + * Class: cx_ath_matthew_unix_USOutputStream + * Method: native_send + * Signature: (I[BII)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_USOutputStream_native_1send__I_3BII + (JNIEnv *env, jobject o, jint sock, jbyteArray buf, jint offs, jint len) +{ + jbyte* cbuf = (*env)->GetByteArrayElements(env, buf, NULL); + void* sendb = cbuf + offs; + int rv = send(sock, sendb, len, 0); + (*env)->ReleaseByteArrayElements(env, buf, cbuf, 0); + if (-1 == rv) { handleerrno(env); return -1; } + return rv; +} + +/* + * Class: cx_ath_matthew_unix_USOutputStream + * Method: native_send + * Signature: (I[[B)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_USOutputStream_native_1send__I_3_3B + (JNIEnv *env, jobject o, jint sock, jobjectArray bufs) +{ + size_t sblen = 1; + socklen_t sblen_size = sizeof(sblen); + getsockopt(sock, SOL_SOCKET, SO_SNDBUF, &sblen, &sblen_size); + + struct msghdr msg; + struct iovec *iov; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + size_t els = (*env)->GetArrayLength(env, bufs); + iov = (struct iovec*) malloc((els= 0; k--, l--) + (*env)->ReleaseByteArrayElements(env, b[k], iov[l].iov_base, 0); + if (-1 == rv) { handleerrno(env); return -1; } + break; + } + b[i] = (*env)->GetObjectArrayElement(env, bufs, i); + if (NULL == b[i]) { + msg.msg_iovlen = j; + rv = sendmsg(sock, &msg, 0); + for (int k = i-1, l = j-1; l >= 0; k--, l--) + (*env)->ReleaseByteArrayElements(env, b[k], iov[l].iov_base, 0); + if (-1 == rv) { handleerrno(env); return -1; } + break; + } + size_t l = (*env)->GetArrayLength(env, b[i]); + if (s+l > sblen || j == IOV_MAX) { + msg.msg_iovlen = j; + rv = sendmsg(sock, &msg, 0); + s = 0; + for (int k = i-1, l = j-1; l >= 0; k--, l--) + (*env)->ReleaseByteArrayElements(env, b[k], iov[l].iov_base, 0); + j = 0; + if (-1 == rv) { handleerrno(env); return -1; } + } + iov[j].iov_base = (*env)->GetByteArrayElements(env, b[i], NULL); + iov[j].iov_len = l; + s += l; + } + + free(iov); + free(b); + return rv; +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_getPID + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1getPID + (JNIEnv * env, jobject o, jint sock) +{ +#ifdef SO_PEERCRED + struct ucred cr; + socklen_t cl=sizeof(cr); + + if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cr, &cl)==0) + return cr.pid; + else + return -1; +#else + return -1; +#endif +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_getUID + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1getUID + (JNIEnv * env, jobject o, jint sock) +{ +#ifdef SO_PEERCRED + struct ucred cr; + socklen_t cl=sizeof(cr); + + if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cr, &cl)==0) + return cr.uid; + else + return -1; +#else + return -1; +#endif +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_getGID + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1getGID + (JNIEnv * env, jobject o, jint sock) +{ +#ifdef SO_PEERCRED + struct ucred cr; + socklen_t cl=sizeof(cr); + + if (getsockopt(sock, SOL_SOCKET, SO_PEERCRED, &cr, &cl)==0) + return cr.gid; + else + return -1; +#else + return -1; +#endif +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_send_creds + * Signature: (B)V + */ +JNIEXPORT void JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1send_1creds + (JNIEnv * env, jobject o, jint sock, jbyte data) +{ + struct msghdr msg; + struct iovec iov; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_flags = 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + iov.iov_base = &data; + iov.iov_len = 1; + +#ifdef SCM_CREDENTIALS + char buf[CMSG_SPACE(sizeof(struct ucred))]; + msg.msg_control = buf; + msg.msg_controllen = sizeof buf; + struct cmsghdr *cmsg; + struct ucred *creds; + + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_CREDENTIALS; + cmsg->cmsg_len = CMSG_LEN(sizeof(struct ucred)); + /* Initialize the payload: */ + creds = (struct ucred *)CMSG_DATA(cmsg); + creds->pid = getpid(); + creds->uid = getuid(); + creds->gid = getgid(); +#endif + + int rv = sendmsg(sock, &msg, 0); + if (-1 == rv) { handleerrno(env); } +} + +/* + * Class: cx_ath_matthew_unix_UnixSocket + * Method: native_recv_creds + * Signature: ([I)B + */ +JNIEXPORT jbyte JNICALL Java_cx_ath_matthew_unix_UnixSocket_native_1recv_1creds + (JNIEnv *env, jobject o, jint sock, jintArray jcreds) +{ + struct msghdr msg; + char iov_buf = 0; + struct iovec iov; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_flags = 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + iov.iov_base = &iov_buf; + iov.iov_len = 1; + +#ifdef SCM_CREDENTIALS + char buf[CMSG_SPACE(sizeof(struct ucred))]; + msg.msg_control = buf; + msg.msg_controllen = sizeof buf; + struct cmsghdr *cmsg; + struct ucred *creds = NULL; +#endif + + recvmsg(sock, &msg, 0); + +#ifdef SCM_CREDENTIALS + for (cmsg = CMSG_FIRSTHDR(&msg); + cmsg != NULL; + cmsg = CMSG_NXTHDR(&msg,cmsg)) { + if (cmsg->cmsg_level == SOL_SOCKET + && cmsg->cmsg_type == SCM_CREDENTIALS) { + creds = (struct ucred *) CMSG_DATA(cmsg); + break; + } + } + if (NULL != creds) { + jint cred_array[3]; + cred_array[0] = creds->pid; + cred_array[1] = creds->uid; + cred_array[2] = creds->gid; + (*env)->SetIntArrayRegion(env, jcreds, 0, 3, &cred_array[0]); + } +#endif + + return iov_buf; +} + + +#ifdef __cplusplus +} +#endif diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/.project b/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/.project new file mode 100755 index 0000000..5a1a074 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/.project @@ -0,0 +1,11 @@ + + + org.genivi.trafficinfo.maven-parent + + + + + + + + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/pom.xml b/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/pom.xml new file mode 100755 index 0000000..4d1ddcc --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo.maven-parent/pom.xml @@ -0,0 +1,182 @@ + + + 4.0.0 + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + pom + TrafficInfo Project Parent Pom + Top level project for all GENIVI TrafficIncidentsService Eclipse projects. + + + + Codehaus Snapshots + http://nexus.codehaus.org/snapshots/ + + true + + + true + + + + + + + + junit + junit + 4.3.1 + + + org.genivi.trafficinfo + demo + 1.0-SNAPSHOT + + + commons-fileupload + commons-fileupload + 1.1.1 + + + commons-logging + commons-logging + 1.0.4 + + + openlr + openlr-cli-sqlite-with-dependencies + 1.2.2 + + + openlr + openlr-map + 1.2.2 + + + openlr + openlr-map-sqlite-with-dependencies + 1.2.2 + + + org.eclipse.emf + org.eclipse.emf.common + 2.8.0.v20130125-0546 + + + org.eclipse.emf + org.eclipse.emf.ecore + 2.8.3.v20130125-0546 + + + org.eclipse.emf + org.eclipse.emf.ecore.xmi + 2.8.1.v20130125-0546 + + + org.genivi + basetypes-model + 1.0-SNAPSHOT + + + org.genivi + booleanexpr-model + 1.0-SNAPSHOT + + + org.genivi + iconset-model + 1.0-SNAPSHOT + + + org.genivi + locref-model + 1.0-SNAPSHOT + + + org.genivi.trafficincidentsservice + dbuswrapper + 1.0-SNAPSHOT + + + org.genivi + trafficinfo + 1.0-SNAPSHOT + + + org.genivi.trafficincidentsservice.trafficincidents + trafficincidents-trafficincident-model + 1.0-SNAPSHOT + + + org.genivi.trafficincidentsservice + trafficincidentsservice-model + 1.0-SNAPSHOT + + + org.genivi.trafficincidentsservice + trafficincidenttables-model + 1.0-SNAPSHOT + + + org.genivi.trafficincidentsservice.trafficincidentfeed + trafficincidentfeed-trafficincident-model + 1.0-SNAPSHOT + + + org.genivi.trafficinfo + libmatthew + 1.0-SNAPSHOT + + + org.genivi.trafficinfo + dbus-java + 1.0-SNAPSHOT + + + + + ../org.genivi.trafficinfo.libmatthew + ../org.genivi.trafficinfo.dbus-java + ../org.genivi.trafficinfo.demo + ../org.genivi.basetypes-model + ../org.genivi.booleanexpr-model + ../org.genivi.iconset-model + ../org.genivi.locref-model + ../org.genivi.trafficincidentsservice.trafficincidenttables-model + ../org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + ../org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + ../org.genivi.trafficincidentsservice.trafficincidentsservice-model + ../org.genivi.trafficinfo + ../org.genivi.trafficincidentsservice.dbuswrapper + ../org.genivi.trafficincidentsservice.dbus.impl + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.5.1 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-eclipse-plugin + 2.9 + + [groupId].[artifactId] + true + true + + + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/.classpath b/src/traffic-incidents-service/org.genivi.trafficinfo/.classpath new file mode 100755 index 0000000..e903c01 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/.classpath @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/.project b/src/traffic-incidents-service/org.genivi.trafficinfo/.project new file mode 100755 index 0000000..d299524 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/.project @@ -0,0 +1,26 @@ + + + org.genivi.trafficinfo + This project the main part of the GENIVI Traffic Information project. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.genivi.basetypes-model + org.genivi.trafficinfo.dbus-java + org.genivi.trafficinfo.libmatthew + org.genivi.trafficincidentsservice.trafficincidentsservice-model + org.genivi.booleanexpr-model + org.genivi.trafficinfo.demo + org.genivi.iconset-model + org.genivi.locref-model + org.genivi.trafficincidentsservice.trafficincidents.trafficincidents-trafficincident-model + org.genivi.trafficincidentsservice.trafficincidenttables-model + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincidentfeed-trafficincident-model + + + + org.eclipse.jdt.core.javabuilder + + + + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/OpenLR-encoder.log b/src/traffic-incidents-service/org.genivi.trafficinfo/OpenLR-encoder.log new file mode 100755 index 0000000..e69de29 diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/ReadMe.confluence b/src/traffic-incidents-service/org.genivi.trafficinfo/ReadMe.confluence new file mode 100755 index 0000000..2c41ae3 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/ReadMe.confluence @@ -0,0 +1,33 @@ +This project contains the main part of the Java only PoC for the TrafficIncidentsService. It makes use of several data models which are defined in other packages. +On top of this there are projects to add D-Bus layers between the components. +Packages + +org.genivi.locref.decoder +Interface definition for Location Reference decoders. This interface is used in the implementation of org.genivi.locref.LocationReferenceDecodingService. + +org.genivi.locref.decoder.openlr +OpenLR implementation of decoder interface defined in org.genivi.locref.decoder. + +org.genivi.locref.refimpl +Reference implementation of org.genivi.locref.LocationReferenceDecodingService + +org.genivi.tpegtecfeed.refimpl +Reference implementation of a TPEG-TEC Feed. This Feed receives TPEG Service Component Frames from the TPEG Framework and translates the information to TrafficIncidents which are handed over to the TrafficIncidents service, via the TrafficIncidentFeed interface. + +org.genivi.trafficincidentsservice +Contains default implementations for TrafficIncidentsListener and TrafficIncidentFeedListener. + +org.genivi.trafficincidentsservice.refimpl +Reference implementation of a TrafficIncidentsService (without any D-Bus binding). + +org.genivi.trafficincidentsservice.textgenerator +Defines an interface for a text generator, as a sub component of the TrafficIncidentsService. + +org.genivi.trafficincidentsservice.textgenerator.basictextgenerator +Basic implementation of a textgenerator. + +org.genivi.trafficinfo.pocmain +Contains the Main class for starting the Proof of Concept (without D-Bus IPC). + +org.genivi.trafficinfo.trafficincidentsexampleclients +Contains the example clients of the TrafficIncidentsService. \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts.properties b/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts.properties new file mode 100755 index 0000000..e962735 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts.properties @@ -0,0 +1 @@ +on_the = on the \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts_en_US.properties b/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts_en_US.properties new file mode 100755 index 0000000..e962735 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/TextParts_en_US.properties @@ -0,0 +1 @@ +on_the = on the \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Category definitions screenshot 1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Category definitions screenshot 1.png new file mode 100755 index 0000000..996c542 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Category definitions screenshot 1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Icons and Iconsets screenshot 1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Icons and Iconsets screenshot 1.png new file mode 100755 index 0000000..b8a8997 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Icons and Iconsets screenshot 1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot - status only.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot - status only.png new file mode 100755 index 0000000..a9c6888 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot - status only.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot 1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot 1.png new file mode 100755 index 0000000..9112f83 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/List Client screenshot 1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Map Client screenshot 1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Map Client screenshot 1.png new file mode 100755 index 0000000..bf469be Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Map Client screenshot 1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Thumbs.db b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Thumbs.db new file mode 100755 index 0000000..4fd0094 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Thumbs.db differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Warning Client screenshot 1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Warning Client screenshot 1.png new file mode 100755 index 0000000..d2319fb Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/doc/Warning Client screenshot 1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/Thumbs.db b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/Thumbs.db new file mode 100755 index 0000000..9c651e8 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/Thumbs.db differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId1.png new file mode 100755 index 0000000..542067f Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId2.png new file mode 100755 index 0000000..6fe9dfe Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId3.png new file mode 100755 index 0000000..1013bf4 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId4.png new file mode 100755 index 0000000..e577a45 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId5.png new file mode 100755 index 0000000..ca20e32 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId6.png new file mode 100755 index 0000000..5bdd290 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId10_RGB888_D_2D_night_themeId44_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..f06f7a8 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..09765eb Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..6b2f110 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..1f6d8a3 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..4ad170f Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..ff5233e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId1_GRAY_8_D_2D_day_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..16d0305 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..149fc8c Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..89d0111 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..7978cb5 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..d8b0f12 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..9e27531 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId2_RGB888_D_2D_day_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..21580ef Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..fa9aa0e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..5352a71 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..a9498b0 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..3456c50 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..0039781 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId3_GRAY_8_D_2D_night_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..be328ce Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..686d784 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..0a96d1e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..4816b0e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..5e36f16 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..55b7a10 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId4_RGB888_D_2D_night_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..fb3150b Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..9b39634 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..bb1bb6e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..c024b42 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..526fb2f Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..414de95 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId5_RGB888_D_2_5D_day_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId1.png new file mode 100755 index 0000000..ceb7422 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId2.png new file mode 100755 index 0000000..cc603e8 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId3.png new file mode 100755 index 0000000..a9d882f Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId4.png new file mode 100755 index 0000000..7ae6fe1 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId5.png new file mode 100755 index 0000000..a89abad Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId6.png new file mode 100755 index 0000000..9bf0c51 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId6_RGB888_D_2_5D_night_themeId28_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId1.png new file mode 100755 index 0000000..6674e6d Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId2.png new file mode 100755 index 0000000..fc374ed Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId3.png new file mode 100755 index 0000000..2309e45 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId4.png new file mode 100755 index 0000000..ca031f6 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId5.png new file mode 100755 index 0000000..889801d Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId6.png new file mode 100755 index 0000000..cb66153 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId7_GRAY_8_D_2D_day_themeId44_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId1.png new file mode 100755 index 0000000..5577406 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId2.png new file mode 100755 index 0000000..797dc60 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId3.png new file mode 100755 index 0000000..bdbf22e Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId4.png new file mode 100755 index 0000000..f8e47fe Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId5.png new file mode 100755 index 0000000..10aa635 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId6.png new file mode 100755 index 0000000..713cc71 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId8_RGB888_D_2D_day_themeId44_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId1.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId1.png new file mode 100755 index 0000000..5fb5601 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId1.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId2.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId2.png new file mode 100755 index 0000000..2998c84 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId2.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId3.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId3.png new file mode 100755 index 0000000..3d44839 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId3.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId4.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId4.png new file mode 100755 index 0000000..8f9c9cc Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId4.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId5.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId5.png new file mode 100755 index 0000000..6457412 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId5.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId6.png b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId6.png new file mode 100755 index 0000000..86aaf80 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/icons/icon_setId9_GRAY_8_D_2D_night_themeId44_32x32_iconId6.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.bmp b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.bmp new file mode 100755 index 0000000..7a0c728 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.bmp differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.png b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.png new file mode 100755 index 0000000..885e113 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/GENIVI_TomTom_64x64.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/Thumbs.db b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/Thumbs.db new file mode 100755 index 0000000..d21979b Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/Thumbs.db differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TomTom GENIVI Traffic Info license.rtf b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TomTom GENIVI Traffic Info license.rtf new file mode 100755 index 0000000..312ede8 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TomTom GENIVI Traffic Info license.rtf @@ -0,0 +1,172 @@ +{\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch31506\stshfhich31506\stshfbi31506\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f34\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f38\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604030504040204}Verdana;}{\flomajor\f31500\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbmajor\f31501\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhimajor\f31502\fbidi \froman\fcharset0\fprq2{\*\panose 02040503050406030204}Cambria;} +{\fbimajor\f31503\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\flominor\f31504\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\fdbminor\f31505\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fhiminor\f31506\fbidi \fswiss\fcharset0\fprq2{\*\panose 020f0502020204030204}Calibri;} +{\fbiminor\f31507\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f198\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\f199\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\f201\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f202\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f203\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f204\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\f205\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f206\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f538\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f539\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;} +{\f541\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;}{\f542\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f545\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f546\fbidi \froman\fcharset163\fprq2 Cambria Math (Vietnamese);} +{\f578\fbidi \fswiss\fcharset238\fprq2 Verdana CE;}{\f579\fbidi \fswiss\fcharset204\fprq2 Verdana Cyr;}{\f581\fbidi \fswiss\fcharset161\fprq2 Verdana Greek;}{\f582\fbidi \fswiss\fcharset162\fprq2 Verdana Tur;} +{\f585\fbidi \fswiss\fcharset186\fprq2 Verdana Baltic;}{\f586\fbidi \fswiss\fcharset163\fprq2 Verdana (Vietnamese);}{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31518\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbmajor\f31519\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fdbmajor\f31521\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fdbmajor\f31522\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbmajor\f31523\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fdbmajor\f31524\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fdbmajor\f31525\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbmajor\f31526\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fhimajor\f31536\fbidi \froman\fcharset163\fprq2 Cambria (Vietnamese);}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\fdbminor\f31558\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fdbminor\f31559\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fdbminor\f31561\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\fdbminor\f31562\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fdbminor\f31563\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fdbminor\f31564\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\fdbminor\f31565\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fdbminor\f31566\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;} +{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fhiminor\f31576\fbidi \fswiss\fcharset163\fprq2 Calibri (Vietnamese);}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;} +{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;} +{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0; +\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192; +\caccentone\ctint255\cshade191\red54\green95\blue145;\caccentone\ctint255\cshade255\red79\green129\blue189;\ctexttwo\ctint255\cshade191\red23\green54\blue93;}{\*\defchp \f31506\fs22 }{\*\defpap \ql \li0\ri0\sa200\sl276\slmult1 +\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 +\f38\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext0 \sqformat \spriority0 \styrsid12075506 Normal;}{\s1\ql \li0\ri0\sb480\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel0\adjustright\rin0\lin0\itap0 +\rtlch\fcs1 \ab\af0\afs28\alang1025 \ltrch\fcs0 \b\fs28\cf17\lang1033\langfe1033\loch\f38\hich\af38\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink15 \sqformat \spriority9 \styrsid1780167 heading 1;}{ +\s2\ql \li0\ri0\sb200\sl276\slmult1\keep\keepn\widctlpar\wrapdefault\aspalpha\aspnum\faauto\outlinelevel1\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ab\af0\afs26\alang1025 \ltrch\fcs0 +\b\fs26\cf18\lang1033\langfe1033\loch\f38\hich\af38\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink16 \ssemihidden \sunhideused \sqformat \spriority9 \styrsid1780167 heading 2;}{\*\cs10 \additive \ssemihidden \sunhideused \spriority1 +Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tblind0\tblindtype3\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af31506\afs22\alang1025 \ltrch\fcs0 \f31506\fs22\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 \snext11 \ssemihidden \sunhideused +Normal Table;}{\*\cs15 \additive \rtlch\fcs1 \ab\af0\afs28 \ltrch\fcs0 \b\fs28\cf17\loch\f38\hich\af38\dbch\af31501 \sbasedon10 \slink1 \slocked \spriority9 \styrsid1780167 Heading 1 Char;}{\*\cs16 \additive \rtlch\fcs1 \ab\af0\afs26 \ltrch\fcs0 +\b\fs26\cf18\loch\f38\hich\af38\dbch\af31501 \sbasedon10 \slink2 \slocked \ssemihidden \spriority9 \styrsid1780167 Heading 2 Char;}{\s17\ql \li0\ri0\sa300\widctlpar\brdrb\brdrs\brdrw20\brsp80\brdrcf18 +\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\contextualspace \rtlch\fcs1 \af0\afs52\alang1025 \ltrch\fcs0 \fs52\expnd1\expndtw5\cf19\lang1033\langfe1033\kerning28\loch\f38\hich\af38\dbch\af31501\cgrid\langnp1033\langfenp1033 +\sbasedon0 \snext0 \slink18 \sqformat \spriority10 \styrsid1780167 Title;}{\*\cs18 \additive \rtlch\fcs1 \af0\afs52 \ltrch\fcs0 \fs52\expnd1\expndtw5\cf19\kerning28\loch\f38\hich\af38\dbch\af31501 +\sbasedon10 \slink17 \slocked \spriority10 \styrsid1780167 Title Char;}{\s19\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\ilvl1\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \ai\af0\afs24\alang1025 \ltrch\fcs0 +\i\fs24\expnd3\expndtw15\cf18\lang1033\langfe1033\loch\f38\hich\af38\dbch\af31501\cgrid\langnp1033\langfenp1033 \sbasedon0 \snext0 \slink20 \sqformat \spriority11 \styrsid1780167 Subtitle;}{\*\cs20 \additive \rtlch\fcs1 \ai\af0\afs24 \ltrch\fcs0 +\i\fs24\expnd3\expndtw15\cf18\loch\f38\hich\af38\dbch\af31501 \sbasedon10 \slink19 \slocked \spriority11 \styrsid1780167 Subtitle Char;}}{\*\rsidtbl \rsid1312242\rsid1780167\rsid2360776\rsid3034291\rsid7419968\rsid11485746\rsid12075506\rsid15359627} +{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author Peter Goedegebure}{\operator Peter Goedegebure}{\creatim\yr2012\mo9\dy27\hr10\min53} +{\revtim\yr2012\mo10\dy1\hr14\min6}{\version3}{\edmins18}{\nofpages1}{\nofwords46}{\nofchars265}{\*\company TomTom Group}{\nofcharsws310}{\vern49273}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}} +\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\gutter0\ltrsect +\widowctrl\ftnbj\aenddoc\trackmoves0\trackformatting1\donotembedsysfont1\relyonvml0\donotembedlingdata0\grfdocevents0\validatexml1\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors1\noxlattoyen +\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1440\dgvorigin1440\dghshow1\dgvshow1 +\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct +\asianbrkrule\rsidroot11485746\newtblstyruls\nogrowautofit\usenormstyforlist\noindnmbrts\felnbrelev\nocxsptable\indrlsweleven\noafcnsttbl\afelev\utinl\hwelev\spltpgpar\notcvasp\notbrkcnstfrctbl\notvatxbx\krnprsnet\cachedcolbal \nouicompat \fet0 +{\*\wgrffmtfilter 2450}\nofeaturethrottle1\ilfomacatclnup0\ltrpar \sectd \ltrsect\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2 +\pnucltr\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang +{\pntxtb (}{\pntxta )}}\pard\plain \ltrpar\ql \li0\ri0\sa200\sl276\slmult1\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \f38\fs18\lang1033\langfe1033\cgrid\langnp1033\langfenp1033 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7419968 This software is only meant to be used to demonstrate the functionality of the GENIVI interfaces for Traffic Information.\line This software may not be distributed.\line This software +is not allowed to be used and will not function after October 14}{\rtlch\fcs1 \af0 \ltrch\fcs0 \super\insrsid7419968\charrsid7419968 th}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7419968 2012. +\par Copyright \'a9 2012, TomTom International B.V. +\par All rights reserved}{\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid7419968\charrsid1780167 +\par }{\*\themedata 504b030414000600080000002100e9de0fbfff0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb4ec3301045f748fc83e52d4a +9cb2400825e982c78ec7a27cc0c8992416c9d8b2a755fbf74cd25442a820166c2cd933f79e3be372bd1f07b5c3989ca74aaff2422b24eb1b475da5df374fd9ad +5689811a183c61a50f98f4babebc2837878049899a52a57be670674cb23d8e90721f90a4d2fa3802cb35762680fd800ecd7551dc18eb899138e3c943d7e503b6 +b01d583deee5f99824e290b4ba3f364eac4a430883b3c092d4eca8f946c916422ecab927f52ea42b89a1cd59c254f919b0e85e6535d135a8de20f20b8c12c3b0 +0c895fcf6720192de6bf3b9e89ecdbd6596cbcdd8eb28e7c365ecc4ec1ff1460f53fe813d3cc7f5b7f020000ffff0300504b030414000600080000002100a5d6 +a7e7c0000000360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4f +c7060abb0884a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b6309512 +0f88d94fbc52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462 +a1a82fe353bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f746865 +6d652f7468656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b +4b0d592c9c070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b +4757e8d3f729e245eb2b260a0238fd010000ffff0300504b03041400060008000000210030dd4329a8060000a41b0000160000007468656d652f7468656d652f +7468656d65312e786d6cec594f6fdb3614bf0fd87720746f6327761a07758ad8b19b2d4d1bc46e871e698996d850a240d2497d1bdae38001c3ba618715d86d87 +615b8116d8a5fb34d93a6c1dd0afb0475292c5585e9236d88aad3e2412f9e3fbff1e1fa9abd7eec70c1d1221294fda5efd72cd4324f1794093b0eddd1ef62fad +79482a9c0498f184b4bd2991deb58df7dfbb8ad755446282607d22d771db8b944ad79796a40fc3585ee62949606ecc458c15bc8a702910f808e8c66c69b9565b +5d8a314d3c94e018c8de1a8fa94fd05093f43672e23d06af89927ac06762a049136785c10607758d9053d965021d62d6f6804fc08f86e4bef210c352c144dbab +999fb7b4717509af678b985ab0b6b4ae6f7ed9ba6c4170b06c788a705430adf71bad2b5b057d03606a1ed7ebf5babd7a41cf00b0ef83a6569632cd467faddec9 +699640f6719e76b7d6ac355c7c89feca9cccad4ea7d36c65b258a206641f1b73f8b5da6a6373d9c11b90c537e7f08dce66b7bbeae00dc8e257e7f0fd2badd586 +8b37a088d1e4600ead1ddaef67d40bc898b3ed4af81ac0d76a197c86826828a24bb318f3442d8ab518dfe3a20f000d6458d104a9694ac6d88728eee2782428d6 +0cf03ac1a5193be4cbb921cd0b495fd054b5bd0f530c1931a3f7eaf9f7af9e3f45c70f9e1d3ff8e9f8e1c3e3073f5a42ceaa6d9c84e5552fbffdeccfc71fa33f +9e7ef3f2d117d57859c6fffac327bffcfc793510d26726ce8b2f9ffcf6ecc98baf3efdfdbb4715f04d814765f890c644a29be408edf3181433567125272371be +15c308d3f28acd249438c19a4b05fd9e8a1cf4cd296699771c393ac4b5e01d01e5a30a787d72cf1178108989a2159c77a2d801ee72ce3a5c545a6147f32a9979 +3849c26ae66252c6ed637c58c5bb8b13c7bfbd490a75330f4b47f16e441c31f7184e140e494214d273fc80900aedee52ead87597fa824b3e56e82e451d4c2b4d +32a423279a668bb6690c7e9956e90cfe766cb37b077538abd27a8b1cba48c80acc2a841f12e698f13a9e281c57911ce298950d7e03aba84ac8c154f8655c4f2a +f074481847bd804859b5e696007d4b4edfc150b12addbecba6b18b148a1e54d1bc81392f23b7f84137c2715a851dd0242a633f900710a218ed715505dfe56e86 +e877f0034e16bafb0e258ebb4faf06b769e888340b103d331115bebc4eb813bf83291b63624a0d1475a756c734f9bbc2cd28546ecbe1e20a3794ca175f3fae90 +fb6d2dd99bb07b55e5ccf68942bd0877b23c77b908e8db5f9db7f024d9239010f35bd4bbe2fcae387bfff9e2bc289f2fbe24cfaa301468dd8bd846dbb4ddf1c2 +ae7b4c191ba8292337a469bc25ec3d411f06f53a73e224c5292c8de0516732307070a1c0660d125c7d44553488700a4d7bddd3444299910e254ab984c3a219ae +a4adf1d0f82b7bd46cea4388ad1c12ab5d1ed8e1153d9c9f350a3246aad01c6873462b9ac05999ad5cc988826eafc3acae853a33b7ba11cd1445875ba1b236b1 +399483c90bd560b0b0263435085a21b0f22a9cf9356b38ec6046026d77eba3dc2dc60b17e92219e180643ed27acffba86e9c94c7ca9c225a0f1b0cfae0788ad5 +4adc5a9aec1b703b8b93caec1a0bd8e5de7b132fe5113cf312503b998e2c2927274bd051db6b35979b1ef271daf6c6704e86c73805af4bdd476216c26593af84 +0dfb5393d964f9cc9bad5c313709ea70f561ed3ea7b053075221d51696910d0d339585004b34272bff7213cc7a510a5454a3b349b1b206c1f0af490176745d4b +c663e2abb2b34b23da76f6352ba57ca2881844c1111ab189d8c7e07e1daaa04f40255c77988aa05fe06e4e5bdb4cb9c5394bbaf28d98c1d971ccd20867e556a7 +689ec9166e0a522183792b8907ba55ca6e943bbf2a26e52f48957218ffcf54d1fb09dc3eac04da033e5c0d0b8c74a6b43d2e54c4a10aa511f5fb021a07533b20 +5ae07e17a621a8e082dafc17e450ffb739676998b48643a4daa7211214f623150942f6a02c99e83b85583ddbbb2c4996113211551257a656ec1139246ca86be0 +aadedb3d1441a89b6a929501833b197fee7b9641a3503739e57c732a59b1f7da1cf8a73b1f9bcca0945b874d4393dbbf10b1680f66bbaa5d6f96e77b6f59113d +316bb31a795600b3d256d0cad2fe354538e7566b2bd69cc6cbcd5c38f0e2bcc63058344429dc2121fd07f63f2a7c66bf76e80d75c8f7a1b622f878a18941d840 +545fb28d07d205d20e8ea071b283369834296bdaac75d256cb37eb0bee740bbe278cad253b8bbfcf69eca23973d939b97891c6ce2cecd8da8e2d343578f6648a +c2d0383fc818c798cf64e52f597c740f1cbd05df0c264c49134cf09d4a60e8a107260f20f92d47b374e32f000000ffff0300504b030414000600080000002100 +0dd1909fb60000001b010000270000007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f7 +8277086f6fd3ba109126dd88d0add40384e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89 +d93b64b060828e6f37ed1567914b284d262452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd500 +1996509affb3fd381a89672f1f165dfe514173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100e9de0f +bfff0000001c0200001300000000000000000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6 +a7e7c0000000360100000b00000000000000000000000000300100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a +0000001c00000000000000000000000000190200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d00140006000800000021 +0030dd4329a8060000a41b00001600000000000000000000000000d60200007468656d652f7468656d652f7468656d65312e786d6c504b01022d001400060008 +00000021000dd1909fb60000001b0100002700000000000000000000000000b20900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d010000ad0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; +\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; +\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 +4d73786d6c322e534158584d4c5265616465722e362e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffff0c6ad98892f1d411a65f0040963251e500000000000000000000000070a7 +493acd9fcd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo.nsi b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo.nsi new file mode 100755 index 0000000..a6d07d9 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo.nsi @@ -0,0 +1,223 @@ +; +; NSIS script om de GENIVI Traffic Info installer te genereren. +; + +!include LogicLib.nsh + +;-------------------------------- + +!macro BIMAGE IMAGE + Push $0 + GetTempFileName $0 + File /oname=$0 "${IMAGE}" + SetBrandingImage $0 + Delete $0 + Pop $0 +!macroend + + +;-------------------------------- + +Name "TomTom GENIVI Traffic Info demo" +Caption "TomTom GENIVI Traffic Info demo" + +OutFile "..\target\TomTom-GENIVI-TrafficInfo-Installer.exe" + +LicenseText "In order to install this software you have to agree with the following license agreement" +LicenseData "TomTom GENIVI Traffic Info license.rtf" + + +InstallColors 101010 e0e0e0 +XPStyle on + +; Add branding image to the installer (an image placeholder on the side). +; It is not enough to just add the placeholder, we must set the image too... +; We will later set the image in every pre-page function. +; We can also set just one persistent image in .onGUIInit +AddBrandingImage left 50 10 + +InstallDir "$PROGRAMFILES\TomTom GENIVI Traffic Info demo" + + +;-------------------------------- + +Page license setBrandingImage +Page components +Page directory +Page instfiles "" "" readySound + +UninstPage uninstConfirm +UninstPage instfiles + +;-------------------------------- + + +Section "" ; empty string makes it hidden. + SetOutPath $INSTDIR + WriteUninstaller "TomTom-GENIVI-TrafficInfo-demo-uninst.exe" +SectionEnd + + +Section "!Traffic Info demo program" + SectionIn RO + + File "TrafficInfo_32x32.ico" + File "..\resources\Traffic Info demo.sh" + CreateDirectory $INSTDIR\resources + File "/oname=resources\tomtom_utrecht_2008_04.db3" "..\resources\tomtom_utrecht_2008_04.db3" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-trafficinfo\1.0-SNAPSHOT\org-genivi-trafficinfo-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-demo\1.0-SNAPSHOT\com-tomtom-demo-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-ti-tecservice\1.0-SNAPSHOT\com-tomtom-ti-tecservice-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-ti-tpeg2waycomm-model\1.0-SNAPSHOT\com-tomtom-ti-tpeg2waycomm-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-ti-tpegfwk\1.0-SNAPSHOT\com-tomtom-ti-tpegfwk-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-ti-tpegfwktypes-model\1.0-SNAPSHOT\com-tomtom-ti-tpegfwktypes-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com-tomtom\com-tomtom-ti-tpegtables\1.0-SNAPSHOT\com-tomtom-ti-tpegtables-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\com\tomtom\ti\com.tomtom.ti.tec.event-model\1.0-SNAPSHOT\com.tomtom.ti.tec.event-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\commons-logging\commons-logging\1.0.4\commons-logging-1.0.4.jar" + File "C:\Documents and Settings\pego\.m2\repository\junit\junit\4.3\junit-4.3.jar" + File "C:\Documents and Settings\pego\.m2\repository\openlr\openlr-cli-sqlite-with-dependencies\1.2.2\openlr-cli-sqlite-with-dependencies-1.2.2.jar" + File "C:\Documents and Settings\pego\.m2\repository\openlr\openlr-map\1.2.2\openlr-map-1.2.2.jar" + File "C:\Documents and Settings\pego\.m2\repository\openlr\openlr-map-sqlite-with-dependencies\1.2.2\openlr-map-sqlite-with-dependencies-1.2.2.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-basetypes\1.0-SNAPSHOT\org-genivi-basetypes-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-locref-model\1.0-SNAPSHOT\org-genivi-locref-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-tpeg-sni-model\1.0-SNAPSHOT\org-genivi-tpeg-sni-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-trafficinfo-trafficincident.model\1.0-SNAPSHOT\org-genivi-trafficinfo-trafficincident.model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-genivi\org-genivi-trafficinfo-trafficincidents-model\1.0-SNAPSHOT\org-genivi-trafficinfo-trafficincidents-model-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org-tisa\org-tisa-tpeg2waycomm\1.0-SNAPSHOT\org-tisa-tpeg2waycomm-1.0-SNAPSHOT.jar" + File "C:\Documents and Settings\pego\.m2\repository\org\eclipse\emf\org.eclipse.emf.common\2.8.0.v20120606-0717\org.eclipse.emf.common-2.8.0.v20120606-0717.jar" + File "C:\Documents and Settings\pego\.m2\repository\org\eclipse\emf\org.eclipse.emf.ecore\2.8.0.v20120606-0717\org.eclipse.emf.ecore-2.8.0.v20120606-0717.jar" + File "C:\Documents and Settings\pego\.m2\repository\org\eclipse\emf\org.eclipse.emf.ecore.xmi\2.8.0.v20120606-0717\org.eclipse.emf.ecore.xmi-2.8.0.v20120606-0717.jar" + File "C:\Documents and Settings\pego\.m2\repository\org\jdesktop\org.jdesktop.swingx\none\org.jdesktop.swingx-none.jar" + File "C:\Documents and Settings\pego\.m2\repository\org\jdesktop\org.jdesktop.swingx-ws\2007_10_14\org.jdesktop.swingx-ws-2007_10_14.jar" + CreateShortCut '$INSTDIR\Traffic Info demo.lnk' 'javaw.exe' \ + '-jar org-genivi-trafficinfo-1.0-SNAPSHOT.jar' '$INSTDIR\TrafficInfo_32x32.ico' '' SW_SHOWNORMAL '' 'Start Traffic Info demo' +SectionEnd + + +sectionGroup Shortcuts + + Section "Shortcuts in Start menu" + CreateDirectory "$SMPROGRAMS\Traffic Info demo" + CreateShortCut '$SMPROGRAMS\Traffic Info demo\Traffic Info demo.lnk' 'javaw.exe' \ + '-jar org-genivi-trafficinfo-1.0-SNAPSHOT.jar' '$INSTDIR\TrafficInfo_32x32.ico' '' SW_SHOWNORMAL '' 'Start Traffic Info demo' + CreateShortCut "$SMPROGRAMS\Traffic Info demo\Traffic Info demo-uninst.lnk" "$INSTDIR\TomTom-GENIVI-TrafficInfo-demo-uninst.exe" \ + "" "$INSTDIR\TomTom-GENIVI-TrafficInfo-demo-uninst.exe" "" SW_SHOWNORMAL "" "Remove Traffic Info demo" + SectionEnd + + Section "Shortcut on Desktop" + CreateShortCut '$DESKTOP\Traffic Info demo.lnk' 'javaw.exe' \ + '-jar org-genivi-trafficinfo-1.0-SNAPSHOT.jar' '$INSTDIR\TrafficInfo_32x32.ico' '' SW_SHOWNORMAL '' 'Start Traffic Info demo' + SectionEnd + + Section "Quick access icon" + CreateShortCut '$QUICKLAUNCH\Traffic Info demo.lnk' 'javaw.exe' \ + '-jar org-genivi-trafficinfo-1.0-SNAPSHOT.jar' '$INSTDIR\TrafficInfo_32x32.ico' '' SW_SHOWNORMAL '' 'Start Traffic Info demo' + SectionEnd + +sectionGroupEnd + +Function .onInit + # the plugins dir is automatically deleted when the installer exits + InitPluginsDir + +FunctionEnd + +Function .onGUIInit + # lets extract some bitmaps... + File /oname=$PLUGINSDIR\TrafficInfoBackground.bmp "TrafficInfoBackground.bmp" + File /oname=$PLUGINSDIR\notify.wav "notify.wav" + + # set the initial background for images to be drawn on + # we will use a gradient from dark blue to a bright blue + BgImage::SetBg /NOUNLOAD /GRADIENT 0x0 0x0 0x50 0x10 0x10 0xFF + + # create the font for the following text + CreateFont $R0 "Times New Roman" 50 700 + # add a text with shadow + BgImage::AddText /NOUNLOAD "Traffic Info demo" $R0 50 50 50 328 48 900 198 + BgImage::AddText /NOUNLOAD "Traffic Info demo" $R0 80 80 80 327 49 899 199 + BgImage::AddText /NOUNLOAD "Traffic Info demo" $R0 110 110 110 326 50 898 200 + BgImage::AddText /NOUNLOAD "Traffic Info demo" $R0 150 150 150 325 51 897 201 + BgImage::AddText /NOUNLOAD "Traffic Info demo" $R0 190 190 190 324 52 896 202 + + # add the background image @ (150,200) + BgImage::AddImage /NOUNLOAD $PLUGINSDIR\TrafficInfoBackground.bmp 50 200 + + # show our creation to the world! + BgImage::Redraw /NOUNLOAD + # Refresh doesn't return any value + +FunctionEnd + + +Function .onGUIEnd + # Destroy must not have /NOUNLOAD so NSIS will be able to unload + # and delete BgImage before it exits + BgImage::Destroy +FunctionEnd + + +Function setBrandingImage + !insertmacro BIMAGE "GENIVI_TomTom_64x64.bmp" +FunctionEnd + + +Function readySound + BgImage::Sound /NOUNLOAD /WAIT $PLUGINSDIR\notify.wav +FunctionEnd + +;-------------------------------- + +; Uninstaller + +UninstallText "This program removes the TomTom GENIVI Traffic Info demo from your computer. Click 'Uninstall' to continue." + +Section "Uninstall" + Delete "$INSTDIR\TrafficInfo_32x32.ico" + Delete "$INSTDIR\Traffic Info demo.sh" + Delete "$INSTDIR\resources\tomtom_utrecht_2008_04.db3" + Delete "$INSTDIR\org-genivi-trafficinfo-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-demo-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-ti-tecservice-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-ti-tpeg2waycomm-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-ti-tpegfwk-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-ti-tpegfwktypes-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com-tomtom-ti-tpegtables-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\com.tomtom.ti.tec.event-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\commons-logging-1.0.4.jar" + Delete "$INSTDIR\junit-4.3.jar" + Delete "$INSTDIR\openlr-cli-sqlite-with-dependencies-1.2.2.jar" + Delete "$INSTDIR\openlr-map-1.2.2.jar" + Delete "$INSTDIR\openlr-map-sqlite-with-dependencies-1.2.2.jar" + Delete "$INSTDIR\org-genivi-basetypes-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org-genivi-locref-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org-genivi-tpeg-sni-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org-genivi-trafficinfo-trafficincident.model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org-genivi-trafficinfo-trafficincidents-model-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org-tisa-tpeg2waycomm-1.0-SNAPSHOT.jar" + Delete "$INSTDIR\org.eclipse.emf.common-2.8.0.v20120606-0717.jar" + Delete "$INSTDIR\org.eclipse.emf.ecore-2.8.0.v20120606-0717.jar" + Delete "$INSTDIR\org.eclipse.emf.ecore.xmi-2.8.0.v20120606-0717.jar" + Delete "$INSTDIR\org.jdesktop.swingx-none.jar" + Delete "$INSTDIR\org.jdesktop.swingx-ws-2007_10_14.jar" + Delete "$INSTDIR\Traffic Info demo.lnk" + Delete "$INSTDIR\TomTom-GENIVI-TrafficInfo-demo-uninst.exe" + Delete "$INSTDIR\OpenLR-encoder.log" + RMDir "$INSTDIR\resources" + RMDir "$INSTDIR" + Delete "$SMPROGRAMS\Traffic Info demo\Traffic Info demo.lnk" + Delete "$SMPROGRAMS\Traffic Info demo\Traffic Info demo-uninst.lnk" + RMDir "$SMPROGRAMS\Traffic Info demo" + Delete "$DESKTOP\Traffic Info demo.lnk" + Delete "$QUICKLAUNCH\Traffic Info demo.lnk" + + IfFileExists "$INSTDIR" 0 InstDirRemoved + MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 + InstDirRemoved: + + IfFileExists "$SMPROGRAMS\Traffic Info demo" 0 ProgramsDirRemoved + MessageBox MB_OK "Note: $SMPROGRAMS\Traffic Info demo could not be removed!" IDOK 0 + ProgramsDirRemoved: + +SectionEnd + diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfoBackground.bmp b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfoBackground.bmp new file mode 100755 index 0000000..a0bfd93 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfoBackground.bmp differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo_32x32.ico b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo_32x32.ico new file mode 100755 index 0000000..c0000e8 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/TrafficInfo_32x32.ico differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/genivi_chrome_1_transparent.png b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/genivi_chrome_1_transparent.png new file mode 100755 index 0000000..4594235 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/genivi_chrome_1_transparent.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/notify.wav b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/notify.wav new file mode 100755 index 0000000..726bc0d Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/notify.wav differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road-smaller.png b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road-smaller.png new file mode 100755 index 0000000..a45356a Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road-smaller.png differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road.jpg b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road.jpg new file mode 100755 index 0000000..0693336 Binary files /dev/null and b/src/traffic-incidents-service/org.genivi.trafficinfo/nsis/road.jpg differ diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/pom.xml b/src/traffic-incidents-service/org.genivi.trafficinfo/pom.xml new file mode 100755 index 0000000..3642b63 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/pom.xml @@ -0,0 +1,72 @@ + + + 4.0.0 + org.genivi + trafficinfo + jar + 1.0-SNAPSHOT + GENIVI Traffic Information main project + This project the main part of the GENIVI Traffic Information project. + + org.genivi.trafficinfo + maven-parent + 1.0-SNAPSHOT + ../org.genivi.trafficinfo.maven-parent + + + + openlr + openlr-cli-sqlite-with-dependencies + + + openlr + openlr-map + + + openlr + openlr-map-sqlite-with-dependencies + + + org.genivi + basetypes-model + + + org.genivi.trafficinfo + dbus-java + + + org.genivi.trafficinfo + libmatthew + + + org.genivi.trafficincidentsservice + trafficincidentsservice-model + + + org.genivi.trafficincidentsservice + trafficincidenttables-model + + + org.genivi.trafficincidentsservice.trafficincidentfeed + trafficincidentfeed-trafficincident-model + + + + src + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.genivi.trafficinfo.pocmain.TrafficIncidentsServicePocMain + true + + + + + + + \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/resources/Traffic Info demo.sh b/src/traffic-incidents-service/org.genivi.trafficinfo/resources/Traffic Info demo.sh new file mode 100755 index 0000000..f380b27 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/resources/Traffic Info demo.sh @@ -0,0 +1 @@ +java -jar org-genivi-trafficinfo-1.0-SNAPSHOT.jar \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationData.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationData.java new file mode 100755 index 0000000..bf59643 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationData.java @@ -0,0 +1,30 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.locref.decoder; + +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; + +public class LocationData { + private Location location; + private LocationInfo locationInfo; + + public LocationData(Location location, LocationInfo locationInfo) { + super(); + this.location = location; + this.locationInfo = locationInfo; + } + + public Location getLocation() { + return location; + } + + public LocationInfo getLocationInfo() { + return locationInfo; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationReferenceDecoder.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationReferenceDecoder.java new file mode 100755 index 0000000..abd4c81 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/LocationReferenceDecoder.java @@ -0,0 +1,25 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.locref.decoder; + + + +public interface LocationReferenceDecoder { + + /** + * Set the language. + * @param languageCode The language to be used. + * @param countryCode The country specific variant for the language to be used. + * + * @model + * @generated + */ + public void setLanguage(String languageCode, String countryCode); + + public LocationData decode(Object locationReference); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/openlr/OpenLRDecoder.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/openlr/OpenLRDecoder.java new file mode 100755 index 0000000..c02b313 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/decoder/openlr/OpenLRDecoder.java @@ -0,0 +1,359 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.locref.decoder.openlr; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.logging.Logger; + +import openlr.OpenLRRuntimeException; +import openlr.binary.ByteArray; +import openlr.binary.OpenLRBinaryRuntimeException; +import openlr.decoder.OpenLRDecoderRuntimeException; +import openlr.decoder.properties.generated.OpenLRDecoderProperties; +import openlr.map.Line; +import openlr.map.MapDatabase; +import openlr.map.Node; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.genivi.common.CommonFactory; +import org.genivi.common.Coordinate; +import org.genivi.location.LinearLocation; +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.Location; +import org.genivi.location.LocationFactory; +import org.genivi.location.LocationInfo; +import org.genivi.locref.decoder.LocationData; +import org.genivi.locref.decoder.LocationReferenceDecoder; + +public class OpenLRDecoder implements LocationReferenceDecoder { + private final static Logger LOGGER = Logger.getLogger(OpenLRDecoder.class.getName()); + private static final LocationFactory LOCATION_FACTORY = LocationFactory.eINSTANCE; + private static final CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; + + private static final String DEFAULT_LANGUAGE = "nld"; + private static final String DEFAULT_COUNTRY = null; + + /** The Constant DECODER_PROPERTIES_FILE. */ + private static final String DECODER_PROPERTIES_FILE = "/OpenLR-Decoder-Properties.xml"; + + private static Map languageMap = new HashMap(); + private static Map countryMap = new HashMap(); + + private MapDatabase mapDataBase; + private OpenLRDecoderProperties openLRDecoderProperties; + private String languageCode = DEFAULT_LANGUAGE; + private String countryCode = DEFAULT_COUNTRY; + private Locale locale; + + static { + languageMap.put("deu", "de"); + languageMap.put("eng", "en"); + languageMap.put("fra", "fr"); + languageMap.put("nld", "nl"); + + countryMap.put("nld", "NL"); + countryMap.put("gbr", "GB"); + countryMap.put("usa", "US"); + countryMap.put("fra", "FR"); + countryMap.put("deu", "DE"); + } + + public OpenLRDecoder(MapDatabase mapDataBase) { + this.mapDataBase = mapDataBase; + + InputStream is = null; + is = getClass().getResourceAsStream(DECODER_PROPERTIES_FILE); + try { + openLRDecoderProperties = openlr.decoder.properties.OpenLRPropertiesReader.loadPropertiesFile(is); + } catch (OpenLRDecoderRuntimeException e) { + throw new RuntimeException("Parsing of decoder properties failed!"); + } + + handleLanguageChange(); + } + + @Override + public void setLanguage(String languageCode, String countryCode) { + LOGGER.fine("=> languageCode = " + languageCode + ", countryCode = " + countryCode); + this.languageCode = languageCode; + this.countryCode = countryCode; + + handleLanguageChange(); + } + + private void handleLanguageChange() { + String twoCharLanguageCode = languageMap.get(languageCode); + String twoCharCountryCode = null; + if (countryCode != null) { + twoCharCountryCode = countryMap.get(countryCode); + } + + if (twoCharCountryCode != null) { + locale = new Locale(twoCharLanguageCode, twoCharCountryCode); + } else { + locale = new Locale(twoCharLanguageCode); + } + LOGGER.fine("locale = " + locale.getDisplayName()); + } + + @Override + public LocationData decode(Object locationReference) { + if (! (locationReference instanceof byte[])) { + throw new IllegalArgumentException("Wrong class for locationReference (not byte[])"); + } + + openlr.LocationReference openLrLocationReference = null; + ByteArray ba = new ByteArray((byte[]) locationReference); + try { + openLrLocationReference = new openlr.binary.impl.LocationReferenceBinaryImpl("", ba); + } catch (OpenLRBinaryRuntimeException e) { + e.printStackTrace(); + } + + openlr.Location openlrLocation = null; // Decoding result + Location location = null; // Decoding result in GENIVI format + LocationInfo locationInfo = null; // Location info related to location + + try { + openlrLocation = openlr.decoder.OpenLRDecoder.decode(openLRDecoderProperties, openLrLocationReference, mapDataBase); + } catch (OpenLRRuntimeException e) { + e.printStackTrace(); + } + + switch (openlrLocation.getLocationType()) { + case LINE_LOCATION: + LinearLocation linearLocation = LOCATION_FACTORY.createLinearLocation(); + List segments = linearLocation.getSegments(); + + List openlrMapLines = openlrLocation.getLocationLines(); + for (Line openlrMapLine: openlrMapLines) { + segments.add(openlrMapLine.getID()); + } + linearLocation.setPositiveOffset(openlrLocation.getPositiveOffset()); + linearLocation.setNegativeOffset(openlrLocation.getNegativeOffset()); + LOGGER.fine("Positive Offset = " + linearLocation.getPositiveOffset() + ", Negative Offset = " + linearLocation.getNegativeOffset()); + + location = linearLocation; + locationInfo = getLinearLocationInfo(linearLocation); + break; + + case GEO_COORDINATES: + case POI_WITH_ACCESS_POINT: + case POINT_ALONG_LINE: + case UNKNOWN: + // TODO PRIO9: FULL_IMPL Implement other location types (and error handling for illegal types). + throw new IllegalArgumentException("Unsupported location type: " + openlrLocation.getLocationType()); + } + + return new LocationData(location, locationInfo); + } + + + private LocationInfo getLinearLocationInfo(LinearLocation linearLocation) { + LinearLocationInfo locationInfo = LOCATION_FACTORY.createLinearLocationInfo(); + + EList segmentIds = linearLocation.getSegments(); + if (!segmentIds.isEmpty()) { + // set fromLocationName to name of first line connected to first node, with a different name. + Long firstSegmentId = segmentIds.get(0); + Line firstLine = mapDataBase.getLine(firstSegmentId); + String firstLineName = getStreetName(firstLine); + LOGGER.fine("firstLineName = " + firstLineName); + locationInfo.setName(firstLineName); + + LOGGER.fine("Going to handle PrevLines "); + Iterator prevLines = firstLine.getPrevLines(); + while (prevLines.hasNext()) { + Line prevLine = prevLines.next(); + String fromName = getStreetName(prevLine); + LOGGER.fine("PrevLine: " + fromName); + if (!fromName.equals(firstLineName)) { + LOGGER.fine("fromName found: " + fromName); + locationInfo.setFromLocationName(fromName); + break; + } else { + LOGGER.fine("skipping name, name equals firstLineName: " + fromName); + } + } + + // set toLocationName to name of first line connected to last node, with a different name. + Long lastSegmentId = segmentIds.get(segmentIds.size() - 1); + Line lastLine = mapDataBase.getLine(lastSegmentId); + String lastLineName = getStreetName(lastLine); + LOGGER.fine("lastLineName = " + lastLineName); + + LOGGER.fine("Going to handle NextLines "); + Iterator nextLines = lastLine.getNextLines(); + while (nextLines.hasNext()) { + Line nextLine = nextLines.next(); + String toName = getStreetName(nextLine); + if (!toName.equals(lastLineName)) { + LOGGER.fine("toName found: " + toName); + locationInfo.setToLocationName(toName); + break; + } else { + LOGGER.fine("skipping name, name equals lastLineName: " + toName); + } + } + + } + + // TODO PRIO9: FULL_IMPL Replace with an implementation for finding parent names in the database. + if (locationInfo.getName() != null && + locationInfo.getName().equals("Hogeweide")) { + locationInfo.setFromLocationParentName("Amsterdam"); + locationInfo.setToLocationParentName("Eindhoven"); + } + + fillCoordinates(linearLocation, locationInfo); + + return locationInfo; + } + + private void fillCoordinates(LinearLocation linearLocation, + LinearLocationInfo locationInfo) { + EList segmentIds = linearLocation.getSegments(); + EList coordinates = locationInfo.getCoordinates(); + + if (segmentIds.isEmpty()) { + return; + } + + int numberOfSegments = segmentIds.size(); + Coordinate coordinate; + + for (int i = 0; i < numberOfSegments; i++) { + Long segmentId = segmentIds.get(i); + Line line = mapDataBase.getLine(segmentId); + + if (i == 0) { + // calculate start coordinate from start node and positive offset + coordinate = calculateCoordinateOnSegment(line.getStartNode(), line.getEndNode(), linearLocation.getPositiveOffset()); + LOGGER.fine("Start coordinate added: " + coordinate); + coordinates.add(coordinate); + + // This is also the main location + locationInfo.setMainLocation(EcoreUtil.copy(coordinate)); + } + if (i != numberOfSegments - 1) { + coordinate = COMMON_FACTORY.createCoordinate(); + coordinate.setLatitude(line.getEndNode().getLatitudeDeg()); + coordinate.setLongitude(line.getEndNode().getLongitudeDeg()); + LOGGER.fine("Intermediate coordinate added: " + coordinate); + coordinates.add(coordinate); + } else { + // calculate end coordinate from end node and negative offset + coordinate = calculateCoordinateOnSegment(line.getEndNode(), line.getStartNode(), linearLocation.getNegativeOffset()); + LOGGER.fine("End coordinate added: " + coordinate); + coordinates.add(coordinate); + } + } + } + + private Coordinate calculateCoordinateOnSegment(Node startNode, Node endNode, + long offset) { + LOGGER.fine("offset = " + offset); + double startLatitude = startNode.getLatitudeDeg(); + double startLongitude = startNode.getLongitudeDeg(); + double endLatitude = endNode.getLatitudeDeg(); + double endLongitude = endNode.getLongitudeDeg(); + LOGGER.fine("startLatitude = " + startLatitude + ", startLongitude = " + startLongitude); + LOGGER.fine("endLatitude = " + endLatitude + ", endLongitude = " + endLongitude); + + double distance = distanceBetweenCoordinates(startLatitude, startLongitude, endLatitude, endLongitude); + LOGGER.fine("distance = " + distance); + + double deltaLatitude = endLatitude - startLatitude; + double deltaLongitude = endLongitude - startLongitude; + LOGGER.fine("deltaLatitude = " + deltaLatitude + ", deltaLongitude = " + deltaLongitude); + double latitude = startLatitude + offset / distance * deltaLatitude; + double longitude = startLongitude + offset / distance * deltaLongitude; + LOGGER.fine("latitude = " + latitude + ", longitude = " + longitude); + + Coordinate coordinate = COMMON_FACTORY.createCoordinate(); + coordinate.setLatitude(latitude); + coordinate.setLongitude(longitude); + + return coordinate; + } + + /** + * Algorithm taken from: + * http://stackoverflow.com/questions/837872/calculate-distance-in-meters-when-you-know-longitude-and-latitude-in-java + */ + private double distanceBetweenCoordinates(double startLatitude, + double startLongitude, double endLatitude, double endLongitude) { + double earthMeanRadius = 6371009; + double dLat = Math.toRadians(endLatitude - startLatitude); + double dLng = Math.toRadians(endLongitude - startLongitude); + LOGGER.fine("dLat = " + dLat + ", dLng = " + dLng); + + double a = Math.sin(dLat/2) * Math.sin(dLat/2) + + Math.cos(Math.toRadians(startLatitude)) * Math.cos(Math.toRadians(endLatitude)) * + Math.sin(dLng/2) * Math.sin(dLng/2); + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); + double dist = earthMeanRadius * c; + + return dist; + } + + private String getStreetName(Line line) { + Map> names = line.getNames(); + + // First check for a name in requested locale + List namesForLocale = names.get(locale); + if (namesForLocale != null && !namesForLocale.isEmpty()) { + LOGGER.fine("Found name in requested locale: " + namesForLocale.get(0)); + return namesForLocale.get(0); + } + + // Next find any name for any locale + for (Locale locale: names.keySet()) { + LOGGER.fine("Checking for locale: " + locale.getDisplayName()); + List namesPerLocale = names.get(locale); + if (!namesPerLocale.isEmpty()) { + LOGGER.fine("Found name in this locale: " + namesPerLocale.get(0)); + return namesPerLocale.get(0); + } + } + + return null; + } + +// /** +// * Convert a byte array to a human readable string. +// */ +// private static String toHex(byte[] messageData) { +// StringBuffer buffer= new StringBuffer("[ "); +// for (int i = 0; i < messageData.length; i++) { +// buffer.append(getHex(messageData[i])).append(' '); +// } +// buffer.append(']'); +// return buffer.toString(); +// } +// +// /** +// * Convert a byte to a printable format. +// * @param b +// * @return +// */ +// private static String getHex(byte b) { +// char char0, char1; +// byte byte1= (byte) (0x0f & (b >> 4)); +// byte byte2= (byte) (0x0f & b); +// char0 = (char) (byte1 > 9 ? 'a' + byte1 - 10 : '0' + byte1); +// char1 = (char) (byte2 > 9 ? 'a' + byte2 - 10 : '0' + byte2); +// return "" + char0 + char1; +// } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/refimpl/LocationReferenceDecodingHandlerRefImpl.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/refimpl/LocationReferenceDecodingHandlerRefImpl.java new file mode 100755 index 0000000..9faa59a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/locref/refimpl/LocationReferenceDecodingHandlerRefImpl.java @@ -0,0 +1,79 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.locref.refimpl; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.locref.LocationReference; +import org.genivi.locref.LocationReferenceDecodingService; +import org.genivi.locref.LocationReferenceDecodingServiceListener; +import org.genivi.locref.decoder.LocationData; +import org.genivi.locref.decoder.LocationReferenceDecoder; + + +public class LocationReferenceDecodingHandlerRefImpl extends EObjectImpl implements LocationReferenceDecodingService { + private final static Logger LOGGER = Logger.getLogger(LocationReferenceDecodingHandlerRefImpl.class.getName()); + + private static final String DEFAULT_LANGUAGE = "nld"; + private static final String DEFAULT_COUNTRY = null; + + private String languageCode = DEFAULT_LANGUAGE; + private String countryCode = DEFAULT_COUNTRY; + Map decoders = new HashMap<>(); + + + public LocationReferenceDecodingHandlerRefImpl() { + LOGGER.setLevel(Level.SEVERE); + } + + @Override + public void setLanguage(String languageCode, String countryCode) { + this.languageCode = languageCode; + this.countryCode = countryCode; + for (LocationReferenceDecoder decoder: decoders.values()) { + decoder.setLanguage(languageCode, countryCode); + } + } + + @Override + public void getLanguage(LocationReferenceDecodingServiceListener listener) { + listener.getLanguageReply(languageCode, countryCode); + } + + public void addDecoder(Byte type, LocationReferenceDecoder decoder) { + decoder.setLanguage(languageCode, countryCode); + decoders.put(type, decoder); + } + + public void removeDecoder(String type) { + decoders.remove(type); + } + + @Override + public void decode(LocationReferenceDecodingServiceListener listener, + LocationReference locationReference) { + if (locationReference == null) { + throw new RuntimeException("LocationReferenceDecodingHandlerRefImpl: locationReference is null"); + } + Byte locationReferenceType = (Byte) (byte) locationReference.getLocationReferenceType(); + LocationReferenceDecoder decoder = decoders.get(locationReferenceType); + if (decoder == null) { + throw new RuntimeException("Location reference type \'" + + locationReferenceType.toString() + "\' not supported"); + } + Object locationReferenceData = locationReference.getData(); + LOGGER.info("Decoding location of type: " + locationReferenceType.toString()); + LocationData locationData = decoder.decode(locationReferenceData); + + listener.decodeReply(locationData.getLocation(), locationData.getLocationInfo()); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsListener.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsListener.java new file mode 100755 index 0000000..0cd7a81 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsListener.java @@ -0,0 +1,258 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconSet; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + +public class DefaultTrafficIncidentsListener extends EObjectImpl implements TrafficIncidentsListener { + private final static Logger LOGGER = Logger.getLogger(DefaultTrafficIncidentsListener.class.getName()); + + @Override + public void getVersionReply(Version version) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getVersionReply ignored!"); + } + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getLanguageReply ignored!"); + } + + @Override + public void setLanguageReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setLanguageReply ignored!"); + } + + @Override + public void setTimeFormatReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setTimeFormatReply ignored!"); + } + + @Override + public void setDateFormatReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setDateFormatReply ignored!"); + } + + @Override + public void setLengthUnitReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setLengthUnitReply ignored!"); + } + + @Override + public void setWeightUnitReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setWeightUnitReply ignored!"); + } + + @Override + public void getApplicabilityReply(String filterExpression) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getApplicabilityReply ignored!"); + } + + @Override + public void setApplicabilityReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to setApplicabilityReply ignored!"); + } + + @Override + public void reserveIconSetIdsReply(EList iconSetIds) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to reserveIconSetIdsReply ignored!"); + } + + @Override + public void freeIconSetIdsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to freeIconSetIdsReply ignored!"); + } + + @Override + public void getIconSetsReply(EList iconSets) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getIconSetsReply ignored!"); + } + + @Override + public void addIconSetDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addIconSetsDefinitionsReply ignored!"); + } + + @Override + public void removeIconSetDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeIconSetDefinitionsReply ignored!"); + } + + @Override + public void getIconDefinitionsReply(EList iconDefinitions) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getIconDefinitionsReply ignored!"); + } + + @Override + public void addIconDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addIconDefinitionsReply ignored!"); + } + + @Override + public void removeIconDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addIconDefinitionsReply ignored!"); + } + + @Override + public void reserveCategoryIdsReply(EList categoryIds) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to reserveCategoryIdsReply ignored!"); + } + + @Override + public void freeCategoryIdsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to freeCategoryIdsReply ignored!"); + } + + @Override + public void getCategoryDefinitionsReply(EList categoryDefinitions) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getCategoryDefinitionsReply ignored!"); + } + + @Override + public void addCategoryDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addCategoryDefinitionsReply ignored!"); + } + + @Override + public void removeCategoryDefinitionsReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeCategoryDefinitionsReply ignored!"); + } + + @Override + public void getTrafficIncidentIdsReply(EList incidentIds) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getTrafficIncidentIdsReply ignored!"); + } + + @Override + public void getTrafficIncidentIdsInAreasReply(EList trafficIncidentIds) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getTrafficIncidentIdsInAreasReply ignored!"); + } + + @Override + public void getTrafficIncidentsReply(EList trafficIncidents) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getTrafficIncidentsReply ignored!"); + } + + @Override + public void getTrafficIncidentsFieldsReply(EList trafficIncidents) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getTrafficIncidentsFieldsReply ignored!"); + } + + @Override + public void getTextsReply(EList texts) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to getTextsReply ignored!"); + } + + @Override + public void addTrafficIncidentsStatusListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addTrafficIncidentsStatusListenerReply ignored!"); + } + + @Override + public void removeTrafficIncidentsStatusListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeTrafficIncidentsStatusListenerReply ignored!"); + } + + @Override + public void addFeedInformationListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addFeedInformationListenerReply ignored!"); + } + + @Override + public void removeFeedInformationListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeFeedInformationListenerReply ignored!"); + } + + @Override + public void addUpdateListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addUpdateListenerReply ignored!"); + } + + @Override + public void removeUpdateListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeUpdateListenerReply ignored!"); + } + + @Override + public void addAreasUpdateListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to addAreasUpdateListenerReply ignored!"); + } + + @Override + public void removeAreasUpdateListenerReply() { + // No action. Override this method if action is needed. + LOGGER.severe("Call to removeAreasUpdateListenerReply ignored!"); + } + + @Override + public void trafficIncidentsStatus( + TrafficIncidentFeedStatus trafficIncidentFeedStatus, + TrafficIncidentsStatus trafficIncidentsStatus) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to trafficIncidentsStatus ignored!"); + } + + @Override + public void feedInformation(EList feedsInformation) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to feedInformation ignored!"); + } + + @Override + public void updates(EList unchangedTrafficIncidentIds, EList changedTrafficIncidentIds, EList newTrafficIncidentIds, EList deletedTrafficIncidentIds) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to updates ignored!"); + } + + @Override + public void updatesInAreas(EList areas) { + // No action. Override this method if action is needed. + LOGGER.severe("Call to updatesInAreas ignored!"); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsUpdatesListener.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsUpdatesListener.java new file mode 100755 index 0000000..3595cbd --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/DefaultTrafficIncidentsUpdatesListener.java @@ -0,0 +1,54 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.common.Version; + +public class DefaultTrafficIncidentsUpdatesListener extends EObjectImpl implements TrafficIncidentFeedListener { + private final static Logger LOGGER = Logger.getLogger(DefaultTrafficIncidentsUpdatesListener.class.getName()); + + static { + LOGGER.setLevel(Level.SEVERE); + } + + @Override + public void getVersionReply(Version version) { + // No action. Override this method if action is needed. + LOGGER.info("Call to getVersionReply ignored!"); + } + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + // No action. Override this method if action is needed. + LOGGER.info("Call to getLanguageReply ignored!"); + } + + @Override + public void registerFeedReply(int feedId) { + // No action. Override this method if action is needed. + LOGGER.info("Call to registerFeedReply ignored!"); + } + + @Override + public void addLanguageListenerReply() { + // No action. Override this method if action is needed. + LOGGER.info("Call to addLanguageListenerReply ignored!"); + } + + @Override + public void removeLanguageListenerReply() { + // No action. Override this method if action is needed. + LOGGER.info("Call to removeLanguageListenerReply ignored!"); + } + + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/AreasFilter.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/AreasFilter.java new file mode 100755 index 0000000..0646c82 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/AreasFilter.java @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.ecore.EObject; +import org.genivi.common.RectangularArea; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + +public class AreasFilter extends Filter { + private final static Logger LOGGER = Logger.getLogger(ExpressionFilter.class.getName()); + + private List areas; + + public AreasFilter(List areas) { + super(); + + LOGGER.setLevel(Level.SEVERE); + + this.areas = areas; + } + + @Override + public boolean filter(EObject object) { + LOGGER.info("=>"); + + boolean returnValue = false; + + if (!(object instanceof TrafficIncident)) { + LOGGER.info("<= Object is not a TrafficIncident" + returnValue); + return returnValue; + } + + TrafficIncident trafficIncident = (TrafficIncident) object; + RectangularArea incidentArea = trafficIncident.getLocationBoundingBox(); + + for (RectangularArea area: areas) { + if (!RectangularAreaUtils.areaIsOutsideArea(area, incidentArea)) { + returnValue = true; + break; + } + } + + LOGGER.info("<= " + returnValue); + + return returnValue; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpirationHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpirationHandler.java new file mode 100755 index 0000000..ccd894d --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpirationHandler.java @@ -0,0 +1,48 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.Date; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; + +public class ExpirationHandler extends Thread { + TrafficIncidentsService trafficInfoStore; + + public ExpirationHandler(TrafficIncidentsService trafficInfoStore) { + this.trafficInfoStore = trafficInfoStore; + } + + public void run() { + for ( ; ; ) { + try { + sleep(1000 * 60); + } catch (InterruptedException e) { + } + + cancelExpiredMessages(); + } + } + + private void cancelExpiredMessages() { + Date currentTime = new Date(); + EList cancelList = new BasicEList<>(); + + for (ManagedTrafficIncident managedTrafficIncident: trafficInfoStore.getManagedEvents()) { + Date expirationTime = managedTrafficIncident.getxTrafficIncident().getExpirationTime(); + if (expirationTime != null && currentTime.after(expirationTime)) { + cancelList.add(managedTrafficIncident.getxTrafficIncident().getTrafficIncidentId()); + } + } + + if (cancelList.size() != 0) { + trafficInfoStore.updateIncidents(-1, cancelList, null); + } + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpressionFilter.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpressionFilter.java new file mode 100755 index 0000000..7659b07 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ExpressionFilter.java @@ -0,0 +1,45 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.ecore.EObject; +import org.genivi.booleanexpr.BooleanExpression; + +public class ExpressionFilter extends Filter { + private final static Logger LOGGER = Logger.getLogger(ExpressionFilter.class.getName()); + + private BooleanExpression expression; + + public ExpressionFilter(BooleanExpression expression) { + super(); + + LOGGER.setLevel(Level.SEVERE); + + this.expression = expression; + } + + @Override + public boolean filter(EObject object) { + LOGGER.info("=> Object = " + object.toString()); + LOGGER.info("=> FilterExpression = " + expression.toString()); + + boolean returnValue = expression.evaluate(object); + + LOGGER.info("<= " + returnValue); + + return returnValue; + } + + public BooleanExpression getExpression() { + return expression; + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/Filter.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/Filter.java new file mode 100755 index 0000000..6827f22 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/Filter.java @@ -0,0 +1,67 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.Collection; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; + +public abstract class Filter { + private final static Logger LOGGER = Logger.getLogger(Filter.class.getName()); + + public Filter() { + LOGGER.setLevel(Level.SEVERE); + } + + public abstract boolean filter(EObject object); + + public static EList applyFilters(Collection values, EList filters) { + EList filteredList = new BasicEList(values); + for (Filter filter: filters) { + filteredList = applyAcceptFilter(filteredList, filter); + } + return filteredList; + } + + public static EList applyAcceptFilter(Collection values, Filter filter) { + LOGGER.info("=>"); + EList filteredList = new BasicEList(); + + for (T object: values) { + if (filter.filter(object)) { + LOGGER.info("Adding object to filteredList: " + object); + filteredList.add(object); + } else { + LOGGER.info("Object NOT added to filteredList: " + object); + } + } + + LOGGER.info("<="); + return filteredList; + } + + public static EList applyRejectFilter(Collection values, Filter filter) { + LOGGER.info("=>"); + EList filteredList = new BasicEList(); + + for (T object: values) { + if (!filter.filter(object)) { + LOGGER.info("Adding object to filteredList: " + object); + filteredList.add(object); + } else { + LOGGER.info("Object NOT added to filteredList: " + object); + } + } + + return filteredList; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/LocationReferenceHandler.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/LocationReferenceHandler.java new file mode 100755 index 0000000..21be7c2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/LocationReferenceHandler.java @@ -0,0 +1,193 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.genivi.common.CommonFactory; +import org.genivi.common.Coordinate; +import org.genivi.common.RectangularArea; +import org.genivi.location.AreaLocationInfo; +import org.genivi.location.LinearLocationInfo; +import org.genivi.location.Location; +import org.genivi.location.LocationInfo; +import org.genivi.location.PointLocationInfo; +import org.genivi.locref.LocationReferenceDecodingServiceListener; +import org.genivi.locref.refimpl.LocationReferenceDecodingHandlerRefImpl; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; + + +public class LocationReferenceHandler { + private final static Logger LOGGER = Logger.getLogger(LocationReferenceHandler.class.getName()); + private final static CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; + + private TrafficIncidentsService trafficIncidentsService; + private LocationReferenceDecodingHandlerRefImpl locationReferencDecodingHandler; + private List incidents; + private boolean allDecodingRequestsSent = false; + private boolean trafficIncidentsServiceNotified = true; + private List locationDecodingHandlerListeners = new ArrayList(); + + public LocationReferenceHandler(TrafficIncidentsService trafficIncidentsService, + LocationReferenceDecodingHandlerRefImpl locationReferencDecodingHandler) { + LOGGER.setLevel(Level.SEVERE); + + this.trafficIncidentsService = trafficIncidentsService; + this.locationReferencDecodingHandler = locationReferencDecodingHandler; + } + + public void setLanguage(String languageCode, String countryCode) { + locationReferencDecodingHandler.setLanguage(languageCode, countryCode); + } + + public void handleLocationReferences(List incidents) { + LOGGER.info("Going to handle location references."); + this.incidents = incidents; + LocationDecodingHandlerListener locationDecodingHandlerListener; + + allDecodingRequestsSent = false; + trafficIncidentsServiceNotified = false; + + for (ManagedTrafficIncident managedTrafficIncident: incidents) { + LOGGER.info("Handling managedTrafficIncident: " + managedTrafficIncident.getxTrafficIncident().getTrafficIncidentId()); + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident = managedTrafficIncident.getxTrafficIncident(); + TrafficIncident trafficIncident = managedTrafficIncident.getTrafficIncident(); + + // Check for LocationReference to be decoded. + if (xTrafficIncident.isSetLocationReference()) { + LOGGER.info("Location to be dereferenced."); + locationDecodingHandlerListener = new LocationDecodingHandlerListener(this, trafficIncident); + locationDecodingHandlerListeners.add(locationDecodingHandlerListener); + + locationReferencDecodingHandler.decode(locationDecodingHandlerListener, xTrafficIncident.getLocationReference()); + } + + // Check for VehicleRelatedRestrictions - RestrictionLocations to be decoded. + for (int applicabilityIndex = 0; applicabilityIndex < xTrafficIncident.getApplicability().size(); applicabilityIndex++) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability xApplicability = xTrafficIncident.getApplicability().get(applicabilityIndex); + Applicability applicability = trafficIncident.getApplicability().get(applicabilityIndex); + for (int restrictionIndex = 0; restrictionIndex < xApplicability.getVehicleRelatedRestrictions().size(); restrictionIndex++) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction xVehicleRelatedRestriction = xApplicability.getVehicleRelatedRestrictions().get(restrictionIndex); + VehicleRelatedRestriction vehicleRelatedRestriction = applicability.getVehicleRelatedRestrictions().get(restrictionIndex); + + if (xVehicleRelatedRestriction.isSetRestrictionLocationReference()) { + LOGGER.info("Restriction Location to be dereferenced."); + locationDecodingHandlerListener = new LocationDecodingHandlerListener(this, vehicleRelatedRestriction); + locationDecodingHandlerListeners.add(locationDecodingHandlerListener); + + locationReferencDecodingHandler.decode(locationDecodingHandlerListener, xVehicleRelatedRestriction.getRestrictionLocationReference()); + } + } + } + } + allDecodingRequestsSent = true; + + handleLocationDecoded(null); + } + + synchronized void handleLocationDecoded(LocationDecodingHandlerListener locationDecodingHandlerListener) { + if (locationDecodingHandlerListener != null) { + locationDecodingHandlerListeners.remove(locationDecodingHandlerListener); + } + + if (allDecodingRequestsSent && locationDecodingHandlerListeners.isEmpty() && + !trafficIncidentsServiceNotified) { + trafficIncidentsServiceNotified = true; + LOGGER.info("Ready with handling location references. Inform the TrafficIncidentsService that decoding the locations is done."); + trafficIncidentsService.locationsDereferenced(incidents); + } + } + + public RectangularArea calculateBoundingBox(LocationInfo locationInfo) { + Coordinate coordinate = locationInfo.getMainLocation(); + double minLatitude = coordinate.getLatitude(); + double maxLatitude = minLatitude; + double minLongitude = coordinate.getLongitude(); + double maxLongitude = minLongitude; + + if (locationInfo instanceof LinearLocationInfo) { + LinearLocationInfo linearLocationInfo = (LinearLocationInfo) locationInfo; + + for (Coordinate loopCoordinate: linearLocationInfo.getCoordinates()) { + if (loopCoordinate.getLatitude() < minLatitude) { + minLatitude = loopCoordinate.getLatitude(); + } + if (loopCoordinate.getLatitude() > maxLatitude) { + maxLatitude = loopCoordinate.getLatitude(); + } + if (loopCoordinate.getLongitude() < minLongitude) { + minLongitude = loopCoordinate.getLongitude(); + } + if (loopCoordinate.getLongitude() > maxLongitude) { + maxLongitude = loopCoordinate.getLongitude(); + } + } + } else if (locationInfo instanceof PointLocationInfo) { + // Nothing else to do + } else if (locationInfo instanceof AreaLocationInfo) { + // TODO PRIO9: FULL_IMPL Implement bounding box for area locations. + } + + Coordinate bottomLeft = COMMON_FACTORY.createCoordinate(); + bottomLeft.setAltitude(0); + bottomLeft.setLongitude(minLongitude); + bottomLeft.setLatitude(minLatitude); + + Coordinate topRight = COMMON_FACTORY.createCoordinate(); + topRight.setAltitude(0); + topRight.setLongitude(maxLongitude); + topRight.setLatitude(maxLatitude); + + RectangularArea boundingBox = COMMON_FACTORY.createRectangularArea(); + boundingBox.setBottomLeft(bottomLeft); + boundingBox.setTopRight(topRight); + + return boundingBox; + } + + class LocationDecodingHandlerListener extends EObjectImpl implements LocationReferenceDecodingServiceListener { + private LocationReferenceHandler locationReferenceHandler; + private Object targetLocationObject; + + LocationDecodingHandlerListener(LocationReferenceHandler locationReferenceHandler, Object targetLocationObject) { + this.locationReferenceHandler = locationReferenceHandler; + this.targetLocationObject = targetLocationObject; + } + + @Override + public void decodeReply(Location location, LocationInfo locationInfo) { + if (targetLocationObject instanceof TrafficIncident) { + TrafficIncident managedTrafficIncident = (TrafficIncident) targetLocationObject; + if (location != null) { + managedTrafficIncident.setLocation(location); + } + if (locationInfo != null) { + managedTrafficIncident.setLocationInfo(locationInfo); + managedTrafficIncident.setLocationBoundingBox(calculateBoundingBox(locationInfo)); + } + } else if (targetLocationObject instanceof VehicleRelatedRestriction) { + VehicleRelatedRestriction managedVehicleRelatedRestriction = (VehicleRelatedRestriction) targetLocationObject; + managedVehicleRelatedRestriction.setRestrictionLocation(location); + } + + locationReferenceHandler.handleLocationDecoded(this); + } + + @Override + public void getLanguageReply(String languageCode, String countryCode) { + // no action. + } + + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ManagedTrafficIncident.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ManagedTrafficIncident.java new file mode 100755 index 0000000..01be3ba --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/ManagedTrafficIncident.java @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.Date; + +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + +public class ManagedTrafficIncident { + private org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident; + private TrafficIncident trafficIncident; + private Date receivedAt; + + public ManagedTrafficIncident( + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident, + TrafficIncident trafficIncident, + Date receivedAt) { + super(); + this.xTrafficIncident = xTrafficIncident; + this.trafficIncident = trafficIncident; + this.receivedAt = receivedAt; + } + + public org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident getxTrafficIncident() { + return xTrafficIncident; + } + + public TrafficIncident getTrafficIncident() { + return trafficIncident; + } + + public Date getReceivedAt() { + return receivedAt; + } +} \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/RectangularAreaUtils.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/RectangularAreaUtils.java new file mode 100755 index 0000000..14d25e2 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/RectangularAreaUtils.java @@ -0,0 +1,34 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import org.genivi.common.RectangularArea; + + +public class RectangularAreaUtils { + + /** + * Determine if one area (area2) is completely outside of another area (area1). + * + * @param area1 + * @param area2 + * @return true if area2 is completely outside of area1. + */ + public static boolean areaIsOutsideArea(RectangularArea rectangle1, RectangularArea rectangle2) { + boolean leftOfOne = + rectangle2.getTopRight().getLongitude() < rectangle1.getBottomLeft().getLongitude(); + boolean rightOfOne = + rectangle2.getBottomLeft().getLongitude() > rectangle1.getTopRight().getLongitude(); + boolean aboveOne = + rectangle2.getBottomLeft().getLatitude() > rectangle1.getTopRight().getLatitude(); + boolean belowOne = + rectangle2.getTopRight().getLatitude() < rectangle1.getBottomLeft().getLatitude(); + return (leftOfOne || rightOfOne || aboveOne || belowOne); + } + +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentConvertor.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentConvertor.java new file mode 100755 index 0000000..020b8be --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentConvertor.java @@ -0,0 +1,272 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.Date; +import java.util.List; + +import org.genivi.common.LocalizedString; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentFactory; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; + +public class TrafficIncidentConvertor { + private static final trafficincidentFactory TI_FACTORY = trafficincidentFactory.eINSTANCE; + + public static TrafficIncident xTrafficIncident2TrafficIncident( + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident, + String languageCode, String languageCountryCode) { + TrafficIncident trafficIncident = TI_FACTORY.createTrafficIncident(); + + // trafficIncidentId: not available in xTrafficIncident. + + // effectCode + if (xTrafficIncident.isSetEffectCode()) { + trafficIncident.setEffectCode(xTrafficIncident.getEffectCode()); + } + + // effectText: not available in xTrafficIncident. + + // startTime + if (xTrafficIncident.isSetStartTime()) { + Date startDate = new Date(xTrafficIncident.getStartTime().getTime()); + trafficIncident.setStartTime(startDate); + } + + // stopTime + if (xTrafficIncident.isSetStopTime()) { + Date stopDate = new Date(xTrafficIncident.getStopTime().getTime()); + trafficIncident.setStopTime(stopDate); + } + + // tendency + if (xTrafficIncident.isSetTendency()) { + trafficIncident.setTendency(xTrafficIncident.getTendency()); + } + + // tendencyText:; not available in xTrafficIncident. + + // lengthAffected + if (xTrafficIncident.isSetLengthAffected()) { + trafficIncident.setLengthAffected(xTrafficIncident.getLengthAffected()); + } + + // averageSpeedAbsolute + if (xTrafficIncident.isSetAverageSpeedAbsolute()) { + trafficIncident.setAverageSpeedAbsolute(xTrafficIncident.getAverageSpeedAbsolute()); + } + + // delay + if (xTrafficIncident.isSetDelay()) { + trafficIncident.setDelay(xTrafficIncident.getDelay()); + } + + // segmentSpeedLimit + if (xTrafficIncident.isSetSegmentSpeedLimit()) { + trafficIncident.setSegmentSpeedLimit(xTrafficIncident.getSegmentSpeedLimit()); + } + + // expectedSpeedAbsolute + if (xTrafficIncident.isSetExpectedSpeedAbsolute()) { + trafficIncident.setExpectedSpeedAbsolute(xTrafficIncident.getExpectedSpeedAbsolute()); + } + + // locationInfo: not available in xTrafficIncident. + + // causeTexts: not available in xTrafficIncident. + + // applicabilityTexts: not available in xTrafficIncident. + + // adviceTexts: not available in xTrafficIncident. + + // categoryIds: not available in xTrafficIncident. + + // locationInfo: not available in xTrafficIncident. + + // causes + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause xCause: xTrafficIncident.getCauses()) { + trafficIncident.getCauses().add(xCause2Cause(xCause, languageCode, languageCountryCode)); + } + + // advices + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice xAdvice: xTrafficIncident.getAdvices()) { + trafficIncident.getAdvices().add(xAdvice2Advice(xAdvice, languageCode, languageCountryCode)); + } + + // applicability + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability xApplicability: xTrafficIncident.getApplicability()) { + trafficIncident.getApplicability().add(xApplicability2Applicability(xApplicability)); + } + + // location: not available in xTrafficIncident. + + // locationBoundingBox: not available in xTrafficIncident. + + return trafficIncident; + } + + private static Cause xCause2Cause(org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause xCause, String languageCode, String languageCountryCode) { + Cause cause; + + if (xCause instanceof org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause) { + cause = xDirectCause2DirectCause((org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause) xCause, languageCode, languageCountryCode); + } else { + cause = xLinkedCause2LinkedCause((org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause) xCause); + } + cause.setMainCause(xCause.getMainCause()); + + return cause; + } + + private static DirectCause xDirectCause2DirectCause(org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.DirectCause xDirectCause, + String languageCode, String languageCountryCode) { + DirectCause directCause = TI_FACTORY.createDirectCause(); + + // warningLevel + if (xDirectCause.isSetWarningLevel()) { + directCause.setWarningLevel(xDirectCause.getWarningLevel()); + } + + // unverifiedInformation + directCause.setUnverifiedInformation(xDirectCause.isUnverifiedInformation()); + + // subCause + if (xDirectCause.isSetSubCause()) { + directCause.setSubCause(xDirectCause.getSubCause()); + } + + // lengthAffected + if (xDirectCause.isSetLengthAffected()) { + directCause.setLengthAffected(xDirectCause.getLengthAffected()); + } + + // freeText + if (xDirectCause.getFreeText().size() != 0) { + directCause.setFreeText(getTextForSelectedLanguage(xDirectCause.getFreeText(), languageCode, languageCountryCode)); + } + + // laneRestrictions + if (xDirectCause.isSetLaneRestrictions()) { + directCause.setLaneRestrictions(xLaneRestrictions2LaneRestrictions(xDirectCause.getLaneRestrictions())); + } + + // causeOffset + if (xDirectCause.isSetCauseOffset()) { + directCause.setCauseOffset(xDirectCause.getCauseOffset()); + } + + return directCause; + } + + private static LaneRestrictions xLaneRestrictions2LaneRestrictions( + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LaneRestrictions xLaneRestrictions) { + LaneRestrictions laneRestrictions = TI_FACTORY.createLaneRestrictions(); + + // laneRestrictionType + laneRestrictions.setLaneRestrictionType(xLaneRestrictions.getLaneRestrictionType()); + + // numberOfLanes + if (xLaneRestrictions.isSetNumberOfLanes()) { + laneRestrictions.setNumberOfLanes(xLaneRestrictions.getNumberOfLanes()); + } + + return laneRestrictions; + } + + private static LinkedCause xLinkedCause2LinkedCause(org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause xLinkedCause) { + LinkedCause linkedCause = TI_FACTORY.createLinkedCause(); + + // causeTrafficIncidentId: not available in xTrafficIncident. + + return linkedCause; + } + + private static Advice xAdvice2Advice(org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Advice xAdvice, String languageCode, String languageCountryCode) { + Advice advice = TI_FACTORY.createAdvice(); + + // mainAdvice + advice.setMainAdvice(xAdvice.getMainAdvice()); + + // subAdvice + if (xAdvice.isSetSubAdvice()) { + advice.setSubAdvice(xAdvice.getSubAdvice()); + } + + // freeText + if (xAdvice.getFreeText().size() != 0) { + advice.setFreeText(getTextForSelectedLanguage(xAdvice.getFreeText(), languageCode, languageCountryCode)); + } + + // applicability + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability xApplicability: xAdvice.getApplicability()) { + advice.getApplicability().add(xApplicability2Applicability(xApplicability)); + } + + return advice; + } + + private static Applicability xApplicability2Applicability(org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Applicability xApplicability) { + Applicability applicability = TI_FACTORY.createApplicability(); + + // vehicleType + applicability.setVehicleType(xApplicability.getVehicleType()); + + // vehicleRelatedRestrictions + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction xVehicleRelatedRestriction: xApplicability.getVehicleRelatedRestrictions()) { + applicability.getVehicleRelatedRestrictions().add(xVehicleRelatedRestriction2VehicleRelatedRestriction(xVehicleRelatedRestriction)); + } + + return applicability; + } + + private static VehicleRelatedRestriction xVehicleRelatedRestriction2VehicleRelatedRestriction( + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.VehicleRelatedRestriction xVehicleRelatedRestriction) { + VehicleRelatedRestriction vehicleRelatedRestriction = TI_FACTORY.createVehicleRelatedRestriction(); + + // restrictionType + vehicleRelatedRestriction.setRestrictionType(xVehicleRelatedRestriction.getRestrictionType()); + + // restrictionValue + if (xVehicleRelatedRestriction.isSetRestrictionValue()) { + vehicleRelatedRestriction.setRestrictionValue(xVehicleRelatedRestriction.getRestrictionValue()); + } + + // restrictionLocation: not available in xTrafficIncident. + + return vehicleRelatedRestriction; + } + + public static String getTextForSelectedLanguage(List localizedStrings, String languageCode, String languageCountryCode) { + // if languageCountryCode is set, try to find a match on language and country + if (languageCountryCode != null) { + for (LocalizedString localizedString: localizedStrings) { + if (localizedString.getLanguageCode().equals(languageCode) && + localizedString.isSetCountryCode() && + localizedString.getCountryCode().equals(languageCountryCode)) { + return localizedString.getString(); + } + } + } + + // try to find a match language only + for (LocalizedString localizedString: localizedStrings) { + if (localizedString.getLanguageCode().equals(languageCode)) { + return localizedString.getString(); + } + } + + // just take the first one + return localizedStrings.get(0).getString(); + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentFilterUtils.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentFilterUtils.java new file mode 100755 index 0000000..ea5a88f --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentFilterUtils.java @@ -0,0 +1,85 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import org.eclipse.emf.common.util.EList; +import org.genivi.booleanexpr.ClassAttribute; +import org.genivi.booleanexpr.DownCastPredicate; +import org.genivi.booleanexpr.FilterexprFactory; +import org.genivi.booleanexpr.InOperator; +import org.genivi.booleanexpr.InPredicate; +import org.genivi.booleanexpr.ListOperator; +import org.genivi.booleanexpr.Literal; +import org.genivi.booleanexpr.MultiplicityPredicate; +import org.genivi.booleanexpr.SignedIntegerLiteral; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentPackage; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +public class TrafficIncidentFilterUtils { + private final static FilterexprFactory FILTER_EXPR_FACTORY = FilterexprFactory.eINSTANCE; + private final static trafficincidentPackage TRAFFIC_INCIDENT_PACKAGE = trafficincidentPackage.eINSTANCE; + + public static Filter createWarningLevelFilter(EList warningLevels) { + + // In Predicate: warningLevel IN warningLevels + InPredicate warningLevelAttributeCheck = FILTER_EXPR_FACTORY.createInPredicate(); + ClassAttribute warningLevelAttribute = FILTER_EXPR_FACTORY.createClassAttribute(); + warningLevelAttribute.setAttributeName(TRAFFIC_INCIDENT_PACKAGE.getDirectCause_WarningLevel().getName()); + warningLevelAttributeCheck.setAttribute(warningLevelAttribute); + warningLevelAttributeCheck.setInOperator(InOperator.IN); + EList literals = warningLevelAttributeCheck.getLiterals(); + for (WarningLevel warningLevel: warningLevels) { + SignedIntegerLiteral warningLevelEnumValue = FILTER_EXPR_FACTORY.createSignedIntegerLiteral(); + warningLevelEnumValue.setValue(warningLevel.getValue()); + literals.add(warningLevelEnumValue); + } + + // Downcast: to DirectCause where (warningLevel IN warningLevels) + DownCastPredicate directCauseDownCast = FILTER_EXPR_FACTORY.createDownCastPredicate(); + directCauseDownCast.setClassName(TRAFFIC_INCIDENT_PACKAGE.getDirectCause().getName()); + directCauseDownCast.setExpression(warningLevelAttributeCheck); + + // Subclass Predicate: ANY cause instanceof DirectCause where (warningLevel IN warningLevels) + MultiplicityPredicate anyCausePredicate = FILTER_EXPR_FACTORY.createMultiplicityPredicate(); + anyCausePredicate.setListOperator(ListOperator.ANY); + ClassAttribute causes = FILTER_EXPR_FACTORY.createClassAttribute(); + causes.setAttributeName(TRAFFIC_INCIDENT_PACKAGE.getTrafficIncident_Causes().getName()); + anyCausePredicate.setAttribute(causes); + anyCausePredicate.setExpression(directCauseDownCast); +// System.out.println(anyCausePredicate.toString()); + + Filter filter = new ExpressionFilter(anyCausePredicate); + + return filter; + } + + public static Filter createCategoryIdsFilter(EList categoryIds) { + // In Predicate: categoryId IN categoryIds + InPredicate categoryIdCheck = FILTER_EXPR_FACTORY.createInPredicate(); + categoryIdCheck.setInOperator(InOperator.IN); + EList literals = categoryIdCheck.getLiterals(); + for (Integer categoryId: categoryIds) { + SignedIntegerLiteral categoryIdLiteral = FILTER_EXPR_FACTORY.createSignedIntegerLiteral(); + categoryIdLiteral.setValue(categoryId); + literals.add(categoryIdLiteral); + } + + // Multiplicity Predicate: ANY categoryId where (categoryId IN categoryIds) + MultiplicityPredicate anyCategoryIdPredicate = FILTER_EXPR_FACTORY.createMultiplicityPredicate(); + anyCategoryIdPredicate.setListOperator(ListOperator.ANY); + ClassAttribute categoryIdsAttribute = FILTER_EXPR_FACTORY.createClassAttribute(); + categoryIdsAttribute.setAttributeName(TRAFFIC_INCIDENT_PACKAGE.getTrafficIncident_CategoryIds().getName()); + anyCategoryIdPredicate.setAttribute(categoryIdsAttribute); + anyCategoryIdPredicate.setExpression(categoryIdCheck); + +// System.out.println(anyCategoryIdPredicate.toString()); + Filter filter = new ExpressionFilter(anyCategoryIdPredicate); + + return filter; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentsService.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentsService.java new file mode 100755 index 0000000..3c0ebe7 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/TrafficIncidentsService.java @@ -0,0 +1,1426 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +/** + * Applicability handling. + * The way that the Traffic Incidents Service shall handle the Applicability + * is a tradeoff between the best user experience and performance (use of system resources). + * It is based on the idea that the application (user) will hardly ever change the + * Applicability settings. + * Behaviour: + * - Traffic Incidents that are not applicable may be thrown away on reception. + * This can be done before any location dereferencing takes place. This implies + * that an Applicability Expression should not refer to any location. + * In a client/server solution it is even possible that the server is instructed + * not to transmit these incidents. + * - If the Applicability Expression is changed, it is applied on the current set of + * Traffic Incidents. This may lead to the removal of incidents, which in its turn + * may trigger notifications being sent to listeners for changes in the traffic situation. + * - Incidents that are not Applicable are never given to a client of this service. + */ +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.emf.common.util.BasicEList; +import org.eclipse.emf.common.util.EList; +import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.impl.EObjectImpl; +import org.eclipse.emf.ecore.util.EcoreUtil; +import org.genivi.booleanexpr.BooleanExpression; +import org.genivi.booleanexpr.util.FilterExprUtil; +import org.genivi.common.CommonFactory; +import org.genivi.common.RectangularArea; +import org.genivi.common.Version; +import org.genivi.iconset.IconDefinition; +import org.genivi.iconset.IconInfo; +import org.genivi.iconset.IconSet; +import org.genivi.locref.refimpl.LocationReferenceDecodingHandlerRefImpl; +import org.genivi.trafficincidentsservice.CategoryDefinition; +import org.genivi.trafficincidentsservice.FeedInformation; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentField; +import org.genivi.trafficincidentsservice.TrafficIncidents; +import org.genivi.trafficincidentsservice.TrafficIncidentsListener; +import org.genivi.trafficincidentsservice.TrafficIncidentsStatus; +import org.genivi.trafficincidentsservice.TrafficIncidentFeed; +import org.genivi.trafficincidentsservice.TrafficIncidentFeedListener; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidentsserviceFactory; +import org.genivi.trafficincidentsservice.textgenerator.TrafficIncidentTextGenerator; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LinkedCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.trafficincidentFactory; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + +public class TrafficIncidentsService extends EObjectImpl implements TrafficIncidents, TrafficIncidentFeed { + private final static Logger LOGGER = Logger.getLogger(TrafficIncidentsService.class.getName()); + private static final trafficincidentsserviceFactory TRAFFIC_INCIDENTS_FACTORY = trafficincidentsserviceFactory.eINSTANCE; + private static final trafficincidentFactory TRAFFIC_INCIDENT_FACTORY = trafficincidentFactory.eINSTANCE; + private static final CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; // Used to create a Version + + private static final int NORMAL_DRIVING_SPEED_IN_METERS_PER_SECOND = 30; // TODO PRIO9: FULL_IMPL This value has to be obtained from the map database, for the related segment(s). + + // Version information + private static final int MAJOR_VERSION_NUMBER = 1; + private static final int MINOR_VERSION_NUMBER = 0; + private static final int MICRO_VERSION_NUMBER = 0; + private static final String VERSION_DATE = "06-03-2014"; + + // Default language information. + private static final String DEFAULT_LANGUAGE_CODE = "eng"; + private static final String DEFAULT_LANGUAGE_COUNTRY_CODE = null; + + // List of TrafficIncidentFields which are text fields. + private static final TrafficIncidentField[] TRAFFIC_INCIDENT_TEXT_FIELDS = { + TrafficIncidentField.APPLICABILITY_TEXTS, + TrafficIncidentField.CAUSE_TEXTS, + TrafficIncidentField.ADVICE_TEXTS, + TrafficIncidentField.EFFECT_TEXT, + TrafficIncidentField.TENDENCY_TEXT, + TrafficIncidentField.TRAFFIC_INCIDENT_ID + }; + + private static Version VERSION; + + // references to other components used. + private TrafficIncidentTextGenerator trafficIncidentTextGenerator; + private ExpirationHandler expirationHandler; +// private LocationReferenceHandler locationReferenceHandler; + private LocationReferenceDecodingHandlerRefImpl locationReferencDecodingHandler; + + // settings + private String languageCode = DEFAULT_LANGUAGE_CODE; + private String languageCountryCode = DEFAULT_LANGUAGE_COUNTRY_CODE; + + // Status information + private TrafficIncidentFeedStatus trafficIncidentFeedStatus = TrafficIncidentFeedStatus.UNAVAILABLE; + private TrafficIncidentsStatus trafficIncidentsStatus = TrafficIncidentsStatus.UNAVAILABLE; + + /* + * all other information. + */ + + // IconSet Ids reserved by applications. + private Set reservedIconSetIds = new HashSet(); + + // All known icons (including the actual data). + private Map iconDefinitionsMap = new HashMap(); + + // IconSets meta data. + private EList iconSets = new BasicEList(); + + // Category Ids reserved by applications. + private Set reservedCategoryIds = new HashSet(); + + // Category definitions + private EList categoryDefinitions = new BasicEList(); + + // Applicability filter + private ExpressionFilter applicabilityFilter = null; + + /* + * The Traffic Incidents + */ + private List managedIncidents; + private Map xIncidentIdToManagedIncidentMap; + private Map incidentIdToManagedIncidentMap; + + /* + * The update listeners. + */ + // Listeners to updates in the Traffic Incidents: based on filters for area, warning level and category. + private Map updateListeners = new HashMap<>(); + // Listeners for changes in the general status. + private List trafficIncidentsStatusListeners = new ArrayList(); + // Listeners for changes in the Feed information. + private List feedInformationListeners = new ArrayList(); + private List trafficIncidentFeedListeners = new ArrayList(); + private Map feedsInformation = new HashMap<>(); + private int nextFeedId = 1; + private int nextTrafficIncidentId = 1; // Use 0 as undefined. + + + static { + VERSION = COMMON_FACTORY.createVersion(); + VERSION.setMajor(MAJOR_VERSION_NUMBER); + VERSION.setMinor(MINOR_VERSION_NUMBER); + VERSION.setMicro(MICRO_VERSION_NUMBER); + VERSION.setDate(VERSION_DATE); + } + + public TrafficIncidentsService(LocationReferenceDecodingHandlerRefImpl locationReferencDecodingHandler, TrafficIncidentTextGenerator trafficIncidentTextGenerator) { + LOGGER.setLevel(Level.SEVERE); + LOGGER.info("Creating TrafficIncidentsService"); + + this.locationReferencDecodingHandler = locationReferencDecodingHandler; + this.trafficIncidentTextGenerator = trafficIncidentTextGenerator; + trafficIncidentTextGenerator.setLanguage(languageCode, languageCountryCode); + + managedIncidents = new ArrayList<>(); + xIncidentIdToManagedIncidentMap = new HashMap<>(); + incidentIdToManagedIncidentMap = new HashMap<>(); + + expirationHandler = new ExpirationHandler(this); + expirationHandler.start(); + } + + @Override + public void getVersion(TrafficIncidentsListener listener) { + listener.getVersionReply(VERSION); + } + + @Override + public void getTrafficIncidentIds(TrafficIncidentsListener listener, EList warningLevels, EList categoryIds) { + LOGGER.info("getTrafficIncidentIds() called, forwarding to getTrafficIncidentIdsInAreas()"); + getTrafficIncidentIdsInAreas(listener, warningLevels, categoryIds, new BasicEList()); + } + + @Override + public void getTrafficIncidentIdsInAreas(TrafficIncidentsListener listener, EList severities, EList categoryIds, EList areas) { + LOGGER.info("=>"); + EList filters = new BasicEList(); + + if (!severities.isEmpty()) { + filters.add(TrafficIncidentFilterUtils.createWarningLevelFilter(severities)); + } + + if (!categoryIds.isEmpty()) { + filters.add(TrafficIncidentFilterUtils.createCategoryIdsFilter(categoryIds)); + } + + if (!areas.isEmpty()) { + filters.add(new AreasFilter(areas)); + } + + EList relevantTrafficIncidents = Filter.applyFilters(getTrafficIncidents(), filters); + + EList trafficIncidentIds = new BasicEList<>(); + for (EObject eObject: relevantTrafficIncidents) { + TrafficIncident trafficIncident = (TrafficIncident) eObject; + LOGGER.info("adding trafficIncidentId " + trafficIncident.getTrafficIncidentId() + " to result list."); + trafficIncidentIds.add(trafficIncident.getTrafficIncidentId()); + } + + LOGGER.info("Calling getTrafficIncidentIdsReply()."); + listener.getTrafficIncidentIdsReply(trafficIncidentIds); + LOGGER.info("<="); + } + + private TrafficIncident getTrafficIncident(int trafficIncidentId, boolean includeTextFields) { + LOGGER.info("getTrafficIncident => trafficIncidentId = " + trafficIncidentId + ", includeTextFields = " + includeTextFields); + ManagedTrafficIncident managedTrafficIncident = incidentIdToManagedIncidentMap.get(trafficIncidentId); + if (managedTrafficIncident != null) { + TrafficIncident trafficIncident = managedTrafficIncident.getTrafficIncident(); + + if (trafficIncident != null) { + LOGGER.info("managedTrafficIncident = " + trafficIncident); + if (includeTextFields) { + fillTextFields(trafficIncident); + } + return trafficIncident; + } + } + + LOGGER.info("getTrafficIncident <= " + null); + return null; + } + + private void fillTextFields(TrafficIncident trafficIncident) { + String[] texts; + + for (TrafficIncidentField trafficIncidentField: TRAFFIC_INCIDENT_TEXT_FIELDS) { + // Check whether the field is already filled in or not. + switch (trafficIncidentField) { + case APPLICABILITY_TEXTS: + if (!trafficIncident.isSetApplicabilityTexts()) { + texts = trafficIncidentTextGenerator.getApplicabilityTexts(trafficIncident); + if (texts != null) { + for (String text: texts) { + trafficIncident.getApplicabilityTexts().add(text); + } + } + } + break; + + case CAUSE_TEXTS: + if (!trafficIncident.isSetCauseTexts()) { + texts = trafficIncidentTextGenerator.getCauseTexts(trafficIncident); + if (texts != null) { + for (String text: texts) { + trafficIncident.getCauseTexts().add(text); + } + } + } + break; + + case ADVICE_TEXTS: + if (!trafficIncident.isSetAdviceTexts()) { + texts = trafficIncidentTextGenerator.getAdviceTexts(trafficIncident); + if (texts != null) { + for (String text: texts) { + trafficIncident.getAdviceTexts().add(text); + } + } + } + break; + + case EFFECT_TEXT: + if (!trafficIncident.isSetEffectText()) { + trafficIncident.setEffectText(trafficIncidentTextGenerator.getEffectText(trafficIncident)); + } + break; + + case TENDENCY_TEXT: + if (!trafficIncident.isSetTendencyText()) { + trafficIncident.setTendencyText(trafficIncidentTextGenerator.getTendencyText(trafficIncident)); + } + break; + + case TRAFFIC_INCIDENT_ID: + break; + + default: + // no action + break; + } + } + } + + @Override + public void getTrafficIncidents(TrafficIncidentsListener listener, + EList trafficIncidentIds, boolean includeTextFields) { + listener.getTrafficIncidentsReply(getTrafficIncidents(trafficIncidentIds, includeTextFields)); + } + + private EList getTrafficIncidents(EList trafficIncidentIds, boolean includeTextFields) { + LOGGER.info("getTrafficIncidents => trafficIncidentIds = " + trafficIncidentIds + ", includeTextFields = " + includeTextFields); + EList trafficIncidents = new BasicEList(); + + for (int trafficIncidentId: trafficIncidentIds) { + TrafficIncident trafficIncident = getTrafficIncident(trafficIncidentId, includeTextFields); + if (trafficIncident != null) { + LOGGER.info("adding trafficIncident: " + trafficIncident); + trafficIncidents.add(trafficIncident); + } else { + LOGGER.info("skipping null value"); + } + } + + LOGGER.info("getTrafficIncidents <= " + trafficIncidents); + return trafficIncidents; + } + + @Override + public void clear() { + managedIncidents.clear(); + } + + @Override + public synchronized void updateIncidents(int feedId, EList idsToCancel, EList newOrUpdatedIncidents) { + LOGGER.info("updateIncidents => feedId = " + feedId + ", idsToCancel = " + idsToCancel + ", newOrUpdatedIncidents = " + newOrUpdatedIncidents); + + dumpManagedIncidentsMap("Before updating"); + dumpIncidents("Before updating"); + + for (String trafficIncidentManagementId: idsToCancel) { + ManagedTrafficIncident managedTrafficIncident = xIncidentIdToManagedIncidentMap.get(trafficIncidentManagementId); + if (managedTrafficIncident == null) { + LOGGER.info("No ManagedTrafficIncident found for TrafficIncidentManagementId: " + trafficIncidentManagementId); + } else { + Integer trafficIncidentId = managedTrafficIncident.getTrafficIncident().getTrafficIncidentId(); + xIncidentIdToManagedIncidentMap.remove(trafficIncidentManagementId); + incidentIdToManagedIncidentMap.remove(trafficIncidentId); + managedIncidents.remove(managedTrafficIncident); + LOGGER.info("Traffic Incident removed, Id = " + trafficIncidentId + ", managementId = " + trafficIncidentManagementId); + } + } + + dumpManagedIncidentsMap("After handling cancels"); + dumpIncidents("After handling cancels"); + EList applicableNewOrUpdatedIncidents; + + if (applicabilityFilter != null) { + applicableNewOrUpdatedIncidents = Filter.applyRejectFilter(newOrUpdatedIncidents, applicabilityFilter); + } else { + applicableNewOrUpdatedIncidents = newOrUpdatedIncidents; + } + + Date receivedAt = new Date(); + List managedApplicableNewOrUpdatedIncidents = new ArrayList<>(); + for (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident: applicableNewOrUpdatedIncidents) { + TrafficIncident newOrUpdatedIncident = TrafficIncidentConvertor.xTrafficIncident2TrafficIncident(xTrafficIncident, languageCode, languageCountryCode); + ManagedTrafficIncident managedTrafficIncident = new ManagedTrafficIncident(xTrafficIncident, newOrUpdatedIncident, receivedAt); + managedApplicableNewOrUpdatedIncidents.add(managedTrafficIncident); + } + + + LOGGER.info("Triggering location dereferencing."); + + // Trigger the LocationReferenceHandler. If this is ready, it calls locationsDereferenced(). + LocationReferenceHandler locationReferenceHandler = new LocationReferenceHandler(this, locationReferencDecodingHandler); + locationReferenceHandler.setLanguage(languageCode, languageCountryCode); + locationReferenceHandler.handleLocationReferences(managedApplicableNewOrUpdatedIncidents); + + notifyAll(); + } + + public void locationsDereferenced(List incidents) { + for (ManagedTrafficIncident managedTrafficIncident: incidents) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident = managedTrafficIncident.getxTrafficIncident(); + TrafficIncident trafficIncident = managedTrafficIncident.getTrafficIncident(); + + String trafficIncidentManagementId = xTrafficIncident.getTrafficIncidentId(); + ManagedTrafficIncident originalEvent = xIncidentIdToManagedIncidentMap.get(trafficIncidentManagementId); + + if (originalEvent != null) { + // It is an update + // Merge the new data into the existing incident + mergeIncidentData(originalEvent, managedTrafficIncident); + // Continue with the updated, existing incident + trafficIncident = originalEvent.getTrafficIncident(); + } + + calculateDelayIfApplicable(trafficIncident); + + trafficIncident.getCategoryIds().clear(); + for (CategoryDefinition categoryDefinition: categoryDefinitions) { + BooleanExpression filterExpression = FilterExprUtil.parseFilterExpression(categoryDefinition.getExpression()); + Filter filter = new ExpressionFilter(filterExpression); + if (filter.filter(trafficIncident)) { + LOGGER.info("Category filter passed, adding category Id to traffic incident: " + categoryDefinition.getCategoryId()); + trafficIncident.getCategoryIds().add(categoryDefinition.getCategoryId()); + } else { + LOGGER.info("Category filter NOT passed, category Id NOT added to traffic incident: " + categoryDefinition.getCategoryId()); + } + } + + updateLinksWithOtherIncidents(managedTrafficIncident); + + xTrafficIncident.setUpdateTime(new Date()); + + if (originalEvent == null) { + // There was no event with this Id yet, so it is a new one. + // So add an application level trafficIncidentId. + int trafficIncidentId = createTrafficIncidentId(); + LOGGER.info("Adding message, Id = " + trafficIncidentId + ", managementId = " + trafficIncidentManagementId); + trafficIncident.setTrafficIncidentId(trafficIncidentId); + managedIncidents.add(managedTrafficIncident); + incidentIdToManagedIncidentMap.put(trafficIncidentId, managedTrafficIncident); + xIncidentIdToManagedIncidentMap.put(trafficIncidentManagementId, managedTrafficIncident); + } + + + } + + dumpManagedIncidentsMap("After updating"); + dumpIncidents("After updating"); + + notifyUpdateListeners(); + } + + /** + * The method handles the links between this incident and other incidents. + * If this incident has a link to another incident, and this incident is already in + * our store, the incidentId of that incident is filled in. + * There can also be an incident in our store, which has a link to this new incident. + * In that case the incidentId is also filled in. + * @param managedTrafficIncident + */ + private void updateLinksWithOtherIncidents(ManagedTrafficIncident managedTrafficIncident) { + TrafficIncident trafficIncident = managedTrafficIncident.getTrafficIncident(); + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident xTrafficIncident = managedTrafficIncident.getxTrafficIncident(); + + // Handle a possible link from this incident to one in our store. + for (int i = 0; i < xTrafficIncident.getCauses().size(); i++) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.Cause xCause = xTrafficIncident.getCauses().get(i); + if (xCause instanceof org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause xLinkedCause = (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause) xCause; + String trafficIncidentManagementId = xLinkedCause.getCauseTrafficIncidentId(); + ManagedTrafficIncident referedToManagedIncident = xIncidentIdToManagedIncidentMap.get(trafficIncidentManagementId); + if (referedToManagedIncident != null) { + Cause cause = trafficIncident.getCauses().get(i); + LinkedCause linkedCause = (LinkedCause) cause; + Integer trafficIncidentId = referedToManagedIncident.getTrafficIncident().getTrafficIncidentId(); + linkedCause.setCauseTrafficIncidentId(trafficIncidentId); + } + } + } + + // Handle a possile link from any incident in our store to this incident. + for (ManagedTrafficIncident referredFromManagedIncident: managedIncidents) { + TrafficIncident referredFromIncident = referredFromManagedIncident.getTrafficIncident(); + for (int i = 0; i < referredFromIncident.getCauses().size(); i++) { + Cause cause = referredFromIncident.getCauses().get(i); + if (cause instanceof LinkedCause) { + LinkedCause linkedCause = (LinkedCause) cause; + Integer referToId = linkedCause.getCauseTrafficIncidentId(); + if (referToId == null) { + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.TrafficIncident referredFromXIncident = referredFromManagedIncident.getxTrafficIncident(); + org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause xLinkedCause = (org.genivi.trafficincidentsservice.trafficincidentfeed.trafficincident.LinkedCause) referredFromXIncident.getCauses().get(i); + String referToManagementId = xLinkedCause.getCauseTrafficIncidentId(); + if (referToManagementId.equals(xTrafficIncident.getTrafficIncidentId())) { + linkedCause.setCauseTrafficIncidentId(trafficIncident.getTrafficIncidentId()); + } + } + } + } + } + } + + private void mergeIncidentData(ManagedTrafficIncident existingManagedTrafficIncident, ManagedTrafficIncident updateManagedTrafficIncident) { + // TODO PRIO9: FULL_IMPL For now only one field merged, full implementation required. + TrafficIncident existingTrafficIncident = existingManagedTrafficIncident.getTrafficIncident(); + TrafficIncident updateTrafficIncident = updateManagedTrafficIncident.getTrafficIncident(); + if (updateTrafficIncident.isSetAverageSpeedAbsolute()) { + existingTrafficIncident.setAverageSpeedAbsolute(updateTrafficIncident.getAverageSpeedAbsolute()); + } + } + + private void calculateDelayIfApplicable(TrafficIncident managedTrafficIncident) { + if ((managedTrafficIncident.getDelay() == null) && + (managedTrafficIncident.getLengthAffected() != null) && + (managedTrafficIncident.getLengthAffected() != null)) { + managedTrafficIncident.getLengthAffected(); // meters + managedTrafficIncident.getAverageSpeedAbsolute(); // m/s + // normal driving time (in seconds) = length affecte (in meters) / normal driving speed (in m/s) + int normalDrivingTimeInSeconds = managedTrafficIncident.getLengthAffected() / NORMAL_DRIVING_SPEED_IN_METERS_PER_SECOND; + // current driving time (in seconds) = length affecte (in meters) / current driving speed (in m/s) + int currentDrivingTimeInSeconds = managedTrafficIncident.getLengthAffected() / managedTrafficIncident.getAverageSpeedAbsolute(); + // delay is the difference rounded to minutes. + int delay = (currentDrivingTimeInSeconds - normalDrivingTimeInSeconds + 30) / 60; + managedTrafficIncident.setDelay(delay); + } + } + + private void dumpManagedIncidentsMap(String whenText) { +// LOGGER.info("Contents of managedIncidentMap - " + whenText); +// +// for (TrafficIncidentManagementId id: managedIncidents.keySet()) { +// LOGGER.info("managementId = " + id.getId()); +// } + } + + public void dumpIncidents(String whenText) { +// LOGGER.info("Current Traffic Incidents - " + whenText); +// +// for (ManagedTrafficIncident managedTrafficIncident: managedIncidents.values()) { +// LOGGER.info("TrafficIncident = " + managedTrafficIncident); +// EList causes = managedTrafficIncident.getCauses(); +// for (Cause cause: causes) { +// LOGGER.info("Cause = " + cause); +// } +// } + } + + @Override + public void updateStatus(int feedId, TrafficIncidentFeedStatus feedStatus, + TrafficIncidentsStatus incidentsStatus) { + boolean statusChanged = false; + + FeedInformation feedInformation = feedsInformation.get(feedId); + + if (feedInformation.getFeedStatus() != feedStatus) { + feedInformation.setFeedStatus(feedStatus); + statusChanged = true; + } + if (feedInformation.getTrafficIncidentsStatus() != incidentsStatus) { + feedInformation.setTrafficIncidentsStatus(incidentsStatus); + LOGGER.info("+++++++++++++ status = " + feedInformation.getTrafficIncidentsStatus()); + statusChanged = true; + } + + if (statusChanged) { + notifyFeedInformationListeners(); + } + + determineNewStatus(); + } + + private void determineNewStatus() { + TrafficIncidentFeedStatus newTrafficIncidentFeedStatus = TrafficIncidentFeedStatus.UNAVAILABLE; + TrafficIncidentsStatus newTrafficIncidentsStatus = TrafficIncidentsStatus.UNAVAILABLE; + + for (Integer feedId: feedsInformation.keySet()) { + FeedInformation feedInformation = feedsInformation.get(feedId); + + TrafficIncidentFeedStatus thisTrafficIncidentFeedStatus = feedInformation.getFeedStatus(); + if (thisTrafficIncidentFeedStatus == TrafficIncidentFeedStatus.CONNECTED) { + newTrafficIncidentFeedStatus = TrafficIncidentFeedStatus.CONNECTED; + } + if (thisTrafficIncidentFeedStatus == TrafficIncidentFeedStatus.DISCONNECTED && + newTrafficIncidentFeedStatus == TrafficIncidentFeedStatus.UNAVAILABLE) { + newTrafficIncidentFeedStatus = TrafficIncidentFeedStatus.DISCONNECTED; + } + + TrafficIncidentsStatus thisTrafficIncidentsStatus = feedInformation.getTrafficIncidentsStatus(); + if (thisTrafficIncidentsStatus == TrafficIncidentsStatus.PARTLY_AVAILABLE) { + newTrafficIncidentsStatus = TrafficIncidentsStatus.PARTLY_AVAILABLE; + } + if (thisTrafficIncidentsStatus == TrafficIncidentsStatus.AVAILABLE && + newTrafficIncidentsStatus == TrafficIncidentsStatus.UNAVAILABLE) { + newTrafficIncidentsStatus = TrafficIncidentsStatus.AVAILABLE; + } + + if (newTrafficIncidentFeedStatus != trafficIncidentFeedStatus || + newTrafficIncidentsStatus != trafficIncidentsStatus) { + trafficIncidentFeedStatus = newTrafficIncidentFeedStatus; + trafficIncidentsStatus = newTrafficIncidentsStatus; + notifyTrafficIncidentsStatusListeners(); + } + } + + } + + @Override + public void addLanguageListener( + TrafficIncidentFeedListener listener, TrafficIncidentFeedListener languageChangeListener) { + languageChangeListener.getLanguageReply(languageCode, languageCountryCode); + trafficIncidentFeedListeners.add(languageChangeListener); + + if (listener != null) { + listener.addLanguageListenerReply(); + } + } + + @Override + public void removeLanguageListener( + TrafficIncidentFeedListener listener, TrafficIncidentFeedListener languageChangeListener) { + trafficIncidentFeedListeners.remove(languageChangeListener); + + if (listener != null) { + listener.removeLanguageListenerReply(); + } + } + + @Override + public void getLanguage(TrafficIncidentFeedListener listener) { + listener.getLanguageReply(languageCode, languageCountryCode); + } + + private int generateFeedId() { + return nextFeedId++; // This should never cause overflow. + } + + private int createTrafficIncidentId() { + int trafficIncidentId = nextTrafficIncidentId ; + + if (nextTrafficIncidentId < Integer.MAX_VALUE) { + nextTrafficIncidentId++; + } else { + nextTrafficIncidentId = 1; + } + return trafficIncidentId; + } + + public Collection getManagedEvents() { + return managedIncidents; + } + + @Override + public void addUpdateListener(TrafficIncidentsListener listener, + EList warningLevels, EList categoryIds, + TrafficIncidentsListener updateListener) { + addAreasUpdateListener(listener, warningLevels, categoryIds, new BasicEList(), updateListener); + } + + @Override + public void addAreasUpdateListener(TrafficIncidentsListener listener, + EList warningLevels, EList categoryIds, EList areas, + TrafficIncidentsListener updateListener) { + LOGGER.info("Adding (areas)UpdateListener => listener = " + listener + + ", warningLevels = " + warningLevels + ", categoryIds = " + categoryIds + + ", areas = " + areas + ", updateListener = " + updateListener); + UpdateListenerInfo updateListenerInfo = new UpdateListenerInfo(warningLevels, categoryIds, areas); + updateListeners.put(updateListener, updateListenerInfo); + + listener.addUpdateListenerReply(); + + HandleUpdateListenerRunnable handleUpdateListenerRunnable = new HandleUpdateListenerRunnable(updateListener); + Thread thread = new Thread(handleUpdateListenerRunnable); + thread.start(); + } + + @Override + public void removeAreasUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener) { + updateListeners.remove(updateListener); + + if (listener != null) { + listener.removeAreasUpdateListenerReply(); + } + } + + @Override + public void removeUpdateListener(TrafficIncidentsListener listener, TrafficIncidentsListener updateListener) { + LOGGER.info("removeUpdateListener => listener = " + listener + ", updateListener = " + updateListener); + updateListeners.remove(updateListener); + + if (listener != null) { + listener.removeUpdateListenerReply(); + } + } + + private void notifyUpdateListeners() { + for (TrafficIncidentsListener updateListener: updateListeners.keySet()) { + LOGGER.info("Notify update listener by calling updates()"); + handleUpdateListener(updateListener); + } + } + + private void handleUpdateListener(TrafficIncidentsListener updateListener) { + LOGGER.info("handleUpdateListener => updateListener = " + updateListener); + UpdateListenerInfo updateListenerInfo = updateListeners.get(updateListener); + + EList filters = new BasicEList(); + + if (updateListenerInfo.getSeveritiesFilter() != null) { + LOGGER.info("adding severitiesFilter"); + filters.add(updateListenerInfo.getSeveritiesFilter()); + } + LOGGER.info("AFTER severitiesFilter"); + + if (updateListenerInfo.getCategoriesFilter() != null) { + LOGGER.info("adding category filter"); + filters.add(updateListenerInfo.getCategoriesFilter()); + } + LOGGER.info("AFTER category Filter"); + + if (updateListenerInfo.getAreasFilter() != null) { + filters.add(updateListenerInfo.getAreasFilter()); + } + LOGGER.info("AFTER Areas Filter"); + + EList relevantTrafficIncidents = applyFilters(managedIncidents, filters); + LOGGER.info("AFTER applyFilters"); + + List unchangedIds = new ArrayList<>(); + List updatedIds = new ArrayList<>(); + List newIds = new ArrayList<>(); + List deletedIds = new ArrayList<>(); + + List relevantTrafficIncidentIds = new ArrayList<>(); + printList("incidentIdsToListener", updateListenerInfo.getIncidentIdsToListener()); + + for (ManagedTrafficIncident eObject: relevantTrafficIncidents) { + TrafficIncident trafficIncident = eObject.getTrafficIncident(); + Integer trafficIncidentId = trafficIncident.getTrafficIncidentId(); + LOGGER.info("Handling relevantTrafficIncidentId " + trafficIncidentId); + relevantTrafficIncidentIds.add(trafficIncidentId); + + // if there is no current, everything is new. + if (updateListenerInfo.getIncidentIdsToListener() != null) { + // if in current and new, the incident is either unchanged or updated. + // else it is new. + if (updateListenerInfo.getIncidentIdsToListener().contains(trafficIncidentId)) { + if (eObject.getReceivedAt().after(updateListenerInfo.getUpdateTime())) { + // in current and new, but later timestamp, so updated. + LOGGER.info("adding trafficIncidentId " + trafficIncidentId + " to Updated list."); + updatedIds.add(trafficIncidentId); + } else { + // in current and new, and same timestamp, so unchanged. + LOGGER.info("adding trafficIncidentId " + trafficIncidentId + " to Unchanged list."); + unchangedIds.add(trafficIncidentId); + } + } else { + LOGGER.info("adding trafficIncidentId " + trafficIncidentId + " to New list."); + newIds.add(trafficIncidentId); + } + } else { + LOGGER.info("adding trafficIncidentId " + trafficIncidentId + " to New list (first update)."); + newIds.add(trafficIncidentId); + } + } + + // if incidentIdsToListener is null, nothing is deleted. + if (updateListenerInfo.getIncidentIdsToListener() != null) { + for (Integer trafficIncidentId: updateListenerInfo.getIncidentIdsToListener()) { + if (!relevantTrafficIncidentIds.contains(trafficIncidentId)) { + LOGGER.info("adding trafficIncidentId " + trafficIncidentId + " to Deleted list."); + deletedIds.add(trafficIncidentId); + } + } + } + + printList("unchangedIds", unchangedIds); + printList("updatedIds", updatedIds); + printList("newIds", newIds); + printList("deletedIds", deletedIds); + + + // call the listener if the listener is new, or if there are any changes. + // There are changes if any of updatedIds, newIds or deletedIds is not empty. + if ((updateListenerInfo.getIncidentIdsToListener() == null) || + (!updatedIds.isEmpty() || + !newIds.isEmpty() || + !deletedIds.isEmpty())) { + LOGGER.info("Calling updates() on listener."); + updateListener.updates(new BasicEList(unchangedIds), + new BasicEList(updatedIds), + new BasicEList(newIds), + new BasicEList(deletedIds)); + LOGGER.info("After calling updates() on listener."); + + unchangedIds.addAll(updatedIds); + unchangedIds.addAll(newIds); + updateListenerInfo.setIncidentIdsToListener(unchangedIds); + updateListenerInfo.setUpdateTime(new Date()); + } else { + LOGGER.info("NOT Calling getTrafficIncidentIdsReply()."); + } + LOGGER.info("handleUpdateListener <="); + } + + private void printList(String listName, List incidentIds) { + StringBuilder buf = new StringBuilder(); + + buf.append("INCIDENTS: "); + buf.append(listName); + buf.append(":"); + + if (incidentIds == null) { + buf.append("NULL"); + } else if (incidentIds.isEmpty()) { + buf.append("EMPTY"); + } else { + for (Integer incidentId: incidentIds) { + buf.append(" "); + buf.append(incidentId); + } + } + + LOGGER.info(buf.toString()); + } + + @Override + public void getLanguage(TrafficIncidentsListener listener) { + listener.getLanguageReply(languageCode, languageCountryCode); + } + + @Override + public void setLanguage(TrafficIncidentsListener listener, String languageCode, String countryCode) { + LOGGER.info("Setting language to: " + languageCode + ", " + countryCode); + this.languageCode = languageCode; + this.languageCountryCode = countryCode; + + trafficIncidentTextGenerator.setLanguage(languageCode, countryCode); + + notifyLanguageListeners(); + + if (listener != null) { + listener.setLanguageReply(); + } + } + + @Override + public void getTexts(TrafficIncidentsListener listener, EList trafficIncidentIds, TextDetailLevel textDetailLevel) { + EList trafficIncidents = getTrafficIncidents(trafficIncidentIds, false); + EList texts = new BasicEList(); + + for (int i = 0; i < trafficIncidents.size(); i++) { + texts.add(trafficIncidentTextGenerator.getText(trafficIncidents.get(i), textDetailLevel)); + } + + listener.getTextsReply(texts); + } + + @Override + public void getTrafficIncidentsFields(TrafficIncidentsListener listener, + EList trafficIncidentIds, EList trafficIncidentFields) { + LOGGER.info("=> listener = " + listener + ", trafficIncidentIds = " + trafficIncidentIds + ", trafficIncidentFields = " + trafficIncidentFields); + EList trafficIncidents = getTrafficIncidentsFields(trafficIncidentIds, trafficIncidentFields); + LOGGER.info("trafficIncidents = " + trafficIncidents); + listener.getTrafficIncidentsReply(trafficIncidents); + LOGGER.info("<="); + } + + private EList getTrafficIncidentsFields(EList trafficIncidentIds, EList trafficIncidentFields) { + EList trafficIncidents = new BasicEList(); + + for (int trafficIncidentId: trafficIncidentIds) { + TrafficIncident trafficIncident = getTrafficIncident(trafficIncidentId, true); + if (trafficIncident != null) { + trafficIncidents.add(constructTrafficIncidentFields(trafficIncident, trafficIncidentFields)); + } + } + + return trafficIncidents; + } + + private TrafficIncident constructTrafficIncidentFields(TrafficIncident trafficIncident, EList trafficIncidentFields) { + TrafficIncident incident; + incident = TRAFFIC_INCIDENT_FACTORY.createTrafficIncident(); + incident.setTrafficIncidentId(trafficIncident.getTrafficIncidentId()); + + for (TrafficIncidentField trafficIncidentField: trafficIncidentFields) { + switch (trafficIncidentField) { + case APPLICABILITY: + EList applicability = incident.getApplicability(); + for (Applicability trafficIncidentApplicability: trafficIncident.getApplicability()) { + applicability.add(EcoreUtil.copy(trafficIncidentApplicability)); + } + break; + + case APPLICABILITY_TEXTS: + EList applicabilityTexts = incident.getApplicabilityTexts(); + for (String trafficIncidentApplicabilityText: trafficIncident.getApplicabilityTexts()) { + applicabilityTexts.add(trafficIncidentApplicabilityText); + } + break; + + case AVERAGE_SPEED_ABSOLUTE: + if (trafficIncident.isSetAverageSpeedAbsolute()) { + trafficIncident.setAverageSpeedAbsolute(trafficIncident.getAverageSpeedAbsolute()); + } + break; + + case CAUSE_TEXTS: + EList causeTexts = incident.getCauseTexts(); + for (String trafficIncidentCauseText: trafficIncident.getCauseTexts()) { + causeTexts.add(trafficIncidentCauseText); + } + break; + + case CAUSES: + EList causes = incident.getCauses(); + for (Cause trafficIncidentCause: trafficIncident.getCauses()) { + causes.add(EcoreUtil.copy(trafficIncidentCause)); + } + break; + + case DELAY: + if (trafficIncident.isSetDelay()) { + incident.setDelay(trafficIncident.getDelay()); + } + break; + + case EFFECT_CODE: + if (trafficIncident.isSetEffectCode()) { + incident.setEffectCode(trafficIncident.getEffectCode()); + } + break; + + case EFFECT_TEXT: + if (trafficIncident.isSetEffectText()) { + incident.setEffectText(trafficIncident.getEffectText()); + } + break; + + case LENGTH_AFFECTED: + if (trafficIncident.isSetLengthAffected()) { + trafficIncident.setLengthAffected(trafficIncident.getLengthAffected()); + } + break; + + case LOCATION: + if (trafficIncident.isSetLocation()) { + incident.setLocation(EcoreUtil.copy(trafficIncident.getLocation())); + } + break; + + case LOCATION_BOUNDING_BOX: + incident.setLocationBoundingBox(EcoreUtil.copy(trafficIncident.getLocationBoundingBox())); + break; + + case LOCATION_INFO: + if (trafficIncident.isSetLocationInfo()) { + incident.setLocationInfo(EcoreUtil.copy(trafficIncident.getLocationInfo())); + } + break; + + case SEGMENT_SPEED_LIMIT: + if (trafficIncident.isSetSegmentSpeedLimit()) { + incident.setSegmentSpeedLimit(trafficIncident.getSegmentSpeedLimit()); + } + break; + + case EXPECTED_SPEED_ABSOLUTE: + if (trafficIncident.isSetExpectedSpeedAbsolute()) { + incident.setExpectedSpeedAbsolute(trafficIncident.getExpectedSpeedAbsolute()); + } + + case START_TIME: + if (trafficIncident.isSetStartTime()) { + incident.setStartTime(trafficIncident.getStartTime()); + } + break; + + case STOP_TIME: + if (trafficIncident.isSetStopTime()) { + incident.setStopTime(trafficIncident.getStopTime()); + } + break; + + case TENDENCY: + if (trafficIncident.isSetTendency()) { + incident.setTendency(trafficIncident.getTendency()); + } + break; + + case TENDENCY_TEXT: + if (trafficIncident.isSetTendencyText()) { + incident.setTendencyText(trafficIncident.getTendencyText()); + } + break; + + case TRAFFIC_INCIDENT_ID: + // No action as the Id is always filled in. + break; + + case ADVICES: + EList advices = incident.getAdvices(); + for (Advice advice: trafficIncident.getAdvices()) { + advices.add(EcoreUtil.copy(advice)); + } + break; + + case ADVICE_TEXTS: + EList adviceTexts = incident.getAdviceTexts(); + for (String adviceText: trafficIncident.getAdviceTexts()) { + adviceTexts.add(adviceText); + } + break; + } + } + + return incident; + } + + private void notifyLanguageListeners() { + for (TrafficIncidentFeedListener listener: trafficIncidentFeedListeners) { + listener.getLanguageReply(languageCode, languageCountryCode); + } + } + + @Override + public void getVersion(TrafficIncidentFeedListener listener) { + listener.getVersionReply(VERSION); + } + + @Override + public synchronized void addTrafficIncidentsStatusListener( + TrafficIncidentsListener listener, TrafficIncidentsListener trafficIncidentsStatusListener) { + trafficIncidentsStatusListeners.add(trafficIncidentsStatusListener); + trafficIncidentsStatusListener.trafficIncidentsStatus(trafficIncidentFeedStatus, trafficIncidentsStatus); + + if (listener != null) { + listener.addTrafficIncidentsStatusListenerReply(); + } + } + + @Override + public void removeTrafficIncidentsStatusListener( + TrafficIncidentsListener listener, + TrafficIncidentsListener trafficIncidentsStatusListener) { + trafficIncidentsStatusListeners.remove(trafficIncidentsStatusListener); + + if (listener != null) { + listener.removeTrafficIncidentsStatusListenerReply(); + } + } + + @Override + public void addFeedInformationListener(TrafficIncidentsListener listener, TrafficIncidentsListener feedInformationListener) { + feedInformationListeners.add(feedInformationListener); + feedInformationListener.feedInformation(createFeedsInformationList()); + + if (listener != null) { + listener.addFeedInformationListenerReply(); + } + } + + @Override + public void removeFeedInformationListener(TrafficIncidentsListener listener, + TrafficIncidentsListener feedInformationListener) { + feedInformationListeners.remove(feedInformationListener); + + if (listener != null) { + listener.removeFeedInformationListenerReply(); + } + } + + private void notifyTrafficIncidentsStatusListeners() { + for (TrafficIncidentsListener trafficIncidentsStatusListener: trafficIncidentsStatusListeners) { + LOGGER.info("Notify update listeners by calling updates()"); + trafficIncidentsStatusListener.trafficIncidentsStatus(trafficIncidentFeedStatus, trafficIncidentsStatus); + } + } + + @Override + public void registerFeed(TrafficIncidentFeedListener listener, + String dataProviderName, String protocolName, + String communicationChannelName) { + FeedInformation feedInformation = TRAFFIC_INCIDENTS_FACTORY.createFeedInformation(); + feedInformation.setDataProviderName(dataProviderName); + feedInformation.setProtocolName(protocolName); + feedInformation.setCommunicationChannelName(communicationChannelName); + feedInformation.setFeedStatus(TrafficIncidentFeedStatus.UNAVAILABLE); + feedInformation.setTrafficIncidentsStatus(TrafficIncidentsStatus.UNAVAILABLE); + + Integer feedId = generateFeedId(); + + feedsInformation.put(feedId, feedInformation); + + notifyFeedInformationListeners(); + + listener.registerFeedReply(feedId); + } + + private void notifyFeedInformationListeners() { + LOGGER.info("=> "); + EList feedsInformationList = createFeedsInformationList(); + + for (TrafficIncidentsListener feedInformationListener: feedInformationListeners) { + LOGGER.info("Going to notify listener: " + feedInformationListener); + feedInformationListener.feedInformation(feedsInformationList); + } + LOGGER.info("<= "); + } + + private EList createFeedsInformationList() { + EList feedsInformationList = new BasicEList(); + for (Integer feedId: feedsInformation.keySet()) { + FeedInformation feedInformation = feedsInformation.get(feedId); + feedsInformationList.add(feedInformation); + } + + return feedsInformationList; + } + + + @Override + public void addCategoryDefinitions( + TrafficIncidentsListener listener, EList categoryDefinitions) { + LOGGER.info("addCategoryDefinitions => categoryDefinitions = " + categoryDefinitions); + for (CategoryDefinition categoryDefinition: categoryDefinitions) { + LOGGER.info("addCategoryDefinitions: adding categoryDefinition: " + categoryDefinition); + this.categoryDefinitions.add(categoryDefinition); + } + + if (listener != null) { + listener.addCategoryDefinitionsReply(); + } + LOGGER.info("addCategoryDefinitions <="); + } + + @Override + public void reserveIconSetIds(TrafficIncidentsListener listener, int numberOfIds) { + EList iconSetIds = new BasicEList(); + for (int i = 1; i <= numberOfIds; i++) { + Integer iconSetId = reserveIconSetId(); + iconSetIds.add(iconSetId); + } + listener.reserveIconSetIdsReply(iconSetIds); + } + + private Integer reserveIconSetId() { + for (int i = 1; i < Integer.MAX_VALUE; i++) { + if (reservedIconSetIds.add(i)) { + return i; + } + } + throw new RuntimeException("No more IconSetId available"); + } + + @Override + public void freeIconSetIds(TrafficIncidentsListener listener, EList iconSetIds) { + for (Integer iconSetId: iconSetIds) { + reservedIconSetIds.remove(iconSetId); + } + + if (listener != null) { + listener.freeIconSetIdsReply(); + } + } + + @Override + public void addIconDefinitions(TrafficIncidentsListener listener, EList iconDefinitions) { + for (IconDefinition iconDefinition: iconDefinitions) { + iconDefinitionsMap.put(iconDefinition.getIconInfo(), iconDefinition); + } + + if (listener != null) { + listener.addIconDefinitionsReply(); + } + } + + @Override + public void removeIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + for (IconInfo iconInfo: iconInfos) { + iconDefinitionsMap.remove(iconInfo); + } + + if (listener != null) { + listener.removeIconDefinitionsReply(); + } + } + + @Override + public void addIconSetDefinitions(TrafficIncidentsListener listener, EList iconSets) { + for (IconSet iconSet: iconSets) { + this.iconSets.add(iconSet); + } + + if (listener != null) { + listener.addIconSetDefinitionsReply(); + } + } + + @Override + public void removeIconSetDefinitions(TrafficIncidentsListener listener, EList iconSetIds) { + for (int iconSetId: iconSetIds) { + for (IconSet iconSet: iconSets) { + if (iconSet.getIconSetId() == iconSetId) { + iconSets.remove(iconSet); + break; + } + } + } + + if (listener != null) { + listener.removeIconSetDefinitionsReply(); + } + } + + @Override + public void getIconSets(TrafficIncidentsListener listener) { + listener.getIconSetsReply(iconSets); + } + + @Override + public void getIconDefinitions(TrafficIncidentsListener listener, EList iconInfos) { + BasicEList requestedIconDefinitions = new BasicEList(); + if (iconInfos.size() == 0) { + for (IconDefinition iconDefinition: iconDefinitionsMap.values()) { + requestedIconDefinitions.add(iconDefinition); + } + } else { + for (IconInfo iconInfo: iconInfos) { + requestedIconDefinitions.add(iconDefinitionsMap.get(iconInfo)); + } + } + + listener.getIconDefinitionsReply(requestedIconDefinitions); + } + + @Override + public void reserveCategoryIds(TrafficIncidentsListener listener, int numberOfIds) { + EList categoryIds = new BasicEList(); + for (int i = 1; i <= numberOfIds; i++) { + Integer categoryId = reserveCategoryId(); + categoryIds.add(categoryId); + } + listener.reserveCategoryIdsReply(categoryIds); + } + + private Integer reserveCategoryId() { + for (int i = 1; i < Integer.MAX_VALUE; i++) { + if (reservedCategoryIds.add(i)) { + return i; + } + } + throw new RuntimeException("No more IconSetId available"); + } + + @Override + public void freeCategoryIds(TrafficIncidentsListener listener, EList categoryIds) { + for (Integer categoryId: categoryIds) { + reservedCategoryIds.remove(categoryId); + } + + if (listener != null) { + listener.freeCategoryIdsReply(); + } + } + + @Override + public void removeCategoryDefinitions(TrafficIncidentsListener listener, EList categoryIds) { + for (int categoryId: categoryIds) { + for (CategoryDefinition categoryDefinition: categoryDefinitions) { + if (categoryDefinition.getCategoryId() == categoryId) { + categoryDefinitions.remove(categoryDefinition); + break; + } + } + } + + if (listener != null) { + listener.removeCategoryDefinitionsReply(); + } + } + + @Override + public void getCategoryDefinitions(TrafficIncidentsListener listener) { + listener.getCategoryDefinitionsReply(categoryDefinitions); + } + + @Override + public void setApplicability(TrafficIncidentsListener listener, String expressionString) { + LOGGER.info("=> " + expressionString); + + BooleanExpression filterExpression = FilterExprUtil.parseFilterExpression(expressionString); + if (filterExpression != null) { + LOGGER.info("filterExpression: " + filterExpression.toString()); + } else { + LOGGER.info("filterExpression is null"); + } + setApplicability(filterExpression); + + + if (listener != null) { + listener.setApplicabilityReply(); + } + LOGGER.info("<= "); + } + + public void setApplicability(BooleanExpression filterExpression) { + LOGGER.info("=> "); + if (filterExpression == null) { + applicabilityFilter = null; + // No need to check for incidents which aren't applicable anymore. + } else { + applicabilityFilter = new ExpressionFilter(filterExpression); + handleApplicabilityChanged(); + } + LOGGER.info("<= "); + } + + private void handleApplicabilityChanged() { + LOGGER.info("=> "); + + // Create a list of current incidents which are no longer Applicable: a cancel list. + EList incidentsToCancel = applyAcceptFilter(managedIncidents, applicabilityFilter); + LOGGER.info("incidentsToCancel: " + incidentsToCancel); + + // Remove these from the current incidents. + for (ManagedTrafficIncident managedTrafficIncident: incidentsToCancel) { + String trafficIncidentManagementId = managedTrafficIncident.getxTrafficIncident().getTrafficIncidentId(); + int trafficIncidentId = managedTrafficIncident.getTrafficIncident().getTrafficIncidentId(); + xIncidentIdToManagedIncidentMap.remove(trafficIncidentManagementId); + incidentIdToManagedIncidentMap.remove(trafficIncidentId); + managedIncidents.remove(managedTrafficIncident); + LOGGER.info("Traffic Incident removed, Id = " + trafficIncidentId + ", managementId = " + trafficIncidentManagementId); + } + + // Notify listeners in case of changes. + if (!incidentsToCancel.isEmpty()) { + notifyUpdateListeners(); + } + LOGGER.info("<= "); + } + + @Override + public void getApplicability(TrafficIncidentsListener listener) { + String expressionString = ""; + + if (applicabilityFilter != null) { + BooleanExpression filterExpression = applicabilityFilter.getExpression(); + expressionString = filterExpression.toString(); + } + + listener.getApplicabilityReply(expressionString); + } + + @Override + public void setTimeFormat(TrafficIncidentsListener listener, String timeFormat) { + trafficIncidentTextGenerator.setTimeFormat(timeFormat); + + if (listener != null) { + listener.setTimeFormatReply(); + } + } + + @Override + public void setDateFormat(TrafficIncidentsListener listener, String dateFormat) { + trafficIncidentTextGenerator.setDateFormat(dateFormat); + + + if (listener != null) { + listener.setDateFormatReply(); + } + } + + @Override + public void setLengthUnit(TrafficIncidentsListener listener, LengthUnit lengthUnit) { + trafficIncidentTextGenerator.setLengthUnit(lengthUnit); + + if (listener != null) { + listener.setLengthUnitReply(); + } + } + + @Override + public void setWeightUnit(TrafficIncidentsListener listener, WeightUnit weightUnit) { + trafficIncidentTextGenerator.setWeightUnit(weightUnit); + + if (listener != null) { + listener.setWeightUnitReply(); + } + } + + public static EList applyAcceptFilter(List managedIncidents, Filter filter) { + LOGGER.info("=>"); + EList filteredManagedIncidents = new BasicEList<>(); + + for (ManagedTrafficIncident managedIncident: managedIncidents) { + if (filter.filter(managedIncident.getTrafficIncident())) { + LOGGER.info("Adding object to filteredList: " + managedIncident); + filteredManagedIncidents.add(managedIncident); + } else { + LOGGER.info("Object NOT added to filteredList: " + managedIncident); + } + } + + LOGGER.info("<="); + return filteredManagedIncidents; + } + + public static EList applyFilters(List managedIncidents, EList filters) { + EList filteredList = new BasicEList<>(managedIncidents); + for (Filter filter: filters) { + filteredList = applyAcceptFilter(filteredList, filter); + } + return filteredList; + } + + private List getTrafficIncidents() { + List trafficIncidents = new ArrayList<>(); + + for (ManagedTrafficIncident managedTrafficIncident: managedIncidents) { + trafficIncidents.add(managedTrafficIncident.getTrafficIncident()); + } + + return trafficIncidents; + } + + class HandleUpdateListenerRunnable implements Runnable { + private TrafficIncidentsListener updateListener; + + public HandleUpdateListenerRunnable(TrafficIncidentsListener updateListener) { + this.updateListener = updateListener; + } + + @Override + public void run() { + handleUpdateListener(updateListener); + } + + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/UpdateListenerInfo.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/UpdateListenerInfo.java new file mode 100755 index 0000000..78f4c86 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/refimpl/UpdateListenerInfo.java @@ -0,0 +1,70 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.refimpl; + +import java.util.Date; +import java.util.List; + +import org.eclipse.emf.common.util.EList; +import org.genivi.common.RectangularArea; +import org.genivi.trafficincidentsservice.trafficincidenttables.WarningLevel; + + +public class UpdateListenerInfo { + private Filter severitiesFilter = null; + private Filter categoriesFilter = null; + private Filter areasFilter = null; + private Date updateTime = null; + private List incidentIdsToListener = null; + + public UpdateListenerInfo( + EList severities, + EList categoryIds, + EList areas) { + + if (!severities.isEmpty()) { + severitiesFilter = TrafficIncidentFilterUtils.createWarningLevelFilter(severities); + } + + if (!categoryIds.isEmpty()) { + categoriesFilter = TrafficIncidentFilterUtils.createCategoryIdsFilter(categoryIds); + } + + if (!areas.isEmpty()) { + areasFilter = new AreasFilter(areas); + } + } + + public List getIncidentIdsToListener() { + return incidentIdsToListener; + } + + public void setIncidentIdsToListener(List incidentIdsToListener) { + this.incidentIdsToListener = incidentIdsToListener; + } + + public Filter getSeveritiesFilter() { + return severitiesFilter; + } + + public Filter getCategoriesFilter() { + return categoriesFilter; + } + + public Filter getAreasFilter() { + return areasFilter; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } +} \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/TrafficIncidentTextGenerator.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/TrafficIncidentTextGenerator.java new file mode 100755 index 0000000..73050e5 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/TrafficIncidentTextGenerator.java @@ -0,0 +1,50 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator; + +import org.genivi.common.Version; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; + +/** + * This interface is the interface for generating texts from a Traffic Incident data model. + * A text generator is not a service to be used by different clients, + * therefore it will be a plain C++ interface, instead of a D-Bus inteface. + */ +public interface TrafficIncidentTextGenerator { + /** + * Get the API version implemented by the TrafficIncidentTextGenerator. + * @return + */ + public Version getVersion(); + + /** + * Set the default language for text generation. + * @param languageCode ISO 639-3 language code + * @param countryCode ISO 3166-1 alpha 3 country code + */ + public void setLanguage(String languageCode, String countryCode); + + public void setDateFormat(String dateFormat); + + public void setTimeFormat(String timeFormat); + + public void setLengthUnit(LengthUnit lengthUnit); + + public void setWeightUnit(WeightUnit weightUnit); + + String getText(TrafficIncident trafficIncident, TextDetailLevel textDetailLevel); + + String[] getApplicabilityTexts(TrafficIncident trafficIncident); + String[] getCauseTexts(TrafficIncident trafficIncident); + String[] getAdviceTexts(TrafficIncident trafficIncident); + String getEffectText(TrafficIncident trafficIncident); + String getTendencyText(TrafficIncident trafficIncident); +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/BasicTextGenerator.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/BasicTextGenerator.java new file mode 100755 index 0000000..2839100 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/BasicTextGenerator.java @@ -0,0 +1,877 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator.basictextgenerator; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.genivi.common.CommonFactory; +import org.genivi.common.Version; +import org.genivi.location.LinearLocationInfo; +import org.genivi.trafficincidentsservice.LengthUnit; +import org.genivi.trafficincidentsservice.TextDetailLevel; +import org.genivi.trafficincidentsservice.WeightUnit; +import org.genivi.trafficincidentsservice.textgenerator.TrafficIncidentTextGenerator; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Advice; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Applicability; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.Cause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.DirectCause; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.LaneRestrictions; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.TrafficIncident; +import org.genivi.trafficincidentsservice.trafficincidents.trafficincident.VehicleRelatedRestriction; +import org.genivi.trafficincidentsservice.trafficincidenttables.Accident; +import org.genivi.trafficincidentsservice.trafficincidenttables.AnimalsOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.BrokenDownVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.DangerousEndOfQueue; +import org.genivi.trafficincidentsservice.trafficincidenttables.DoNotLeaveYourVehicle; +import org.genivi.trafficincidentsservice.trafficincidenttables.DriveCarefully; +import org.genivi.trafficincidentsservice.trafficincidenttables.DrivingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.ExtremeWeatherConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Fire; +import org.genivi.trafficincidentsservice.trafficincidenttables.FollowDiversion; +import org.genivi.trafficincidentsservice.trafficincidenttables.GivingPathVehiclesFromBehind; +import org.genivi.trafficincidentsservice.trafficincidenttables.HazardousDrivingConditions; +import org.genivi.trafficincidentsservice.trafficincidenttables.Impassibility; +import org.genivi.trafficincidentsservice.trafficincidenttables.MajorEvent; +import org.genivi.trafficincidentsservice.trafficincidenttables.MalfunctioningRoadsideEquipment; +import org.genivi.trafficincidentsservice.trafficincidenttables.NarrowLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.ObjectsOnTheRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.OvertakingNotAllowed; +import org.genivi.trafficincidentsservice.trafficincidenttables.PeopleOnRoadway; +import org.genivi.trafficincidentsservice.trafficincidenttables.PoliceCheckpoint; +import org.genivi.trafficincidentsservice.trafficincidenttables.Precipitation; +import org.genivi.trafficincidentsservice.trafficincidenttables.RecklessPersons; +import org.genivi.trafficincidentsservice.trafficincidenttables.RegulatoryMeasure; +import org.genivi.trafficincidentsservice.trafficincidenttables.RescueAndRecoveryWorkInProgress; +import org.genivi.trafficincidentsservice.trafficincidenttables.RestrictionType; +import org.genivi.trafficincidentsservice.trafficincidenttables.RiskOfFire; +import org.genivi.trafficincidentsservice.trafficincidenttables.RoadWorks; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotOperating; +import org.genivi.trafficincidentsservice.trafficincidenttables.ServiceNotUsable; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlipperyRoad; +import org.genivi.trafficincidentsservice.trafficincidenttables.SlowMovingVehicles; +import org.genivi.trafficincidentsservice.trafficincidenttables.TimeDelay; +import org.genivi.trafficincidentsservice.trafficincidenttables.TrafficCongestion; +import org.genivi.trafficincidentsservice.trafficincidenttables.UseTollLanes; +import org.genivi.trafficincidentsservice.trafficincidenttables.VisibilityReduced; + +public class BasicTextGenerator implements TrafficIncidentTextGenerator { + private final static Logger LOGGER = Logger.getLogger(BasicTextGenerator.class.getName()); + private static final CommonFactory COMMON_FACTORY = CommonFactory.eINSTANCE; + private static final Double KM_TO_MILES_FACTOR = 1.609344; + private static final Double KG_TO_POUNDS_FACTOR = 0.45359237; // 1 pound = 0.45359237 kilograms + private static final double FOOT_TO_METER_FACTOR = 0.304800; // 1 foot = 0,304 800 m + private static final int MAJOR_VERSION_NUMBER = 0; + private static final int MINOR_VERSION_NUMBER = 1; + private static final int MICRO_VERSION_NUMBER = 0; + private static final String VERSION_DATE = "13-3-2012"; + + private static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd"; + private static final String DEFAULT_TIME_FORMAT = "hh:mm a"; + private static final LengthUnit DEFAULT_LENGTH_UNIT = LengthUnit.KILOMETERS; + private static final WeightUnit DEFAULT_WEIGHT_UNIT = WeightUnit.KILOGRAM; + private static final String DEFAULT_LANGUAGE = "nld"; + private static final String DEFAULT_COUNTRY = null; + + private static Version VERSION; + private static Map languageMap = new HashMap(); + private static Map countryMap = new HashMap(); + private static Map speedUnitMap = new HashMap(); + private static Map lengthUnitMapLarge = new HashMap(); + + private SimpleDateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT); + private SimpleDateFormat timeFormat = new SimpleDateFormat(DEFAULT_TIME_FORMAT); + private LengthUnit lengthUnit = DEFAULT_LENGTH_UNIT; + private WeightUnit weightUnit = DEFAULT_WEIGHT_UNIT; + private String languageCode = DEFAULT_LANGUAGE; + private String countryCode = DEFAULT_COUNTRY; + private Locale locale = null; + private ResourceBundle textParts = null; + private MessageFormat messageFormat = new MessageFormat(""); + + static { + VERSION = COMMON_FACTORY.createVersion(); + VERSION.setMajor(MAJOR_VERSION_NUMBER); + VERSION.setMinor(MINOR_VERSION_NUMBER); + VERSION.setMicro(MICRO_VERSION_NUMBER); + VERSION.setDate(VERSION_DATE); + + speedUnitMap.put(LengthUnit.KILOMETERS, "km/h"); + speedUnitMap.put(LengthUnit.MILES, "mph"); + + lengthUnitMapLarge.put(LengthUnit.KILOMETERS, "km"); + lengthUnitMapLarge.put(LengthUnit.MILES, "mile"); + + languageMap.put("deu", "de"); + languageMap.put("eng", "en"); + languageMap.put("fra", "fr"); + languageMap.put("nld", "nl"); + + countryMap.put("nld", "NL"); + countryMap.put("gbr", "GB"); + countryMap.put("usa", "US"); + countryMap.put("fra", "FR"); + countryMap.put("deu", "DE"); + } + + public BasicTextGenerator() { + LOGGER.setLevel(Level.SEVERE); + LOGGER.info("=>"); + handleLanguageChange(); + } + + private void handleLanguageChange() { + String twoCharLanguageCode = languageMap.get(languageCode); + String twoCharCountryCode = null; + if (countryCode != null) { + twoCharCountryCode = countryMap.get(countryCode); + } + + if (twoCharCountryCode != null) { + locale = new Locale(twoCharLanguageCode, twoCharCountryCode); + } else { + locale = new Locale(twoCharLanguageCode); + } + LOGGER.info("locale = " + locale.getDisplayName()); + messageFormat.setLocale(locale); + textParts = ResourceBundle.getBundle("org.genivi.trafficincidentsservice.textgenerator.basictextgenerator.TextParts", locale); + } + + @Override + public Version getVersion() { + return VERSION; + } + + @Override + public void setLanguage(String languageCode, String countryCode) { + LOGGER.info("=> languageCode = " + languageCode + ", countryCode = " + countryCode); + this.languageCode = languageCode; + this.countryCode = countryCode; + + handleLanguageChange(); + } + + @Override + public void setDateFormat(String dateFormat) { + this.dateFormat = new SimpleDateFormat(dateFormat); + } + + @Override + public void setTimeFormat(String timeFormat) { + this.timeFormat = new SimpleDateFormat(timeFormat); + } + + @Override + public void setLengthUnit(LengthUnit lengthUnit) { + this.lengthUnit = lengthUnit; + } + + @Override + public void setWeightUnit(WeightUnit weightUnit) { + this.weightUnit = weightUnit; + } + + @Override + public String getText(TrafficIncident trafficIncident, + TextDetailLevel textDetailLevel) { + StringBuffer buf = new StringBuffer(); + + fillLocation(buf, trafficIncident); + + fillEffect(buf, trafficIncident); + + fillAverageSpeedAbsolute(buf, trafficIncident); + + fillSpeedLimit(buf, trafficIncident, textDetailLevel); + + fillExpectedSpeed(buf, trafficIncident, textDetailLevel); + + fillLengthAffected(buf, trafficIncident); + + fillDelay(buf, trafficIncident); + + fillValidityPeriod(buf, trafficIncident); + + fillTendencyPart(buf, trafficIncident, textDetailLevel); + + // Causes + if (textDetailLevel == TextDetailLevel.FULL && + trafficIncident.isSetCauses()) { + buf.append(textParts.getString("causedByPart")); + + boolean first = true; + for (Cause cause: trafficIncident.getCauses()) { + if (first) { + first = false; + } else { + buf.append(", "); + } + fillCause(buf, cause); + } + } + + // Advices + if (textDetailLevel == TextDetailLevel.FULL && + trafficIncident.isSetAdvices()) { + buf.append(", "); + buf.append(textParts.getString("advicePart")); + + boolean first = true; + for (Advice advice: trafficIncident.getAdvices()) { + if (first) { + first = false; + } else { + buf.append(", "); + } + fillAdvice(buf, advice); + } + } + buf.append("."); + + fillApplicabilityPart(buf, trafficIncident); + + return buf.toString(); + } + + private void formatDateTime(StringBuffer buf, Date dateTime) { + if (dateIsToday(dateTime)) { + // no date printed + } else if (dateIsTomorrow(dateTime)) { + buf.append(textParts.getString("tomorrow")); + } else { + buf.append(dateFormat.format(dateTime)); + buf.append(" "); + } + + } + + private boolean dateIsToday(Date dateTime) { + GregorianCalendar dateTimeCalendar = new GregorianCalendar(); + dateTimeCalendar.setTime(dateTime); + + GregorianCalendar todayCalendar = new GregorianCalendar(); + todayCalendar.setTime(new Date()); + + if ((dateTimeCalendar.get(Calendar.YEAR) == todayCalendar.get(Calendar.YEAR)) && + (dateTimeCalendar.get(Calendar.DAY_OF_YEAR) == todayCalendar.get(Calendar.DAY_OF_YEAR))) { + return true; + } else { + return false; + } + } + + private boolean dateIsTomorrow(Date dateTime) { + GregorianCalendar dateTimeCalendar = new GregorianCalendar(); + dateTimeCalendar.setTime(dateTime); + + GregorianCalendar tomorrowCalendar = new GregorianCalendar(); + tomorrowCalendar.setTime(new Date()); + tomorrowCalendar.add(Calendar.DATE, 1); + + if ((dateTimeCalendar.get(Calendar.YEAR) == tomorrowCalendar.get(Calendar.YEAR)) && + (dateTimeCalendar.get(Calendar.DAY_OF_YEAR) == tomorrowCalendar.get(Calendar.DAY_OF_YEAR))) { + return true; + } else { + return false; + } + } + + @Override + public String[] getApplicabilityTexts(TrafficIncident trafficIncident) { + if (trafficIncident.isSetApplicability()) { + StringBuffer buf = new StringBuffer(); + + List applicabilities = trafficIncident.getApplicability(); + String[] texts = new String[applicabilities.size()]; + + int i = 0; + for (Applicability applicability: applicabilities) { + buf.setLength(0); + fillApplicability(buf, applicability); + texts[i++] = buf.toString(); + } + + return texts; + } else { + return null; + } + } + + @Override + public String[] getCauseTexts(TrafficIncident trafficIncident) { + if (trafficIncident.isSetCauses()) { + StringBuffer buf = new StringBuffer(); + + List causes = trafficIncident.getCauses(); + String[] texts = new String[causes.size()]; + + int i = 0; + for (Cause cause: causes) { + buf.setLength(0); + fillCause(buf, cause); + LOGGER.fine("buf = " + buf.toString()); + texts[i++] = buf.toString(); + } + + for (String text: texts) { + LOGGER.fine("text = " + text); + } + return texts; + } else { + return null; + } + } + + @Override + public String[] getAdviceTexts(TrafficIncident trafficIncident) { + if (trafficIncident.isSetAdvices()) { + StringBuffer buf = new StringBuffer(); + + List advices = trafficIncident.getAdvices(); + String[] texts = new String[advices.size()]; + + int i = 0; + for (Advice advice: advices) { + buf.setLength(0); + fillAdvice(buf, advice); + LOGGER.fine("buf = " + buf.toString()); + texts[i++] = buf.toString(); + } + + for (String text: texts) { + LOGGER.fine("text = " + text); + } + return texts; + } else { + return null; + } + } + + @Override + public String getEffectText(TrafficIncident trafficIncident) { + StringBuffer buf = new StringBuffer(); + + fillEffect(buf, trafficIncident); + + return buf.toString(); + } + + @Override + public String getTendencyText(TrafficIncident trafficIncident) { + StringBuffer buf = new StringBuffer(); + + fillTendency(buf, trafficIncident); + + return buf.toString(); + } + + + private void fillLocation(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetLocationInfo()) { + LinearLocationInfo linearLocationInfo = (LinearLocationInfo) trafficIncident.getLocationInfo(); + + if (linearLocationInfo.getFromLocationParentName() != null && + linearLocationInfo.getToLocationParentName() != null) { + messageFormat.applyPattern(textParts.getString("locationTemplate")); + Object[] messageArguments = { + linearLocationInfo.getName(), + linearLocationInfo.getFromLocationParentName(), + linearLocationInfo.getToLocationParentName(), + linearLocationInfo.getFromLocationName(), + linearLocationInfo.getToLocationName() + }; + messageFormat.format(messageArguments, buf, null); + } else { + messageFormat.applyPattern(textParts.getString("locationTemplateShort")); + Object[] messageArguments = { + linearLocationInfo.getName(), + linearLocationInfo.getFromLocationName(), + linearLocationInfo.getToLocationName() + }; + messageFormat.format(messageArguments, buf, null); + } + } + } + + private void fillEffect(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetEffectCode()) { + buf.append(trafficIncident.getEffectCode().getLiteral()); + } else { + buf.append(""); + } + } + + private void fillAverageSpeedAbsolute(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetAverageSpeedAbsolute()) { + messageFormat.applyPattern(textParts.getString("averageSpeedAbsoluteTemplate")); + double speed = msToKmh(trafficIncident.getAverageSpeedAbsolute()); + if (lengthUnit == LengthUnit.MILES) { + speed = kmToMiles(speed); + } + Object[] messageArguments = { + speed, + speedUnitMap.get(lengthUnit) + }; + messageFormat.format(messageArguments, buf, null); + } + } + + private void fillSpeedLimit(StringBuffer buf, TrafficIncident trafficIncident, TextDetailLevel textDetailLevel) { + if (textDetailLevel == TextDetailLevel.FULL && + trafficIncident.isSetSegmentSpeedLimit()) { + messageFormat.applyPattern(textParts.getString("speedLimitTemplate")); + double speedLimit = msToKmh(trafficIncident.getSegmentSpeedLimit()); + if (lengthUnit == LengthUnit.MILES) { + speedLimit = kmToMiles(speedLimit); + } + Object[] messageArguments = { + speedLimit, + speedUnitMap.get(lengthUnit) + }; + messageFormat.format(messageArguments, buf, null); + } + } + + private void fillExpectedSpeed(StringBuffer buf, TrafficIncident trafficIncident, TextDetailLevel textDetailLevel) { + if (textDetailLevel == TextDetailLevel.FULL && + trafficIncident.isSetExpectedSpeedAbsolute()) { + messageFormat.applyPattern(textParts.getString("expectedSpeedTemplate")); + double expectedSpeed = msToKmh(trafficIncident.getExpectedSpeedAbsolute()); + if (lengthUnit == LengthUnit.MILES) { + expectedSpeed = kmToMiles(expectedSpeed); + } + Object[] messageArguments = { + expectedSpeed, + speedUnitMap.get(lengthUnit) + }; + messageFormat.format(messageArguments, buf, null); + } + } + + private void fillLengthAffected(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetLengthAffected()) { + messageFormat.applyPattern(textParts.getString("lengthAffectedTemplate")); + double lengthAffected = trafficIncident.getLengthAffected() / 1000.0; + if (lengthUnit == LengthUnit.MILES) { + lengthAffected = kmToMiles(lengthAffected); + } + Object[] messageArguments = { + lengthAffected, + lengthUnitMapLarge.get(lengthUnit) + }; + messageFormat.format(messageArguments, buf, null); + } + } + + private void fillDelay(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetDelay()) { + messageFormat.applyPattern(textParts.getString("delayTemplate")); + Object[] messageArguments = { + trafficIncident.getDelay() + }; + messageFormat.format(messageArguments, buf, null); + } + } + + + private void fillValidityPeriod(StringBuffer buf, TrafficIncident trafficIncident) { + // StartTime and StopTime + if (trafficIncident.isSetStartTime()) { + buf.append(textParts.getString("fromPart")); + formatDateTime(buf, trafficIncident.getStartTime()); + buf.append(timeFormat.format(trafficIncident.getStartTime())); + } + if (trafficIncident.isSetStopTime()) { + buf.append(textParts.getString("tillPart")); + formatDateTime(buf, trafficIncident.getStopTime()); + buf.append(timeFormat.format(trafficIncident.getStopTime())); + } + } + + private void fillTendencyPart(StringBuffer buf, TrafficIncident trafficIncident, TextDetailLevel textDetailLevel) { + if (textDetailLevel == TextDetailLevel.FULL && + trafficIncident.isSetTendency()) { + buf.append(textParts.getString("tendencyPart")); + fillTendency(buf, trafficIncident); + } + } + + private void fillTendency(StringBuffer buf, TrafficIncident trafficIncident) { + if (trafficIncident.isSetTendency()) { + buf.append(trafficIncident.getTendency().getLiteral()); + } + } + + private void fillCause(StringBuffer buf, Cause cause) { + String causeText = cause.getMainCause().getLiteral(); + if (cause instanceof DirectCause) { + DirectCause directCause = (DirectCause) cause; + + + // subCause + Object subCause = directCause.getSubCause(); + + if (subCause != null) { + switch (cause.getMainCause()) { + case TRAFFIC_CONGESTION: + causeText = ((TrafficCongestion) subCause).getLiteral(); + break; + + case ACCIDENT: + causeText = ((Accident) subCause).getLiteral(); + break; + + case ROADWORKS: + causeText = ((RoadWorks) subCause).getLiteral(); + break; + + case NARROW_LANES: + causeText = ((NarrowLanes) subCause).getLiteral(); + break; + + case IMPASSIBILITY: + causeText = ((Impassibility) subCause).getLiteral(); + break; + + case SLIPPERY_ROAD: + causeText = ((SlipperyRoad) subCause).getLiteral(); + break; + + case AQUAPLANING: + // No SubCause + break; + + case FIRE: + causeText = ((Fire) subCause).getLiteral(); + break; + + case HAZARDOUS_DRIVING_CONDITIONS: + causeText = ((HazardousDrivingConditions) subCause).getLiteral(); + break; + + case OBJECTS_ON_THE_ROAD: + causeText = ((ObjectsOnTheRoad) subCause).getLiteral(); + break; + + case ANIMALS_ON_ROADWAY: + causeText = ((AnimalsOnRoadway) subCause).getLiteral(); + break; + + case PEOPLE_ON_ROADWAY: + causeText = ((PeopleOnRoadway) subCause).getLiteral(); + break; + + case BROKEN_DOWN_VEHICLES: + causeText = ((BrokenDownVehicles) subCause).getLiteral(); + break; + + case VEHICLE_ON_WRONG_CARRIAGEWAY: + // No SubCause + break; + + case RESCUE_AND_RECOVERY_WORK_IN_PROGRESS: + causeText = ((RescueAndRecoveryWorkInProgress) subCause).getLiteral(); + break; + + case REGULATORY_MEASURE: + causeText = ((RegulatoryMeasure) subCause).getLiteral(); + break; + + case EXTREME_WEATHER_CONDITIONS: + causeText = ((ExtremeWeatherConditions) subCause).getLiteral(); + break; + + case VISIBILITY_REDUCED: + causeText = ((VisibilityReduced) subCause).getLiteral(); + break; + + case PRECIPITATION: + causeText = ((Precipitation) subCause).getLiteral(); + break; + + case RECKLESS_PERSONS: + causeText = ((RecklessPersons) subCause).getLiteral(); + break; + + case OVER_HEIGHT_WARNING_SYSTEM_TRIGGERED: + // No SubCause + break; + + case TRAFFIC_REGULATIONS_CHANGED: + // No SubCause + break; + + case MAJOR_EVENT: + causeText = ((MajorEvent) subCause).getLiteral(); + break; + + case SERVICE_NOT_OPERATING: + causeText = ((ServiceNotOperating) subCause).getLiteral(); + break; + + case SERVICE_NOT_USEABLE: + causeText = ((ServiceNotUsable) subCause).getLiteral(); + break; + + case SLOW_MOVING_VEHICLES: + causeText = ((SlowMovingVehicles) subCause).getLiteral(); + break; + + case DANGEROUS_END_OF_QUEUE: + causeText = ((DangerousEndOfQueue) subCause).getLiteral(); + break; + + case RISK_OF_FIRE: + causeText = ((RiskOfFire) subCause).getLiteral(); + break; + + case TIME_DELAY: + causeText = ((TimeDelay) subCause).getLiteral(); + break; + + case POLICE_CHECKPOINT: + causeText = ((PoliceCheckpoint) subCause).getLiteral(); + break; + + case MALFUNCTIONING_ROADSIDE_EQUIPMENT: + causeText = ((MalfunctioningRoadsideEquipment) subCause).getLiteral(); + break; + } + } + buf.append(" "); + buf.append(causeText); + + // lengthAffected + if (directCause.getLengthAffected() != null) { + messageFormat.applyPattern(textParts.getString("lengthAffectedTemplate")); + double lengthAffected = directCause.getLengthAffected() / 1000.0; + if (lengthUnit == LengthUnit.MILES) { + lengthAffected = kmToMiles(lengthAffected); + } + Object[] messageArguments = { + lengthAffected, + lengthUnitMapLarge.get(lengthUnit) + }; + messageFormat.format(messageArguments, buf, null); + } + + // laneRestrictions + LaneRestrictions laneRestrictions = directCause.getLaneRestrictions(); + if (laneRestrictions != null) { + buf.append(textParts.getString("laneRestrictionsPart")); + if (laneRestrictions.getNumberOfLanes() != null) { + buf.append(String.valueOf(laneRestrictions.getNumberOfLanes())); + buf.append(" "); + } + buf.append(laneRestrictions.getLaneRestrictionType().getLiteral()); + } + + // freeText + if (directCause.isSetFreeText()) { + buf.append(" "); + buf.append(directCause.getFreeText()); + } + + // unverifiedInformation + if (directCause.isUnverifiedInformation()) { + buf.append(textParts.getString("unverifiedInformationPart")); + } + } else { + buf.append(" "); + buf.append(causeText); + } + } + + private void fillApplicabilityPart(StringBuffer buf, TrafficIncident trafficIncident) { + // Applicability + if (trafficIncident.isSetApplicability()) { + buf.append(textParts.getString("applicabilityPart")); + + for (Applicability applicability: trafficIncident.getApplicability()) { + fillApplicability(buf, applicability); + } + } + } + + private void fillApplicability(StringBuffer buf, Applicability applicability) { + if (applicability.getVehicleType() != null) { + buf.append(" "); + buf.append(applicability.getVehicleType().getLiteral()); + } + + for (VehicleRelatedRestriction vehicleRelatedRestriction: applicability.getVehicleRelatedRestrictions()) { + buf.append(" "); + buf.append(vehicleRelatedRestriction.getRestrictionType().getLiteral()); + + fillRestrictionTypeValueAndUnit(buf, vehicleRelatedRestriction.getRestrictionType(), vehicleRelatedRestriction.getRestrictionValue()); + } + } + + private void fillAdvice(StringBuffer buf, Advice advice) { + String adviceText = advice.getMainAdvice().getLiteral(); + // subCause + Object subAdviceCode = null; + if (advice.isSetSubAdvice()) { + subAdviceCode = advice.getSubAdvice(); + } + + if (subAdviceCode != null) { + switch (advice.getMainAdvice()) { + case AVOID_THE_AREA: + case DO_NOT_DIVERT: + case DRIVE_TO_NEXT_AVAILABLE_PARKING_PLACE: + case FOLLOW_POLICE_INSTRUCTIONS: + case NO_DIVERSION_TO_RECOMMEND: + case SWITCH_ON_RADIO: + case USE_HARD_SHOULDER_AS_LANE: + case WAIT_FOR_CONVOI: + case WAIT_FOR_IMPROVED_WEATHER: + case WAIT_FOR_POLICE_PATROL: + // No SubCause + break; + + case DO_NOT_LEAVE_YOUR_VEHICLE: + adviceText = ((DoNotLeaveYourVehicle) subAdviceCode).getLiteral(); + break; + + case DRIVE_CAREFULLY: + adviceText = ((DriveCarefully) subAdviceCode).getLiteral(); + break; + + case DRIVING_NOT_ALLOWED: + adviceText = ((DrivingNotAllowed) subAdviceCode).getLiteral(); + break; + + case FOLLOW_DIVERSION: + adviceText = ((FollowDiversion) subAdviceCode).getLiteral(); + break; + + case GIVING_PATH_VEHICLES_COMING_FROM_BEHIND: + adviceText = ((GivingPathVehiclesFromBehind) subAdviceCode).getLiteral(); + break; + + case OVERTAKING_NOT_ALLOWED: + adviceText = ((OvertakingNotAllowed) subAdviceCode).getLiteral(); + break; + + case USE_TOLL_LANES: + adviceText = ((UseTollLanes) subAdviceCode).getLiteral(); + break; + } + } + buf.append(" "); + buf.append(adviceText); + } + + private void fillRestrictionTypeValueAndUnit(StringBuffer buf, RestrictionType restrictionType, Integer restrictionValue) { + if (restrictionValue == null) { + return; + } + + double value = restrictionValue; + String unit = null; + switch (restrictionType) { + // units in Tonnes + case AXLE_LOAD_GREATER_THAN: + case AXLE_LOAD_LESS_THAN: + case WEIGHT_GREATER_THAN: + case WEIGHT_LESS_THAN: + switch (weightUnit) { + case KILOGRAM: + value = value / 1000; + unit = textParts.getString("tonnes"); + break; + + case POUND: + value = kgToPounds(value); + unit = textParts.getString("pounds"); + break; + } + break; + + // units in m + case HEIGTH_GREATER_THAN: + case HEIGTH_LESS_THAN: + case LENGTH_GREATER_THAN: + case LENGTH_LESS_THAN: + case WIDTH_GREATER_THAN: + case WIDTH_LESS_THAN: + switch (lengthUnit) { + case KILOMETERS: + unit = "m"; + value = value / 100; + break; + + case MILES: + unit = textParts.getString("foot"); + value = meterToFoot(value / 100); + break; + } + break; + + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3: + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO3D4: + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO4: + case VEHICLE_FULFILLS_EMISSION_STANDARD_EURO5: + case EVEN_NUMBER_PLATE: + case ODD_NUMBER_PLATE: + case PERSONS_IN_VEHICLE_LESS_THAN: + case PERSONS_IN_VEHICLE_MORE_THAN: + case WITH_TRAILER: + case WITH_CARAVAN: + case WITHOUT_SNOW_CHAIN: + case WITHOUT_WINTER_TYRE: + case RESIDENTS_TRAFFIC: + case WITH_LPG_ENGINE: + case WITH_PETROL_ENGINE: + case WITH_DIESEL_ENGINE: + case WITH_DESTINATION_IN_GIVEN_AREA: + case THROUGH_TRAFFIC: + // No unit + break; + } + + buf.append(" "); + buf.append(String.valueOf(value)); + + if (unit != null) { + buf.append(" "); + buf.append(unit); + } + } + + public static double msToKmh(int ms) { + return 3600.0 * ms / 1000.0; + } + + public static double kmToMiles(double km) { + return km / KM_TO_MILES_FACTOR; + } + + public static double metersToYards(double length) { + return 0.0; + } + + public static double kgToPounds(double kg) { + return kg / KG_TO_POUNDS_FACTOR; + } + + public static double meterToFoot(double meter) { + return meter / FOOT_TO_METER_FACTOR; + } +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts.java new file mode 100755 index 0000000..18efb81 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator.basictextgenerator; + +import java.util.ListResourceBundle; + +public class TextParts extends ListResourceBundle { + public Object[][] getContents() { + return contents; + } + + private Object[][] contents = { + {"locationTemplate", "On the {0} from {1} to {2} between {3} and {4}: "}, + {"locationTemplateShort", "On the {0} between {1} and {2}: "}, + {"averageSpeedAbsoluteTemplate", " with an average driving speed of {0,number} {1}"}, + {"speedLimitTemplate", " with a speedlimit of {0,number} {1}"}, + {"expectedSpeedTemplate", " with an expected speed of {0,number} {1}"}, + {"lengthAffectedTemplate", " over a length of {0,number} {1}"}, + {"delayTemplate", " resulting in a delay of {0} minutes"}, + {"fromPart", " from "}, + {"tillPart", " till "}, + {"tendencyPart", " tendency is "}, + {"causedByPart", " caused by"}, + {"advicePart", "advice"}, + {"laneRestrictionsPart", " lane restrictions "}, + {"unverifiedInformationPart", " (unverified information)"}, + {"applicabilityPart", " This information is only applicable for:"}, + {"tomorrow", "tomorrow "}, + {"tonnes", "tonnes"}, + {"pounds", "pound"}, + {"foot", "feet"} + }; +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en.java new file mode 100755 index 0000000..5524367 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator.basictextgenerator; + +import java.util.ListResourceBundle; + +public class TextParts_en extends ListResourceBundle { + public Object[][] getContents() { + return contents; + } + + private Object[][] contents = { + {"locationTemplate", "On the {0} from {1} to {2} between {3} and {4}: "}, + {"locationTemplateShort", "On the {0} between {1} and {2}: "}, + {"averageSpeedAbsoluteTemplate", " with an average driving speed of {0,number} {1}"}, + {"speedLimitTemplate", " with a speedlimit of {0,number} {1}"}, + {"expectedSpeedTemplate", " with an expected speed of {0,number} {1}"}, + {"lengthAffectedTemplate", " over a length of {0,number} {1}"}, + {"delayTemplate", " resulting in a delay of {0} minutes"}, + {"fromPart", " from "}, + {"tillPart", " till "}, + {"tendencyPart", " tendency is "}, + {"causedByPart", " caused by"}, + {"advicePart", "advice"}, + {"laneRestrictionsPart", " lane restrictions "}, + {"unverifiedInformationPart", " (unverified information)"}, + {"applicabilityPart", " This information is only applicable for:"}, + {"tomorrow", "tomorrow "}, + {"tonnes", "tonnes"}, + {"pounds", "pound"}, + {"foot", "feet"} + }; +} \ No newline at end of file diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en_US.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en_US.java new file mode 100755 index 0000000..5a5013a --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_en_US.java @@ -0,0 +1,38 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator.basictextgenerator; + +import java.util.ListResourceBundle; + +public class TextParts_en_US extends ListResourceBundle { + public Object[][] getContents() { + return contents; + } + + private Object[][] contents = { + {"locationTemplate", "On the {0} from {1} to {2} between {3} and {4}: "}, + {"locationTemplateShort", "On the {0} between {1} and {2}: "}, + {"averageSpeedAbsoluteTemplate", " with an av. speed of {0,number} {1}"}, + {"speedLimitTemplate", " with a speedlimit of {0,number} {1}"}, + {"expectedSpeedTemplate", " with an expected speed of {0,number} {1}"}, + {"lengthAffectedTemplate", " over a length of {0,number} {1}"}, + {"delayTemplate", " resulting in a dlay of {0} minutes"}, + {"fromPart", " from "}, + {"tillPart", " till "}, + {"tendencyPart", " tendency "}, + {"causedByPart", " caused by"}, + {"advicePart", "advice"}, + {"laneRestrictionsPart", " lane restr. "}, + {"unverifiedInformationPart", " (unverified info)"}, + {"applicabilityPart", " This info is only appl. for:"}, + {"tomorrow", "tomorrow "}, + {"tonnes", "tonnes"}, + {"pounds", "pound"}, + {"foot", "feet"} + }; +} diff --git a/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_nl.java b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_nl.java new file mode 100755 index 0000000..d0df755 --- /dev/null +++ b/src/traffic-incidents-service/org.genivi.trafficinfo/src/org/genivi/trafficincidentsservice/textgenerator/basictextgenerator/TextParts_nl.java @@ -0,0 +1,39 @@ +/** + * Copyright (C) 2013 TomTom International B.V. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ +package org.genivi.trafficincidentsservice.textgenerator.basictextgenerator; + +import java.util.ListResourceBundle; + +public class TextParts_nl extends ListResourceBundle { + public Object[][] getContents() { + return contents; + } + + private Object[][] contents = { + {"locationTemplate", "Op de {0} van {1} naar {2} tussen {3} en {4}: "}, + {"locationTemplateShort", "Op de {0} tussen {1} en {2}: "}, + {"averageSpeedAbsoluteTemplate", " met een gemiddelde rijsnelheid van {0,number} {1}"}, + {"speedLimitTemplate", " met een maximum snelheid van {0,number} {1}"}, + {"expectedSpeedTemplate", " met een verwachtte snelheid van {0,number} {1}"}, + {"lengthAffectedTemplate", " over een lengte van {0,number} {1}"}, + {"delayTemplate", " resulterend in een vertraging van {0} minuten"}, + {"fromPart", " van "}, + {"tillPart", " tot "}, + {"tendencyPart", " tendens is "}, + {"causedByPart", " veroorzaakt door"}, + {"advicePart", "advies"}, + {"laneRestrictionsPart", " rijstrook beperkingen "}, + {"unverifiedInformationPart", " (informatie niet geverifieerd)"}, + {"applicabilityPart", " Deze informatie is alleen van toepassing voor:"}, + {"tomorrow", "morgen "}, + {"tonnes", "ton"}, + {"pounds", "pond"}, + {"foot", "voet"} + }; + +} -- cgit v1.2.1