From cedc5adfdaecde7a7eeaae2219b324bcf9f0ecac Mon Sep 17 00:00:00 2001 From: Stefan Walter Date: Mon, 10 Jun 2024 06:25:13 +0000 Subject: [PATCH] Remove deprecated code Co-authored-by: Martin Grzenia Merged-by: Martin Grzenia --- .../opentcs/access/KernelServicePortal.java | 10 - .../access/SchedulerAllocationState.java | 53 -- .../access/rmi/services/RegistrationName.java | 5 - .../rmi/services/RemoteDispatcherService.java | 22 +- .../RemoteKernelServicePortalProxy.java | 21 - .../rmi/services/RemotePlantModelService.java | 7 +- .../rmi/services/RemoteRouterService.java | 24 +- .../services/RemoteRouterServiceProxy.java | 51 +- .../rmi/services/RemoteSchedulerService.java | 36 - .../services/RemoteSchedulerServiceProxy.java | 43 -- .../rmi/services/RemoteVehicleService.java | 11 +- .../access/to/model/GroupCreationTO.java | 110 --- .../model/ModelLayoutElementCreationTO.java | 106 --- .../access/to/model/PlantModelCreationTO.java | 167 +---- .../access/to/model/PointCreationTO.java | 66 -- .../model/ShapeLayoutElementCreationTO.java | 107 --- .../to/model/VisualLayoutCreationTO.java | 142 ---- .../PeripheralOperationCreationTO.java | 8 +- .../opentcs/components/kernel/Dispatcher.java | 29 +- .../org/opentcs/components/kernel/Router.java | 97 +-- .../opentcs/components/kernel/Scheduler.java | 87 +-- .../kernel/routing/EdgeEvaluator.java | 9 +- .../kernel/services/DispatcherService.java | 20 +- .../services/InternalPlantModelService.java | 19 - .../InternalTransportOrderService.java | 10 +- .../services/InternalVehicleService.java | 16 - .../kernel/services/PlantModelService.java | 7 +- .../kernel/services/RouterService.java | 67 +- .../kernel/services/SchedulerService.java | 36 - .../kernel/services/VehicleService.java | 8 +- .../plantoverview/LocationTheme.java | 6 +- .../OrderCategorySuggestions.java | 28 - .../java/org/opentcs/data/model/Group.java | 108 --- .../org/opentcs/data/model/PlantModel.java | 85 ++- .../java/org/opentcs/data/model/Point.java | 82 --- .../java/org/opentcs/data/model/Vehicle.java | 102 --- .../model/visualization/ElementPropKeys.java | 3 +- .../data/model/visualization/ImageData.java | 100 --- .../visualization/ImageLayoutElement.java | 54 -- .../model/visualization/LayoutElement.java | 78 -- .../visualization/ModelLayoutElement.java | 52 -- .../visualization/ShapeLayoutElement.java | 35 - .../model/visualization/VisualLayout.java | 51 -- .../data/peripherals/PeripheralOperation.java | 14 +- .../BasicPeripheralCommAdapter.java | 8 - .../peripherals/PeripheralCommAdapter.java | 5 +- .../peripherals/PeripheralController.java | 5 +- .../peripherals/PeripheralJobCallback.java | 35 +- .../PeripheralAttachmentInformation.java | 28 +- .../vehicle/BasicVehicleCommAdapter.java | 115 +-- .../drivers/vehicle/LoadHandlingDevice.java | 13 - .../drivers/vehicle/MovementCommand.java | 424 +++++++++-- .../drivers/vehicle/VehicleCommAdapter.java | 113 +-- .../drivers/vehicle/VehicleController.java | 141 +--- .../drivers/vehicle/VehicleProcessModel.java | 200 ----- .../vehicle/management/AttachmentEvent.java | 65 -- .../management/AttachmentInformation.java | 120 --- .../management/VehicleAttachmentEvent.java | 32 +- .../VehicleAttachmentInformation.java | 55 +- .../management/VehicleProcessModelTO.java | 57 -- .../src/main/java/org/opentcs/util/Enums.java | 70 -- .../rmi/services/RemoteServicesTest.java | 3 - .../data/model/ModelSerializationTest.java | 13 - .../drivers/vehicle/MovementCommandTest.java | 177 +++++ .../LoopbackCommunicationAdapter.java | 38 +- .../java/org/opentcs/util/Comparators.java | 18 - .../opentcs/util/persistence/ModelParser.java | 12 +- .../persistence/v005/AllowedOperationTO.java | 24 + .../v005/AllowedPeripheralOperationTO.java | 24 + .../util/persistence/v005/BlockTO.java | 90 +++ .../util/persistence/v005/Comparators.java | 58 ++ .../util/persistence/v005/CoupleTO.java | 48 ++ .../util/persistence/v005/LocationTO.java | 232 ++++++ .../util/persistence/v005/LocationTypeTO.java | 95 +++ .../util/persistence/v005/MemberTO.java | 24 + .../opentcs/util/persistence/v005/PathTO.java | 230 ++++++ .../v005/PeripheralOperationTO.java | 61 ++ .../persistence/v005/PlantModelElementTO.java | 56 ++ .../util/persistence/v005/PointTO.java | 218 ++++++ .../util/persistence/v005/PropertyTO.java | 52 ++ .../persistence/v005/V005ModelParser.java | 299 ++++++++ .../persistence/v005/V005PlantModelTO.java | 221 ++++++ .../util/persistence/v005/V005TOMapper.java | 681 ++++++++++++++++++ .../persistence/v005/VehicleEnvelopeTO.java | 50 ++ .../util/persistence/v005/VehicleTO.java | 173 +++++ .../util/persistence/v005/VisualLayoutTO.java | 191 +++++ .../opentcs/util/persistence/model-0.0.5.xsd | 538 ++++++++++++++ .../V005DrivingCoursePersistenceTest.java | 345 +++++++++ .../src/docs/release-notes/changelog.adoc | 6 + .../servicewebapi/v1/PlantModelHandler.java | 2 +- .../v1/converter/VisualLayoutConverter.java | 23 +- .../v1/PlantModelHandlerTest.java | 6 +- .../converter/VisualLayoutConverterTest.java | 10 +- .../extensions/rmi/RmiServicesModule.java | 2 - .../rmi/StandardRemoteRouterService.java | 46 -- .../rmi/StandardRemoteSchedulerService.java | 146 ---- .../kernel/DefaultKernelInjectionModule.java | 5 - .../NullPeripheralCommAdapter.java | 4 + .../services/StandardPlantModelService.java | 17 +- .../services/StandardRouterService.java | 58 -- .../services/StandardSchedulerService.java | 50 -- .../services/StandardVehicleService.java | 11 - .../vehicles/DefaultVehicleController.java | 71 +- .../kernel/vehicles/MovementCommandImpl.java | 238 ------ .../vehicles/MovementCommandMapper.java | 20 +- .../vehicles/NullVehicleController.java | 72 +- .../kernel/workingset/PlantModelManager.java | 240 ------ .../workingset/TransportOrderPoolManager.java | 1 - .../vehicles/AttachmentManagerTest.java | 6 +- .../PeripheralAttachmentManagerTest.java | 4 + .../vehicles/MovementCommandImplTest.java | 178 ----- .../vehicles/MovementCommandMapperTest.java | 3 - .../vehicles/MovementComparisonsTest.java | 84 --- .../vehicles/PeripheralInteractionTest.java | 103 +-- .../workingset/PlantModelManagerTest.java | 11 - .../draw/DefaultPointSelectedAction.java | 4 - .../unified/PlantModelElementConverter.java | 3 - .../symbols/toolbar/point-report-arrow.22.png | Bin 3679 -> 0 bytes .../res/symbols/toolbar/point-report.22.png | Bin 3646 -> 0 bytes .../guing/base/model/elements/PointModel.java | 10 - .../base/model/elements/VehicleModel.java | 1 - .../plantoverview/base/Bundle.properties | 2 - .../plantoverview/base/Bundle_de.properties | 2 - .../drawing/figures/PointFigure.java | 8 - .../common/exchange/adapter/PointAdapter.java | 7 - .../exchange/adapter/ProcessAdapterUtil.java | 1 - .../persistence/OpenTCSModelManager.java | 1 - .../DefaultPeripheralJobDispatcher.java | 16 - .../basic/routing/DefaultRouter.java | 75 +- .../basic/scheduling/AllocationAdvisor.java | 22 - .../basic/scheduling/DefaultScheduler.java | 14 - .../basic/scheduling/DummyScheduler.java | 4 + .../EdgeEvaluatorCompositeTest.java | 29 +- 133 files changed, 4635 insertions(+), 4630 deletions(-) delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/SchedulerAllocationState.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerService.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerServiceProxy.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/to/model/GroupCreationTO.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ModelLayoutElementCreationTO.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ShapeLayoutElementCreationTO.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/SchedulerService.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/OrderCategorySuggestions.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/Group.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageData.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageLayoutElement.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/LayoutElement.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ModelLayoutElement.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ShapeLayoutElement.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentEvent.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentInformation.java delete mode 100644 openTCS-API-Base/src/main/java/org/opentcs/util/Enums.java create mode 100644 openTCS-API-Base/src/test/java/org/opentcs/drivers/vehicle/MovementCommandTest.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedOperationTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedPeripheralOperationTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/BlockTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/Comparators.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/CoupleTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTypeTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/MemberTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PathTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PeripheralOperationTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PlantModelElementTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PointTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PropertyTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005ModelParser.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005PlantModelTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005TOMapper.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleEnvelopeTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleTO.java create mode 100644 openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VisualLayoutTO.java create mode 100644 openTCS-Common/src/main/resources/org/opentcs/util/persistence/model-0.0.5.xsd create mode 100644 openTCS-Common/src/test/java/org/opentcs/util/persistence/v005/V005DrivingCoursePersistenceTest.java delete mode 100644 openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteSchedulerService.java delete mode 100644 openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardSchedulerService.java delete mode 100644 openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandImpl.java delete mode 100644 openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandImplTest.java delete mode 100644 openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report-arrow.22.png delete mode 100644 openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report.22.png diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/KernelServicePortal.java b/openTCS-API-Base/src/main/java/org/opentcs/access/KernelServicePortal.java index 7e0235832..1f5a02eb5 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/KernelServicePortal.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/KernelServicePortal.java @@ -17,7 +17,6 @@ import org.opentcs.components.kernel.services.PlantModelService; import org.opentcs.components.kernel.services.QueryService; import org.opentcs.components.kernel.services.RouterService; -import org.opentcs.components.kernel.services.SchedulerService; import org.opentcs.components.kernel.services.TransportOrderService; import org.opentcs.components.kernel.services.VehicleService; @@ -123,15 +122,6 @@ void publishEvent(Object event) @Nonnull RouterService getRouterService(); - /** - * Returns the service a client can use to access methods regarding the scheduler. - * - * @return The service a client can use to access methods regarding the scheduler. - */ - @Nonnull - @Deprecated - SchedulerService getSchedulerService(); - /** * Returns the service a client can use to access methods for generic queries. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/SchedulerAllocationState.java b/openTCS-API-Base/src/main/java/org/opentcs/access/SchedulerAllocationState.java deleted file mode 100644 index d7c8f5b65..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/SchedulerAllocationState.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; -import static java.util.Objects.requireNonNull; -import java.util.Set; -import org.opentcs.data.model.TCSResource; -import org.opentcs.data.model.Vehicle; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Represents the current state of resource allocations. - * - * @deprecated Acquire allocations from {@link Vehicle}, instead. - */ -@Deprecated -@ScheduledApiChange(when = "6.0", details = "Will be removed.") -public class SchedulerAllocationState - implements Serializable { - - /** - * The current state of allocations. - */ - private final Map>> allocationStates; - - /** - * Creates a new instance. - * - * @param allocationStates The current state of allocations. - */ - public SchedulerAllocationState(@Nonnull Map>> allocationStates) { - this.allocationStates = Collections.unmodifiableMap(requireNonNull(allocationStates, - "allocationStates")); - } - - /** - * Returns the current state of allocations. - * - * @return The current state of allocations. - */ - public Map>> getAllocationStates() { - return allocationStates; - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RegistrationName.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RegistrationName.java index 815589caf..71fc1453e 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RegistrationName.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RegistrationName.java @@ -40,11 +40,6 @@ public interface RegistrationName { * The name the {@link RemoteDispatcherService} registers itself with a RMI registry. */ String REMOTE_DISPATCHER_SERVICE = RemoteDispatcherService.class.getCanonicalName(); - /** - * The name the {@link RemoteSchedulerService} registers itself with a RMI registry. - */ - @Deprecated - String REMOTE_SCHEDULER_SERVICE = RemoteSchedulerService.class.getCanonicalName(); /** * The name the {@link RemoteQueryService} registers itself with a RMI registry. */ diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteDispatcherService.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteDispatcherService.java index 1155b9486..091ab78d5 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteDispatcherService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteDispatcherService.java @@ -15,7 +15,6 @@ import org.opentcs.data.model.Vehicle; import org.opentcs.data.order.ReroutingType; import org.opentcs.data.order.TransportOrder; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods provided by the {@link DispatcherService} via RMI. @@ -48,22 +47,13 @@ void withdrawByTransportOrder(ClientID clientId, boolean immediateAbort) throws RemoteException; - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void reroute(ClientID clientId, - TCSObjectReference ref, - ReroutingType reroutingType) - throws RemoteException { - } + void reroute(ClientID clientId, TCSObjectReference ref, ReroutingType reroutingType) + throws RemoteException; - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void rerouteAll(ClientID clientId, - ReroutingType reroutingType) - throws RemoteException { - } + void rerouteAll(ClientID clientId, ReroutingType reroutingType) + throws RemoteException; - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void assignNow(ClientID clientId, TCSObjectReference ref) - throws RemoteException { - } + void assignNow(ClientID clientId, TCSObjectReference ref) + throws RemoteException; // CHECKSTYLE:ON } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteKernelServicePortalProxy.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteKernelServicePortalProxy.java index 796f378c8..53ee2f2fc 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteKernelServicePortalProxy.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteKernelServicePortalProxy.java @@ -29,7 +29,6 @@ import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_PLANT_MODEL_SERVICE; import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_QUERY_SERVICE; import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_ROUTER_SERVICE; -import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_SCHEDULER_SERVICE; import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_TRANSPORT_ORDER_SERVICE; import static org.opentcs.access.rmi.services.RegistrationName.REMOTE_VEHICLE_SERVICE; import org.opentcs.components.kernel.services.DispatcherService; @@ -40,7 +39,6 @@ import org.opentcs.components.kernel.services.PlantModelService; import org.opentcs.components.kernel.services.QueryService; import org.opentcs.components.kernel.services.RouterService; -import org.opentcs.components.kernel.services.SchedulerService; import org.opentcs.components.kernel.services.ServiceUnavailableException; import org.opentcs.components.kernel.services.TransportOrderService; import org.opentcs.components.kernel.services.VehicleService; @@ -103,11 +101,6 @@ public class RemoteKernelServicePortalProxy * The router service. */ private final RemoteRouterServiceProxy routerService = new RemoteRouterServiceProxy(); - /** - * The scheduler service. - */ - @SuppressWarnings("deprecation") - private final RemoteSchedulerServiceProxy schedulerService = new RemoteSchedulerServiceProxy(); /** * The query service. */ @@ -287,13 +280,6 @@ public QueryService getQueryService() { return queryService; } - @Override - @Nonnull - @Deprecated - public SchedulerService getSchedulerService() { - return schedulerService; - } - @Override @Nonnull public PeripheralService getPeripheralService() { @@ -312,7 +298,6 @@ public PeripheralDispatcherService getPeripheralDispatcherService() { return peripheralDispatcherService; } - @SuppressWarnings("deprecation") private void updateServiceLogins(Registry registry) throws RemoteException, NotBoundException { plantModelService @@ -347,11 +332,6 @@ private void updateServiceLogins(Registry registry) .setRemoteService((RemoteRouterService) registry.lookup(REMOTE_ROUTER_SERVICE)) .setServiceListener(this); - schedulerService - .setClientId(getClientId()) - .setRemoteService((RemoteSchedulerService) registry.lookup(REMOTE_SCHEDULER_SERVICE)) - .setServiceListener(this); - queryService .setClientId(getClientId()) .setRemoteService((RemoteQueryService) registry.lookup(REMOTE_QUERY_SERVICE)) @@ -387,7 +367,6 @@ private void resetServiceLogins() { notificationService.setClientId(null).setRemoteService(null).setServiceListener(null); dispatcherService.setClientId(null).setRemoteService(null).setServiceListener(null); routerService.setClientId(null).setRemoteService(null).setServiceListener(null); - schedulerService.setClientId(null).setRemoteService(null).setServiceListener(null); queryService.setClientId(null).setRemoteService(null).setServiceListener(null); peripheralService.setClientId(null).setRemoteService(null).setServiceListener(null); peripheralJobService.setClientId(null).setRemoteService(null).setServiceListener(null); diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemotePlantModelService.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemotePlantModelService.java index 302082028..95feea347 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemotePlantModelService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemotePlantModelService.java @@ -17,7 +17,6 @@ import org.opentcs.data.model.Location; import org.opentcs.data.model.Path; import org.opentcs.data.model.PlantModel; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods provided by the {@link PlantModelService} via RMI. @@ -53,9 +52,7 @@ Map getModelProperties(ClientID clientId) void updateLocationLock(ClientID clientId, TCSObjectReference ref, boolean locked) throws RemoteException; - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updatePathLock(ClientID clientId, TCSObjectReference ref, boolean locked) - throws RemoteException { - } + void updatePathLock(ClientID clientId, TCSObjectReference ref, boolean locked) + throws RemoteException; // CHECKSTYLE:ON } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterService.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterService.java index 767d8b25e..6fa2317ea 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterService.java @@ -19,7 +19,6 @@ import org.opentcs.data.model.TCSResourceReference; import org.opentcs.data.model.Vehicle; import org.opentcs.data.order.Route; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods provided by the {@link RouterService} via RMI. @@ -39,28 +38,7 @@ public interface RemoteRouterService extends Remote { // CHECKSTYLE:OFF - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void updatePathLock(ClientID clientId, TCSObjectReference ref, boolean locked) - throws RemoteException; - - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void updateRoutingTopology(ClientID clientId) - throws RemoteException; - - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default public void updateRoutingTopology(ClientID clientId, Set> refs) - throws RemoteException { - updateRoutingTopology(clientId); - } - - @Deprecated - public Map, Route> computeRoutes( - ClientID clientId, - TCSObjectReference vehicleRef, - TCSObjectReference sourcePointRef, - Set> destinationPointRefs) + public void updateRoutingTopology(ClientID clientId, Set> refs) throws RemoteException; public Map, Route> computeRoutes( diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterServiceProxy.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterServiceProxy.java index 47241c0dc..055792d6f 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterServiceProxy.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteRouterServiceProxy.java @@ -12,7 +12,6 @@ import java.util.Set; import org.opentcs.access.KernelRuntimeException; import org.opentcs.components.kernel.services.RouterService; -import org.opentcs.data.ObjectUnknownException; import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Path; import org.opentcs.data.model.Point; @@ -34,38 +33,10 @@ class RemoteRouterServiceProxy RemoteRouterServiceProxy() { } - @Override - @Deprecated - public void updatePathLock(TCSObjectReference ref, boolean locked) - throws ObjectUnknownException, KernelRuntimeException { - checkServiceAvailability(); - - try { - getRemoteService().updatePathLock(getClientId(), ref, locked); - } - catch (RemoteException ex) { - throw findSuitableExceptionFor(ex); - } - } - - @Override - @Deprecated - public void updateRoutingTopology() - throws KernelRuntimeException { - checkServiceAvailability(); - - try { - getRemoteService().updateRoutingTopology(getClientId()); - } - catch (RemoteException ex) { - throw findSuitableExceptionFor(ex); - } - } - @Override public void updateRoutingTopology(Set> refs) throws KernelRuntimeException { - checkServiceAvailability(); + checkServiceAvailability(); try { getRemoteService().updateRoutingTopology(getClientId(), refs); @@ -75,26 +46,6 @@ public void updateRoutingTopology(Set> refs) } } - @Deprecated - @Override - public Map, Route> computeRoutes( - TCSObjectReference vehicleRef, - TCSObjectReference sourcePointRef, - Set> destinationPointRefs) - throws KernelRuntimeException { - checkServiceAvailability(); - - try { - return getRemoteService().computeRoutes(getClientId(), - vehicleRef, - sourcePointRef, - destinationPointRefs); - } - catch (RemoteException ex) { - throw findSuitableExceptionFor(ex); - } - } - @Override public Map, Route> computeRoutes( TCSObjectReference vehicleRef, diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerService.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerService.java deleted file mode 100644 index 9fa352adf..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerService.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access.rmi.services; - -import java.rmi.Remote; -import java.rmi.RemoteException; -import org.opentcs.access.rmi.ClientID; - -/** - * Declares the methods provided by the {@code SchedulerService} via RMI. - * - *

- * The majority of the methods declared here have signatures analogous to their counterparts in - * {@code SchedulerService}, with an additional {@link ClientID} parameter which serves the purpose - * of identifying the calling client and determining its permissions. - *

- *

- * To avoid redundancy, the semantics of methods that only pass through their arguments are not - * explicitly documented here again. See the corresponding API documentation in - * {@code SchedulerService} for these, instead. - *

- */ -@Deprecated -public interface RemoteSchedulerService - extends Remote { - - // CHECKSTYLE:OFF - public org.opentcs.access.SchedulerAllocationState fetchSchedulerAllocations(ClientID clientId) - throws RemoteException; - // CHECKSTYLE:ON -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerServiceProxy.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerServiceProxy.java deleted file mode 100644 index db3375f02..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteSchedulerServiceProxy.java +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access.rmi.services; - -import java.rmi.RemoteException; -import org.opentcs.access.KernelRuntimeException; -import org.opentcs.access.SchedulerAllocationState; -import org.opentcs.components.kernel.services.SchedulerService; - -/** - * The default implementation of the scheduler service. - * Delegates method invocations to the corresponding remote service. - */ -@Deprecated -class RemoteSchedulerServiceProxy - extends AbstractRemoteServiceProxy - implements SchedulerService { - - /** - * Creates a new instance. - */ - RemoteSchedulerServiceProxy() { - } - - @Override - @Deprecated - public SchedulerAllocationState fetchSchedulerAllocations() - throws KernelRuntimeException { - checkServiceAvailability(); - - try { - return getRemoteService().fetchSchedulerAllocations(getClientId()); - } - catch (RemoteException ex) { - throw findSuitableExceptionFor(ex); - } - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteVehicleService.java b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteVehicleService.java index c7569a896..06f82a33c 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteVehicleService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/rmi/services/RemoteVehicleService.java @@ -18,7 +18,6 @@ import org.opentcs.drivers.vehicle.VehicleCommAdapterDescription; import org.opentcs.drivers.vehicle.management.VehicleAttachmentInformation; import org.opentcs.drivers.vehicle.management.VehicleProcessModelTO; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods provided by the {@link VehicleService} via RMI. @@ -81,11 +80,9 @@ void updateVehicleAllowedOrderTypes(ClientID clientId, Set allowedOrderTypes) throws RemoteException; - @ScheduledApiChange(when = "6.0", details = "Deault implementation will be removed.") - default void updateVehicleEnvelopeKey(ClientID clientId, - TCSObjectReference ref, - String envelopeKey) - throws RemoteException { - } + void updateVehicleEnvelopeKey(ClientID clientId, + TCSObjectReference ref, + String envelopeKey) + throws RemoteException; // CHECKSTYLE:ON } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/GroupCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/GroupCreationTO.java deleted file mode 100644 index 3c547c402..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/GroupCreationTO.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access.to.model; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import java.util.Collections; -import java.util.Map; -import static java.util.Objects.requireNonNull; -import java.util.Set; -import org.opentcs.access.to.CreationTO; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A transfer object describing a group in the plant model. - * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class GroupCreationTO - extends CreationTO - implements Serializable { - - /** - * This group's member names. - */ - @Nonnull - private final Set memberNames; - - /** - * Creates a new instance. - * - * @param name The name of this group. - */ - public GroupCreationTO(String name) { - super(name); - - this.memberNames = Set.of(); - } - - private GroupCreationTO(@Nonnull String name, - @Nonnull Map properties, - @Nonnull Set memberNames) { - super(name, properties); - this.memberNames = requireNonNull(memberNames, "memberNames"); - } - - /** - * Creates a copy of this object with the given name. - * - * @param name The new name. - * @return A copy of this object, differing in the given value. - */ - @Override - public GroupCreationTO withName(@Nonnull String name) { - return new GroupCreationTO(name, getModifiableProperties(), memberNames); - } - - /** - * Creates a copy of this object with the given properties. - * - * @param properties the new properties. - * @return A copy of this object, differing in the given properties. - */ - @Override - public GroupCreationTO withProperties(@Nonnull Map properties) { - return new GroupCreationTO(getName(), properties, memberNames); - } - - /** - * Creates a copy of this object and adds the given property. - * If value == null, then the key-value pair is removed from the properties. - * - * @param key the key. - * @param value the value - * @return A copy of this object that either - * includes the given entry in it's current properties, if value != null or - * excludes the entry otherwise. - */ - @Override - public GroupCreationTO withProperty(@Nonnull String key, @Nonnull String value) { - return new GroupCreationTO(getName(), propertiesWith(key, value), memberNames); - } - - /** - * Returns the names of this group's members. - * - * @return The names of this group's members. - */ - @Nonnull - public Set getMemberNames() { - return Collections.unmodifiableSet(memberNames); - } - - /** - * Creates a copy of this object with group's members. - * - * @param memberNames The names of this group's members. - * @return A copy of this object, differing in the given value. - */ - public GroupCreationTO withMemberNames(@Nonnull Set memberNames) { - return new GroupCreationTO(getName(), getModifiableProperties(), memberNames); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ModelLayoutElementCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ModelLayoutElementCreationTO.java deleted file mode 100644 index 11941e1b1..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ModelLayoutElementCreationTO.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access.to.model; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import java.util.Map; -import org.opentcs.access.to.CreationTO; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A transfer object describing a model layout element in the visual layout. - * - * @deprecated Will be removed in favor of dedicated layout classes in corresponding TCS data - * objects. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ModelLayoutElementCreationTO - extends CreationTO - implements Serializable { - - /** - * The layer on which this model layout element is to be displayed. - */ - private final int layer; - - /** - * Creates a new instance. - * - * @param name The name of this model layout element. - */ - public ModelLayoutElementCreationTO(String name) { - super(name); - this.layer = 0; - } - - private ModelLayoutElementCreationTO(@Nonnull String name, - @Nonnull Map properties, - int layer) { - super(name, properties); - this.layer = layer; - } - - /** - * Creates a copy of this object with the given name. - * - * @param name The new name. - * @return A copy of this object, differing in the given name. - */ - @Override - public ModelLayoutElementCreationTO withName(@Nonnull String name) { - return new ModelLayoutElementCreationTO(name, getModifiableProperties(), layer); - } - - /** - * Creates a copy of this object with the given properties. - * - * @param properties The new properties. - * @return A copy of this object, differing in the given properties. - */ - @Override - public ModelLayoutElementCreationTO withProperties(@Nonnull Map properties) { - return new ModelLayoutElementCreationTO(getName(), properties, layer); - } - - /** - * Creates a copy of this object and adds the given property. - * If value == null, then the key-value pair is removed from the properties. - * - * @param key the key. - * @param value the value - * @return A copy of this object that either - * includes the given entry in it's current properties, if value != null or - * excludes the entry otherwise. - */ - @Override - public ModelLayoutElementCreationTO withProperty(@Nonnull String key, @Nonnull String value) { - return new ModelLayoutElementCreationTO(getName(), propertiesWith(key, value), layer); - } - - /** - * Returns the layer on which this model layout element is to be displayed. - * - * @return The layer on which this model layout element is to be displayed. - */ - public int getLayer() { - return layer; - } - - /** - * Creates a copy of this object with the given layer on which this model layout element is to be - * displayed. - * - * @param layer The new layer - * @return A copy of this object, differing in the given layer. - */ - public ModelLayoutElementCreationTO withLayer(int layer) { - return new ModelLayoutElementCreationTO(getName(), getModifiableProperties(), layer); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PlantModelCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PlantModelCreationTO.java index 821c61878..07a162236 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PlantModelCreationTO.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PlantModelCreationTO.java @@ -17,7 +17,6 @@ import org.opentcs.data.model.ModelConstants; import org.opentcs.data.model.visualization.Layer; import org.opentcs.data.model.visualization.LayerGroup; -import org.opentcs.util.annotations.ScheduledApiChange; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,19 +52,14 @@ public class PlantModelCreationTO * The plant model's blocks. */ private final List blocks; - /** - * The plant model's groups. - */ - @Deprecated - private final List groups; /** * The plant model's vehicles. */ private final List vehicles; /** - * The plant model's visual layouts. + * The plant model's visual layout. */ - private final List visualLayouts; + private final VisualLayoutCreationTO visualLayout; /** * Creates a new instance. @@ -79,12 +73,10 @@ public PlantModelCreationTO(String name) { this.locationTypes = List.of(); this.locations = List.of(); this.blocks = List.of(); - this.groups = List.of(); this.vehicles = List.of(); - this.visualLayouts = List.of(defaultVisualLayout()); + this.visualLayout = defaultVisualLayout(); } - @SuppressWarnings("deprecation") private PlantModelCreationTO(@Nonnull String name, @Nonnull Map properties, @Nonnull List points, @@ -92,18 +84,16 @@ private PlantModelCreationTO(@Nonnull String name, @Nonnull List locationTypes, @Nonnull List locations, @Nonnull List blocks, - @Nonnull List groups, @Nonnull List vehicles, - @Nonnull List visualLayouts) { + @Nonnull VisualLayoutCreationTO visualLayout) { super(name, properties); this.points = requireNonNull(points, "points"); this.paths = requireNonNull(paths, "paths"); this.locationTypes = requireNonNull(locationTypes, "locationTypes"); this.locations = requireNonNull(locations, "locations"); this.blocks = requireNonNull(blocks, "blocks"); - this.groups = requireNonNull(groups, "groups"); this.vehicles = requireNonNull(vehicles, "vehicles"); - this.visualLayouts = requireNonNull(visualLayouts, "visualLayouts"); + this.visualLayout = requireNonNull(visualLayout, "visualLayout"); } /** @@ -129,9 +119,8 @@ public PlantModelCreationTO withPoints(@Nonnull List points) { locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -149,9 +138,8 @@ public PlantModelCreationTO withPoint(@Nonnull PointCreationTO point) { locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -177,9 +165,8 @@ public PlantModelCreationTO withPaths(@Nonnull List paths) { locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -197,9 +184,8 @@ public PlantModelCreationTO withPath(@Nonnull PathCreationTO path) { locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -227,9 +213,8 @@ public PlantModelCreationTO withLocationTypes( locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -247,9 +232,8 @@ public PlantModelCreationTO withLocationType(@Nonnull LocationTypeCreationTO loc listWithAppendix(locationTypes, locationType), locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -275,9 +259,8 @@ public PlantModelCreationTO withLocations(@Nonnull List loca locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -295,9 +278,8 @@ public PlantModelCreationTO withLocation(@Nonnull LocationCreationTO location) { locationTypes, listWithAppendix(locations, location), blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -323,9 +305,8 @@ public PlantModelCreationTO withBlocks(@Nonnull List blocks) { locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -343,62 +324,8 @@ public PlantModelCreationTO withBlock(@Nonnull BlockCreationTO block) { locationTypes, locations, CreationTO.listWithAppendix(blocks, block), - groups, - vehicles, - visualLayouts); - } - - /** - * Returns this plant model's groups. - * - * @return This plant model's groups. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public List getGroups() { - return Collections.unmodifiableList(groups); - } - - /** - * Creates a copy of this object with the given groups. - * - * @param groups The new groups. - * @return A copy of this model, differing in the given groups. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public PlantModelCreationTO withGroups(@Nonnull List groups) { - return new PlantModelCreationTO(getName(), - getModifiableProperties(), - points, - paths, - locationTypes, - locations, - blocks, - groups, - vehicles, - visualLayouts); - } - - /** - * Creates a copy of this object that includes the given group in the list of groups. - * - * @param group the new group. - * @return A copy of this model that also includes the given group. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public PlantModelCreationTO withGroup(@Nonnull GroupCreationTO group) { - requireNonNull(group, "group"); - return new PlantModelCreationTO(getName(), - getModifiableProperties(), - points, - paths, - locationTypes, - locations, blocks, - listWithAppendix(groups, group), vehicles, - visualLayouts); + visualLayout); } /** @@ -424,9 +351,8 @@ public PlantModelCreationTO withVehicles(@Nonnull List vehicl locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -444,9 +370,8 @@ public PlantModelCreationTO withVehicle(@Nonnull VehicleCreationTO vehicle) { locationTypes, locations, blocks, - groups, listWithAppendix(vehicles, vehicle), - visualLayouts); + visualLayout); } /** @@ -455,55 +380,15 @@ public PlantModelCreationTO withVehicle(@Nonnull VehicleCreationTO vehicle) { * @return This plant model's visual layout. */ public VisualLayoutCreationTO getVisualLayout() { - return visualLayouts.get(visualLayouts.size() - 1); - } - - /** - * Returns this plant model's visual layouts. - * - * @return This plant model's visual layouts. - * @deprecated Use{@link #getVisualLayout()} instead. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public List getVisualLayouts() { - return Collections.unmodifiableList(visualLayouts); - } - - /** - * Creates a copy of this object with the given visual layouts. - * - * @param visualLayouts The new visual layouts. - * @return A copy of this model, differing in the given visual layouts. - * @deprecated Use {@link #withVisualLayout(org.opentcs.access.to.model.VisualLayoutCreationTO)} - * instead - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public PlantModelCreationTO withVisualLayouts( - @Nonnull List visualLayouts - ) { - return new PlantModelCreationTO(getName(), - getModifiableProperties(), - points, - paths, - locationTypes, - locations, - blocks, - groups, - vehicles, - visualLayouts); + return visualLayout; } /** - * Creates a copy of this object that includes the given visual layout in the list of - * visual layout elements. + * Creates a copy of this object with the given visual layout. * * @param visualLayout the new visual layout. - * @return A copy of this model that also includes the given visual layout. + * @return A copy of this model with the given visual layout. */ - @ScheduledApiChange(details = "A plant model will contain only a single visual layout.", - when = "6.0") public PlantModelCreationTO withVisualLayout(@Nonnull VisualLayoutCreationTO visualLayout) { requireNonNull(visualLayout, "visualLayout"); return new PlantModelCreationTO(getName(), @@ -513,9 +398,8 @@ public PlantModelCreationTO withVisualLayout(@Nonnull VisualLayoutCreationTO vis locationTypes, locations, blocks, - groups, vehicles, - listWithAppendix(visualLayouts, ensureValidity(visualLayout))); + ensureValidity(visualLayout)); } /** @@ -533,9 +417,8 @@ public PlantModelCreationTO withProperties(@Nonnull Map properti locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } /** @@ -557,9 +440,8 @@ public PlantModelCreationTO withProperty(@Nonnull String key, @Nonnull String va locationTypes, locations, blocks, - groups, vehicles, - visualLayouts); + visualLayout); } @Override @@ -571,9 +453,8 @@ public String toString() { + ", locationTypes=" + locationTypes + ", locations=" + locations + ", blocks=" + blocks - + ", groups=" + groups + ", vehicles=" + vehicles - + ", visualLayouts=" + visualLayouts + + ", visualLayout=" + visualLayout + ", properties=" + getProperties() + '}'; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PointCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PointCreationTO.java index ed3eee0ee..01d554112 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PointCreationTO.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/PointCreationTO.java @@ -17,7 +17,6 @@ import org.opentcs.data.model.Point; import org.opentcs.data.model.Pose; import org.opentcs.data.model.Triple; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A transfer object describing a point in the plant model. @@ -111,71 +110,6 @@ public PointCreationTO withPose(@Nonnull Pose pose) { layout); } - /** - * Returns the position of this point (in mm). - * - * @return The position of this point (in mm). - * @deprecated Use {@link #getPose()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - public Triple getPosition() { - return pose.getPosition(); - } - - /** - * Creates a copy of this object with the given position (in mm). - * - * @param position The new position. - * @return A copy of this object, differing in the given position. - * @deprecated Use {@link #withPose(org.opentcs.data.model.Pose)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public PointCreationTO withPosition(@Nonnull Triple position) { - return new PointCreationTO(getName(), - getModifiableProperties(), - pose.withPosition(position), - type, - vehicleEnvelopes, - layout); - } - - /** - * Returns a vehicle's orientation angle at this position. - * (-360..360, or {@code Double.NaN}, if an orientation angle is not specified for this point.) - * - * @return The vehicle's orientation angle when it's at this position. - * @deprecated Use {@link #getPose()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public double getVehicleOrientationAngle() { - return pose.getOrientationAngle(); - } - - /** - * Creates a copy of this object with the vehicle's (assumed) orientation angle when it's at this - * position. - * Allowed value range: [-360..360], or {@code Double.NaN} to indicate that there is no specific - * orientation angle for this point. - * - * @param vehicleOrientationAngle The new angle. - * @return A copy of this object, differing in the given angle. - * @deprecated Use {@link #withPose(org.opentcs.data.model.Pose)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public PointCreationTO withVehicleOrientationAngle(double vehicleOrientationAngle) { - return new PointCreationTO(getName(), - getModifiableProperties(), - pose.withOrientationAngle(vehicleOrientationAngle), - type, - vehicleEnvelopes, - layout); - } - /** * Returns the type of this point. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ShapeLayoutElementCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ShapeLayoutElementCreationTO.java deleted file mode 100644 index 398192d74..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/ShapeLayoutElementCreationTO.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.access.to.model; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import java.util.Map; -import org.opentcs.access.to.CreationTO; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A transfer object describing a shape layout element in the visual layout. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ShapeLayoutElementCreationTO - extends CreationTO - implements Serializable { - - /** - * The layer on which this shape layout element is to be displayed. - */ - private final int layer; - - /** - * Creates a new instance. - * - * @param name The name of this shape layout element. - */ - public ShapeLayoutElementCreationTO(String name) { - super(name); - this.layer = 0; - } - - /** - * Creates a new instance. - * - * @param name the name. - * @param properties the properties. - * @param layer the layer. - */ - private ShapeLayoutElementCreationTO(String name, Map properties, int layer) { - super(name, properties); - this.layer = layer; - } - - /** - * Creates a copy of this object with the given name. - * - * @param name The new name. - * @return A copy of this object, differing in the given value. - */ - @Override - public ShapeLayoutElementCreationTO withName(@Nonnull String name) { - return new ShapeLayoutElementCreationTO(name, getModifiableProperties(), layer); - } - - /** - * Creates a copy of this object with the given properties. - * - * @param properties The new properties. - * @return A copy of this object, differing in the given properties. - */ - @Override - public ShapeLayoutElementCreationTO withProperties(@Nonnull Map properties) { - return new ShapeLayoutElementCreationTO(getName(), properties, layer); - } - - /** - * Creates a copy of this object and adds the given property. - * If value == null, then the key-value pair is removed from the properties. - * - * @param key the key. - * @param value the value - * @return A copy of this object that either - * includes the given entry in it's current properties, if value != null or - * excludes the entry otherwise. - */ - public ShapeLayoutElementCreationTO withPropery(@Nonnull String key, @Nonnull String value) { - return new ShapeLayoutElementCreationTO(getName(), propertiesWith(key, value), layer); - } - - /** - * Returns the layer on which this shape layout element is to be displayed. - * - * @return The layer on which this shape layout element is to be displayed. - */ - public int getLayer() { - return layer; - } - - /** - * Creates a copy of this object with the given layer - * on which this shape layout element is to be displayed. - * - * @param layer the new layer. - * @return a copy of this object, differing in the given layer. - */ - public ShapeLayoutElementCreationTO withLayer(int layer) { - return new ShapeLayoutElementCreationTO(getName(), getModifiableProperties(), layer); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/VisualLayoutCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/VisualLayoutCreationTO.java index 39eff4c0c..1a73487e4 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/VisualLayoutCreationTO.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/to/model/VisualLayoutCreationTO.java @@ -16,7 +16,6 @@ import org.opentcs.access.to.CreationTO; import org.opentcs.data.model.visualization.Layer; import org.opentcs.data.model.visualization.LayerGroup; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A transfer object describing a visual layout in the plant model. @@ -33,16 +32,6 @@ public class VisualLayoutCreationTO * This layout's scale on the Y axis (in mm/pixel). */ private final double scaleY; - /** - * This layout's model layout elements. - */ - @Deprecated - private final List modelElements; - /** - * This layout's shape layout elements. - */ - @Deprecated - private final List shapeElements; /** * This layout's layers. */ @@ -62,26 +51,19 @@ public VisualLayoutCreationTO(@Nonnull String name) { this.scaleX = 50.0; this.scaleY = 50.0; - this.modelElements = List.of(); - this.shapeElements = List.of(); this.layers = List.of(); this.layerGroups = List.of(); } - @SuppressWarnings("deprecation") private VisualLayoutCreationTO(@Nonnull String name, @Nonnull Map properties, double scaleX, double scaleY, - @Nonnull List modelElements, - @Nonnull List shapeElements, @Nonnull List layers, @Nonnull List layerGroups) { super(name, properties); this.scaleX = scaleX; this.scaleY = scaleY; - this.modelElements = requireNonNull(modelElements, "modelElements"); - this.shapeElements = requireNonNull(shapeElements, "shapeElements"); this.layers = requireNonNull(layers, "layers"); this.layerGroups = requireNonNull(layerGroups, "layerGroups"); } @@ -98,8 +80,6 @@ public VisualLayoutCreationTO withName(@Nonnull String name) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -116,8 +96,6 @@ public VisualLayoutCreationTO withProperties(@Nonnull Map proper properties, scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -138,8 +116,6 @@ public VisualLayoutCreationTO withProperty(@Nonnull String key, @Nonnull String propertiesWith(key, value), scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -164,8 +140,6 @@ public VisualLayoutCreationTO withScaleX(double scaleX) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -190,112 +164,6 @@ public VisualLayoutCreationTO withScaleY(double scaleY) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, - layers, - layerGroups); - } - - /** - * Returns the model layout elements of this visual layout. - * - * @return The model layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - @Nonnull - public List getModelElements() { - return Collections.unmodifiableList(modelElements); - } - - /** - * Creates a copy of this object with the given model elements. - * - * @param modelElements The new model layout elements. - * @return A copy of this object, differing in the layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VisualLayoutCreationTO withModelElements( - @Nonnull List modelElements) { - return new VisualLayoutCreationTO(getName(), - getModifiableProperties(), - scaleX, - scaleY, - modelElements, - shapeElements, - layers, - layerGroups); - } - - /** - * Creates a copy of this object with the given model element. - * - * @param modelElement The new model layout elements. - * @return A copy of this object, differing in the layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VisualLayoutCreationTO withModelElement( - @Nonnull ModelLayoutElementCreationTO modelElement) { - return new VisualLayoutCreationTO(getName(), - getModifiableProperties(), - scaleX, - scaleY, - listWithAppendix(modelElements, modelElement), - shapeElements, - layers, - layerGroups); - } - - /** - * Returns the shape layout elements of this visual layout. - * - * @return The shape layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - @Nonnull - public List getShapeElements() { - return Collections.unmodifiableList(shapeElements); - } - - /** - * Creates a copy of this object with the given shape elements. - * - * @param shapeElements the new shape layout elements. - * @return A copy of this object, differing in the shape layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VisualLayoutCreationTO withShapeElements( - @Nonnull List shapeElements) { - return new VisualLayoutCreationTO(getName(), - getModifiableProperties(), - scaleX, - scaleY, - modelElements, - shapeElements, - layers, - layerGroups); - } - - /** - * Creates a copy of this object with the given shape element. - * - * @param shapeElement the new shape layout element. - * @return A copy of this object, differing in the shape layout elements of this visual layout. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VisualLayoutCreationTO withShapeElement( - @Nonnull ShapeLayoutElementCreationTO shapeElement) { - return new VisualLayoutCreationTO(getName(), - getModifiableProperties(), - scaleX, - scaleY, - modelElements, - listWithAppendix(shapeElements, shapeElement), layers, layerGroups); } @@ -321,8 +189,6 @@ public VisualLayoutCreationTO withLayers(@Nonnull List layers) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -338,8 +204,6 @@ public VisualLayoutCreationTO withLayer(@Nonnull Layer layer) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, listWithAppendix(layers, layer), layerGroups); } @@ -365,8 +229,6 @@ public VisualLayoutCreationTO withLayerGroups(@Nonnull List layerGro getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, layers, layerGroups); } @@ -382,8 +244,6 @@ public VisualLayoutCreationTO withLayerGroup(@Nonnull LayerGroup layerGroup) { getModifiableProperties(), scaleX, scaleY, - modelElements, - shapeElements, layers, listWithAppendix(layerGroups, layerGroup)); } @@ -394,8 +254,6 @@ public String toString() { + "name=" + getName() + ", scaleX=" + scaleX + ", scaleY=" + scaleY - + ", modelElements=" + modelElements - + ", shapeElements=" + shapeElements + ", layers=" + layers + ", layerGroups=" + layerGroups + ", properties=" + getProperties() diff --git a/openTCS-API-Base/src/main/java/org/opentcs/access/to/peripherals/PeripheralOperationCreationTO.java b/openTCS-API-Base/src/main/java/org/opentcs/access/to/peripherals/PeripheralOperationCreationTO.java index 5937954ac..23bcc5328 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/access/to/peripherals/PeripheralOperationCreationTO.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/access/to/peripherals/PeripheralOperationCreationTO.java @@ -56,7 +56,6 @@ public PeripheralOperationCreationTO(@Nonnull String operation, @Nonnull String this.completionRequired = false; } - @SuppressWarnings("deprecation") private PeripheralOperationCreationTO( @Nonnull String name, @Nonnull Map properties, @@ -67,12 +66,7 @@ private PeripheralOperationCreationTO( super(name, properties); this.operation = requireNonNull(operation, "operation"); this.locationName = requireNonNull(locationName, "locationName"); - requireNonNull(executionTrigger, "executionTrigger"); - this.executionTrigger - = (executionTrigger == PeripheralOperation.ExecutionTrigger.BEFORE_MOVEMENT) - ? PeripheralOperation.ExecutionTrigger.AFTER_ALLOCATION - : executionTrigger; - + this.executionTrigger = requireNonNull(executionTrigger, "executionTrigger"); this.completionRequired = completionRequired; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Dispatcher.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Dispatcher.java index 14cc4f7e6..2645b758a 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Dispatcher.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Dispatcher.java @@ -13,7 +13,6 @@ import org.opentcs.data.model.Vehicle; import org.opentcs.data.order.ReroutingType; import org.opentcs.data.order.TransportOrder; -import org.opentcs.util.annotations.ScheduledApiChange; /** * This interface declares the methods a dispatcher module for the openTCS @@ -100,19 +99,6 @@ public interface Dispatcher */ void withdrawOrder(@Nonnull Vehicle vehicle, boolean immediateAbort); - /** - * Notifies the dispatcher of changes in the topology. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @deprecated Use {@link #rerouteAll(org.opentcs.data.order.ReroutingType)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void topologyChanged() { - } - /** * Notifies the dispatcher of a request to reroute the given vehicle considering the given * rerouting type. @@ -123,9 +109,7 @@ default void topologyChanged() { * @param vehicle The vehicle to be rerouted. * @param reroutingType The type of the requested rerouting. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void reroute(@Nonnull Vehicle vehicle, @Nonnull ReroutingType reroutingType) { - } + void reroute(@Nonnull Vehicle vehicle, @Nonnull ReroutingType reroutingType); /** * Notifies the dispatcher to reroute all vehicles considering the given rerouting type. @@ -135,9 +119,7 @@ default void reroute(@Nonnull Vehicle vehicle, @Nonnull ReroutingType reroutingT * * @param reroutingType The type of the requested rerouting. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void rerouteAll(@Nonnull ReroutingType reroutingType) { - } + void rerouteAll(@Nonnull ReroutingType reroutingType); /** * Notifies the dispatcher that it should assign the given transport order (to its intended @@ -150,9 +132,6 @@ default void rerouteAll(@Nonnull ReroutingType reroutingType) { * @throws TransportOrderAssignmentException If the given transport order could not be assigned * to its intended vehicle. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void assignNow(@Nonnull TransportOrder transportOrder) - throws TransportOrderAssignmentException { - throw new UnsupportedOperationException("Not supported yet."); - } + void assignNow(@Nonnull TransportOrder transportOrder) + throws TransportOrderAssignmentException; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Router.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Router.java index 2bb49e971..01d30d695 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Router.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Router.java @@ -14,7 +14,6 @@ import java.util.Optional; import java.util.Set; import org.opentcs.components.Lifecycle; -import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Path; import org.opentcs.data.model.Point; import org.opentcs.data.model.TCSResourceReference; @@ -22,7 +21,6 @@ import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.Route; import org.opentcs.data.order.TransportOrder; -import org.opentcs.util.annotations.ScheduledApiChange; /** * This interface declares the methods a router module for the openTCS @@ -59,32 +57,6 @@ public interface Router */ String PROPKEY_ROUTING_COST_REVERSE = "tcs:routingCostReverse"; - /** - * Notifies the router of changes in the topology. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @deprecated Use {@link #updateRoutingTopology()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void topologyChanged(); - - /** - * Notifies the router to update its routing topology. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @deprecated Use {@link #updateRoutingTopology(java.util.Set)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void updateRoutingTopology() { - this.topologyChanged(); - } - /** * Notifies the router to update its routing topology with respect to the given paths. *

@@ -94,10 +66,7 @@ default void updateRoutingTopology() { * @param paths The paths to update in the routing topology. An empty set of paths results in the * router updating the entire routing topology. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updateRoutingTopology(@Nonnull Set paths) { - this.topologyChanged(); - } + void updateRoutingTopology(@Nonnull Set paths); /** * Checks the general routability of a given transport order. @@ -135,27 +104,6 @@ Optional> getRoute(@Nonnull Vehicle vehicle, @Nonnull Point sourcePoint, @Nonnull TransportOrder transportOrder); - /** - * Returns a route from one point to another, passable for a given vehicle. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param vehicle The vehicle for which the route must be passable. - * @param sourcePoint The starting point of the route to calculate. - * @param destinationPoint The end point of the route to calculate. - * @return The calculated route, or the empty optional, if a route between the - * given points does not exist. - * @deprecated Use {@link #getRoute(org.opentcs.data.model.Vehicle, - * org.opentcs.data.model.Point, org.opentcs.data.model.Point, java.util.Set)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - Optional getRoute(@Nonnull Vehicle vehicle, - @Nonnull Point sourcePoint, - @Nonnull Point destinationPoint); - /** * Returns a route from one point to another, passable for a given vehicle. *

@@ -175,49 +123,6 @@ Optional getRoute(@Nonnull Vehicle vehicle, @Nonnull Point destinationPoint, @Nonnull Set> resourcesToAvoid); - /** - * Returns the costs for travelling a route from one point to another with a - * given vehicle. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param vehicle The vehicle for which the route must be passable. - * @param sourcePoint The starting point of the route. - * @param destinationPoint The end point of the route. - * @return The costs of the route, or Long.MAX_VALUE, if no such - * route exists. - * @deprecated Use {@link #getCosts(org.opentcs.data.model.Vehicle, org.opentcs.data.model.Point, - * org.opentcs.data.model.Point, java.util.Set)} instead. - * - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - long getCosts(@Nonnull Vehicle vehicle, - @Nonnull Point sourcePoint, - @Nonnull Point destinationPoint); - - /** - * Returns the costs for travelling a route from one point to another with a - * given vehicle. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param vehicle The vehicle for which the route must be passable. - * @param srcPointRef The starting point reference of the route. - * @param dstPointRef The end point reference of the route. - * @return The costs of the route, or Long.MAX_VALUE, if no such - * route exists. - * @deprecated Use {@link #getCosts(org.opentcs.data.model.Vehicle, org.opentcs.data.model.Point, - * org.opentcs.data.model.Point, java.util.Set)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - long getCostsByPointRef(@Nonnull Vehicle vehicle, - @Nonnull TCSObjectReference srcPointRef, - @Nonnull TCSObjectReference dstPointRef); - /** * Returns the costs for travelling a route from one point to another with a * given vehicle. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Scheduler.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Scheduler.java index cdd92b5cd..cd98275e9 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Scheduler.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/Scheduler.java @@ -16,7 +16,6 @@ import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.TCSResource; import org.opentcs.data.model.Vehicle; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Manages resources used by clients (vehicles) to help prevent both collisions and deadlocks. @@ -95,48 +94,6 @@ public interface Scheduler */ void claim(@Nonnull Client client, @Nonnull List>> resourceSequence); - /** - * Notifies the scheduler that the given client has now reached the given index in its claimed - * resource sequence, and that the client does not need the resources preceding the index in the - * sequence, any more. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param client The client. - * @param index The new index in the client's claimed resource sequence. - * @throws IllegalArgumentException If the client does not hold a claim, or if the new index is - * larger than a valid index in its claim's resource sequence, or if the new index is not larger - * than the current index. - * @deprecated Stick to - * {@link #claim(org.opentcs.components.kernel.Scheduler.Client, java.util.List) claim()} and - * {@link #allocate(org.opentcs.components.kernel.Scheduler.Client, java.util.Set) allocate()}. - * They implicitly update both the set of claimed and the set of allocated resources. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void updateProgressIndex(@Nonnull Client client, int index) - throws IllegalArgumentException { - } - - /** - * Unclaims a set of resources claimed by a vehicle. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param client The client unclaiming the resources. - * @throws IllegalArgumentException If the given client does not hold a claim. - * @deprecated Use {@link #claim(org.opentcs.components.kernel.Scheduler.Client, java.util.List)} - * with an empty list, instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void unclaim(@Nonnull Client client) - throws IllegalArgumentException { - claim(client, List.of()); - } - /** * Requests allocation of the given resources. * The client will be informed via a callback to @@ -181,10 +138,7 @@ void allocate(@Nonnull Client client, @Nonnull Set> resources) * @return {@code true} if the given resources are safe to be allocated by the given client, * otherwise {@code false}. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default boolean mayAllocateNow(@Nonnull Client client, @Nonnull Set> resources) { - return false; - } + boolean mayAllocateNow(@Nonnull Client client, @Nonnull Set> resources); /** * Informs the scheduler that a set of resources are to be allocated for the given client @@ -250,9 +204,7 @@ void allocateNow(@Nonnull Client client, @Nonnull Set> resources) * * @param client The client. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void clearPendingAllocations(@Nonnull Client client) { - } + void clearPendingAllocations(@Nonnull Client client); /** * Explicitly triggers a rescheduling run during which the scheduler tries to allocate resources @@ -261,9 +213,7 @@ default void clearPendingAllocations(@Nonnull Client client) { * This method is supposed to be called only from the kernel executor thread. *

*/ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void reschedule() { - } + void reschedule(); /** * Returns all resource allocations as a map of client IDs to resources. @@ -312,10 +262,7 @@ interface Client { * this client is not related to any {@link Vehicle}. */ @Nullable - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default TCSObjectReference getRelatedVehicle() { - return null; - } + TCSObjectReference getRelatedVehicle(); /** * Called when resources have been reserved for this client. @@ -341,32 +288,6 @@ default TCSObjectReference getRelatedVehicle() { interface Module extends Lifecycle { - /** - * Sets a client's total claim. - * With vehicles, this is equivalent to the route a vehicle plans to take. - * - * @param client The client the resource sequence is claimed by. - * @param claim The resource sequence, i.e. total claim. - * @deprecated Redundant - use {@link #setAllocationState(Client, Set, List)} - * instead/exclusively. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void claim(@Nonnull Client client, @Nonnull List>> claim) { - } - - /** - * Resets a client's total claim. - * - * @param client The client for which to reset the claim. - * @deprecated Redundant - use {@link #setAllocationState(Client, Set, List)} - * instead/exclusively. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void unclaim(@Nonnull Client client) { - } - /** * Informs this module about a client's current allocation state. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/routing/EdgeEvaluator.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/routing/EdgeEvaluator.java index 62611e2cb..6c5241d22 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/routing/EdgeEvaluator.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/routing/EdgeEvaluator.java @@ -9,7 +9,6 @@ import jakarta.annotation.Nonnull; import org.opentcs.data.model.Vehicle; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Computes the weight of edges in the routing graph. @@ -21,18 +20,14 @@ public interface EdgeEvaluator { * * @param vehicle The vehicle for which the routing graph is computed. */ - @ScheduledApiChange(details = "Default implementation will be removed.", when = "6.0") - default void onGraphComputationStart(@Nonnull Vehicle vehicle) { - } + void onGraphComputationStart(@Nonnull Vehicle vehicle); /** * Called when/after a computation of a routing graph is done. * * @param vehicle The vehicle for which the routing graph is computed. */ - @ScheduledApiChange(details = "Default implementation will be removed.", when = "6.0") - default void onGraphComputationEnd(@Nonnull Vehicle vehicle) { - } + void onGraphComputationEnd(@Nonnull Vehicle vehicle); /** * Computes the weight of an edge in the routing graph. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/DispatcherService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/DispatcherService.java index 724320d3a..dfcf88ebf 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/DispatcherService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/DispatcherService.java @@ -17,7 +17,6 @@ import org.opentcs.data.order.ReroutingType; import org.opentcs.data.order.TransportOrder; import org.opentcs.data.order.TransportOrder.State; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides methods concerning the {@link Dispatcher}. @@ -84,11 +83,9 @@ void withdrawByTransportOrder(TCSObjectReference ref, boolean im * @param ref The vehicle to be rerouted. * @param reroutingType The type of the requested rerouting. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void reroute(@Nonnull TCSObjectReference ref, - @Nonnull ReroutingType reroutingType) - throws ObjectUnknownException, KernelRuntimeException { - } + void reroute(@Nonnull TCSObjectReference ref, + @Nonnull ReroutingType reroutingType) + throws ObjectUnknownException, KernelRuntimeException; /** * Explicitly trigger a rerouting for all vehicles. @@ -99,9 +96,7 @@ default void reroute(@Nonnull TCSObjectReference ref, * * @param reroutingType The type of rerouting. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void rerouteAll(@Nonnull ReroutingType reroutingType) { - } + void rerouteAll(@Nonnull ReroutingType reroutingType); /** * Assign the referenced transport order (to its intended vehicle) now. @@ -116,9 +111,6 @@ default void rerouteAll(@Nonnull ReroutingType reroutingType) { * to its intended vehicle. * @throws KernelRuntimeException In case there is an exception executing this method. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void assignNow(TCSObjectReference ref) - throws ObjectUnknownException, TransportOrderAssignmentException, KernelRuntimeException { - throw new UnsupportedOperationException("Not supported yet."); - } + void assignNow(TCSObjectReference ref) + throws ObjectUnknownException, TransportOrderAssignmentException, KernelRuntimeException; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalPlantModelService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalPlantModelService.java index 90e6922ee..a6112aadb 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalPlantModelService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalPlantModelService.java @@ -7,15 +7,10 @@ */ package org.opentcs.components.kernel.services; -import jakarta.annotation.Nullable; import java.util.Set; -import org.opentcs.access.KernelRuntimeException; import org.opentcs.data.ObjectUnknownException; -import org.opentcs.data.TCSObjectReference; -import org.opentcs.data.model.Location; import org.opentcs.data.model.TCSResource; import org.opentcs.data.model.TCSResourceReference; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods the plant model service must provide which are not accessible to remote @@ -53,18 +48,4 @@ void loadPlantModel() */ void savePlantModel() throws IllegalStateException; - - /** - * Updates a location's reservation token. - * - * @param ref A reference to the location to be updated. - * @param token The location's new reservation token. - * @throws ObjectUnknownException If the referenced location does not exist. - * @throws KernelRuntimeException In case there is an exception executing this method. - * @deprecated Use {@code InternalPeripheralService.updatePeripheralReservationToken()} instead. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - void updateLocationReservationToken(TCSObjectReference ref, @Nullable String token) - throws ObjectUnknownException, KernelRuntimeException; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalTransportOrderService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalTransportOrderService.java index 117d32b97..eed6190a2 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalTransportOrderService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalTransportOrderService.java @@ -14,7 +14,6 @@ import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.OrderSequence; import org.opentcs.data.order.TransportOrder; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods the transport order service must provide which are not accessible to remote @@ -89,12 +88,9 @@ void updateTransportOrderNextDriveOrder(TCSObjectReference ref) * @param index The new index. * @throws ObjectUnknownException If the referenced transport order does not exist. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updateTransportOrderCurrentRouteStepIndex(TCSObjectReference ref, - int index) - throws ObjectUnknownException { - throw new UnsupportedOperationException("Not supported, yet."); - } + void updateTransportOrderCurrentRouteStepIndex(TCSObjectReference ref, + int index) + throws ObjectUnknownException; /** * Updates a transport order's processing vehicle. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalVehicleService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalVehicleService.java index 3ead1682b..e959aab04 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalVehicleService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/InternalVehicleService.java @@ -18,7 +18,6 @@ import org.opentcs.data.order.OrderSequence; import org.opentcs.data.order.TransportOrder; import org.opentcs.drivers.vehicle.LoadHandlingDevice; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Declares the methods the vehicle service must provide which are not accessible to remote peers. @@ -121,21 +120,6 @@ void updateVehicleProcState(TCSObjectReference ref, Vehicle.ProcState s void updateVehicleRechargeOperation(TCSObjectReference ref, String rechargeOperation) throws ObjectUnknownException; - /** - * Updates a vehicle's index of the last route step travelled for the current drive order of its - * current transport order. - * - * @param ref A reference to the vehicle to be modified. - * @param index The new index. - * @throws ObjectUnknownException If the referenced vehicle does not exist. - * @deprecated Use {@link InternalTransportOrderService#updateTransportOrderCurrentRouteStepIndex( - * org.opentcs.data.TCSObjectReference, int)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void updateVehicleRouteProgressIndex(TCSObjectReference ref, int index) - throws ObjectUnknownException; - /** * Updates a vehicle's claimed resources. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/PlantModelService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/PlantModelService.java index e05da804e..5ebc7bdb0 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/PlantModelService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/PlantModelService.java @@ -16,7 +16,6 @@ import org.opentcs.data.model.Location; import org.opentcs.data.model.Path; import org.opentcs.data.model.PlantModel; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides methods concerning the plant model. @@ -86,8 +85,6 @@ void updateLocationLock(TCSObjectReference ref, boolean locked) * @throws ObjectUnknownException If the referenced path does not exist. * @throws KernelRuntimeException In case there is an exception executing this method. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updatePathLock(TCSObjectReference ref, boolean locked) - throws ObjectUnknownException, KernelRuntimeException { - } + void updatePathLock(TCSObjectReference ref, boolean locked) + throws ObjectUnknownException, KernelRuntimeException; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/RouterService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/RouterService.java index cab90bff4..9fafd063c 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/RouterService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/RouterService.java @@ -11,56 +11,18 @@ import java.util.Set; import org.opentcs.access.KernelRuntimeException; import org.opentcs.components.kernel.Router; -import org.opentcs.data.ObjectUnknownException; import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Path; import org.opentcs.data.model.Point; import org.opentcs.data.model.TCSResourceReference; import org.opentcs.data.model.Vehicle; import org.opentcs.data.order.Route; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides methods concerning the {@link Router}. */ public interface RouterService { - /** - * Updates a path's lock state. - *

- * If called within the kernel application, this method is supposed to be called only on the - * kernel executor thread. - *

- * - * @param ref A reference to the path to be updated. - * @param locked Indicates whether the path is to be locked ({@code true}) or unlocked - * ({@code false}). - * @throws ObjectUnknownException If the referenced path does not exist. - * @throws KernelRuntimeException In case there is an exception executing this method. - * @deprecated Use - * {@link PlantModelService#updatePathLock(org.opentcs.data.TCSObjectReference, boolean)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void updatePathLock(TCSObjectReference ref, boolean locked) - throws ObjectUnknownException, KernelRuntimeException; - - /** - * Notifies the router that the topology has changed in a significant way and needs to be - * re-evaluated. - *

- * If called within the kernel application, this method is supposed to be called only on the - * kernel executor thread. - *

- * - * @throws KernelRuntimeException In case there is an exception executing this method. - * @deprecated Use {@link #updateRoutingTopology(java.util.Set)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void updateRoutingTopology() - throws KernelRuntimeException; - /** * Notifies the router that the topology has changed with respect to the given paths and needs to * be re-evaluated. @@ -73,34 +35,7 @@ void updateRoutingTopology() * path references results in the router updating the entire routing topology. * @throws KernelRuntimeException In case there is an exception executing this method. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updateRoutingTopology(Set> refs) - throws KernelRuntimeException { - updateRoutingTopology(); - } - - /** - * Computes routes for the given vehicle from a source point to a set of destination points. - *

- * If called within the kernel application, this method is supposed to be called only on the - * kernel executor thread. - *

- * - * @param vehicleRef A reference to the vehicle to calculate the routes for. - * @param sourcePointRef A reference to the source point. - * @param destinationPointRefs A set of references to the destination points. - * @return A map of destination points to the corresponding computed routes or {@code null}, if - * no route could be determined for a specific destination point. - * @throws KernelRuntimeException In case there is an exception executing this method. - * @deprecated Use {@link #computeRoutes(org.opentcs.data.TCSObjectReference, - * org.opentcs.data.TCSObjectReference, java.util.Set, java.util.Set)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - Map, Route> computeRoutes( - TCSObjectReference vehicleRef, - TCSObjectReference sourcePointRef, - Set> destinationPointRefs) + void updateRoutingTopology(Set> refs) throws KernelRuntimeException; /** diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/SchedulerService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/SchedulerService.java deleted file mode 100644 index df547beaf..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/SchedulerService.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.components.kernel.services; - -import org.opentcs.access.KernelRuntimeException; -import org.opentcs.access.SchedulerAllocationState; -import org.opentcs.components.kernel.Scheduler; -import org.opentcs.data.model.Vehicle; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Provides methods concerning the {@link Scheduler}. - * - * @deprecated - */ -@Deprecated -@ScheduledApiChange(when = "6.0", details = "Will be removed.") -public interface SchedulerService { - - /** - * Returns the current state of resource allocations. - * - * @return The current state of resource allocations. - * @throws KernelRuntimeException In case there is an exception executing this method. - * @deprecated Acquire allocations from {@link Vehicle}, instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - SchedulerAllocationState fetchSchedulerAllocations() - throws KernelRuntimeException; -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/VehicleService.java b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/VehicleService.java index 1af530ad3..33ab315e8 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/VehicleService.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/kernel/services/VehicleService.java @@ -17,7 +17,6 @@ import org.opentcs.drivers.vehicle.VehicleCommAdapterDescription; import org.opentcs.drivers.vehicle.management.VehicleAttachmentInformation; import org.opentcs.drivers.vehicle.management.VehicleProcessModelTO; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides methods concerning {@link Vehicle}s. @@ -160,9 +159,6 @@ void updateVehicleAllowedOrderTypes(TCSObjectReference ref, * is currently claiming/allocating resources. * @throws KernelRuntimeException In case there is an exception executing this method. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void updateVehicleEnvelopeKey(TCSObjectReference ref, String envelopeKey) - throws ObjectUnknownException, IllegalArgumentException, KernelRuntimeException { - throw new UnsupportedOperationException("Not supported yet."); - } + void updateVehicleEnvelopeKey(TCSObjectReference ref, String envelopeKey) + throws ObjectUnknownException, IllegalArgumentException, KernelRuntimeException; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/LocationTheme.java b/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/LocationTheme.java index 798c33373..fb0941802 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/LocationTheme.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/LocationTheme.java @@ -12,7 +12,6 @@ import org.opentcs.data.model.Location; import org.opentcs.data.model.LocationType; import org.opentcs.data.model.visualization.LocationRepresentation; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides a location theme. @@ -36,8 +35,5 @@ public interface LocationTheme { * @return The image for the give location. */ @Nonnull - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default Image getImageFor(@Nonnull Location location, @Nonnull LocationType locationType) { - return getImageFor(LocationRepresentation.NONE); - } + Image getImageFor(@Nonnull Location location, @Nonnull LocationType locationType); } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/OrderCategorySuggestions.java b/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/OrderCategorySuggestions.java deleted file mode 100644 index 1bf4a06bf..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/components/plantoverview/OrderCategorySuggestions.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.components.plantoverview; - -import java.util.Set; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Implementations of this class provide suggestions for transport order categories. - * - * @deprecated Use {@link OrderTypeSuggestions} instead. - */ -@Deprecated -@ScheduledApiChange(when = "5.0", details = "Will be removed.") -public interface OrderCategorySuggestions { - - /** - * Returns a set of categories that can be assigned to a transport order. - * - * @return A set of categories that can be assigned to a transport order. - */ - Set getCategorySuggestions(); -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Group.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/Group.java deleted file mode 100644 index 3994f6d69..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Group.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashSet; -import java.util.Map; -import static java.util.Objects.requireNonNull; -import java.util.Set; -import org.opentcs.data.ObjectHistory; -import org.opentcs.data.TCSObject; -import org.opentcs.data.TCSObjectReference; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * An aggregation of model elements. - * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class Group - extends TCSObject - implements Serializable { - - /** - * The model elements aggregated in this group. - */ - private final Set> members; - - /** - * Creates a new, empty group. - * - * @param name This group's name. - */ - public Group(String name) { - super(name); - this.members = new HashSet<>(); - } - - private Group(String name, - Map properties, - ObjectHistory history, - Set> members) { - super(name, properties, history); - this.members = new HashSet<>(requireNonNull(members, "members")); - } - - @Override - public Group withProperty(String key, String value) { - return new Group(getName(), - propertiesWith(key, value), - getHistory(), - members); - } - - @Override - public Group withProperties(Map properties) { - return new Group(getName(), - properties, - getHistory(), - members); - } - - @Override - public TCSObject withHistoryEntry(ObjectHistory.Entry entry) { - return new Group(getName(), - getProperties(), - getHistory().withEntryAppended(entry), - members); - } - - @Override - public TCSObject withHistory(ObjectHistory history) { - return new Group(getName(), - getProperties(), - history, - members); - } - - /** - * Returns an unmodifiable set of all members of this group. - * - * @return An unmodifiable set of all members of this group. - */ - public Set> getMembers() { - return Collections.unmodifiableSet(members); - } - - /** - * Creates a copy of this object, with the given members. - * - * @param members The value to be set in the copy. - * @return A copy of this object, differing in the given value. - */ - public Group withMembers(Set> members) { - return new Group(getName(), - getProperties(), - getHistory(), - members); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/PlantModel.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/PlantModel.java index b26f98808..10266e219 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/PlantModel.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/model/PlantModel.java @@ -9,11 +9,13 @@ import jakarta.annotation.Nonnull; import java.io.Serializable; +import java.util.List; import java.util.Map; import static java.util.Objects.requireNonNull; import java.util.Set; +import org.opentcs.data.model.visualization.Layer; +import org.opentcs.data.model.visualization.LayerGroup; import org.opentcs.data.model.visualization.VisualLayout; -import org.opentcs.util.annotations.ScheduledApiChange; /** * An immutable representation of a complete plant model's state. @@ -29,7 +31,7 @@ public class PlantModel private final Set locations; private final Set blocks; private final Set vehicles; - private final Set visualLayouts; + private final VisualLayout visualLayout; /** * Creates a new instance. @@ -37,7 +39,8 @@ public class PlantModel * @param name The model's name. */ public PlantModel(@Nonnull String name) { - this(name, Map.of(), Set.of(), Set.of(), Set.of(), Set.of(), Set.of(), Set.of(), Set.of()); + this(name, Map.of(), Set.of(), Set.of(), Set.of(), Set.of(), Set.of(), Set.of(), + defaultVisualLayout()); } private PlantModel(@Nonnull String name, @@ -48,7 +51,7 @@ private PlantModel(@Nonnull String name, @Nonnull Set locations, @Nonnull Set blocks, @Nonnull Set vehicles, - @Nonnull Set visualLayouts) { + @Nonnull VisualLayout visualLayout) { this.name = requireNonNull(name, "name"); this.properties = Map.copyOf(properties); this.points = Set.copyOf(points); @@ -57,7 +60,7 @@ private PlantModel(@Nonnull String name, this.locations = Set.copyOf(locations); this.blocks = Set.copyOf(blocks); this.vehicles = Set.copyOf(vehicles); - this.visualLayouts = Set.copyOf(visualLayouts); + this.visualLayout = requireNonNull(visualLayout, "visualLayout"); } /** @@ -95,7 +98,7 @@ public PlantModel withProperties(Map properties) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -123,7 +126,7 @@ public PlantModel withPoints(@Nonnull Set points) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -151,7 +154,7 @@ public PlantModel withPaths(@Nonnull Set paths) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -179,7 +182,7 @@ public PlantModel withLocationTypes(@Nonnull Set locationTypes) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -207,7 +210,7 @@ public PlantModel withLocations(@Nonnull Set locations) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -235,7 +238,7 @@ public PlantModel withBlocks(@Nonnull Set blocks) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** @@ -263,39 +266,26 @@ public PlantModel withVehicles(@Nonnull Set vehicles) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } /** - * Returns the visual layouts in this plant model. + * Returns the visual layout in this plant model. * - * @return The visual layouts in this plant model. + * @return The visual layout in this plant model. */ @Nonnull - public Set getVisualLayouts() { - return visualLayouts; + public VisualLayout getVisualLayout() { + return visualLayout; } /** - * Returns a copy of this plant model, with its visual layouts replaced by the given ones. + * Returns a copy of this plant model, with its visual layout replaced by the given one. * - * @param visualLayouts The visual layouts to be set. - * @return A copy of this plant model, with its visual layouts replaced by the given ones. - * @deprecated Use {@link #withVisualLayouts(java.util.Set)} instead. + * @param visualLayout The visual layout to be set. + * @return A copy of this plant model, with its visual layout replaced by the given one. */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public PlantModel withVisuaLayouts(@Nonnull Set visualLayouts) { - return withVisualLayouts(visualLayouts); - } - - /** - * Returns a copy of this plant model, with its visual layouts replaced by the given ones. - * - * @param visualLayouts The visual layouts to be set. - * @return A copy of this plant model, with its visual layouts replaced by the given ones. - */ - public PlantModel withVisualLayouts(@Nonnull Set visualLayouts) { + public PlantModel withVisualLayout(@Nonnull VisualLayout visualLayout) { return new PlantModel(name, properties, points, @@ -304,7 +294,7 @@ public PlantModel withVisualLayouts(@Nonnull Set visualLayouts) { locations, blocks, vehicles, - visualLayouts); + visualLayout); } @Override @@ -318,7 +308,32 @@ public String toString() { + ", locations=" + locations + ", blocks=" + blocks + ", vehicles=" + vehicles - + ", visualLayouts=" + visualLayouts + + ", visualLayout=" + visualLayout + '}'; } + + private static VisualLayout defaultVisualLayout() { + return new VisualLayout(ModelConstants.DEFAULT_VISUAL_LAYOUT_NAME) + .withLayers( + List.of( + new Layer( + ModelConstants.DEFAULT_LAYER_ID, + ModelConstants.DEFAULT_LAYER_ORDINAL, + true, + ModelConstants.DEFAULT_LAYER_NAME, + ModelConstants.DEFAULT_LAYER_GROUP_ID + ) + ) + ) + .withLayerGroups( + List.of( + new LayerGroup( + ModelConstants.DEFAULT_LAYER_GROUP_ID, + ModelConstants.DEFAULT_LAYER_GROUP_NAME, + true + ) + ) + ); + } + } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Point.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/Point.java index 112f1b4c4..fa84532f3 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Point.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/model/Point.java @@ -16,7 +16,6 @@ import org.opentcs.data.ObjectHistory; import org.opentcs.data.TCSObject; import org.opentcs.data.TCSObjectReference; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A point in the driving course at which a {@link Vehicle} may be located. @@ -188,78 +187,6 @@ public Point withPose(Pose pose) { layout); } - /** - * Returns the physical coordinates of this point in mm. - * - * @return The physical coordinates of this point in mm. - * @deprecated Use {@link #getPose()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public Triple getPosition() { - return pose.getPosition(); - } - - /** - * Creates a copy of this object, with the given position. - * - * @param position The value to be set in the copy. - * @return A copy of this object, differing in the given value. - * @deprecated Use {@link #withPose(org.opentcs.data.model.Pose)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public Point withPosition(Triple position) { - return new Point(getName(), - getProperties(), - getHistory(), - pose.withPosition(position), - type, - incomingPaths, - outgoingPaths, - attachedLinks, - occupyingVehicle, - vehicleEnvelopes, - layout); - } - - /** - * Returns a vehicle's orientation angle at this position. - * (-360..360, or Double.NaN, if an orientation angle is not - * specified for this point.) - * - * @return The vehicle's orientation angle when it's at this position. - * @deprecated Use {@link #getPose()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public double getVehicleOrientationAngle() { - return pose.getOrientationAngle(); - } - - /** - * Creates a copy of this object, with the given vehicle orientation angle. - * - * @param vehicleOrientationAngle The value to be set in the copy. - * @return A copy of this object, differing in the given value. - * @deprecated Use {@link #withPose(org.opentcs.data.model.Pose)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public Point withVehicleOrientationAngle(double vehicleOrientationAngle) { - return new Point(getName(), - getProperties(), - getHistory(), - pose.withOrientationAngle(vehicleOrientationAngle), - type, - incomingPaths, - outgoingPaths, - attachedLinks, - occupyingVehicle, - vehicleEnvelopes, - layout); - } - /** * Returns this point's type. * @@ -498,15 +425,6 @@ public Point withLayout(Layout layout) { */ public enum Type { - /** - * Indicates a position at which a vehicle is expected to report in. - * Halting or even parking at such a position is not allowed. - * - * @deprecated Support for report points will be removed. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - REPORT_POSITION, /** * Indicates a position at which a vehicle may halt temporarily, e.g. for executing an * operation. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Vehicle.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/Vehicle.java index dffa23f5a..f2d63d150 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/Vehicle.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/model/Vehicle.java @@ -25,7 +25,6 @@ import org.opentcs.drivers.vehicle.LoadHandlingDevice; import static org.opentcs.util.Assertions.checkArgument; import static org.opentcs.util.Assertions.checkInRange; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Describes a vehicle's current state. @@ -34,14 +33,6 @@ public class Vehicle extends TCSObject implements Serializable { - /** - * A value indicating that no route steps have been travelled for the current drive order, yet. - * - * @deprecated Use {@link TransportOrder#ROUTE_STEP_INDEX_DEFAULT} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public static final int ROUTE_INDEX_DEFAULT = -1; /** * The key for a property to store the class name of the preferred communication adapter (factory) * for this vehicle. @@ -116,11 +107,6 @@ public class Vehicle * The set of transport order types this vehicle is allowed to process. */ private final Set allowedOrderTypes; - /** - * The index of the last route step travelled for the current drive order of the current transport - * order. - */ - private final int routeProgressIndex; /** * The resources this vehicle has claimed for future allocation. */ @@ -176,7 +162,6 @@ public Vehicle(String name) { this.transportOrder = null; this.orderSequence = null; this.allowedOrderTypes = new HashSet<>(Arrays.asList(OrderConstants.TYPE_ANY)); - this.routeProgressIndex = ROUTE_INDEX_DEFAULT; this.claimedResources = List.of(); this.allocatedResources = List.of(); this.state = State.UNKNOWN; @@ -207,7 +192,6 @@ private Vehicle(String name, TCSObjectReference transportOrder, TCSObjectReference orderSequence, Set allowedOrderTypes, - int routeProgressIndex, List>> claimedResources, List>> allocatedResources, State state, @@ -243,7 +227,6 @@ private Vehicle(String name, this.transportOrder = transportOrder; this.orderSequence = orderSequence; this.allowedOrderTypes = requireNonNull(allowedOrderTypes, "allowedOrderTypes"); - this.routeProgressIndex = routeProgressIndex; this.claimedResources = requireNonNull(claimedResources, "claimedResources"); this.allocatedResources = requireNonNull(allocatedResources, "allocatedResources"); this.state = requireNonNull(state, "state"); @@ -282,7 +265,6 @@ public Vehicle withProperty(String key, String value) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -315,7 +297,6 @@ public Vehicle withProperties(Map properties) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -348,7 +329,6 @@ public TCSObject withHistoryEntry(ObjectHistory.Entry entry) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -381,7 +361,6 @@ public TCSObject withHistory(ObjectHistory history) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -428,7 +407,6 @@ public Vehicle withEnergyLevel(int energyLevel) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -528,7 +506,6 @@ public Vehicle withEnergyLevelCritical(int energyLevelCritical) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -577,7 +554,6 @@ public Vehicle withEnergyLevelGood(int energyLevelGood) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -624,7 +600,6 @@ public Vehicle withEnergyLevelFullyRecharged(int energyLevelFullyRecharged) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -672,7 +647,6 @@ public Vehicle withEnergyLevelSufficientlyRecharged(int energyLevelSufficientlyR transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -721,7 +695,6 @@ public Vehicle withRechargeOperation(String rechargeOperation) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -768,7 +741,6 @@ public Vehicle withLoadHandlingDevices(List loadHandlingDevi transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -815,7 +787,6 @@ public Vehicle withMaxVelocity(int maxVelocity) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -862,7 +833,6 @@ public Vehicle withMaxReverseVelocity(int maxReverseVelocity) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -920,7 +890,6 @@ public Vehicle withState(State state) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -976,7 +945,6 @@ public Vehicle withIntegrationLevel(IntegrationLevel integrationLevel) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1023,7 +991,6 @@ public Vehicle withPaused(boolean paused) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1073,7 +1040,6 @@ public Vehicle withProcState(ProcState procState) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1121,7 +1087,6 @@ public Vehicle withLength(int length) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1171,7 +1136,6 @@ public Vehicle withTransportOrder(TCSObjectReference transportOr transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1221,7 +1185,6 @@ public Vehicle withOrderSequence(TCSObjectReference orderSequence transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1268,62 +1231,6 @@ public Vehicle withAllowedOrderTypes(Set allowedOrderTypes) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, - claimedResources, - allocatedResources, - state, - integrationLevel, - paused, - currentPosition, - nextPosition, - precisePosition, - orientationAngle, - energyLevel, - loadHandlingDevices, - envelopeKey, - layout); - } - - /** - * Returns the index of the last route step travelled for the current drive - * order of the current transport order. - * - * @return The index of the last route step travelled for the current drive - * order of the current transport order. - * @deprecated Use {@link TransportOrder#getCurrentRouteStepIndex()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public int getRouteProgressIndex() { - return routeProgressIndex; - } - - /** - * Creates a copy of this object, with the given route progress index. - * - * @param routeProgressIndex The value to be set in the copy. - * @return A copy of this object, differing in the given value. - * @deprecated Use {@link TransportOrder#withCurrentRouteStepIndex(int)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public Vehicle withRouteProgressIndex(int routeProgressIndex) { - return new Vehicle(getName(), - getProperties(), - getHistory(), - length, - energyLevelGood, - energyLevelCritical, - energyLevelFullyRecharged, - energyLevelSufficientlyRecharged, - maxVelocity, - maxReverseVelocity, - rechargeOperation, - procState, - transportOrder, - orderSequence, - allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1370,7 +1277,6 @@ public Vehicle withClaimedResources(List>> claimedRe transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1417,7 +1323,6 @@ public Vehicle withAllocatedResources(List>> allocat transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1466,7 +1371,6 @@ public Vehicle withCurrentPosition(TCSObjectReference currentPosition) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1515,7 +1419,6 @@ public Vehicle withNextPosition(TCSObjectReference nextPosition) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1564,7 +1467,6 @@ public Vehicle withPrecisePosition(Triple precisePosition) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1613,7 +1515,6 @@ public Vehicle withOrientationAngle(double orientationAngle) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1661,7 +1562,6 @@ public Vehicle withEnvelopeKey(@Nullable String envelopeKey) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1708,7 +1608,6 @@ public Vehicle withLayout(Layout layout) { transportOrder, orderSequence, allowedOrderTypes, - routeProgressIndex, claimedResources, allocatedResources, state, @@ -1750,7 +1649,6 @@ public String toString() { + ", loadHandlingDevices=" + loadHandlingDevices + ", length=" + length + ", transportOrder=" + transportOrder - + ", routeProgressIndex=" + routeProgressIndex + ", claimedResources=" + claimedResources + ", allocatedResources=" + allocatedResources + ", orderSequence=" + orderSequence diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ElementPropKeys.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ElementPropKeys.java index d4614c3f3..a34cac25c 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ElementPropKeys.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ElementPropKeys.java @@ -8,8 +8,7 @@ package org.opentcs.data.model.visualization; /** - * Defines some reserved/commonly used property keys of - * {@link LayoutElement LayoutElements}. + * Defines some reserved/commonly used property keys of elements in a {@link VisualLayout}. */ public interface ElementPropKeys { diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageData.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageData.java deleted file mode 100644 index 7ae94582e..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageData.java +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model.visualization; - -import java.io.Serializable; -import java.util.Objects; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Generic image data that can be stored along with a layout. - * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ImageData - implements Serializable { - - /** - * The binary data describing the actual image. - */ - private byte[] content = new byte[0]; - /** - * The type of image. - * Examples for possible values: "SVG", "WMF", "PNG", "JPEG". - */ - private String contentFormat = ""; - /** - * A label/name for this image. - */ - private String label = ""; - - /** - * Creates a new ImageData. - */ - public ImageData() { - // Do nada. - } - - /** - * Returns the binary data describing the actual image. - * - * @return The binary data describing the actual image. - */ - public byte[] getContent() { - return content; - } - - /** - * Sets the binary data describing the actual image. - * - * @param content The new binary data. - */ - public void setContent(byte[] content) { - this.content = Objects.requireNonNull(content, "content is null"); - } - - /** - * Returns the content type/format of this image. - * Examples for possible values: "SVG", "WMF", "PNG", "JPEG". - * - * @return The type of this image. - */ - public String getContentFormat() { - return contentFormat; - } - - /** - * Sets this image's content type/format. - * - * @param contentFormat The new type/format. - */ - public void setContentFormat(String contentFormat) { - this.contentFormat = Objects.requireNonNull(contentFormat, - "contentFormat is null"); - } - - /** - * Returns a label/name for this image. - * - * @return A label/name for this image. - */ - public String getLabel() { - return label; - } - - /** - * Sets a label/name for this image. - * - * @param label The new label. - */ - public void setLabel(String label) { - this.label = Objects.requireNonNull(label, "label is null"); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageLayoutElement.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageLayoutElement.java deleted file mode 100644 index 2888f589d..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ImageLayoutElement.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model.visualization; - -import java.io.Serializable; -import java.util.Objects; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A layout element describing an image to be displayed. - * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ImageLayoutElement - extends LayoutElement - implements Serializable { - - /** - * The image to be displayed. - */ - private ImageData imageData = new ImageData(); - - /** - * Creates a new ImageLayoutElement. - */ - public ImageLayoutElement() { - // Do nada. - } - - /** - * Returns this layout element's image data. - * - * @return This layout element's image data. - */ - public ImageData getImageData() { - return imageData; - } - - /** - * Sets this layout element's image data. - * - * @param imageData The new image data. - */ - public void setImageData(ImageData imageData) { - this.imageData = Objects.requireNonNull(imageData, "imageData is null"); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/LayoutElement.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/LayoutElement.java deleted file mode 100644 index 5d896b1ac..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/LayoutElement.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model.visualization; - -import java.io.Serializable; -import java.util.Map; -import static java.util.Objects.requireNonNull; -import java.util.TreeMap; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A generic layout element that is to be displayed. - * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public abstract class LayoutElement - implements Serializable { - - /** - * A set of generic key-value pairs associated with this layout element. - */ - private Map properties = new TreeMap<>(); - /** - * The layer on which this layout element is to be displayed. - */ - private int layer; - - /** - * Creates a new LayoutElement. - */ - protected LayoutElement() { - // Do nada. - } - - /** - * Returns the layer on which this layout element is to be displayed. - * - * @return The layer on which this layout element is to be displayed. - */ - public int getLayer() { - return layer; - } - - /** - * Sets the layer on which this layout element is to be displayed. - * - * @param layer The new layer. - */ - public void setLayer(int layer) { - this.layer = layer; - } - - /** - * Returns this layout element's properties, a generic set of key-value pairs - * that can contain basically any information describing this element. - * - * @return This layout element's properties. - */ - public Map getProperties() { - return properties; - } - - /** - * Sets this layout element's properties. - * - * @param properties The new properties. - */ - public void setProperties(Map properties) { - this.properties = requireNonNull(properties, "properties"); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ModelLayoutElement.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ModelLayoutElement.java deleted file mode 100644 index 07e9f7b0f..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ModelLayoutElement.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model.visualization; - -import java.io.Serializable; -import java.util.Objects; -import org.opentcs.data.TCSObjectReference; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A layout element describing the way in which a model element is to be - * displayed. - * - * @deprecated Will be removed in favor of dedicated layout classes in corresponding TCS data - * objects. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ModelLayoutElement - extends LayoutElement - implements Serializable { - - /** - * The model object to be visualized. - */ - private final TCSObjectReference visualizedObject; - - /** - * Creates a new ModelLayoutElement for the given model element. - * - * @param visualizedObject The model element this layout element corresponds - * to. - */ - public ModelLayoutElement(TCSObjectReference visualizedObject) { - this.visualizedObject = Objects.requireNonNull(visualizedObject, - "visualizedObject is null"); - } - - /** - * Returns a reference to the object this layout element corresponds to. - * - * @return A reference to the object this layout element corresponds to. - */ - public TCSObjectReference getVisualizedObject() { - return visualizedObject; - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ShapeLayoutElement.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ShapeLayoutElement.java deleted file mode 100644 index 755470b64..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/ShapeLayoutElement.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.data.model.visualization; - -import java.io.Serializable; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * A layout element describing a geometrical shape to be displayed. - *

- * This class is simply a marker class for identifying shape elements. The - * actual description of the geometrical shape is contained in the element's - * properties. - *

- * - * @deprecated Will be removed. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class ShapeLayoutElement - extends LayoutElement - implements Serializable { - - /** - * Creates a new ShapeLayoutElement. - */ - public ShapeLayoutElement() { - // Do nada. - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/VisualLayout.java b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/VisualLayout.java index c6a6d1af0..3a09be399 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/VisualLayout.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/model/visualization/VisualLayout.java @@ -9,14 +9,11 @@ import java.io.Serializable; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import java.util.Map; import static java.util.Objects.requireNonNull; -import java.util.Set; import org.opentcs.data.ObjectHistory; import org.opentcs.data.TCSObject; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Describes the visual attributes of a model. @@ -33,12 +30,6 @@ public class VisualLayout * This layout's scale on the Y axis (in mm/pixel). */ private final double scaleY; - /** - * VisualLayout elements describing the visualization of a model and additional - * elements that need to be displayed. - */ - @Deprecated - private final Set layoutElements; /** * The layers in this model. */ @@ -57,7 +48,6 @@ public VisualLayout(String name) { super(name); this.scaleX = 50.0; this.scaleY = 50.0; - this.layoutElements = Set.of(); this.layers = List.of(); this.layerGroups = List.of(); } @@ -67,19 +57,16 @@ public VisualLayout(String name) { * * @param name This visual layout's name. */ - @SuppressWarnings("deprecation") private VisualLayout(String name, Map properties, ObjectHistory history, double scaleX, double scaleY, - Set layoutElements, List layers, List layerGroups) { super(name, properties, history); this.scaleX = scaleX; this.scaleY = scaleY; - this.layoutElements = new HashSet<>(requireNonNull(layoutElements, "layoutElements")); this.layers = new ArrayList<>(requireNonNull(layers, "layers")); this.layerGroups = new ArrayList<>(requireNonNull(layerGroups, "layerGroups")); } @@ -91,7 +78,6 @@ public VisualLayout withProperty(String key, String value) { getHistory(), scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -103,7 +89,6 @@ public VisualLayout withProperties(Map properties) { getHistory(), scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -115,7 +100,6 @@ public TCSObject withHistoryEntry(ObjectHistory.Entry entry) { getHistory().withEntryAppended(entry), scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -127,7 +111,6 @@ public TCSObject withHistory(ObjectHistory history) { history, scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -153,7 +136,6 @@ public VisualLayout withScaleX(double scaleX) { getHistory(), scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -179,37 +161,6 @@ public VisualLayout withScaleY(double scaleY) { getHistory(), scaleX, scaleY, - layoutElements, - layers, - layerGroups); - } - - /** - * Returns the layout elements describing the visualization of a model. - * - * @return The layout elements describing the visualization of a model. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public Set getLayoutElements() { - return layoutElements; - } - - /** - * Creates a copy of this object, with the given layoutElements. - * - * @param layoutElements The value to be set in the copy. - * @return A copy of this object, differing in the given value. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VisualLayout withLayoutElements(Set layoutElements) { - return new VisualLayout(getName(), - getProperties(), - getHistory(), - scaleX, - scaleY, - layoutElements, layers, layerGroups); } @@ -235,7 +186,6 @@ public VisualLayout withLayers(List layers) { getHistory(), scaleX, scaleY, - layoutElements, layers, layerGroups); } @@ -261,7 +211,6 @@ public VisualLayout withLayerGroups(List layerGroups) { getHistory(), scaleX, scaleY, - layoutElements, layers, layerGroups); } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/data/peripherals/PeripheralOperation.java b/openTCS-API-Base/src/main/java/org/opentcs/data/peripherals/PeripheralOperation.java index 8cfb97af6..3fbec0c2b 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/data/peripherals/PeripheralOperation.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/data/peripherals/PeripheralOperation.java @@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull; import org.opentcs.data.model.Location; import org.opentcs.data.model.TCSResourceReference; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Describes an operation that is to be executed by a peripheral device. @@ -55,10 +54,7 @@ public PeripheralOperation(@Nonnull TCSResourceReference location, boolean completionRequired) { this.location = requireNonNull(location, "location"); this.operation = requireNonNull(operation, "operation"); - requireNonNull(executionTrigger, "executionTrigger"); - this.executionTrigger = (executionTrigger == ExecutionTrigger.BEFORE_MOVEMENT) - ? ExecutionTrigger.AFTER_ALLOCATION - : executionTrigger; + this.executionTrigger = requireNonNull(executionTrigger, "executionTrigger"); this.completionRequired = completionRequired; } @@ -111,14 +107,6 @@ public enum ExecutionTrigger { * The operation is to be triggered immediately. */ IMMEDIATE, - /** - * The operation is to be triggered before the movement. - * - * @deprecated Use {@link #AFTER_ALLOCATION} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - BEFORE_MOVEMENT, /** * The operation is to be triggered after the allocation of the path / before the movement. */ diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/BasicPeripheralCommAdapter.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/BasicPeripheralCommAdapter.java index f83f7cd94..8a4ce311e 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/BasicPeripheralCommAdapter.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/BasicPeripheralCommAdapter.java @@ -10,7 +10,6 @@ import static java.util.Objects.requireNonNull; import org.opentcs.data.model.PeripheralInformation; import org.opentcs.drivers.peripherals.management.PeripheralProcessModelEvent; -import org.opentcs.util.annotations.ScheduledApiChange; import org.opentcs.util.event.EventHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -137,13 +136,6 @@ public PeripheralProcessModel getProcessModel() { return processModel; } - @Override - @ScheduledApiChange(when = "6.0", details = "Implementation will be removed") - public void abortJob() { - setProcessModel(getProcessModel().withState(PeripheralInformation.State.IDLE)); - sendProcessModelChangedEvent(PeripheralProcessModel.Attribute.STATE); - } - protected void setProcessModel(PeripheralProcessModel processModel) { this.processModel = processModel; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralCommAdapter.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralCommAdapter.java index 1e6e77480..f3c123601 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralCommAdapter.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralCommAdapter.java @@ -11,7 +11,6 @@ import org.opentcs.components.Lifecycle; import org.opentcs.data.peripherals.PeripheralJob; import org.opentcs.util.ExplainedBoolean; -import org.opentcs.util.annotations.ScheduledApiChange; /** * This interface declares the methods that a driver communicating with and controlling a @@ -75,9 +74,7 @@ public interface PeripheralCommAdapter * The kernel will ignore calls to the callback after calling this method. *

*/ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed") - default void abortJob() { - } + void abortJob(); /** * Executes the given {@link PeripheralAdapterCommand}. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralController.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralController.java index fe64dc3f4..dd7c5227f 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralController.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralController.java @@ -11,7 +11,6 @@ import org.opentcs.components.Lifecycle; import org.opentcs.data.peripherals.PeripheralJob; import org.opentcs.util.ExplainedBoolean; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides high-level methods for the system to control a peripheral device. @@ -40,9 +39,7 @@ void process(@Nonnull PeripheralJob job, @Nonnull PeripheralJobCallback callback * The kernel will ignore calls to the callback after calling this method. *

*/ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed") - default void abortJob() { - } + void abortJob(); /** * Checks if the peripheral device would be able to process the given job, taking into account diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralJobCallback.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralJobCallback.java index 923971014..7c059ebe0 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralJobCallback.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/PeripheralJobCallback.java @@ -10,39 +10,12 @@ import jakarta.annotation.Nonnull; import org.opentcs.data.TCSObjectReference; import org.opentcs.data.peripherals.PeripheralJob; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A callback used to inform about the successful or failed completion of jobs. */ public interface PeripheralJobCallback { - /** - * Called on successful completion of a job. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param job The job that was successfully completed. - * @deprecated Use {@link #peripheralJobFinished(org.opentcs.data.TCSObjectReference)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void peripheralJobFinished(@Nonnull PeripheralJob job); - - /** - * Called on failed completion of a job. - *

- * This method is supposed to be called only from the kernel executor thread. - *

- * - * @param job The job whose completion has failed. - * @deprecated Use {@link #peripheralJobFailed(org.opentcs.data.TCSObjectReference)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - void peripheralJobFailed(@Nonnull PeripheralJob job); - /** * Called on successful completion of a job. *

@@ -51,9 +24,7 @@ public interface PeripheralJobCallback { * * @param ref A reference to the peripheral job that was successfully completed. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void peripheralJobFinished(@Nonnull TCSObjectReference ref) { - } + void peripheralJobFinished(@Nonnull TCSObjectReference ref); /** * Called on failed completion of a job. @@ -63,7 +34,5 @@ default void peripheralJobFinished(@Nonnull TCSObjectReference re * * @param ref A reference to the peripheral job whose completion has failed. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void peripheralJobFailed(@Nonnull TCSObjectReference ref) { - } + void peripheralJobFailed(@Nonnull TCSObjectReference ref); } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/management/PeripheralAttachmentInformation.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/management/PeripheralAttachmentInformation.java index c8fbbcf6d..087cf06ef 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/management/PeripheralAttachmentInformation.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/peripherals/management/PeripheralAttachmentInformation.java @@ -14,7 +14,6 @@ import org.opentcs.data.model.Location; import org.opentcs.data.model.TCSResourceReference; import org.opentcs.drivers.peripherals.PeripheralCommAdapterDescription; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Describes which communication adapter a location is currently associated with. @@ -52,21 +51,6 @@ public PeripheralAttachmentInformation( this.attachedCommAdapter = requireNonNull(attachedCommAdapter, "attachedCommAdapter"); } - /** - * Creates a new instance. - * - * @param locationReference The location this attachment information belongs to. - * @param attachedCommAdapter The comm adapter attached to the referenced location. - * @deprecated Use three-parameter constructor, instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - public PeripheralAttachmentInformation( - @Nonnull TCSResourceReference locationReference, - @Nonnull PeripheralCommAdapterDescription attachedCommAdapter) { - this(locationReference, List.of(), attachedCommAdapter); - } - /** * Returns the location this attachment information belongs to. * @@ -85,7 +69,11 @@ public TCSResourceReference getLocationReference() { */ public PeripheralAttachmentInformation withLocationReference( TCSResourceReference locationReference) { - return new PeripheralAttachmentInformation(locationReference, attachedCommAdapter); + return new PeripheralAttachmentInformation( + locationReference, + availableCommAdapters, + attachedCommAdapter + ); } /** @@ -129,7 +117,11 @@ public PeripheralCommAdapterDescription getAttachedCommAdapter() { */ public PeripheralAttachmentInformation withAttachedCommAdapter( @Nonnull PeripheralCommAdapterDescription attachedCommAdapter) { - return new PeripheralAttachmentInformation(locationReference, attachedCommAdapter); + return new PeripheralAttachmentInformation( + locationReference, + availableCommAdapters, + attachedCommAdapter + ); } @Override diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/BasicVehicleCommAdapter.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/BasicVehicleCommAdapter.java index 9f9da27d3..5317b7410 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/BasicVehicleCommAdapter.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/BasicVehicleCommAdapter.java @@ -12,7 +12,6 @@ import java.util.Objects; import static java.util.Objects.requireNonNull; import java.util.Queue; -import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ScheduledExecutorService; import org.opentcs.data.model.Vehicle; @@ -20,7 +19,6 @@ import static org.opentcs.drivers.vehicle.VehicleProcessModel.Attribute.COMMAND_EXECUTED; import org.opentcs.drivers.vehicle.management.VehicleProcessModelTO; import static org.opentcs.util.Assertions.checkInRange; -import org.opentcs.util.annotations.ScheduledApiChange; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,13 +47,9 @@ public abstract class BasicVehicleCommAdapter */ private final VehicleProcessModel vehicleModel; /** - * The number of commands this adapter's command queue accepts. + * The number of commands this comm adapter accepts. Must be at least 1. */ - private final int commandQueueCapacity; - /** - * The maximum number of orders to be sent to a vehicle. - */ - private final int sentQueueCapacity; + private final int commandsCapacity; /** * The string to recognize as a recharge operation. */ @@ -63,7 +57,7 @@ public abstract class BasicVehicleCommAdapter /** * The executor to run tasks on. */ - private final Executor executor; + private final ScheduledExecutorService executor; /** * Indicates whether this adapter is initialized. */ @@ -86,64 +80,6 @@ public abstract class BasicVehicleCommAdapter */ private final Queue sentQueue = new LinkedBlockingQueue<>(); - /** - * Creates a new instance. - * - * @param vehicleModel An observable model of the vehicle's and its comm adapter's attributes. - * @param commandQueueCapacity The number of commands this comm adapter's command queue accepts. - * Must be at least 1. - * @param sentQueueCapacity The maximum number of orders to be sent to a vehicle. - * Must be at least 1. - * @param rechargeOperation The string to recognize as a recharge operation. - * @param executor The executor to run tasks on. - * @deprecated Use more specific constructor instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - public BasicVehicleCommAdapter(VehicleProcessModel vehicleModel, - int commandQueueCapacity, - int sentQueueCapacity, - String rechargeOperation, - Executor executor) { - this.vehicleModel = requireNonNull(vehicleModel, "vehicleModel"); - this.commandQueueCapacity = checkInRange(commandQueueCapacity, - 1, - Integer.MAX_VALUE, - "commandQueueCapacity"); - this.sentQueueCapacity = checkInRange(sentQueueCapacity, - 1, - Integer.MAX_VALUE, - "sentQueueCapacity"); - this.rechargeOperation = requireNonNull(rechargeOperation, "rechargeOperation"); - this.executor = requireNonNull(executor, "executor"); - } - - /** - * Creates a new instance. - * - * @param vehicleModel An observable model of the vehicle's and its comm adapter's attributes. - * @param commandQueueCapacity The number of commands this comm adapter's command queue accepts. - * Must be at least 1. - * @param sentQueueCapacity The maximum number of orders to be sent to a vehicle. - * Must be at least 1. - * @param rechargeOperation The string to recognize as a recharge operation. - * @param executor The executor to run tasks on. - * @deprecated Use constructor with {@code commandsCapacity} parameter instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - public BasicVehicleCommAdapter(VehicleProcessModel vehicleModel, - int commandQueueCapacity, - int sentQueueCapacity, - String rechargeOperation, - ScheduledExecutorService executor) { - this(vehicleModel, - commandQueueCapacity, - sentQueueCapacity, - rechargeOperation, - (Executor) executor); - } - /** * Creates a new instance. * @@ -156,11 +92,13 @@ public BasicVehicleCommAdapter(VehicleProcessModel vehicleModel, int commandsCapacity, String rechargeOperation, ScheduledExecutorService executor) { - this(vehicleModel, - commandsCapacity, - commandsCapacity, - rechargeOperation, - (Executor) executor); + this.vehicleModel = requireNonNull(vehicleModel, "vehicleModel"); + this.commandsCapacity = checkInRange(commandsCapacity, + 1, + Integer.MAX_VALUE, + "commandsCapacity"); + this.rechargeOperation = requireNonNull(rechargeOperation, "rechargeOperation"); + this.executor = requireNonNull(executor, "executor"); } /** @@ -266,29 +204,17 @@ public VehicleProcessModelTO createTransferableProcessModel() { @Override public synchronized Queue getUnsentCommands() { - return getCommandQueue(); + return commandQueue; } @Override public synchronized Queue getSentCommands() { - return getSentQueue(); + return sentQueue; } @Override public int getCommandsCapacity() { - return getCommandQueueCapacity(); - } - - @Override - @Deprecated - public int getCommandQueueCapacity() { - return commandQueueCapacity; - } - - @Override - @Deprecated - public synchronized Queue getCommandQueue() { - return commandQueue; + return commandsCapacity; } @Override @@ -296,18 +222,6 @@ public boolean canAcceptNextCommand() { return (getUnsentCommands().size() + getSentCommands().size()) < getCommandsCapacity(); } - @Override - @Deprecated - public int getSentQueueCapacity() { - return sentQueueCapacity; - } - - @Override - @Deprecated - public synchronized Queue getSentQueue() { - return sentQueue; - } - @Override public String getRechargeOperation() { return rechargeOperation; @@ -369,8 +283,7 @@ public String getName() { * * @return The executor to run tasks on. */ - @ScheduledApiChange(when = "6.0", details = "Will return ScheduledExectorService instead") - public Executor getExecutor() { + public ScheduledExecutorService getExecutor() { return executor; } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/LoadHandlingDevice.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/LoadHandlingDevice.java index 3baad1a87..5a621e346 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/LoadHandlingDevice.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/LoadHandlingDevice.java @@ -10,7 +10,6 @@ import java.io.Serializable; import java.util.Objects; import static java.util.Objects.requireNonNull; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Describes a single load handling device on a vehicle. @@ -40,18 +39,6 @@ public LoadHandlingDevice(String label, boolean full) { this.full = full; } - /** - * Creates a new LoadHandlingDevice as a copy of the given one. - * - * @param original The instance to be copied. - * @deprecated Copying this immutable data structure does not make sense. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed", when = "6.0") - public LoadHandlingDevice(LoadHandlingDevice original) { - this(original.label, original.full); - } - /** * Returns this load handling device's name/label. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/MovementCommand.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/MovementCommand.java index 077e73359..ec947bd77 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/MovementCommand.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/MovementCommand.java @@ -10,58 +10,173 @@ import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; import java.util.Map; +import java.util.Objects; +import static java.util.Objects.requireNonNull; import org.opentcs.data.model.Location; import org.opentcs.data.model.Point; import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.Route; -import org.opentcs.data.order.Route.Step; import org.opentcs.data.order.TransportOrder; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A command for moving a step. */ -@ScheduledApiChange(when = "6.0", details = "Will become a class with 'with' methods.") -public interface MovementCommand { +public class MovementCommand { /** * A constant indicating there is no operation to be executed after moving. */ - String NO_OPERATION = DriveOrder.Destination.OP_NOP; + public static final String NO_OPERATION = DriveOrder.Destination.OP_NOP; /** - * A constant indicating the vehicle should basically just move to a point - * without a location associated to it. + * A constant indicating the vehicle should basically just move to a point without a location + * associated to it. */ - String MOVE_OPERATION = DriveOrder.Destination.OP_MOVE; + public static final String MOVE_OPERATION = DriveOrder.Destination.OP_MOVE; /** * A constant for parking the vehicle. (Again, basically doing nothing at the destination.) */ - String PARK_OPERATION = DriveOrder.Destination.OP_PARK; + public static final String PARK_OPERATION = DriveOrder.Destination.OP_PARK; + /** + * The transport order this movement belongs to. + */ + private final TransportOrder transportOrder; + /** + * The drive order this movement belongs to. + */ + private final DriveOrder driveOrder; + /** + * The step describing the movement. + */ + private final Route.Step step; + /** + * The operation to be executed after moving. + */ + private final String operation; + /** + * The location at which the operation is to be executed. + * May be null if the movement command's operation is considred an empty + * operation (i.e. is {@link #NO_OPERATION}, {@link #MOVE_OPERATION} or {@link #PARK_OPERATION}). + */ + private final Location opLocation; + /** + * Indicates whether this movement is the final one for the drive order it belongs to. + */ + private final boolean finalMovement; + /** + * The destination position of the whole drive order. + */ + private final Point finalDestination; + /** + * The destination location of the whole drive order. + */ + private final Location finalDestinationLocation; + /** + * The operation to be executed at the destination position. + */ + private final String finalOperation; + /** + * Properties of the order this command is part of. + */ + private final Map properties; + + /** + * Creates a new instance. + * + * @param transportOrder The transport order this movement belongs to. + * @param driveOrder The drive order this movement belongs to. + * @param step The step describing the movement. + * @param operation The operation to be executed after moving. + * @param opLocation The location at which the operation is to be executed. + * May be null if the movement command's operation is considred an empty + * operation (i.e. is {@link #NO_OPERATION}, {@link #MOVE_OPERATION} or {@link #PARK_OPERATION}). + * @param finalMovement Indicates whether this movement is the final one in the drive order it + * belongs to. + * @param finalDestinationLocation The destination location of the whole drive order. + * @param finalDestination The destination position of the whole drive order. + * @param finalOperation The operation to be executed at the destination position. + * @param properties Properties of the order this command is part of. + */ + public MovementCommand(@Nonnull TransportOrder transportOrder, + @Nonnull DriveOrder driveOrder, + @Nonnull Route.Step step, + @Nonnull String operation, + @Nullable Location opLocation, + boolean finalMovement, + @Nullable Location finalDestinationLocation, + @Nonnull Point finalDestination, + @Nonnull String finalOperation, + @Nonnull Map properties) { + this.transportOrder = requireNonNull(transportOrder, "transportOrder"); + this.driveOrder = requireNonNull(driveOrder, "driveOrder"); + this.step = requireNonNull(step, "step"); + this.operation = requireNonNull(operation, "operation"); + this.finalMovement = finalMovement; + this.finalDestinationLocation = finalDestinationLocation; + this.finalDestination = requireNonNull(finalDestination, "finalDestination"); + this.finalOperation = requireNonNull(finalOperation, "finalOperation"); + this.properties = requireNonNull(properties, "properties"); + if (opLocation == null && !isEmptyOperation(operation)) { + throw new NullPointerException("opLocation is null while operation is not considered empty"); + } + this.opLocation = opLocation; + } /** * Returns the transport order this movement belongs to. * * @return The transport order this movement belongs to. */ - TransportOrder getTransportOrder(); + @Nonnull + public TransportOrder getTransportOrder() { + return transportOrder; + } + + /** + * Creates a copy of this object, with the given transport order. + * + * @param transportOrder The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withTransportOrder(@Nonnull TransportOrder transportOrder) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } /** * Returns the drive order this movement belongs to. * * @return The drive order this movement belongs to. */ - DriveOrder getDriveOrder(); + @Nonnull + public DriveOrder getDriveOrder() { + return driveOrder; + } /** - * Returns the route that this movement belongs to. + * Creates a copy of this object, with the given drive order. * - * @return The route that this movement belongs to. - * @deprecated Use the route provided as part of {@link #getDriveOrder()}, instead. + * @param driveOrder The value to be set in the copy. + * @return A copy of this object, differing in the given value. */ - @Deprecated - @Nonnull - default Route getRoute() { - return getDriveOrder().getRoute(); + public MovementCommand withDriveOrder(@Nonnull DriveOrder driveOrder) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); } /** @@ -70,7 +185,28 @@ default Route getRoute() { * @return The step describing the movement. */ @Nonnull - Step getStep(); + public Route.Step getStep() { + return step; + } + + /** + * Creates a copy of this object, with the given step. + * + * @param step The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withStep(@Nonnull Route.Step step) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } /** * Returns the operation to be executed after moving. @@ -78,52 +214,132 @@ default Route getRoute() { * @return The operation to be executed after moving. */ @Nonnull - String getOperation(); + public String getOperation() { + return operation; + } /** - * Checks whether an operation is to be executed in addition to moving or not. + * Creates a copy of this object, with the given operation. * - * @return true if, and only if, no operation is to be executed. - * @deprecated Use {@link #hasEmptyOperation()} instead. + * @param operation The value to be set in the copy. + * @return A copy of this object, differing in the given value. */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - boolean isWithoutOperation(); + public MovementCommand withOperation(@Nonnull String operation) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } /** * Indicates whether an operation is to be executed in addition to moving or not. * * @return true if, and only if, no operation is to be executed. */ - default boolean hasEmptyOperation() { - return isWithoutOperation(); + public boolean hasEmptyOperation() { + return isEmptyOperation(operation); } /** - * Returns the location at which the operation is to be executed. (May be - * null if operation is NO_OPERATION.) + * Returns the location at which the operation is to be executed. + *

+ * May be null if the movement command's operation is considred an empty + * operation (i.e. is {@link #NO_OPERATION}, {@link #MOVE_OPERATION} or {@link #PARK_OPERATION}). + *

* * @return The location at which the operation is to be executed. */ @Nullable - Location getOpLocation(); + public Location getOpLocation() { + return opLocation; + } + + /** + * Creates a copy of this object, with the given location at which the operation is to be + * executed. + *

+ * May be null if the movement command's operation is considred an empty + * operation (i.e. is {@link #NO_OPERATION}, {@link #MOVE_OPERATION} or {@link #PARK_OPERATION}). + *

+ * + * @param opLocation The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withOpLocation(@Nullable Location opLocation) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } /** * Indicates whether this movement is the final one in the driver order it belongs to. * * @return true if, and only if, this movement is the final one. */ - boolean isFinalMovement(); + public boolean isFinalMovement() { + return finalMovement; + } /** - * Returns the final destination of the drive order this MovementCommand was - * created for. + * Creates a copy of this object, with the given final movement flag. * - * @return The final destination of the drive order this MovementCommand was - * created for. + * @param finalMovement The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withFinalMovement(boolean finalMovement) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } + + /** + * Returns the final destination of the drive order this MovementCommand was created for. + * + * @return The final destination of the drive order this MovementCommand was created for. */ @Nonnull - Point getFinalDestination(); + public Point getFinalDestination() { + return finalDestination; + } + + /** + * Creates a copy of this object, with the given final destination. + * + * @param finalDestination The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withFinalDestination(@Nonnull Point finalDestination) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } /** * Returns the destination location of the whole drive order. @@ -131,17 +347,96 @@ default boolean hasEmptyOperation() { * @return The destination location of the whole drive order. */ @Nullable - Location getFinalDestinationLocation(); + public Location getFinalDestinationLocation() { + return finalDestinationLocation; + } /** - * Returns the operation to be executed at the final destination - * position. + * Creates a copy of this object, with the given final destination location. * - * @return The operation to be executed at the final destination - * position. + * @param finalDestinationLocation The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withFinalDestinationLocation(@Nullable Location finalDestinationLocation) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } + + /** + * Returns the operation to be executed at the final destination position. + * + * @return The operation to be executed at the final destination position. */ @Nonnull - String getFinalOperation(); + public String getFinalOperation() { + return finalOperation; + } + + /** + * Creates a copy of this object, with the given final operation. + * + * @param finalOperation The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withFinalOperation(@Nonnull String finalOperation) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } + + /** + * Returns the properties of the order this command is part of. + * + * @return The properties of the order this command is part of. + */ + @Nonnull + public Map getProperties() { + return properties; + } + + /** + * Creates a copy of this object, with the given properties. + * + * @param properties The value to be set in the copy. + * @return A copy of this object, differing in the given value. + */ + public MovementCommand withProperties(@Nonnull Map properties) { + return new MovementCommand(transportOrder, + driveOrder, + step, + operation, + opLocation, + finalMovement, + finalDestinationLocation, + finalDestination, + finalOperation, + properties); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof MovementCommand)) { + return false; + } + + MovementCommand other = (MovementCommand) o; + return step.equals(other.getStep()) && operation.equals(other.getOperation()); + } /** * Compares the given movement command to this movement command, ignoring rerouting-related @@ -151,15 +446,46 @@ default boolean hasEmptyOperation() { * @return {@code true}, if the given movement command is equal to this movement command * (ignoring rerouting-related properties), otherwise {@code false}. */ - default boolean equalsInMovement(MovementCommand command) { - return false; + public boolean equalsInMovement(MovementCommand command) { + if (command == null) { + return false; + } + + return this.getStep().equalsInMovement(command.getStep()) + && Objects.equals(this.getOperation(), command.getOperation()); + } + + @Override + public int hashCode() { + return step.hashCode() ^ operation.hashCode(); + } + + @Override + public String toString() { + return "MovementCommand{" + + "transportOrder=" + getTransportOrder() + + ", driveOrder=" + getDriveOrder() + + ", step=" + getStep() + + ", operation=" + getOperation() + + ", opLocation=" + getOpLocation() + + ", finalMovement=" + isFinalMovement() + + ", finalDestination=" + getFinalDestination() + + ", finalDestinationLocation=" + getFinalDestinationLocation() + + ", finalOperation=" + getFinalOperation() + + ", properties=" + getProperties() + + '}'; } /** - * Returns the properties of the order this command is part of. + * Checks whether an operation means something is to be done in addition to moving or not. * - * @return The properties of the order this command is part of. + * @param operation The operation to be checked. + * @return true if, and only if, the vehicle should only move with the given + * operation. */ - @Nonnull - Map getProperties(); + private boolean isEmptyOperation(String operation) { + return NO_OPERATION.equals(operation) + || MOVE_OPERATION.equals(operation) + || PARK_OPERATION.equals(operation); + } } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleCommAdapter.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleCommAdapter.java index 745ac5c6f..a63e9e582 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleCommAdapter.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleCommAdapter.java @@ -9,15 +9,12 @@ import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; -import java.util.List; import java.util.Queue; -import java.util.stream.Collectors; import org.opentcs.components.Lifecycle; import org.opentcs.components.kernel.services.VehicleService; import org.opentcs.data.order.TransportOrder; import org.opentcs.drivers.vehicle.management.VehicleProcessModelTO; import org.opentcs.util.ExplainedBoolean; -import org.opentcs.util.annotations.ScheduledApiChange; /** * This interface declares the methods that a driver communicating with and @@ -76,10 +73,7 @@ public interface VehicleCommAdapter * @return This adapter's queue of unsent commands. * @see #getCommandsCapacity() */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default Queue getUnsentCommands() { - return getCommandQueue(); - } + Queue getUnsentCommands(); /** * Returns this adapter's queue of sent commands. @@ -89,12 +83,9 @@ default Queue getUnsentCommands() { *

* * @return This adapter's queue of sent commands. - * @see #getCommandQueueCapacity() + * @see #getCommandsCapacity() */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default Queue getSentCommands() { - return getSentQueue(); - } + Queue getSentCommands(); /** * Indicates how many commands this comm adapter accepts. @@ -110,42 +101,7 @@ default Queue getSentCommands() { * * @return The number of commands this comm adapter accepts. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default int getCommandsCapacity() { - return getCommandQueueCapacity(); - } - - /** - * Indicates how many commands this comm adapter accepts. - *

- * This capacity considers both the {@link #getCommandQueue() command queue} and the - * {@link #getSentQueue() sent queue}. This means that the number of elements in both queues - * combined must not exceed this number. - *

- * - * @return The number of commands this comm adapter accepts. - * @deprecated Use {@link #getCommandsCapacity()} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - int getCommandQueueCapacity(); - - /** - * Returns this adapter's command queue. - *

- * This queue contains {@link MovementCommand}s that the comm adapter received from the - * {@link VehicleController} it's associated with. When a command is sent to the vehicle, the - * command is removed from this queue and added to the {@link #getSentQueue() sent queue}. - *

- * - * @return This adapter's command queue. - * @see #getCommandQueueCapacity() - * @deprecated Use {@link #getUnsentCommands()} instead. - */ - @Nonnull - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - Queue getCommandQueue(); + int getCommandsCapacity(); /** * Checks whether this comm adapter can accept the next (i.e. one more) @@ -153,36 +109,7 @@ default int getCommandsCapacity() { * * @return {@code true}, if this adapter can accept another command, otherwise {@code false}. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default boolean canAcceptNextCommand() { - return (getCommandQueue().size() + getSentQueue().size()) < getCommandQueueCapacity(); - } - - /** - * Returns the capacity of this adapter's {@link #getSentQueue() sent queue}. - * - * @return The capacity of this adapter's sent queue. - * @deprecated Will be removed without a replacement, as this method no longer seems to serve any - * purpose. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - int getSentQueueCapacity(); - - /** - * Returns a queue containing the commands that this adapter has sent to the vehicle already but - * which have not yet been processed by it. - * - * @return A queue containing the commands that this adapter has sent to the vehicle already but - * which have not yet been processed by it. - * @see #getSentQueueCapacity() - * @see #getCommandQueueCapacity() - * @deprecated Use {@link #getSentCommands()} instead. - */ - @Nonnull - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - Queue getSentQueue(); + boolean canAcceptNextCommand(); /** * Returns the string the comm adapter recognizes as a recharge operation. @@ -226,31 +153,7 @@ default boolean canAcceptNextCommand() { * process the given order. */ @Nonnull - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default ExplainedBoolean canProcess(@Nonnull TransportOrder order) { - return canProcess( - order.getFutureDriveOrders().stream() - .map(driveOrder -> driveOrder.getDestination().getOperation()) - .collect(Collectors.toList()) - ); - } - - /** - * Checks if the vehicle would be able to process the given sequence of operations, taking into - * account its current state. - * - * @param operations A sequence of operations that might have to be processed as part of a - * transport order. - * @return An ExplainedBoolean indicating whether the vehicle would be able to - * process every single operation in the list (in the given order). - * @deprecated Use {@link #canProcess(org.opentcs.data.order.TransportOrder)} instead. - */ - @Nonnull - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default ExplainedBoolean canProcess(@Nonnull List operations) { - return new ExplainedBoolean(false, "VehicleCommAdapter default implementation"); - } + ExplainedBoolean canProcess(@Nonnull TransportOrder order); /** * Notifies the implementation that the vehicle's paused state in the kernel has changed. @@ -259,9 +162,7 @@ default ExplainedBoolean canProcess(@Nonnull List operations) { * * @param paused The vehicle's new paused state. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void onVehiclePaused(boolean paused) { - } + void onVehiclePaused(boolean paused); /** * Processes a generic message to the communication adapter. diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleController.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleController.java index cc887b092..5755c4b14 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleController.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleController.java @@ -9,31 +9,20 @@ import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; -import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Queue; import java.util.Set; -import java.util.stream.Collectors; import org.opentcs.components.Lifecycle; -import org.opentcs.components.kernel.Scheduler; import org.opentcs.data.model.TCSResource; import org.opentcs.data.model.Vehicle; -import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.TransportOrder; import org.opentcs.util.ExplainedBoolean; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Provides high-level methods for the kernel to control a vehicle. */ -@ScheduledApiChange( - when = "6.0", - details = "Will not extend Scheduler.Client any more; should be done by implementations." -) public interface VehicleController - extends Lifecycle, - Scheduler.Client { + extends Lifecycle { /** * Sets/Updates the current transport order for the vehicle associated with this controller. @@ -59,49 +48,8 @@ public interface VehicleController * vehicle's current position is unknown or the resources for the vehicle's current position may * not be allocated (in case of forced rerouting). */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void setTransportOrder(@Nonnull TransportOrder newOrder) - throws IllegalArgumentException { - } - - /** - * Sets the current drive order for the vehicle associated with this - * controller. - * - * @param newOrder The new drive order. - * @param orderProperties Properties of the transport order the new drive - * order is part of. - * @throws IllegalStateException If this controller already has a drive order. - * @deprecated Use {@link #setTransportOrder(org.opentcs.data.order.TransportOrder)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void setDriveOrder(@Nonnull DriveOrder newOrder, - @Nonnull Map orderProperties) - throws IllegalStateException { - } - - /** - * Updates the current drive order for the vehicle associated with this controller. - *

- * An update is only allowed, if the continuity of the current drive order is guaranteed. - * The continuity of the current drive order is guaranteed, if the routes of both the current - * drive order and the {@code newOrder} match to the point where the vehicle associated with this - * controller is currently reported at. Beyond that point the routes may diverge. - *

- * - * @param newOrder The new drive order. - * @param orderProperties Properties of the transport order the new drive order is part of. - * @throws IllegalStateException If the {@code newOrder} would not guarantee the current drive - * order's continuity. - * @deprecated Use {@link #setTransportOrder(org.opentcs.data.order.TransportOrder)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void updateDriveOrder(@Nonnull DriveOrder newOrder, - @Nonnull Map orderProperties) - throws IllegalStateException { - } + void setTransportOrder(@Nonnull TransportOrder newOrder) + throws IllegalArgumentException; /** * Notifies the controller that the current transport order is to be aborted. @@ -114,49 +62,7 @@ default void updateDriveOrder(@Nonnull DriveOrder newOrder, * (Note that this is unsafe, as the vehicle might be moving and clearing the command queue might * overlap with the vehicle's movement/progress.) */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void abortTransportOrder(boolean immediate) { - if (immediate) { - clearDriveOrder(); - } - else { - abortDriveOrder(); - } - } - - /** - * Resets the current drive order for the vehicle associated with this controller. - * At the end of this method, {@link #clearCommandQueue()} is called implicitly. - * - * @deprecated Use {@link #abortTransportOrder(boolean)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void clearDriveOrder() { - } - - /** - * Notifies the controller that the current drive order is to be aborted. - * After receiving this notification, the controller should not send any - * further movement commands to the vehicle. - * - * @deprecated Use {@link #abortTransportOrder(boolean)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void abortDriveOrder() { - } - - /** - * Clears the associated vehicle's command queue and frees all resources reserved for the removed - * commands/movements. - * - * @deprecated Use {@link #abortTransportOrder(boolean)} instead. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default void clearCommandQueue() { - } + void abortTransportOrder(boolean immediate); /** * Checks if the vehicle would be able to process the given transport order, taking into account @@ -167,30 +73,7 @@ default void clearCommandQueue() { * process given order. */ @Nonnull - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default ExplainedBoolean canProcess(@Nonnull TransportOrder order) { - return canProcess( - order.getFutureDriveOrders().stream() - .map(driveOrder -> driveOrder.getDestination().getOperation()) - .collect(Collectors.toList()) - ); - } - - /** - * Checks if the vehicle would be able to process the given sequence of operations, taking into - * account its current state. - * - * @param operations A sequence of operations that might appear in future commands. - * @return An ExplainedBoolean indicating whether the vehicle would be able to - * process every single operation in the list (in the given order). - * @deprecated Use {@link #canProcess(org.opentcs.data.order.TransportOrder)} instead. - */ - @Nonnull - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - default ExplainedBoolean canProcess(@Nonnull List operations) { - return new ExplainedBoolean(false, "VehicleController default implementation"); - } + ExplainedBoolean canProcess(@Nonnull TransportOrder order); /** * Notifies the implementation that the vehicle's paused state in the kernel has changed. @@ -199,9 +82,7 @@ default ExplainedBoolean canProcess(@Nonnull List operations) { * * @param paused The vehicle's new paused state. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default void onVehiclePaused(boolean paused) { - } + void onVehiclePaused(boolean paused); /** * Delivers a generic message to the communication adapter. @@ -234,10 +115,7 @@ default void onVehiclePaused(boolean paused) { * {@link Optional#empty()} if there's no such command. */ @Nonnull - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default Optional getInteractionsPendingCommand() { - return Optional.empty(); - } + Optional getInteractionsPendingCommand(); /** * Checks if the given set of resources are safe to be allocated immediately by this @@ -247,8 +125,5 @@ default Optional getInteractionsPendingCommand() { * @return {@code true} if the given resources are safe to be allocated by this controller, * otherwise {@code false}. */ - @ScheduledApiChange(when = "6.0", details = "Default implementation will be removed.") - default boolean mayAllocateNow(@Nonnull Set> resources) { - return false; - } + boolean mayAllocateNow(@Nonnull Set> resources); } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleProcessModel.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleProcessModel.java index f6573d143..3336e4a90 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleProcessModel.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/VehicleProcessModel.java @@ -23,7 +23,6 @@ import org.opentcs.data.model.Triple; import org.opentcs.data.model.Vehicle; import org.opentcs.data.notification.UserNotification; -import org.opentcs.util.annotations.ScheduledApiChange; /** * An observable model of a vehicle's and its comm adapter's attributes. @@ -127,19 +126,6 @@ public void removePropertyChangeListener(PropertyChangeListener listener) { pcs.removePropertyChangeListener(listener); } - /** - * Returns a reference to the vehicle. - * - * @return A reference to the vehicle. - * @deprecated Use {@link #getReference()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - public TCSObjectReference getVehicleReference() { - return getReference(); - } - /** * Returns a reference to the vehicle. * @@ -247,19 +233,6 @@ public void setCommAdapterConnected(boolean commAdapterConnected) { commAdapterConnected); } - /** - * Returns the vehicle's current position. - * - * @return The position. - * @deprecated Use {@link #getPosition()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nullable - public String getVehiclePosition() { - return getPosition(); - } - /** * Returns the vehicle's current position. * @@ -270,18 +243,6 @@ public String getPosition() { return position; } - /** - * Updates the vehicle's current position. - * - * @param position The new position - * @deprecated Use {@link #setPosition(java.lang.String)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehiclePosition(@Nullable String position) { - setPosition(position); - } - /** * Updates the vehicle's current position. * @@ -297,19 +258,6 @@ public void setPosition(@Nullable String position) { position); } - /** - * Returns the vehicle's precise position. - * - * @return The vehicle's precise position. - * @deprecated Use {@link #getPrecisePosition()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nullable - public Triple getVehiclePrecisePosition() { - return getPrecisePosition(); - } - /** * Returns the vehicle's precise position. * @@ -320,18 +268,6 @@ public Triple getPrecisePosition() { return precisePosition; } - /** - * Sets the vehicle's precise position. - * - * @param position The new position. - * @deprecated Use {@link #setPrecisePosition(org.opentcs.data.model.Triple)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehiclePrecisePosition(@Nullable Triple position) { - setPrecisePosition(position); - } - /** * Sets the vehicle's precise position. * @@ -347,19 +283,6 @@ public void setPrecisePosition(@Nullable Triple position) { position); } - /** - * Returns the vehicle's current orientation angle. - * - * @return The vehicle's current orientation angle. - * @see Vehicle#getOrientationAngle() - * @deprecated Use {@link #getOrientationAngle()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public double getVehicleOrientationAngle() { - return getOrientationAngle(); - } - /** * Returns the vehicle's current orientation angle. * @@ -370,18 +293,6 @@ public double getOrientationAngle() { return orientationAngle; } - /** - * Sets the vehicle's current orientation angle. - * - * @param angle The new angle - * @deprecated Use {@link #setOrientationAngle(double)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleOrientationAngle(double angle) { - setOrientationAngle(angle); - } - /** * Sets the vehicle's current orientation angle. * @@ -396,18 +307,6 @@ public void setOrientationAngle(double angle) { angle); } - /** - * Returns the vehicle's current energy level. - * - * @return The vehicle's current energy level. - * @deprecated Use {@link #getEnergyLevel()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public int getVehicleEnergyLevel() { - return getEnergyLevel(); - } - /** * Returns the vehicle's current energy level. * @@ -417,18 +316,6 @@ public int getEnergyLevel() { return energyLevel; } - /** - * Sets the vehicle's current energy level. - * - * @param newLevel The new level. - * @deprecated Use {@link #setEnergyLevel(int)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleEnergyLevel(int newLevel) { - setEnergyLevel(newLevel); - } - /** * Sets the vehicle's current energy level. * @@ -443,19 +330,6 @@ public void setEnergyLevel(int newLevel) { newLevel); } - /** - * Returns the vehicle's load handling devices. - * - * @return The vehicle's load handling devices. - * @deprecated Use {@link #getLoadHandlingDevices()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - public List getVehicleLoadHandlingDevices() { - return getLoadHandlingDevices(); - } - /** * Returns the vehicle's load handling devices. * @@ -466,18 +340,6 @@ public List getLoadHandlingDevices() { return loadHandlingDevices; } - /** - * Sets the vehicle's load handling devices. - * - * @param devices The new devices - * @deprecated Use {@link #setLoadHandlingDevices(java.util.List)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleLoadHandlingDevices(@Nonnull List devices) { - setLoadHandlingDevices(devices); - } - /** * Sets the vehicle's load handling devices. * @@ -494,19 +356,6 @@ public void setLoadHandlingDevices(@Nonnull List devices) { devs); } - /** - * Sets a property of the vehicle. - * - * @param key The property's key. - * @param value The property's new value. - * @deprecated Use {@link #setProperty(java.lang.String, java.lang.String)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleProperty(@Nonnull String key, @Nullable String value) { - setProperty(key, value); - } - /** * Sets a property of the vehicle. * @@ -530,19 +379,6 @@ public void setProperty(@Nonnull String key, @Nullable String value) { new VehiclePropertyUpdate(key, value)); } - /** - * Returns the vehicle's current state. - * - * @return The state - * @deprecated Use {@link #getState()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - public Vehicle.State getVehicleState() { - return getState(); - } - /** * Returns the vehicle's current state. * @@ -553,18 +389,6 @@ public Vehicle.State getState() { return state; } - /** - * Sets the vehicle's current state. - * - * @param newState The new state - * @deprecated Use {@link #setState(org.opentcs.data.model.Vehicle.State)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleState(@Nonnull Vehicle.State newState) { - setState(newState); - } - /** * Sets the vehicle's current state. * @@ -588,18 +412,6 @@ else if (oldState == Vehicle.State.ERROR && newState != Vehicle.State.ERROR) { } } - /** - * Returns the vehicle's current length. - * - * @return The vehicle's current length. - * @deprecated Use {@link #getLength()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public int getVehicleLength() { - return getLength(); - } - /** * Returns the vehicle's current length. * @@ -609,18 +421,6 @@ public int getLength() { return length; } - /** - * Sets the vehicle's current length. - * - * @param length The new length. - * @deprecated Use {@link #setLength(int)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public void setVehicleLength(int length) { - setLength(length); - } - /** * Sets the vehicle's current length. * diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentEvent.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentEvent.java deleted file mode 100644 index 5ff62b988..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentEvent.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.drivers.vehicle.management; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import static java.util.Objects.requireNonNull; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Instances of this class represent events emitted by/for attaching comm adapters. - * - * @deprecated Use {@link VehicleAttachmentEvent} instead. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class AttachmentEvent - extends CommAdapterEvent - implements Serializable { - - /** - * The vehicle's name a comm adapter has been attached to. - */ - private final String vehicleName; - /** - * The {@link AttachmentInformation} to the actual attachment. - */ - private final AttachmentInformation updatedAttachmentInformation; - - /** - * Creates a new instance. - * - * @param vehicleName The vehicle's name a comm adapter has been attached to. - * @param updatedAttachmentInformation The information to the actual attachment. - */ - public AttachmentEvent(@Nonnull String vehicleName, - @Nonnull AttachmentInformation updatedAttachmentInformation) { - this.vehicleName = requireNonNull(vehicleName, "vehicleName"); - this.updatedAttachmentInformation = requireNonNull(updatedAttachmentInformation, - "updatedAttachmentInformation"); - } - - /** - * Returns the vehicle's name a comm adapter has been attached to. - * - * @return The vehicle's name a comm adapter has been attached to. - */ - public String getVehicleName() { - return vehicleName; - } - - /** - * Returns the {@link AttachmentInformation} to the actual attachment. - * - * @return The {@link AttachmentInformation} to the actual attachment. - */ - public AttachmentInformation getUpdatedAttachmentInformation() { - return updatedAttachmentInformation; - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentInformation.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentInformation.java deleted file mode 100644 index 57c9e8cea..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/AttachmentInformation.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.drivers.vehicle.management; - -import jakarta.annotation.Nonnull; -import java.io.Serializable; -import java.util.List; -import static java.util.Objects.requireNonNull; -import org.opentcs.data.TCSObjectReference; -import org.opentcs.data.model.Vehicle; -import org.opentcs.drivers.vehicle.VehicleCommAdapterDescription; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Describes which communication adapter a vehicle is currently associated with and which adapters - * are available. - * - * @deprecated Use {@link VehicleAttachmentInformation} instead. - */ -@Deprecated -@ScheduledApiChange(details = "Will be removed.", when = "6.0") -public class AttachmentInformation - implements Serializable { - - /** - * The vehicle this attachment information belongs to. - */ - private final TCSObjectReference vehicleReference; - /** - * The list of comm adapters available to be attached to the referenced vehicle. - */ - private final List availableCommAdapters; - /** - * The comm adapter attached to the referenced vehicle. - */ - private final VehicleCommAdapterDescription attachedCommAdapter; - - /** - * Creates a new instance. - * - * @param vehicleReference The vehicle this attachment information belongs to. - * @param availableCommAdapters The list of comm adapters available to be attached to the - * referenced vehicle. - * @param attachedCommAdapter The comm adapter attached to the referenced vehicle. - */ - public AttachmentInformation(@Nonnull TCSObjectReference vehicleReference, - @Nonnull List availableCommAdapters, - @Nonnull VehicleCommAdapterDescription attachedCommAdapter) { - this.vehicleReference = requireNonNull(vehicleReference, "vehicleReference"); - this.availableCommAdapters = requireNonNull(availableCommAdapters, "availableCommAdapters"); - this.attachedCommAdapter = requireNonNull(attachedCommAdapter, "attachedCommAdapter"); - } - - /** - * Returns the vehicle this attachment information belongs to. - * - * @return The vehicle this attachment information belongs to. - */ - @Nonnull - public TCSObjectReference getVehicleReference() { - return vehicleReference; - } - - /** - * Creates a copy of this object with the given vehicle reference. - * - * @param vehicleReference The new vehicle reference. - * @return A copy of this object, differing in the given vehicle reference. - */ - public AttachmentInformation withVehicleReference(TCSObjectReference vehicleReference) { - return new AttachmentInformation(vehicleReference, availableCommAdapters, attachedCommAdapter); - } - - /** - * Returns the list of comm adapters available to be attached to the referenced vehicle. - * - * @return The list of comm adapters available to be attached to the referenced vehicle. - */ - @Nonnull - public List getAvailableCommAdapters() { - return availableCommAdapters; - } - - /** - * Creates a copy of this object with the given available comm adapters. - * - * @param availableCommAdapters The new available comm adapters. - * @return A copy of this object, differing in the given available comm adapters. - */ - public AttachmentInformation withAvailableCommAdapters( - @Nonnull List availableCommAdapters) { - return new AttachmentInformation(vehicleReference, availableCommAdapters, attachedCommAdapter); - } - - /** - * Returns the comm adapter attached to the referenced vehicle. - * - * @return The comm adapter attached to the referenced vehicle. - */ - @Nonnull - public VehicleCommAdapterDescription getAttachedCommAdapter() { - return attachedCommAdapter; - } - - /** - * Creates a copy of this object with the given attached comm adapter. - * - * @param attachedCommAdapter The new attached comm adapter. - * @return A copy of this object, differing in the given attached comm adapter. - */ - public AttachmentInformation withAttachedCommAdapter( - @Nonnull VehicleCommAdapterDescription attachedCommAdapter) { - return new AttachmentInformation(vehicleReference, availableCommAdapters, attachedCommAdapter); - } -} diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentEvent.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentEvent.java index e6ffbfbe6..f8046ab99 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentEvent.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentEvent.java @@ -8,14 +8,24 @@ package org.opentcs.drivers.vehicle.management; import jakarta.annotation.Nonnull; -import org.opentcs.util.annotations.ScheduledApiChange; +import java.io.Serializable; +import static java.util.Objects.requireNonNull; /** * Instances of this class represent events emitted by/for attaching comm adapters. */ -@SuppressWarnings("deprecation") public class VehicleAttachmentEvent - extends AttachmentEvent { + extends CommAdapterEvent + implements Serializable { + + /** + * The vehicle's name a comm adapter has been attached to. + */ + private final String vehicleName; + /** + * The {@link VehicleAttachmentInformation} to the actual attachment. + */ + private final VehicleAttachmentInformation attachmentInformation; /** * Creates a new instance. @@ -25,19 +35,17 @@ public class VehicleAttachmentEvent */ public VehicleAttachmentEvent(@Nonnull String vehicleName, @Nonnull VehicleAttachmentInformation attachmentInformation) { - super(vehicleName, attachmentInformation); + this.vehicleName = requireNonNull(vehicleName, "vehicleName"); + this.attachmentInformation = requireNonNull(attachmentInformation, "attachmentInformation"); } /** - * {@inheritDoc} + * Returns the vehicle's name a comm adapter has been attached to. * - * @deprecated Use {@link #getAttachmentInformation()} instead. + * @return The vehicle's name a comm adapter has been attached to. */ - @Override - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public VehicleAttachmentInformation getUpdatedAttachmentInformation() { - return (VehicleAttachmentInformation) super.getUpdatedAttachmentInformation(); + public String getVehicleName() { + return vehicleName; } /** @@ -46,6 +54,6 @@ public VehicleAttachmentInformation getUpdatedAttachmentInformation() { * @return The {@link VehicleAttachmentInformation} to the actual attachment. */ public VehicleAttachmentInformation getAttachmentInformation() { - return getUpdatedAttachmentInformation(); + return attachmentInformation; } } diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentInformation.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentInformation.java index 820d34047..bcd4ffa58 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentInformation.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleAttachmentInformation.java @@ -9,6 +9,7 @@ import jakarta.annotation.Nonnull; import java.util.List; +import static java.util.Objects.requireNonNull; import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Vehicle; import org.opentcs.drivers.vehicle.VehicleCommAdapterDescription; @@ -17,9 +18,20 @@ * Describes which communication adapter a vehicle is currently associated with and which adapters * are available. */ -@SuppressWarnings("deprecation") -public class VehicleAttachmentInformation - extends AttachmentInformation { +public class VehicleAttachmentInformation { + + /** + * The vehicle this attachment information belongs to. + */ + private final TCSObjectReference vehicleReference; + /** + * The list of comm adapters available to be attached to the referenced vehicle. + */ + private final List availableCommAdapters; + /** + * The comm adapter attached to the referenced vehicle. + */ + private final VehicleCommAdapterDescription attachedCommAdapter; /** * Creates a new instance. @@ -33,7 +45,19 @@ public VehicleAttachmentInformation( @Nonnull TCSObjectReference vehicleReference, @Nonnull List availableCommAdapters, @Nonnull VehicleCommAdapterDescription attachedCommAdapter) { - super(vehicleReference, availableCommAdapters, attachedCommAdapter); + this.vehicleReference = requireNonNull(vehicleReference, "vehicleReference"); + this.availableCommAdapters = requireNonNull(availableCommAdapters, "availableCommAdapters"); + this.attachedCommAdapter = requireNonNull(attachedCommAdapter, "attachedCommAdapter"); + } + + /** + * Returns the vehicle this attachment information belongs to. + * + * @return The vehicle this attachment information belongs to. + */ + @Nonnull + public TCSObjectReference getVehicleReference() { + return vehicleReference; } /** @@ -42,7 +66,6 @@ public VehicleAttachmentInformation( * @param vehicleReference The new vehicle reference. * @return A copy of this object, differing in the given vehicle reference. */ - @Override public VehicleAttachmentInformation withVehicleReference( TCSObjectReference vehicleReference) { return new VehicleAttachmentInformation(vehicleReference, @@ -50,13 +73,22 @@ public VehicleAttachmentInformation withVehicleReference( getAttachedCommAdapter()); } + /** + * Returns the list of comm adapters available to be attached to the referenced vehicle. + * + * @return The list of comm adapters available to be attached to the referenced vehicle. + */ + @Nonnull + public List getAvailableCommAdapters() { + return availableCommAdapters; + } + /** * Creates a copy of this object with the given available comm adapters. * * @param availableCommAdapters The new available comm adapters. * @return A copy of this object, differing in the given available comm adapters. */ - @Override public VehicleAttachmentInformation withAvailableCommAdapters( @Nonnull List availableCommAdapters) { return new VehicleAttachmentInformation(getVehicleReference(), @@ -64,13 +96,22 @@ public VehicleAttachmentInformation withAvailableCommAdapters( getAttachedCommAdapter()); } + /** + * Returns the comm adapter attached to the referenced vehicle. + * + * @return The comm adapter attached to the referenced vehicle. + */ + @Nonnull + public VehicleCommAdapterDescription getAttachedCommAdapter() { + return attachedCommAdapter; + } + /** * Creates a copy of this object with the given attached comm adapter. * * @param attachedCommAdapter The new attached comm adapter. * @return A copy of this object, differing in the given attached comm adapter. */ - @Override public VehicleAttachmentInformation withAttachedCommAdapter( @Nonnull VehicleCommAdapterDescription attachedCommAdapter) { return new VehicleAttachmentInformation(getVehicleReference(), diff --git a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleProcessModelTO.java b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleProcessModelTO.java index 260abbb4c..42bf1ce7e 100644 --- a/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleProcessModelTO.java +++ b/openTCS-API-Base/src/main/java/org/opentcs/drivers/vehicle/management/VehicleProcessModelTO.java @@ -20,7 +20,6 @@ import org.opentcs.data.notification.UserNotification; import org.opentcs.drivers.vehicle.LoadHandlingDevice; import org.opentcs.drivers.vehicle.VehicleProcessModel; -import org.opentcs.util.annotations.ScheduledApiChange; /** * A serializable representation of a {@link VehicleProcessModel}. @@ -50,28 +49,10 @@ public class VehicleProcessModelTO public VehicleProcessModelTO() { } - /** - * @deprecated Use {@link #getName()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public String getVehicleName() { - return getName(); - } - public String getName() { return name; } - /** - * @deprecated Use {@link #setName(java.lang.String)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public VehicleProcessModelTO setVehicleName(@Nonnull String vehicleName) { - return setName(vehicleName); - } - public VehicleProcessModelTO setName(@Nonnull String name) { this.name = requireNonNull(name); return this; @@ -95,30 +76,11 @@ public VehicleProcessModelTO setCommAdapterConnected(boolean commAdapterConnecte return this; } - /** - * @deprecated Use {@link #getPosition()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nullable - public String getVehiclePosition() { - return getPosition(); - } - @Nullable public String getPosition() { return position; } - /** - * @deprecated Use {@link #setPosition(java.lang.String)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public VehicleProcessModelTO setVehiclePosition(@Nullable String vehiclePosition) { - return setPosition(vehiclePosition); - } - public VehicleProcessModelTO setPosition(@Nullable String position) { this.position = position; return this; @@ -173,30 +135,11 @@ public VehicleProcessModelTO setLoadHandlingDevices( return this; } - /** - * @deprecated Use {@link #getState()} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - @Nonnull - public Vehicle.State getVehicleState() { - return getState(); - } - @Nonnull public Vehicle.State getState() { return state; } - /** - * @deprecated Use {@link #setState(org.opentcs.data.model.Vehicle.State)} instead. - */ - @Deprecated() - @ScheduledApiChange(when = "6.0", details = "Will be removed.") - public VehicleProcessModelTO setVehicleState(@Nonnull Vehicle.State state) { - return setState(state); - } - public VehicleProcessModelTO setState(@Nonnull Vehicle.State state) { this.state = requireNonNull(state, "state"); return this; diff --git a/openTCS-API-Base/src/main/java/org/opentcs/util/Enums.java b/openTCS-API-Base/src/main/java/org/opentcs/util/Enums.java deleted file mode 100644 index bd0900714..000000000 --- a/openTCS-API-Base/src/main/java/org/opentcs/util/Enums.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.util; - -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; -import org.opentcs.util.annotations.ScheduledApiChange; - -/** - * Provides helper methods for working with enums. - * - * @deprecated Use Java streams, instead. - */ -@Deprecated -@ScheduledApiChange(when = "6.0", details = "Will be removed.") -public final class Enums { - - /** - * Prevents undesired instantiation. - */ - private Enums() { - // Do nada. - } - - /** - * Returns the String representations of all elements of the given enum class - * as a set. - * - * @param enumClass The enum class for which to return the String - * representations. - * @return The String representations of all elements of the given enum class - * as a set. - */ - public static Set asStringSet(Class> enumClass) { - Objects.requireNonNull(enumClass, "enumClass is null"); - - Set result = new HashSet<>(); - for (Enum constant : enumClass.getEnumConstants()) { - result.add(constant.name()); - } - return result; - } - - /** - * Returns the String representations of all elements of the given enum class - * as an array. - * - * @param enumClass The enum class for which to return the String - * representations. - * @param The enum class's type. - * @return The String representations of all elements of the given enum class - * as an array. - */ - public static > String[] asStringArray(Class enumClass) { - Objects.requireNonNull(enumClass, "enumClass is null"); - - E[] constants = enumClass.getEnumConstants(); - String[] result = new String[constants.length]; - for (int i = 0; i < result.length; i++) { - result[i] = constants[i].name(); - } - return result; - } -} diff --git a/openTCS-API-Base/src/test/java/org/opentcs/access/rmi/services/RemoteServicesTest.java b/openTCS-API-Base/src/test/java/org/opentcs/access/rmi/services/RemoteServicesTest.java index b43c7ffec..5ff7e396f 100644 --- a/openTCS-API-Base/src/test/java/org/opentcs/access/rmi/services/RemoteServicesTest.java +++ b/openTCS-API-Base/src/test/java/org/opentcs/access/rmi/services/RemoteServicesTest.java @@ -21,7 +21,6 @@ import org.opentcs.components.kernel.services.PlantModelService; import org.opentcs.components.kernel.services.QueryService; import org.opentcs.components.kernel.services.RouterService; -import org.opentcs.components.kernel.services.SchedulerService; import org.opentcs.components.kernel.services.TCSObjectService; import org.opentcs.components.kernel.services.TransportOrderService; import org.opentcs.components.kernel.services.VehicleService; @@ -39,7 +38,6 @@ class RemoteServicesTest { private static final Logger LOG = LoggerFactory.getLogger(RemoteServicesTest.class); @Test - @SuppressWarnings("deprecation") void shouldMapAllMethodsInServiceInterfaces() { checkMapping(DispatcherService.class, RemoteDispatcherService.class); checkMapping(NotificationService.class, RemoteNotificationService.class); @@ -49,7 +47,6 @@ void shouldMapAllMethodsInServiceInterfaces() { checkMapping(PlantModelService.class, RemotePlantModelService.class); checkMapping(QueryService.class, RemoteQueryService.class); checkMapping(RouterService.class, RemoteRouterService.class); - checkMapping(SchedulerService.class, RemoteSchedulerService.class); checkMapping(TCSObjectService.class, RemoteTCSObjectService.class); checkMapping(TransportOrderService.class, RemoteTransportOrderService.class); checkMapping(VehicleService.class, RemoteVehicleService.class); diff --git a/openTCS-API-Base/src/test/java/org/opentcs/data/model/ModelSerializationTest.java b/openTCS-API-Base/src/test/java/org/opentcs/data/model/ModelSerializationTest.java index dd1ce7007..c2e1b6b8b 100644 --- a/openTCS-API-Base/src/test/java/org/opentcs/data/model/ModelSerializationTest.java +++ b/openTCS-API-Base/src/test/java/org/opentcs/data/model/ModelSerializationTest.java @@ -23,9 +23,6 @@ */ class ModelSerializationTest { - ModelSerializationTest() { - } - @Test void shouldSerializeAndDeserializeBlock() throws Exception { @@ -35,16 +32,6 @@ void shouldSerializeAndDeserializeBlock() assertEquals(originalObject, deserializedObject); } - @Test - @SuppressWarnings("deprecation") - void shouldSerializeAndDeserializeGroup() - throws Exception { - Group originalObject = new Group("Group1"); - Group deserializedObject = (Group) deserializeTCSObject(serializeTCSObject(originalObject)); - - assertEquals(originalObject, deserializedObject); - } - @Test void shouldSerializeAndDeserializeLocation() throws Exception { diff --git a/openTCS-API-Base/src/test/java/org/opentcs/drivers/vehicle/MovementCommandTest.java b/openTCS-API-Base/src/test/java/org/opentcs/drivers/vehicle/MovementCommandTest.java new file mode 100644 index 000000000..f752c1829 --- /dev/null +++ b/openTCS-API-Base/src/test/java/org/opentcs/drivers/vehicle/MovementCommandTest.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.drivers.vehicle; + +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; +import java.util.List; +import java.util.Map; +import static java.util.Objects.requireNonNull; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.opentcs.data.model.Location; +import org.opentcs.data.model.LocationType; +import org.opentcs.data.model.Path; +import org.opentcs.data.model.Point; +import org.opentcs.data.model.Vehicle; +import org.opentcs.data.order.DriveOrder; +import org.opentcs.data.order.ReroutingType; +import org.opentcs.data.order.Route; +import org.opentcs.data.order.TransportOrder; + +/** + * Test for {@link MovementCommand}. + */ +public class MovementCommandTest { + + private Point destinationPoint; + private Location location; + + @BeforeEach + public void setUp() { + destinationPoint = new Point("p1"); + location = new Location("L1", new LocationType("LT1").getReference()); + } + + @Test + void considerIdenticalMovementCommandsEqual() { + Route.Step stepAB = createStep("A", "B", + Vehicle.Orientation.FORWARD, + 0, true, null); + Route route = new Route(List.of(stepAB), 22); + + DriveOrder driveOrder + = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) + .withRoute(route); + TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); + + MovementCommand command = new MovementCommand(transportOrder, + driveOrder, + stepAB, + "some-operation", + location, + false, + location, + destinationPoint, + "final-operation", + Map.of()); + + assertTrue(command.equalsInMovement(command)); + } + + @Test + void considerMovementCommandsWithDifferentStepsNotEqual() { + Route.Step stepAB = createStep("A", "B", + Vehicle.Orientation.FORWARD, + 0, true, null); + Route route = new Route(List.of(stepAB), 22); + + DriveOrder driveOrder + = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) + .withRoute(route); + TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); + + MovementCommand commandA = new MovementCommand(transportOrder, + driveOrder, + stepAB, + "some-operation", + location, + false, + location, + destinationPoint, + "final-operation", + Map.of("a", "b")); + + Route.Step stepBC = createStep("B", "C", + Vehicle.Orientation.FORWARD, + 0, true, null); + Route route2 = new Route(List.of(stepBC), 22); + + driveOrder + = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) + .withRoute(route2); + transportOrder = new TransportOrder("some-order", List.of(driveOrder)); + + MovementCommand commandB = new MovementCommand(transportOrder, + driveOrder, + stepBC, + "some-operation", + location, + false, + location, + destinationPoint, + "final-operation", + Map.of("a", "b")); + + assertFalse(commandA.equalsInMovement(commandB)); + } + + @Test + void considerMovementCommandsWithOperationNotEqual() { + Route.Step stepAB = createStep("A", "B", + Vehicle.Orientation.FORWARD, + 0, true, null); + Route route = new Route(List.of(stepAB), 22); + + DriveOrder driveOrder + = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) + .withRoute(route); + TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); + + MovementCommand commandA = new MovementCommand(transportOrder, + driveOrder, + stepAB, + "operation-a", + location, + false, + location, + destinationPoint, + "final-operation", + Map.of("a", "b")); + + MovementCommand commandB = new MovementCommand(transportOrder, + driveOrder, + stepAB, + "operation-b", + location, + false, + location, + destinationPoint, + "final-operation", + Map.of("a", "b")); + + assertFalse(commandA.equalsInMovement(commandB)); + } + + private Route.Step createStep(@Nonnull String srcPointName, + @Nonnull String destPointName, + @Nonnull Vehicle.Orientation orientation, + int routeIndex, + boolean executionAllowed, + @Nullable ReroutingType reroutingType) { + requireNonNull(srcPointName, "srcPointName"); + requireNonNull(destPointName, "destPointName"); + requireNonNull(orientation, "orientation"); + + Point srcPoint = new Point(srcPointName); + Point destPoint = new Point(destPointName); + Path path = new Path(srcPointName + "-" + destPointName, + srcPoint.getReference(), + destPoint.getReference()); + + return new Route.Step(path, + srcPoint, + destPoint, + orientation, + routeIndex, + executionAllowed, + reroutingType); + } +} diff --git a/openTCS-CommAdapter-Loopback/src/main/java/org/opentcs/virtualvehicle/LoopbackCommunicationAdapter.java b/openTCS-CommAdapter-Loopback/src/main/java/org/opentcs/virtualvehicle/LoopbackCommunicationAdapter.java index 7e50b297e..89b80448f 100644 --- a/openTCS-CommAdapter-Loopback/src/main/java/org/opentcs/virtualvehicle/LoopbackCommunicationAdapter.java +++ b/openTCS-CommAdapter-Loopback/src/main/java/org/opentcs/virtualvehicle/LoopbackCommunicationAdapter.java @@ -239,9 +239,7 @@ public synchronized ExplainedBoolean canProcess(TransportOrder order) { ); } - @Override - @Deprecated - public synchronized ExplainedBoolean canProcess(List operations) { + private ExplainedBoolean canProcess(List operations) { requireNonNull(operations, "operations"); LOG.debug("{}: Checking processability of {}...", getName(), operations); @@ -328,7 +326,7 @@ private void startVehicleSimulation(MovementCommand command) { if (step.getPath() == null) { LOG.debug("Starting operation simulation..."); - ((ScheduledExecutorService) getExecutor()).schedule( + getExecutor().schedule( () -> operationSimulation(command, 0), SIMULATION_PERIOD, TimeUnit.MILLISECONDS); @@ -342,9 +340,9 @@ private void startVehicleSimulation(MovementCommand command) { ); LOG.debug("Starting movement simulation..."); - ((ScheduledExecutorService) getExecutor()).schedule(() -> movementSimulation(command), - SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + getExecutor().schedule(() -> movementSimulation(command), + SIMULATION_PERIOD, + TimeUnit.MILLISECONDS); } } @@ -369,9 +367,9 @@ private void movementSimulation(MovementCommand command) { WayEntry currentWayEntry = getProcessModel().getVelocityController().getCurrentWayEntry(); //if we are still on the same way entry then reschedule to do it again if (prevWayEntry == currentWayEntry) { - ((ScheduledExecutorService) getExecutor()).schedule(() -> movementSimulation(command), - SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + getExecutor().schedule(() -> movementSimulation(command), + SIMULATION_PERIOD, + TimeUnit.MILLISECONDS); } else { //if the way enties are different then we have finished this step @@ -380,10 +378,11 @@ private void movementSimulation(MovementCommand command) { LOG.debug("Movement simulation finished."); if (!command.hasEmptyOperation()) { LOG.debug("Starting operation simulation..."); - ((ScheduledExecutorService) getExecutor()).schedule( + getExecutor().schedule( () -> operationSimulation(command, 0), SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + TimeUnit.MILLISECONDS + ); } else { finishMovementCommand(command); @@ -402,10 +401,11 @@ private void operationSimulation(MovementCommand command, int timePassed) { if (timePassed < getProcessModel().getOperatingTime()) { getProcessModel().getVelocityController().advanceTime(getSimulationTimeStep()); - ((ScheduledExecutorService) getExecutor()).schedule( + getExecutor().schedule( () -> operationSimulation(command, timePassed + getSimulationTimeStep()), SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + TimeUnit.MILLISECONDS + ); } else { LOG.debug("Operation simulation finished."); @@ -428,13 +428,14 @@ else if (operation.equals(this.getRechargeOperation())) { LOG.debug("Starting recharge simulation..."); finishMovementCommand(command); getProcessModel().setState(Vehicle.State.CHARGING); - ((ScheduledExecutorService) getExecutor()).schedule( + getExecutor().schedule( () -> chargingSimulation( getProcessModel().getPosition(), getProcessModel().getEnergyLevel() ), SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + TimeUnit.MILLISECONDS + ); } else { simulateNextCommand(); @@ -469,10 +470,11 @@ private void chargingSimulation(String rechargePosition, } if (nextChargePercentage(rechargePercentage) < 100.0) { getProcessModel().setEnergyLevel((int) rechargePercentage); - ((ScheduledExecutorService) getExecutor()).schedule( + getExecutor().schedule( () -> chargingSimulation(rechargePosition, nextChargePercentage(rechargePercentage)), SIMULATION_PERIOD, - TimeUnit.MILLISECONDS); + TimeUnit.MILLISECONDS + ); } else { LOG.debug("Finishing recharge operation, vehicle at 100%..."); diff --git a/openTCS-Common/src/main/java/org/opentcs/util/Comparators.java b/openTCS-Common/src/main/java/org/opentcs/util/Comparators.java index ccd7ee65f..eb19a9405 100644 --- a/openTCS-Common/src/main/java/org/opentcs/util/Comparators.java +++ b/openTCS-Common/src/main/java/org/opentcs/util/Comparators.java @@ -12,7 +12,6 @@ import org.opentcs.data.TCSObjectReference; import org.opentcs.data.order.TransportOrder; import org.opentcs.data.peripherals.PeripheralJob; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Some commonly used comparator implementations. @@ -74,21 +73,4 @@ public static Comparator ordersByAge() { public static Comparator jobsByAge() { return Comparator.comparing(PeripheralJob::getCreationTime).thenComparing(objectsByName()); } - - /** - * A comparator for ordering ModelLayoutElements by the names of their - * visualized objects. - * - * @return A comparator for ordering ModelLayoutElements by the names of their - * visualized objects. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - public static Comparator - modelLayoutElementsByName() { - return (org.opentcs.data.model.visualization.ModelLayoutElement o1, - org.opentcs.data.model.visualization.ModelLayoutElement o2) - -> o1.getVisualizedObject().getName().compareTo( - o2.getVisualizedObject().getName()); - } } diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/ModelParser.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/ModelParser.java index 03c527689..7f9b0ef02 100644 --- a/openTCS-Common/src/main/java/org/opentcs/util/persistence/ModelParser.java +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/ModelParser.java @@ -19,9 +19,9 @@ import java.io.Writer; import java.nio.charset.Charset; import org.opentcs.access.to.model.PlantModelCreationTO; -import org.opentcs.util.persistence.v004.V004ModelParser; -import org.opentcs.util.persistence.v004.V004PlantModelTO; -import org.opentcs.util.persistence.v004.V004TOMapper; +import org.opentcs.util.persistence.v005.V005ModelParser; +import org.opentcs.util.persistence.v005.V005PlantModelTO; +import org.opentcs.util.persistence.v005.V005TOMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,7 +61,7 @@ public PlantModelCreationTO readModel(File file) try (Reader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), CHARSET))) { - return new V004ModelParser().read(reader, modelVersion); + return new V005ModelParser().read(reader, modelVersion); } } @@ -76,8 +76,8 @@ public void writeModel(PlantModelCreationTO model, File file) throws IOException { try (Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), CHARSET))) { - V004TOMapper mapper = new V004TOMapper(); - V004PlantModelTO mappedModel = mapper.map(model); + V005TOMapper mapper = new V005TOMapper(); + V005PlantModelTO mappedModel = mapper.map(model); mappedModel.toXml(writer); } } diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedOperationTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedOperationTO.java new file mode 100644 index 000000000..a6c23b68d --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedOperationTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +public class AllowedOperationTO + extends PlantModelElementTO { + + /** + * Creates a new instance. + */ + public AllowedOperationTO() { + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedPeripheralOperationTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedPeripheralOperationTO.java new file mode 100644 index 000000000..b09911275 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/AllowedPeripheralOperationTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +public class AllowedPeripheralOperationTO + extends PlantModelElementTO { + + /** + * Creates a new instance. + */ + public AllowedPeripheralOperationTO() { + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/BlockTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/BlockTO.java new file mode 100644 index 000000000..d50654a97 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/BlockTO.java @@ -0,0 +1,90 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", "type", "members", "properties", "blockLayout"}) +public class BlockTO + extends PlantModelElementTO { + + private String type = "SINGLE_VEHICLE_ONLY"; + private List members = new ArrayList<>(); + private BlockLayout blockLayout = new BlockLayout(); + + /** + * Creates a new instance. + */ + public BlockTO() { + } + + @XmlAttribute(required = true) + public String getType() { + return type; + } + + public BlockTO setType(@Nonnull String type) { + requireNonNull(type, "type"); + this.type = type; + return this; + } + + @XmlElement(name = "member") + public List getMembers() { + return members; + } + + public BlockTO setMembers(@Nonnull List members) { + requireNonNull(members, "members"); + this.members = members; + return this; + } + + @XmlElement(required = true) + public BlockLayout getBlockLayout() { + return blockLayout; + } + + public BlockTO setBlockLayout(@Nonnull BlockLayout blockLayout) { + this.blockLayout = requireNonNull(blockLayout, "blockLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + public static class BlockLayout { + + private String color = ""; + + /** + * Creates a new instance. + */ + public BlockLayout() { + } + + @XmlAttribute(required = true) + public String getColor() { + return color; + } + + public BlockLayout setColor(@Nonnull String color) { + this.color = requireNonNull(color, "color"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/Comparators.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/Comparators.java new file mode 100644 index 000000000..7eff9cceb --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/Comparators.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import java.util.Comparator; + +/** + * Some comparator implementations for JAXB classes. + */ +public final class Comparators { + + /** + * Prevents instantiation. + */ + private Comparators() { + } + + /** + * Returns a comparator for ordering PlantModelElementTOs ascendingly by their names. + * + * @return A comparator for ordering PlantModelElementTOs ascendingly by their names. + */ + public static Comparator elementsByName() { + return Comparator.comparing(PlantModelElementTO::getName); + } + + /** + * Returns a comparator for ordering OutgoingPaths ascendingly by their names. + * + * @return A comparator for ordering OutgoingPaths ascendingly by their names. + */ + public static Comparator outgoingPathsByName() { + return Comparator.comparing(PointTO.OutgoingPath::getName); + } + + /** + * Returns a comparator for ordering Links ascendingly by their point names. + * + * @return A comparator for ordering Links ascendingly by their point names. + */ + public static Comparator linksByPointName() { + return Comparator.comparing(LocationTO.Link::getPoint); + } + + /** + * Returns a comparator for ordering Propertiess ascendingly by their names. + * + * @return A comparator for ordering Properties ascendingly by their names. + */ + public static Comparator propertiesByName() { + return Comparator.comparing(PropertyTO::getName); + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/CoupleTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/CoupleTO.java new file mode 100644 index 000000000..d38abfa0a --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/CoupleTO.java @@ -0,0 +1,48 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"x", "y"}) +public class CoupleTO { + + private Long x; + private Long y; + + public CoupleTO() { + } + + @XmlAttribute(required = true) + public Long getX() { + return x; + } + + public CoupleTO setX(@Nonnull Long x) { + this.x = requireNonNull(x, "x"); + return this; + } + + @XmlAttribute(required = true) + public Long getY() { + return y; + } + + public CoupleTO setY(@Nonnull Long y) { + this.y = requireNonNull(y, "y"); + return this; + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTO.java new file mode 100644 index 000000000..43b440874 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTO.java @@ -0,0 +1,232 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", "xPosition", "yPosition", "zPosition", "links", "locked", + "properties", "locationLayout"}) +public class LocationTO + extends PlantModelElementTO { + + private Long xPosition = 0L; + private Long yPosition = 0L; + private Long zPosition = 0L; + private String type = ""; + private List links = new ArrayList<>(); + private Boolean locked = false; + private LocationLayout locationLayout = new LocationLayout(); + + /** + * Creates a new instance. + */ + public LocationTO() { + } + + @XmlAttribute + public Long getxPosition() { + return xPosition; + } + + public LocationTO setxPosition(@Nonnull Long xPosition) { + requireNonNull(xPosition, "xPosition"); + this.xPosition = xPosition; + return this; + } + + @XmlAttribute + public Long getyPosition() { + return yPosition; + } + + public LocationTO setyPosition(@Nonnull Long yPosition) { + requireNonNull(yPosition, "yPosition"); + this.yPosition = yPosition; + return this; + } + + @XmlAttribute + public Long getzPosition() { + return zPosition; + } + + public LocationTO setzPosition(@Nonnull Long zPosition) { + requireNonNull(zPosition, "zPosition"); + this.zPosition = zPosition; + return this; + } + + @XmlAttribute + public String getType() { + return type; + } + + public LocationTO setType(@Nonnull String type) { + requireNonNull(type, "type"); + this.type = type; + return this; + } + + @XmlElement(name = "link", required = true) + public List getLinks() { + return links; + } + + public LocationTO setLinks(@Nonnull List links) { + requireNonNull(links, "links"); + this.links = links; + return this; + } + + @XmlAttribute(required = true) + public Boolean isLocked() { + return locked; + } + + public LocationTO setLocked(Boolean locked) { + this.locked = locked; + return this; + } + + @XmlElement(required = true) + public LocationLayout getLocationLayout() { + return locationLayout; + } + + public LocationTO setLocationLayout(@Nonnull LocationLayout locationLayout) { + this.locationLayout = requireNonNull(locationLayout, "locationLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"point", "allowedOperations"}) + public static class Link { + + private String point = ""; + private List allowedOperations = new ArrayList<>(); + + /** + * Creates a new instance. + */ + public Link() { + } + + @XmlAttribute(required = true) + public String getPoint() { + return point; + } + + public Link setPoint(@Nonnull String point) { + requireNonNull(point, "point"); + this.point = point; + return this; + } + + @XmlElement(name = "allowedOperation") + public List getAllowedOperations() { + return allowedOperations; + } + + public Link setAllowedOperations(@Nonnull List allowedOperations) { + requireNonNull(allowedOperations, "allowedOperations"); + this.allowedOperations = allowedOperations; + return this; + } + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"xPosition", "yPosition", "xLabelOffset", "yLabelOffset", + "locationRepresentation", "layerId"}) + public static class LocationLayout { + + private Long xPosition = 0L; + private Long yPosition = 0L; + private Long xLabelOffset = 0L; + private Long yLabelOffset = 0L; + private String locationRepresentation = ""; + private Integer layerId = 0; + + /** + * Creates a new instance. + */ + public LocationLayout() { + } + + @XmlAttribute(required = true) + public Long getxPosition() { + return xPosition; + } + + public LocationLayout setxPosition(Long xPosition) { + this.xPosition = requireNonNull(xPosition, "xPosition"); + return this; + } + + @XmlAttribute(required = true) + public Long getyPosition() { + return yPosition; + } + + public LocationLayout setyPosition(Long yPosition) { + this.yPosition = requireNonNull(yPosition, "yPosition"); + return this; + } + + @XmlAttribute(required = true) + public Long getxLabelOffset() { + return xLabelOffset; + } + + public LocationLayout setxLabelOffset(Long xLabelOffset) { + this.xLabelOffset = requireNonNull(xLabelOffset, "xLabelOffset"); + return this; + } + + @XmlAttribute(required = true) + public Long getyLabelOffset() { + return yLabelOffset; + } + + public LocationLayout setyLabelOffset(Long yLabelOffset) { + this.yLabelOffset = requireNonNull(yLabelOffset, "yLabelOffset"); + return this; + } + + @XmlAttribute(required = true) + public String getLocationRepresentation() { + return locationRepresentation; + } + + public LocationLayout setLocationRepresentation(String locationRepresentation) { + this.locationRepresentation = requireNonNull(locationRepresentation, + "locationRepresentation"); + return this; + } + + @XmlAttribute(required = true) + public Integer getLayerId() { + return layerId; + } + + public LocationLayout setLayerId(Integer layerId) { + this.layerId = requireNonNull(layerId, "layerId"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTypeTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTypeTO.java new file mode 100644 index 000000000..7a7f10f1f --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/LocationTypeTO.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", + "allowedOperations", + "allowedPeripheralOperations", + "properties", + "locationTypeLayout"}) +public class LocationTypeTO + extends PlantModelElementTO { + + private List allowedOperations = new ArrayList<>(); + private List allowedPeripheralOperations = new ArrayList<>(); + private LocationTypeLayout locationTypeLayout = new LocationTypeLayout(); + + /** + * Creates a new instance. + */ + public LocationTypeTO() { + } + + @XmlElement(name = "allowedOperation") + public List getAllowedOperations() { + return allowedOperations; + } + + public LocationTypeTO setAllowedOperations(@Nonnull List allowedOperations) { + this.allowedOperations = requireNonNull(allowedOperations, "allowedOperations"); + return this; + } + + @XmlElement(name = "allowedPeripheralOperation") + public List getAllowedPeripheralOperations() { + return allowedPeripheralOperations; + } + + public LocationTypeTO setAllowedPeripheralOperations( + List allowedPeripheralOperations) { + this.allowedPeripheralOperations = requireNonNull(allowedPeripheralOperations, + "allowedPeripheralOperations"); + return this; + } + + @XmlElement(required = true) + public LocationTypeLayout getLocationTypeLayout() { + return locationTypeLayout; + } + + public LocationTypeTO setLocationTypeLayout(@Nonnull LocationTypeLayout locationTypeLayout) { + this.locationTypeLayout = requireNonNull(locationTypeLayout, "locationTypeLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + public static class LocationTypeLayout { + + private String locationRepresentation = ""; + + /** + * Creates a new instance. + */ + public LocationTypeLayout() { + } + + @XmlAttribute(required = true) + public String getLocationRepresentation() { + return locationRepresentation; + } + + public LocationTypeLayout setLocationRepresentation(@Nonnull String locationRepresentation) { + this.locationRepresentation = requireNonNull(locationRepresentation, + "locationRepresentation"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/MemberTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/MemberTO.java new file mode 100644 index 000000000..c10537d07 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/MemberTO.java @@ -0,0 +1,24 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +public class MemberTO + extends PlantModelElementTO { + + /** + * Creates a new instance. + */ + public MemberTO() { + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PathTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PathTO.java new file mode 100644 index 000000000..28697c79b --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PathTO.java @@ -0,0 +1,230 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", + "sourcePoint", + "destinationPoint", + "length", + "maxVelocity", + "maxReverseVelocity", + "peripheralOperations", + "locked", + "vehicleEnvelopes", + "properties", + "pathLayout"}) +public class PathTO + extends PlantModelElementTO { + + private String sourcePoint = ""; + private String destinationPoint = ""; + private Long length = 0L; + private Long maxVelocity = 0L; + private Long maxReverseVelocity = 0L; + private List peripheralOperations = new ArrayList<>(); + private Boolean locked = false; + private List vehicleEnvelopes = new ArrayList<>(); + private PathLayout pathLayout = new PathLayout(); + + /** + * Creates a new instance. + */ + public PathTO() { + } + + @XmlAttribute(required = true) + public String getSourcePoint() { + return sourcePoint; + } + + public PathTO setSourcePoint(@Nonnull String sourcePoint) { + requireNonNull(sourcePoint, "sourcePoint"); + this.sourcePoint = sourcePoint; + return this; + } + + @XmlAttribute(required = true) + public String getDestinationPoint() { + return destinationPoint; + } + + public PathTO setDestinationPoint(@Nonnull String destinationPoint) { + requireNonNull(destinationPoint, "destinationPoint"); + this.destinationPoint = destinationPoint; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getLength() { + return length; + } + + public PathTO setLength(@Nonnull Long length) { + requireNonNull(length, "length"); + this.length = length; + return this; + } + + @XmlAttribute(required = true) + @XmlSchemaType(name = "unsignedInt") + public Long getMaxVelocity() { + return maxVelocity; + } + + public PathTO setMaxVelocity(@Nonnull Long maxVelocity) { + requireNonNull(maxVelocity, "maxVelocity"); + this.maxVelocity = maxVelocity; + return this; + } + + @XmlAttribute(required = true) + @XmlSchemaType(name = "unsignedInt") + public Long getMaxReverseVelocity() { + return maxReverseVelocity; + } + + public PathTO setMaxReverseVelocity(@Nonnull Long maxReverseVelocity) { + requireNonNull(maxReverseVelocity, "maxReverseVelocity"); + this.maxReverseVelocity = maxReverseVelocity; + return this; + } + + @XmlElement(name = "peripheralOperation") + public List getPeripheralOperations() { + return peripheralOperations; + } + + public PathTO setPeripheralOperations(List peripheralOperations) { + this.peripheralOperations = requireNonNull(peripheralOperations, "peripheralOperations"); + return this; + } + + @XmlAttribute(required = true) + public Boolean isLocked() { + return locked; + } + + public PathTO setLocked(Boolean locked) { + this.locked = locked; + return this; + } + + @XmlElement(name = "vehicleEnvelope") + public List getVehicleEnvelopes() { + return vehicleEnvelopes; + } + + public PathTO setVehicleEnvelopes(@Nonnull List vehicleEnvelopes) { + this.vehicleEnvelopes = requireNonNull(vehicleEnvelopes, "vehicleEnvelopes"); + return this; + } + + @XmlElement(required = true) + public PathLayout getPathLayout() { + return pathLayout; + } + + public PathTO setPathLayout(@Nonnull PathLayout pathLayout) { + this.pathLayout = requireNonNull(pathLayout, "pathLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"connectionType", "layerId", "controlPoints"}) + public static class PathLayout { + + private String connectionType = ""; + private Integer layerId = 0; + private List controlPoints = new ArrayList<>(); + + /** + * Creates a new instance. + */ + public PathLayout() { + } + + @XmlAttribute(required = true) + public String getConnectionType() { + return connectionType; + } + + public PathLayout setConnectionType(@Nonnull String connectionType) { + this.connectionType = requireNonNull(connectionType, "connectionType"); + return this; + } + + @XmlAttribute(required = true) + public Integer getLayerId() { + return layerId; + } + + public PathLayout setLayerId(@Nonnull Integer layerId) { + this.layerId = requireNonNull(layerId, "layerId"); + return this; + } + + @XmlElement(name = "controlPoint") + public List getControlPoints() { + return controlPoints; + } + + public PathLayout setControlPoints(@Nonnull List controlPoints) { + this.controlPoints = requireNonNull(controlPoints, "controlPoints"); + return this; + } + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"x", "y"}) + public static class ControlPoint { + + private Long x = 0L; + private Long y = 0L; + + /** + * Creates a new instance. + */ + public ControlPoint() { + } + + @XmlAttribute(required = true) + public Long getX() { + return x; + } + + public ControlPoint setX(@Nonnull Long x) { + this.x = requireNonNull(x, "x"); + return this; + } + + @XmlAttribute(required = true) + public Long getY() { + return y; + } + + public ControlPoint setY(@Nonnull Long y) { + this.y = requireNonNull(y, "y"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PeripheralOperationTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PeripheralOperationTO.java new file mode 100644 index 000000000..bb52b93a8 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PeripheralOperationTO.java @@ -0,0 +1,61 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +public class PeripheralOperationTO + extends PlantModelElementTO { + + private String locationName = ""; + private String executionTrigger = ""; + private boolean completionRequired; + + /** + * Creates a new instance. + */ + public PeripheralOperationTO() { + } + + @XmlAttribute(required = true) + public String getLocationName() { + return locationName; + } + + public PeripheralOperationTO setLocationName(String locationName) { + this.locationName = requireNonNull(locationName, "locationName"); + return this; + } + + @XmlAttribute(required = true) + public String getExecutionTrigger() { + return executionTrigger; + } + + public PeripheralOperationTO setExecutionTrigger(String executionTrigger) { + this.executionTrigger = requireNonNull(executionTrigger, "executionTrigger"); + return this; + } + + @XmlAttribute(required = true) + public boolean isCompletionRequired() { + return completionRequired; + } + + public PeripheralOperationTO setCompletionRequired(boolean completionRequired) { + this.completionRequired = completionRequired; + return this; + } + +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PlantModelElementTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PlantModelElementTO.java new file mode 100644 index 000000000..742c25098 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PlantModelElementTO.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlTransient; + +/** + */ +@XmlTransient +@XmlAccessorType(XmlAccessType.PROPERTY) +public class PlantModelElementTO { + + private String name = ""; + private List properties = new ArrayList<>(); + + /** + * Creates a new instance. + */ + public PlantModelElementTO() { + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public PlantModelElementTO setName(@Nonnull String name) { + requireNonNull(name, "name"); + this.name = name; + return this; + } + + @XmlElement(name = "property") + public List getProperties() { + return properties; + } + + public PlantModelElementTO setProperties(@Nonnull List properties) { + requireNonNull(properties, "properties"); + this.properties = properties; + return this; + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PointTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PointTO.java new file mode 100644 index 000000000..0c56d84d7 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PointTO.java @@ -0,0 +1,218 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", "xPosition", "yPosition", "zPosition", "vehicleOrientationAngle", + "type", "vehicleEnvelopes", "outgoingPaths", "properties", "pointLayout"}) +public class PointTO + extends PlantModelElementTO { + + private Long xPosition = 0L; + private Long yPosition = 0L; + private Long zPosition = 0L; + private Float vehicleOrientationAngle = 0.0F; + private String type = "HALT_POSITION"; + private List vehicleEnvelopes = new ArrayList<>(); + private List outgoingPaths = new ArrayList<>(); + private PointLayout pointLayout = new PointLayout(); + + /** + * Creates a new instance. + */ + public PointTO() { + } + + @XmlAttribute(required = true) + public Long getxPosition() { + return xPosition; + } + + public PointTO setxPosition(@Nonnull Long xPosition) { + requireNonNull(xPosition, "xPosition"); + this.xPosition = xPosition; + return this; + } + + @XmlAttribute(required = true) + public Long getyPosition() { + return yPosition; + } + + public PointTO setyPosition(@Nonnull Long yPosition) { + requireNonNull(yPosition, "yPosition"); + this.yPosition = yPosition; + return this; + } + + @XmlAttribute + public Long getzPosition() { + return zPosition; + } + + public PointTO setzPosition(@Nonnull Long zPosition) { + requireNonNull(zPosition, "zPosition"); + this.zPosition = zPosition; + return this; + } + + @XmlAttribute + public Float getVehicleOrientationAngle() { + return vehicleOrientationAngle; + } + + public PointTO setVehicleOrientationAngle(@Nonnull Float vehicleOrientationAngle) { + requireNonNull(vehicleOrientationAngle, "vehicleOrientationAngle"); + this.vehicleOrientationAngle = vehicleOrientationAngle; + return this; + } + + @XmlAttribute(required = true) + public String getType() { + return type; + } + + public PointTO setType(@Nonnull String type) { + requireNonNull(type, "type"); + this.type = type; + return this; + } + + @XmlElement(name = "outgoingPath") + public List getOutgoingPaths() { + return outgoingPaths; + } + + public PointTO setOutgoingPaths(@Nonnull List outgoingPath) { + requireNonNull(outgoingPath, "outgoingPath"); + this.outgoingPaths = outgoingPath; + return this; + } + + @XmlElement(name = "vehicleEnvelope") + public List getVehicleEnvelopes() { + return vehicleEnvelopes; + } + + public PointTO setVehicleEnvelopes(@Nonnull List vehicleEnvelopes) { + this.vehicleEnvelopes = requireNonNull(vehicleEnvelopes, "vehicleEnvelopes"); + return this; + } + + @XmlElement(required = true) + public PointLayout getPointLayout() { + return pointLayout; + } + + public PointTO setPointLayout(@Nonnull PointLayout pointLayout) { + this.pointLayout = requireNonNull(pointLayout, "pointLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + public static class OutgoingPath { + + private String name = ""; + + /** + * Creates a new instance. + */ + public OutgoingPath() { + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public OutgoingPath setName(@Nonnull String name) { + requireNonNull(name, "name"); + this.name = name; + return this; + } + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"xPosition", "yPosition", "xLabelOffset", "yLabelOffset", "layerId"}) + public static class PointLayout { + + private Long xPosition = 0L; + private Long yPosition = 0L; + private Long xLabelOffset = 0L; + private Long yLabelOffset = 0L; + private Integer layerId = 0; + + /** + * Creates a new instance. + */ + public PointLayout() { + } + + @XmlAttribute(required = true) + public Long getxPosition() { + return xPosition; + } + + public PointLayout setxPosition(@Nonnull Long xPosition) { + this.xPosition = requireNonNull(xPosition, "xPosition"); + return this; + } + + @XmlAttribute(required = true) + public Long getyPosition() { + return yPosition; + } + + public PointLayout setyPosition(@Nonnull Long yPosition) { + this.yPosition = requireNonNull(yPosition, "yPosition"); + return this; + } + + @XmlAttribute(required = true) + public Long getxLabelOffset() { + return xLabelOffset; + } + + public PointLayout setxLabelOffset(@Nonnull Long xLabelOffset) { + this.xLabelOffset = requireNonNull(xLabelOffset, "xLabelOffset"); + return this; + } + + @XmlAttribute(required = true) + public Long getyLabelOffset() { + return yLabelOffset; + } + + public PointLayout setyLabelOffset(@Nonnull Long yLabelOffset) { + this.yLabelOffset = requireNonNull(yLabelOffset, "yLabelOffset"); + return this; + } + + @XmlAttribute(required = true) + public Integer getLayerId() { + return layerId; + } + + public PointLayout setLayerId(@Nonnull Integer layerId) { + this.layerId = requireNonNull(layerId, "layerId"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PropertyTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PropertyTO.java new file mode 100644 index 000000000..b0b62da79 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/PropertyTO.java @@ -0,0 +1,52 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", "value"}) +public class PropertyTO { + + private String name = ""; + private String value = ""; + + /** + * Creates a new instance. + */ + public PropertyTO() { + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public PropertyTO setName(@Nonnull String name) { + this.name = requireNonNull(name, "name"); + return this; + } + + @XmlAttribute(required = true) + public String getValue() { + return value; + } + + public PropertyTO setValue(@Nonnull String value) { + requireNonNull(value, "value"); + this.value = value; + return this; + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005ModelParser.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005ModelParser.java new file mode 100644 index 000000000..25922eff2 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005ModelParser.java @@ -0,0 +1,299 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import java.io.IOException; +import java.io.Reader; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.opentcs.access.to.model.PlantModelCreationTO; +import static org.opentcs.data.ObjectPropConstants.LOCTYPE_DEFAULT_REPRESENTATION; +import static org.opentcs.data.ObjectPropConstants.LOC_DEFAULT_REPRESENTATION; +import org.opentcs.data.model.visualization.LocationRepresentation; +import org.opentcs.util.persistence.v004.V004ModelParser; +import org.opentcs.util.persistence.v004.V004PlantModelTO; + +/** + * The parser for V005 models. + */ +public class V005ModelParser { + + /** + * Creates a new instance. + */ + public V005ModelParser() { + } + + /** + * Reads a model with the given reader and parses it to a {@link PlantModelCreationTO} instance. + * + * @param reader The reader to use. + * @param modelVersion The model version. + * @return The parsed {@link PlantModelCreationTO}. + * @throws IOException If there was an error reading the model. + */ + public PlantModelCreationTO read(Reader reader, String modelVersion) + throws IOException { + return new V005TOMapper().map(readRaw(reader, modelVersion)); + } + + /** + * Reads a model with the given reader and parses it to a {@link V005PlantModelTO} instance. + * + * @param reader The reader to use. + * @param modelVersion The model version. + * @return The parsed {@link V005PlantModelTO}. + * @throws IOException If there was an error reading the model. + */ + public V005PlantModelTO readRaw(Reader reader, String modelVersion) + throws IOException { + if (Objects.equals(modelVersion, V005TOMapper.VERSION_STRING)) { + return V005PlantModelTO.fromXml(reader); + } + else { + return convert(new V004ModelParser().readRaw(reader, modelVersion)); + } + } + + private V005PlantModelTO convert(V004PlantModelTO to) { + return new V005PlantModelTO() + .setName(to.getName()) + .setPoints(convertPoints(to)) + .setPaths(convertPaths(to)) + .setVehicles(convertVehicles(to)) + .setLocationTypes(convertLocationTypes(to)) + .setLocations(convertLocations(to)) + .setBlocks(convertBlocks(to)) + .setVisualLayout(convertVisualLayout(to)) + .setProperties(convertProperties(to.getProperties())); + } + + private List convertProperties( + List tos) { + return tos.stream() + .map(property -> new PropertyTO().setName(property.getName()).setValue(property.getValue())) + .toList(); + } + + private List convertPoints(V004PlantModelTO to) { + return to.getPoints().stream() + .map(point -> { + PointTO result = new PointTO(); + result.setName(point.getName()) + .setProperties(convertProperties(point.getProperties())); + result.setxPosition(point.getxPosition()) + .setyPosition(point.getyPosition()) + .setzPosition(point.getzPosition()) + .setVehicleOrientationAngle(point.getVehicleOrientationAngle()) + .setType(point.getType()) + .setOutgoingPaths(convertOutgoingPaths(point)) + .setPointLayout(new PointTO.PointLayout() + .setxPosition(point.getPointLayout().getxPosition()) + .setyPosition(point.getPointLayout().getyPosition()) + .setxLabelOffset(point.getPointLayout().getxLabelOffset()) + .setyLabelOffset(point.getPointLayout().getyLabelOffset())); + return result; + }) + .toList(); + } + + private Map toPropertiesMap( + List properties) { + Map result = new HashMap<>(); + for (org.opentcs.util.persistence.v004.PropertyTO property : properties) { + result.put(property.getName(), property.getValue()); + } + return result; + } + + private List convertOutgoingPaths( + org.opentcs.util.persistence.v004.PointTO to) { + return to.getOutgoingPaths().stream() + .map(path -> new PointTO.OutgoingPath().setName(path.getName())) + .toList(); + } + + private List convertPaths(V004PlantModelTO to) { + return to.getPaths().stream() + .map(path -> { + PathTO result = new PathTO(); + result.setName(path.getName()) + .setProperties(convertProperties(path.getProperties())); + result.setSourcePoint(path.getSourcePoint()) + .setDestinationPoint(path.getDestinationPoint()) + .setLength(path.getLength()) + .setMaxVelocity(path.getMaxVelocity()) + .setMaxReverseVelocity(path.getMaxReverseVelocity()) + .setLocked(path.isLocked()) + .setPathLayout(new PathTO.PathLayout() + .setConnectionType(path.getPathLayout().getConnectionType()) + .setControlPoints( + path.getPathLayout().getControlPoints().stream() + .map( + controlPoint -> new PathTO.ControlPoint() + .setX(controlPoint.getX()) + .setY(controlPoint.getY()) + ) + .toList() + ) + ); + return result; + }) + .toList(); + } + + private List convertVehicles(V004PlantModelTO to) { + return to.getVehicles().stream() + .map(vehicle -> { + VehicleTO result = new VehicleTO(); + result.setName(vehicle.getName()) + .setProperties(convertProperties(vehicle.getProperties())); + result.setLength(vehicle.getLength()) + .setEnergyLevelCritical(vehicle.getEnergyLevelCritical()) + .setEnergyLevelGood(vehicle.getEnergyLevelGood()) + .setEnergyLevelFullyRecharged(vehicle.getEnergyLevelFullyRecharged()) + .setEnergyLevelSufficientlyRecharged(vehicle.getEnergyLevelSufficientlyRecharged()) + .setMaxVelocity(vehicle.getMaxVelocity()) + .setMaxReverseVelocity(vehicle.getMaxReverseVelocity()) + .setVehicleLayout( + new VehicleTO.VehicleLayout() + .setColor(vehicle.getVehicleLayout().getColor()) + ); + return result; + }) + .toList(); + } + + private List convertLocationTypes(V004PlantModelTO to) { + return to.getLocationTypes().stream() + .map(locationType -> { + String locationRepresentation = toPropertiesMap(locationType.getProperties()) + .getOrDefault(LOCTYPE_DEFAULT_REPRESENTATION, LocationRepresentation.NONE.name()); + + LocationTypeTO result = new LocationTypeTO(); + result.setName(locationType.getName()) + .setProperties(convertProperties(locationType.getProperties())); + result.setAllowedOperations(convertAllowedOperations(locationType.getAllowedOperations())) + .setLocationTypeLayout(new LocationTypeTO.LocationTypeLayout() + .setLocationRepresentation(locationRepresentation)); + return result; + }) + .toList(); + } + + private List convertAllowedOperations( + List tos) { + return tos.stream() + .map(allowedOperation -> { + AllowedOperationTO result = new AllowedOperationTO(); + result.setName(allowedOperation.getName()); + result.setProperties(convertProperties(allowedOperation.getProperties())); + return result; + }) + .toList(); + } + + private List convertLocations(V004PlantModelTO to) { + return to.getLocations().stream() + .map(location -> { + String locationRepresentation = toPropertiesMap(location.getProperties()) + .getOrDefault(LOC_DEFAULT_REPRESENTATION, LocationRepresentation.DEFAULT.name()); + + LocationTO result = new LocationTO(); + result.setName(location.getName()) + .setProperties(convertProperties(location.getProperties())); + result.setxPosition(location.getxPosition()) + .setyPosition(location.getyPosition()) + .setzPosition(location.getzPosition()) + .setType(location.getType()) + .setLinks(convertLinks(location)) + .setLocked(location.isLocked()) + .setLocationLayout(new LocationTO.LocationLayout() + .setxPosition(location.getLocationLayout().getxPosition()) + .setyPosition(location.getLocationLayout().getyPosition()) + .setxLabelOffset(location.getLocationLayout().getxLabelOffset()) + .setyLabelOffset(location.getLocationLayout().getyLabelOffset()) + .setLocationRepresentation(locationRepresentation)); + return result; + }) + .toList(); + } + + private List convertLinks(org.opentcs.util.persistence.v004.LocationTO to) { + return to.getLinks().stream() + .map(link -> { + return new LocationTO.Link() + .setPoint(link.getPoint()) + .setAllowedOperations(convertAllowedOperations(link.getAllowedOperations())); + }) + .toList(); + } + + private List convertBlocks(V004PlantModelTO to) { + return to.getBlocks().stream() + .map(block -> { + BlockTO result = new BlockTO(); + result.setName(block.getName()) + .setProperties(convertProperties(block.getProperties())); + result.setType(block.getType()) + .setMembers(convertMembers(block.getMembers())) + .setBlockLayout( + new BlockTO.BlockLayout() + .setColor(block.getBlockLayout().getColor()) + ); + return result; + }) + .toList(); + } + + private List convertMembers(List tos) { + return tos.stream() + .map(member -> { + MemberTO result = new MemberTO(); + result.setName(member.getName()) + .setProperties(convertProperties(member.getProperties())); + return result; + }) + .toList(); + } + + private VisualLayoutTO convertVisualLayout(V004PlantModelTO to) { + VisualLayoutTO result = new VisualLayoutTO() + .setScaleX(to.getVisualLayout().getScaleX()) + .setScaleY(to.getVisualLayout().getScaleY()) + .setLayers( + to.getVisualLayout().getLayers().stream() + .map( + layer -> new VisualLayoutTO.Layer() + .setId(layer.getId()) + .setOrdinal(layer.getOrdinal()) + .setVisible(layer.isVisible()) + .setName(layer.getName()) + .setGroupId(layer.getGroupId()) + ) + .toList() + ) + .setLayerGroups( + to.getVisualLayout().getLayerGroups().stream() + .map( + layerGroup -> new VisualLayoutTO.LayerGroup() + .setId(layerGroup.getId()) + .setName(layerGroup.getName()) + .setVisible(layerGroup.isVisible()) + ) + .toList() + ); + result + .setProperties(convertProperties(to.getVisualLayout().getProperties())) + .setName(to.getVisualLayout().getName()); + + return result; + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005PlantModelTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005PlantModelTO.java new file mode 100644 index 000000000..141f39cc3 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005PlantModelTO.java @@ -0,0 +1,221 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.XMLConstants; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import org.opentcs.util.persistence.BasePlantModelTO; +import org.xml.sax.SAXException; + +/** + */ +@XmlRootElement(name = "model") +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"version", "name", "points", "paths", "vehicles", "locationTypes", + "locations", "blocks", "visualLayout", "properties"}) +public class V005PlantModelTO + extends BasePlantModelTO { + + private String name = ""; + private List points = new ArrayList<>(); + private List paths = new ArrayList<>(); + private List vehicles = new ArrayList<>(); + private List locationTypes = new ArrayList<>(); + private List locations = new ArrayList<>(); + private List blocks = new ArrayList<>(); + private VisualLayoutTO visualLayout = new VisualLayoutTO(); + private List properties = new ArrayList<>(); + + /** + * Creates a new instance. + */ + public V005PlantModelTO() { + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public V005PlantModelTO setName(@Nonnull String name) { + requireNonNull(name, "name"); + this.name = name; + return this; + } + + @XmlElement(name = "point") + public List getPoints() { + return points; + } + + public V005PlantModelTO setPoints(@Nonnull List points) { + requireNonNull(points, "points"); + this.points = points; + return this; + } + + @XmlElement(name = "path") + public List getPaths() { + return paths; + } + + public V005PlantModelTO setPaths(@Nonnull List paths) { + requireNonNull(paths, "paths"); + this.paths = paths; + return this; + } + + @XmlElement(name = "vehicle") + public List getVehicles() { + return vehicles; + } + + public V005PlantModelTO setVehicles(@Nonnull List vehicles) { + requireNonNull(vehicles, "vehicles"); + this.vehicles = vehicles; + return this; + } + + @XmlElement(name = "locationType") + public List getLocationTypes() { + return locationTypes; + } + + public V005PlantModelTO setLocationTypes(@Nonnull List locationTypes) { + requireNonNull(locationTypes, "locationTypes"); + this.locationTypes = locationTypes; + return this; + } + + @XmlElement(name = "location") + public List getLocations() { + return locations; + } + + public V005PlantModelTO setLocations(@Nonnull List locations) { + requireNonNull(locations, "locations"); + this.locations = locations; + return this; + } + + @XmlElement(name = "block") + public List getBlocks() { + return blocks; + } + + public V005PlantModelTO setBlocks(@Nonnull List blocks) { + requireNonNull(blocks, "blocks"); + this.blocks = blocks; + return this; + } + + @XmlElement + public VisualLayoutTO getVisualLayout() { + return visualLayout; + } + + public V005PlantModelTO setVisualLayout(@Nonnull VisualLayoutTO visualLayout) { + this.visualLayout = requireNonNull(visualLayout, "visualLayout"); + return this; + } + + @XmlElement(name = "property") + public List getProperties() { + return properties; + } + + public V005PlantModelTO setProperties(@Nonnull List properties) { + requireNonNull(properties, "properties"); + this.properties = properties; + return this; + } + + /** + * Marshals this instance to its XML representation and writes it to the given writer. + * + * @param writer The writer to write this instance's XML representation to. + * @throws IOException If there was a problem marshalling this instance. + */ + public void toXml(@Nonnull Writer writer) + throws IOException { + requireNonNull(writer, "writer"); + + try { + createMarshaller().marshal(this, writer); + } + catch (JAXBException | SAXException exc) { + throw new IOException("Exception marshalling data", exc); + } + } + + /** + * Unmarshals an instance of this class from the given XML representation. + * + * @param reader Provides the XML representation to parse to an instance. + * @return The instance unmarshalled from the given reader. + * @throws IOException If there was a problem unmarshalling the given string. + */ + public static V005PlantModelTO fromXml(@Nonnull Reader reader) + throws IOException { + requireNonNull(reader, "reader"); + + try { + return (V005PlantModelTO) createUnmarshaller().unmarshal(reader); + } + catch (JAXBException | SAXException exc) { + throw new IOException("Exception unmarshalling data", exc); + } + } + + private static Marshaller createMarshaller() + throws JAXBException, SAXException { + Marshaller marshaller = createContext().createMarshaller(); + marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + marshaller.setSchema(createSchema()); + return marshaller; + } + + private static Unmarshaller createUnmarshaller() + throws JAXBException, SAXException { + Unmarshaller unmarshaller = createContext().createUnmarshaller(); + unmarshaller.setSchema(createSchema()); + return unmarshaller; + } + + private static JAXBContext createContext() + throws JAXBException { + return JAXBContext.newInstance(V005PlantModelTO.class); + } + + private static Schema createSchema() + throws SAXException { + URL schemaUrl + = V005PlantModelTO.class.getResource("/org/opentcs/util/persistence/model-0.0.4.xsd"); + SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); + return schemaFactory.newSchema(schemaUrl); + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005TOMapper.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005TOMapper.java new file mode 100644 index 000000000..8f882bf31 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/V005TOMapper.java @@ -0,0 +1,681 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; +import org.opentcs.access.to.model.BlockCreationTO; +import org.opentcs.access.to.model.LocationCreationTO; +import org.opentcs.access.to.model.LocationTypeCreationTO; +import org.opentcs.access.to.model.PathCreationTO; +import org.opentcs.access.to.model.PlantModelCreationTO; +import org.opentcs.access.to.model.PointCreationTO; +import org.opentcs.access.to.model.VehicleCreationTO; +import org.opentcs.access.to.model.VisualLayoutCreationTO; +import org.opentcs.access.to.peripherals.PeripheralOperationCreationTO; +import org.opentcs.data.model.Block; +import org.opentcs.data.model.Couple; +import org.opentcs.data.model.Envelope; +import org.opentcs.data.model.Path; +import org.opentcs.data.model.Point; +import org.opentcs.data.model.Pose; +import org.opentcs.data.model.Triple; +import org.opentcs.data.model.visualization.Layer; +import org.opentcs.data.model.visualization.LayerGroup; +import org.opentcs.data.model.visualization.LocationRepresentation; +import org.opentcs.data.peripherals.PeripheralOperation; +import org.opentcs.util.Colors; + +/** + * Provides methods for mapping {@link PlantModelCreationTO} to {@link V005PlantModelTO} and + * vice versa. + */ +public class V005TOMapper { + + /** + * The file format version this mapper works with. + */ + public static final String VERSION_STRING = "0.0.5"; + + /** + * Creates a new instance. + */ + public V005TOMapper() { + } + + /** + * Maps the given model to a {@link PlantModelCreationTO} instance. + * + * @param model The model to map. + * @return The mapped {@link PlantModelCreationTO} instance. + */ + public PlantModelCreationTO map(V005PlantModelTO model) { + return new PlantModelCreationTO(model.getName()) + .withPoints(toPointCreationTO(model.getPoints())) + .withVehicles(toVehicleCreationTO(model.getVehicles())) + .withPaths(toPathCreationTO(model.getPaths())) + .withLocationTypes(toLocationTypeCreationTO(model.getLocationTypes())) + .withLocations(toLocationCreationTO(model.getLocations())) + .withBlocks(toBlockCreationTO(model.getBlocks())) + .withVisualLayout(toVisualLayoutCreationTO(model.getVisualLayout())) + .withProperties(convertProperties(model.getProperties())); + } + + /** + * Maps the given model to a {@link V005PlantModelTO} instance. + * + * @param model The model to map. + * @return The mapped {@link V005PlantModelTO} instance. + */ + public V005PlantModelTO map(PlantModelCreationTO model) { + V005PlantModelTO result = new V005PlantModelTO(); + + result.setName(model.getName()); + result.setVersion(VERSION_STRING); + result.getPoints().addAll(toPointTO(model.getPoints(), model.getPaths())); + result.getVehicles().addAll(toVehicleTO(model.getVehicles())); + result.getPaths().addAll(toPathTO(model.getPaths())); + result.getLocationTypes().addAll(toLocationTypeTO(model.getLocationTypes())); + result.getLocations().addAll(toLocationTO(model.getLocations())); + result.getBlocks().addAll(toBlockTO(model.getBlocks())); + result.setVisualLayout(toVisualLayoutTO(model.getVisualLayout())); + result.getProperties().addAll(convertProperties(model.getProperties())); + + return result; + } + + //Methods for mapping from PlantModelElementTO to CreationTO start here. + private List toPointCreationTO(List points) { + List result = new ArrayList<>(); + + for (PointTO point : points) { + result.add( + new PointCreationTO(point.getName()) + .withPose( + new Pose( + new Triple(point.getxPosition(), point.getyPosition(), point.getzPosition()), + point.getVehicleOrientationAngle().doubleValue() + ) + ) + .withType(Point.Type.valueOf(point.getType())) + .withVehicleEnvelopes(toEnvelopeMap(point.getVehicleEnvelopes())) + .withProperties(convertProperties(point.getProperties())) + .withLayout( + new PointCreationTO.Layout( + new Couple(point.getPointLayout().getxPosition(), + point.getPointLayout().getyPosition()), + new Couple(point.getPointLayout().getxLabelOffset(), + point.getPointLayout().getyLabelOffset()), + point.getPointLayout().getLayerId() + ) + ) + ); + } + + return result; + } + + private List toVehicleCreationTO(List vehicles) { + List result = new ArrayList<>(); + + for (VehicleTO vehicle : vehicles) { + result.add( + new VehicleCreationTO(vehicle.getName()) + .withLength(vehicle.getLength().intValue()) + .withEnergyLevelCritical(vehicle.getEnergyLevelCritical().intValue()) + .withEnergyLevelGood(vehicle.getEnergyLevelGood().intValue()) + .withEnergyLevelFullyRecharged(vehicle.getEnergyLevelFullyRecharged().intValue()) + .withEnergyLevelSufficientlyRecharged( + vehicle.getEnergyLevelSufficientlyRecharged().intValue() + ) + .withMaxReverseVelocity(vehicle.getMaxReverseVelocity()) + .withMaxVelocity(vehicle.getMaxVelocity()) + .withEnvelopeKey(vehicle.getEnvelopeKey()) + .withProperties(convertProperties(vehicle.getProperties())) + .withLayout(new VehicleCreationTO.Layout( + Colors.decodeFromHexRGB(vehicle.getVehicleLayout().getColor()) + )) + ); + } + + return result; + } + + private List toPathCreationTO(List paths) { + List result = new ArrayList<>(); + + for (PathTO path : paths) { + result.add( + new PathCreationTO(path.getName(), + path.getSourcePoint(), + path.getDestinationPoint()) + .withLength(path.getLength()) + .withLocked(path.isLocked()) + .withMaxVelocity(path.getMaxVelocity().intValue()) + .withMaxReverseVelocity(path.getMaxReverseVelocity().intValue()) + .withPeripheralOperations( + toPeripheralOperationCreationTOs(path.getPeripheralOperations()) + ) + .withVehicleEnvelopes(toEnvelopeMap(path.getVehicleEnvelopes())) + .withProperties(convertProperties(path.getProperties())) + .withLayout(new PathCreationTO.Layout( + Path.Layout.ConnectionType.valueOf(path.getPathLayout().getConnectionType()), + path.getPathLayout().getControlPoints().stream() + .map(controlPoint -> new Couple(controlPoint.getX(), controlPoint.getY())) + .toList(), + path.getPathLayout().getLayerId() + )) + ); + } + + return result; + } + + private List toPeripheralOperationCreationTOs( + List tos) { + return tos.stream() + .map( + to -> new PeripheralOperationCreationTO(to.getName(), to.getLocationName()) + .withExecutionTrigger( + PeripheralOperation.ExecutionTrigger.valueOf(to.getExecutionTrigger()) + ) + .withCompletionRequired(to.isCompletionRequired()) + ) + .toList(); + } + + private List toLocationTypeCreationTO( + List locationTypes) { + List result = new ArrayList<>(); + + for (LocationTypeTO locationType : locationTypes) { + result.add( + new LocationTypeCreationTO(locationType.getName()) + .withAllowedOperations(getOperationNames(locationType.getAllowedOperations())) + .withAllowedPeripheralOperations(getPeripheralOperationNames( + locationType.getAllowedPeripheralOperations()) + ) + .withProperties(convertProperties(locationType.getProperties())) + .withLayout( + new LocationTypeCreationTO.Layout( + LocationRepresentation.valueOf( + locationType.getLocationTypeLayout().getLocationRepresentation() + ) + ) + ) + ); + } + + return result; + } + + private List toLocationCreationTO(List locations) { + List result = new ArrayList<>(); + + for (LocationTO location : locations) { + result.add( + new LocationCreationTO(location.getName(), + location.getType(), + new Triple(location.getxPosition(), + location.getyPosition(), + location.getzPosition())) + .withLinks(getLinks(location)) + .withLocked(location.isLocked()) + .withProperties(convertProperties(location.getProperties())) + .withLayout( + new LocationCreationTO.Layout( + new Couple(location.getLocationLayout().getxPosition(), + location.getLocationLayout().getyPosition()), + new Couple(location.getLocationLayout().getxLabelOffset(), + location.getLocationLayout().getyLabelOffset()), + LocationRepresentation.valueOf( + location.getLocationLayout().getLocationRepresentation() + ), + location.getLocationLayout().getLayerId() + ) + ) + ); + } + + return result; + } + + private List toBlockCreationTO(List blocks) { + List result = new ArrayList<>(); + + for (BlockTO block : blocks) { + result.add( + new BlockCreationTO(block.getName()) + .withType(Block.Type.valueOf(block.getType())) + .withMemberNames(block.getMembers().stream() + .map(member -> member.getName()) + .collect(Collectors.toSet())) + .withProperties(convertProperties(block.getProperties())) + .withLayout(new BlockCreationTO.Layout( + Colors.decodeFromHexRGB(block.getBlockLayout().getColor()) + )) + ); + } + + return result; + } + + private VisualLayoutCreationTO toVisualLayoutCreationTO(VisualLayoutTO visualLayout) { + return new VisualLayoutCreationTO(visualLayout.getName()) + .withScaleX(visualLayout.getScaleX()) + .withScaleY(visualLayout.getScaleY()) + .withLayers(convertLayers(visualLayout.getLayers())) + .withLayerGroups(convertLayerGroups(visualLayout.getLayerGroups())) + .withProperties(convertProperties(visualLayout.getProperties())); + } + + private List convertLayers(List layers) { + List result = new ArrayList<>(); + + for (VisualLayoutTO.Layer layer : layers) { + result.add(new Layer(layer.getId(), + layer.getOrdinal(), + layer.isVisible(), + layer.getName(), + layer.getGroupId())); + } + + return result; + } + + private List convertLayerGroups(List layerGroups) { + List result = new ArrayList<>(); + + for (VisualLayoutTO.LayerGroup layerGroup : layerGroups) { + result.add(new LayerGroup(layerGroup.getId(), + layerGroup.getName(), + layerGroup.isVisible())); + } + + return result; + } + + private Map convertProperties(List propsList) { + Map result = new HashMap<>(); + for (PropertyTO property : propsList) { + String propName + = isNullOrEmpty(property.getName()) ? "Property unknown" : property.getName(); + String propValue + = isNullOrEmpty(property.getValue()) ? "Value unknown" : property.getValue(); + + result.put(propName, propValue); + } + + return result; + } + + private List getOperationNames(List ops) { + List result = new ArrayList<>(ops.size()); + for (AllowedOperationTO operation : ops) { + result.add(operation.getName()); + } + return result; + } + + private List getPeripheralOperationNames(List ops) { + List result = new ArrayList<>(ops.size()); + for (AllowedPeripheralOperationTO operation : ops) { + result.add(operation.getName()); + } + return result; + } + + private Map> getLinks(LocationTO to) { + Map> result = new HashMap<>(); + for (LocationTO.Link linkTO : to.getLinks()) { + result.put(linkTO.getPoint(), + new HashSet<>(getOperationNames(linkTO.getAllowedOperations()))); + } + + return result; + } + + //Methods for mapping from CreationTO to PlantModelElementTO start here. + private List toPointTO(List points, List paths) { + List result = new ArrayList<>(); + + for (PointCreationTO point : points) { + PointTO pointTO = new PointTO(); + pointTO.setName(point.getName()); + pointTO.setxPosition(point.getPose().getPosition().getX()) + .setyPosition(point.getPose().getPosition().getY()) + .setVehicleOrientationAngle((float) point.getPose().getOrientationAngle()) + .setType(point.getType().name()) + .setOutgoingPaths(getOutgoingPaths(point, paths)) + .setVehicleEnvelopes(toVehicleEnvelopeTOs(point.getVehicleEnvelopes())) + .setPointLayout(new PointTO.PointLayout() + .setxPosition(point.getLayout().getPosition().getX()) + .setyPosition(point.getLayout().getPosition().getY()) + .setxLabelOffset(point.getLayout().getLabelOffset().getX()) + .setyLabelOffset(point.getLayout().getLabelOffset().getY()) + .setLayerId(point.getLayout().getLayerId())) + .setProperties(convertProperties(point.getProperties())); + + result.add(pointTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private List toVehicleTO(List vehicles) { + List result = new ArrayList<>(); + + for (VehicleCreationTO vehicle : vehicles) { + VehicleTO vehicleTO = new VehicleTO(); + vehicleTO.setName(vehicle.getName()); + vehicleTO.setLength((long) vehicle.getLength()) + .setMaxVelocity(vehicle.getMaxVelocity()) + .setMaxReverseVelocity(vehicle.getMaxReverseVelocity()) + .setEnergyLevelGood((long) vehicle.getEnergyLevelGood()) + .setEnergyLevelCritical((long) vehicle.getEnergyLevelCritical()) + .setEnergyLevelFullyRecharged((long) vehicle.getEnergyLevelFullyRecharged()) + .setEnergyLevelSufficientlyRecharged((long) vehicle.getEnergyLevelSufficientlyRecharged()) + .setEnvelopeKey(vehicle.getEnvelopeKey()) + .setVehicleLayout(new VehicleTO.VehicleLayout() + .setColor(Colors.encodeToHexRGB(vehicle.getLayout().getRouteColor()))) + .setProperties(convertProperties(vehicle.getProperties())); + + result.add(vehicleTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private List toPathTO(List paths) { + List result = new ArrayList<>(); + + for (PathCreationTO path : paths) { + PathTO pathTO = new PathTO(); + pathTO.setName(path.getName()); + pathTO.setSourcePoint(path.getSrcPointName()) + .setDestinationPoint(path.getDestPointName()) + .setLength(path.getLength()) + .setMaxVelocity((long) path.getMaxVelocity()) + .setMaxReverseVelocity((long) path.getMaxReverseVelocity()) + .setPeripheralOperations(toPeripheralOperationTOs(path.getPeripheralOperations())) + .setLocked(path.isLocked()) + .setVehicleEnvelopes(toVehicleEnvelopeTOs(path.getVehicleEnvelopes())) + .setPathLayout(new PathTO.PathLayout() + .setConnectionType(path.getLayout().getConnectionType().name()) + .setControlPoints(path.getLayout().getControlPoints().stream() + .map(controlPoint -> { + return new PathTO.ControlPoint() + .setX(controlPoint.getX()) + .setY(controlPoint.getY()); + }) + .toList()) + .setLayerId(path.getLayout().getLayerId())) + .setProperties(convertProperties(path.getProperties())); + + result.add(pathTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private List toPeripheralOperationTOs( + List tos) { + return tos.stream() + .map( + to -> (PeripheralOperationTO) new PeripheralOperationTO() + .setLocationName(to.getLocationName()) + .setExecutionTrigger(to.getExecutionTrigger().name()) + .setCompletionRequired(to.isCompletionRequired()) + .setName(to.getOperation()) + ) + .toList(); + } + + private List toLocationTypeTO( + List locationTypes) { + List result = new ArrayList<>(); + + for (LocationTypeCreationTO locationType : locationTypes) { + LocationTypeTO locationTypeTO = new LocationTypeTO(); + locationTypeTO.setName(locationType.getName()); + locationTypeTO.setAllowedOperations( + toAllowedOperationTOs(locationType.getAllowedOperations()) + ) + .setAllowedPeripheralOperations( + toAllowedPeripheralOperationTOs(locationType.getAllowedPeripheralOperations()) + ) + .setLocationTypeLayout( + new LocationTypeTO.LocationTypeLayout() + .setLocationRepresentation( + locationType.getLayout().getLocationRepresentation().name()) + ) + .setProperties(convertProperties(locationType.getProperties())); + + result.add(locationTypeTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private List toLocationTO(List locations) { + List result = new ArrayList<>(); + + for (LocationCreationTO location : locations) { + LocationTO locationTO = new LocationTO(); + locationTO.setName(location.getName()); + locationTO.setxPosition(location.getPosition().getX()) + .setyPosition(location.getPosition().getY()) + .setType(location.getTypeName()) + .setLinks(toLocationTOLinks(location.getLinks())) + .setLocked(location.isLocked()) + .setLocationLayout(new LocationTO.LocationLayout() + .setxPosition(location.getLayout().getPosition().getX()) + .setyPosition(location.getLayout().getPosition().getY()) + .setxLabelOffset(location.getLayout().getLabelOffset().getX()) + .setyLabelOffset(location.getLayout().getLabelOffset().getY()) + .setLocationRepresentation(location.getLayout().getLocationRepresentation().name()) + .setLayerId(location.getLayout().getLayerId())) + .setProperties(convertProperties(location.getProperties())); + + result.add(locationTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private List toBlockTO(List blocks) { + List result = new ArrayList<>(); + + for (BlockCreationTO block : blocks) { + BlockTO blockTO = new BlockTO(); + blockTO.setName(block.getName()); + blockTO.setType(block.getType().name()) + .setMembers(toMemberTOs(block.getMemberNames())) + .setBlockLayout(new BlockTO.BlockLayout() + .setColor(Colors.encodeToHexRGB(block.getLayout().getColor()))) + .setProperties(convertProperties(block.getProperties())); + + result.add(blockTO); + } + + Collections.sort(result, Comparators.elementsByName()); + + return result; + } + + private VisualLayoutTO toVisualLayoutTO(VisualLayoutCreationTO layout) { + VisualLayoutTO result = new VisualLayoutTO(); + + result.setName(layout.getName()) + .setProperties(convertProperties(layout.getProperties())); + result.setScaleX((float) layout.getScaleX()) + .setScaleY((float) layout.getScaleY()) + .setLayers(toLayerTOs(layout.getLayers())) + .setLayerGroups(toLayerGroupTOs(layout.getLayerGroups())); + + return result; + } + + private List toLayerTOs(List layers) { + List result = new ArrayList<>(); + + for (Layer layer : layers) { + result.add(new VisualLayoutTO.Layer() + .setId(layer.getId()) + .setOrdinal(layer.getOrdinal()) + .setVisible(layer.isVisible()) + .setName(layer.getName()) + .setGroupId(layer.getGroupId())); + } + + return result; + } + + private List toLayerGroupTOs(List layerGroups) { + List result = new ArrayList<>(); + + for (LayerGroup layerGroup : layerGroups) { + result.add(new VisualLayoutTO.LayerGroup() + .setId(layerGroup.getId()) + .setName(layerGroup.getName()) + .setVisible(layerGroup.isVisible())); + } + + return result; + } + + private List getOutgoingPaths(PointCreationTO point, + List paths) { + List result = new ArrayList<>(); + + for (PathCreationTO path : paths) { + if (Objects.equals(path.getSrcPointName(), point.getName())) { + result.add(new PointTO.OutgoingPath().setName(path.getName())); + } + } + + Collections.sort(result, Comparators.outgoingPathsByName()); + + return result; + } + + private List toAllowedOperationTOs(Collection allowedOperations) { + return allowedOperations.stream() + .sorted() + .map(allowedOperation -> { + return (AllowedOperationTO) new AllowedOperationTO().setName(allowedOperation); + }) + .toList(); + } + + private List toAllowedPeripheralOperationTOs( + Collection allowedOperations) { + return allowedOperations.stream() + .sorted() + .map(allowedOperation -> { + return (AllowedPeripheralOperationTO) new AllowedPeripheralOperationTO() + .setName(allowedOperation); + }) + .toList(); + } + + private List toLocationTOLinks(Map> links) { + List result = new ArrayList<>(); + + links.forEach((key, value) -> { + result.add( + new LocationTO.Link() + .setPoint(key) + .setAllowedOperations(toAllowedOperationTOs(value)) + ); + }); + + Collections.sort(result, Comparators.linksByPointName()); + + return result; + } + + private List toMemberTOs(Collection members) { + return members.stream() + .map(member -> (MemberTO) new MemberTO().setName(member)) + .sorted(Comparators.elementsByName()) + .toList(); + } + + private List convertProperties(Map properties) { + List result = new ArrayList<>(); + + properties.forEach((key, value) -> { + result.add(new PropertyTO().setName(key).setValue(value)); + }); + + Collections.sort(result, Comparators.propertiesByName()); + + return result; + } + + private boolean isNullOrEmpty(String s) { + return s == null || s.isEmpty(); + } + + private Map toEnvelopeMap(List envelopeTOs) { + return envelopeTOs.stream() + .collect( + Collectors.toMap(VehicleEnvelopeTO::getKey, + vehicleEnvelopeTO -> toEnvelope(vehicleEnvelopeTO)) + ); + } + + private Envelope toEnvelope(VehicleEnvelopeTO vehicleEnvelopeTO) { + return new Envelope( + vehicleEnvelopeTO.getVertices().stream() + .map(coupleTO -> new Couple(coupleTO.getX(), coupleTO.getY())) + .toList() + ); + } + + private List toVehicleEnvelopeTOs(Map envelopeMap) { + return envelopeMap.entrySet() + .stream() + .sorted(Map.Entry.comparingByKey()) + .map( + entry -> new VehicleEnvelopeTO() + .setKey(entry.getKey()) + .setVertices(toCoupleTOs(entry.getValue().getVertices())) + ) + .toList(); + } + + private List toCoupleTOs(List couples) { + return couples.stream() + .map( + couple -> new CoupleTO() + .setX(couple.getX()) + .setY(couple.getY()) + ) + .toList(); + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleEnvelopeTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleEnvelopeTO.java new file mode 100644 index 000000000..284c9204c --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleEnvelopeTO.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"key", "vertices"}) +public class VehicleEnvelopeTO { + + private String key; + private List vertices; + + public VehicleEnvelopeTO() { + } + + public String getKey() { + return key; + } + + @XmlAttribute + public VehicleEnvelopeTO setKey(@Nonnull String key) { + this.key = requireNonNull(key, "key"); + return this; + } + + @XmlElement(name = "vertex") + public List getVertices() { + return vertices; + } + + public VehicleEnvelopeTO setVertices(@Nonnull List vertices) { + this.vertices = requireNonNull(vertices, "vertices"); + return this; + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleTO.java new file mode 100644 index 000000000..c7bca3727 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VehicleTO.java @@ -0,0 +1,173 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import jakarta.annotation.Nullable; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlSchemaType; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType( + propOrder = {"name", "length", "energyLevelCritical", "energyLevelGood", + "energyLevelFullyRecharged", "energyLevelSufficientlyRecharged", + "maxVelocity", "maxReverseVelocity", "properties", "vehicleLayout"}) +public class VehicleTO + extends PlantModelElementTO { + + //max velocity in mm/s. + private int maxVelocity; + //max rev velocity in mm/s. + private int maxReverseVelocity; + private Long length = 0L; + private Long energyLevelCritical = 0L; + private Long energyLevelGood = 0L; + private Long energyLevelFullyRecharged = 0L; + private Long energyLevelSufficientlyRecharged = 0L; + private String envelopeKey; + private VehicleLayout vehicleLayout = new VehicleLayout(); + + /** + * Creates a new instance. + */ + public VehicleTO() { + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getLength() { + return length; + } + + public VehicleTO setLength(@Nonnull Long length) { + requireNonNull(length, "length"); + this.length = length; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getEnergyLevelCritical() { + return energyLevelCritical; + } + + public VehicleTO setEnergyLevelCritical(@Nonnull Long energyLevelCritical) { + requireNonNull(energyLevelCritical, "energyLevelCritical"); + this.energyLevelCritical = energyLevelCritical; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getEnergyLevelGood() { + return energyLevelGood; + } + + public VehicleTO setEnergyLevelGood(@Nonnull Long energyLevelGood) { + requireNonNull(energyLevelGood, "energyLevelGood"); + this.energyLevelGood = energyLevelGood; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getEnergyLevelFullyRecharged() { + return energyLevelFullyRecharged; + } + + public VehicleTO setEnergyLevelFullyRecharged(@Nonnull Long energyLevelFullyRecharged) { + requireNonNull(energyLevelFullyRecharged, "energyLevelFullyRecharged"); + this.energyLevelFullyRecharged = energyLevelFullyRecharged; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public Long getEnergyLevelSufficientlyRecharged() { + return energyLevelSufficientlyRecharged; + } + + public VehicleTO setEnergyLevelSufficientlyRecharged( + @Nonnull Long energyLevelSufficientlyRecharged) { + requireNonNull(energyLevelSufficientlyRecharged, "energyLevelSufficientlyRecharged"); + this.energyLevelSufficientlyRecharged = energyLevelSufficientlyRecharged; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public int getMaxVelocity() { + return maxVelocity; + } + + public VehicleTO setMaxVelocity(@Nonnull int maxVelocity) { + this.maxVelocity = maxVelocity; + return this; + } + + @XmlAttribute + @XmlSchemaType(name = "unsignedInt") + public int getMaxReverseVelocity() { + return maxReverseVelocity; + } + + public VehicleTO setMaxReverseVelocity(@Nonnull int maxReverseVelocity) { + this.maxReverseVelocity = maxReverseVelocity; + return this; + } + + @XmlAttribute + @Nullable + public String getEnvelopeKey() { + return envelopeKey; + } + + public VehicleTO setEnvelopeKey(@Nullable String envelopeKey) { + this.envelopeKey = envelopeKey; + return this; + } + + @XmlElement(required = true) + public VehicleLayout getVehicleLayout() { + return vehicleLayout; + } + + public VehicleTO setVehicleLayout(@Nonnull VehicleLayout vehicleLayout) { + this.vehicleLayout = requireNonNull(vehicleLayout, "vehicleLayout"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + public static class VehicleLayout { + + private String color = ""; + + /** + * Creates a new instance. + */ + public VehicleLayout() { + } + + @XmlAttribute(required = true) + public String getColor() { + return color; + } + + public VehicleLayout setColor(@Nonnull String color) { + this.color = requireNonNull(color, "color"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VisualLayoutTO.java b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VisualLayoutTO.java new file mode 100644 index 000000000..043615f70 --- /dev/null +++ b/openTCS-Common/src/main/java/org/opentcs/util/persistence/v005/VisualLayoutTO.java @@ -0,0 +1,191 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import jakarta.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; +import static java.util.Objects.requireNonNull; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; + +/** + */ +@XmlAccessorType(XmlAccessType.PROPERTY) +@XmlType(propOrder = {"name", "scaleX", "scaleY", "layers", "layerGroups", "properties"}) +public class VisualLayoutTO + extends PlantModelElementTO { + + private Float scaleX = 0.0F; + private Float scaleY = 0.0F; + private List layers = new ArrayList<>(); + private List layerGroups = new ArrayList<>(); + + /** + * Creates a new instance. + */ + public VisualLayoutTO() { + } + + @XmlAttribute(required = true) + public Float getScaleX() { + return scaleX; + } + + public VisualLayoutTO setScaleX(@Nonnull Float scaleX) { + requireNonNull(scaleX, "scaleX"); + this.scaleX = scaleX; + return this; + } + + @XmlAttribute(required = true) + public Float getScaleY() { + return scaleY; + } + + public VisualLayoutTO setScaleY(@Nonnull Float scaleY) { + requireNonNull(scaleY, "scaleY"); + this.scaleY = scaleY; + return this; + } + + @XmlElement(name = "layer") + public List getLayers() { + return layers; + } + + public VisualLayoutTO setLayers(@Nonnull List layers) { + this.layers = requireNonNull(layers, "layers"); + return this; + } + + @XmlElement(name = "layerGroup") + public List getLayerGroups() { + return layerGroups; + } + + public VisualLayoutTO setLayerGroups(@Nonnull List layerGroups) { + this.layerGroups = requireNonNull(layerGroups, "layerGroups"); + return this; + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"id", "ordinal", "visible", "name", "groupId"}) + public static class Layer { + + private Integer id = 0; + private Integer ordinal = 0; + private Boolean visible = true; + private String name = ""; + private Integer groupId = 0; + + /** + * Creates a new instance. + */ + public Layer() { + } + + @XmlAttribute(required = true) + public Integer getId() { + return id; + } + + public Layer setId(Integer id) { + this.id = requireNonNull(id, "id"); + return this; + } + + @XmlAttribute(required = true) + public Integer getOrdinal() { + return ordinal; + } + + public Layer setOrdinal(Integer ordinal) { + this.ordinal = requireNonNull(ordinal, "ordinal"); + return this; + } + + @XmlAttribute(required = true) + public Boolean isVisible() { + return visible; + } + + public Layer setVisible(Boolean visible) { + this.visible = requireNonNull(visible, "visible"); + return this; + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public Layer setName(String name) { + this.name = requireNonNull(name, "name"); + return this; + } + + @XmlAttribute(required = true) + public Integer getGroupId() { + return groupId; + } + + public Layer setGroupId(Integer groupId) { + this.groupId = requireNonNull(groupId, "groupId"); + return this; + } + } + + @XmlAccessorType(XmlAccessType.PROPERTY) + @XmlType(propOrder = {"id", "name", "visible"}) + public static class LayerGroup { + + private Integer id = 0; + private String name = ""; + private Boolean visible = true; + + /** + * Creates a new instance. + */ + public LayerGroup() { + } + + @XmlAttribute(required = true) + public Integer getId() { + return id; + } + + public LayerGroup setId(Integer id) { + this.id = requireNonNull(id, "id"); + return this; + } + + @XmlAttribute(required = true) + public String getName() { + return name; + } + + public LayerGroup setName(String name) { + this.name = requireNonNull(name, "name"); + return this; + } + + @XmlAttribute(required = true) + public Boolean isVisible() { + return visible; + } + + public LayerGroup setVisible(Boolean visible) { + this.visible = requireNonNull(visible, "visible"); + return this; + } + } +} diff --git a/openTCS-Common/src/main/resources/org/opentcs/util/persistence/model-0.0.5.xsd b/openTCS-Common/src/main/resources/org/opentcs/util/persistence/model-0.0.5.xsd new file mode 100644 index 000000000..c3e3d1ec5 --- /dev/null +++ b/openTCS-Common/src/main/resources/org/opentcs/util/persistence/model-0.0.5.xsd @@ -0,0 +1,538 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/openTCS-Common/src/test/java/org/opentcs/util/persistence/v005/V005DrivingCoursePersistenceTest.java b/openTCS-Common/src/test/java/org/opentcs/util/persistence/v005/V005DrivingCoursePersistenceTest.java new file mode 100644 index 000000000..04e782b6c --- /dev/null +++ b/openTCS-Common/src/test/java/org/opentcs/util/persistence/v005/V005DrivingCoursePersistenceTest.java @@ -0,0 +1,345 @@ +/** + * Copyright (c) The openTCS Authors. + * + * This program is free software and subject to the MIT license. (For details, + * see the licensing information (LICENSE.txt) you should have received with + * this copy of the software.) + */ +package org.opentcs.util.persistence.v005; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +/** + */ +class V005DrivingCoursePersistenceTest { + + private V005PlantModelTO plantModel; + + @BeforeEach + void setUp() { + plantModel = createPlantModel(); + } + + @Test + void persistAndMaterializeModelAttributes() + throws IOException { + plantModel.setVersion("0.0.5"); + plantModel.getProperties().add(new PropertyTO().setName("some-prop").setValue("some-prop-val")); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getVersion(), is(equalTo("0.0.5"))); + assertThat(parsedModel.getProperties(), hasSize(1)); + assertThat(parsedModel.getProperties().get(0).getName(), is(equalTo("some-prop"))); + assertThat(parsedModel.getProperties().get(0).getValue(), is(equalTo("some-prop-val"))); + } + + @Test + void persistAndMaterializePoints() + throws IOException { + plantModel.getPoints().get(0).setName("my-point"); + plantModel.getPoints().get(0).setxPosition(1L); + plantModel.getPoints().get(0).setyPosition(2L); + plantModel.getPoints().get(0).setzPosition(3L); + plantModel.getPoints().get(0).setVehicleOrientationAngle(12.34f); + plantModel.getPoints().get(0).setType("PARK_POSITION"); + plantModel.getPoints().get(0).getOutgoingPaths() + .add(new PointTO.OutgoingPath().setName("some-path")); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getPoints(), hasSize(2)); + assertThat(parsedModel.getPoints().get(0).getName(), is(equalTo("my-point"))); + assertThat(parsedModel.getPoints().get(0).getxPosition(), is(1L)); + assertThat(parsedModel.getPoints().get(0).getyPosition(), is(2L)); + assertThat(parsedModel.getPoints().get(0).getzPosition(), is(3L)); + assertThat(parsedModel.getPoints().get(0).getVehicleOrientationAngle(), is(12.34f)); + assertThat(parsedModel.getPoints().get(0).getType(), is(equalTo("PARK_POSITION"))); + assertThat(parsedModel.getPoints().get(0).getOutgoingPaths(), hasSize(1)); + assertThat(parsedModel.getPoints().get(0).getOutgoingPaths().get(0).getName(), + is(equalTo("some-path"))); + } + + @Test + void persistAndMaterializePaths() + throws IOException { + plantModel.getPaths().get(0).setName("my-path"); + plantModel.getPaths().get(0).setSourcePoint("some-source-point"); + plantModel.getPaths().get(0).setDestinationPoint("some-dest-point"); + plantModel.getPaths().get(0).setLength(1234L); + plantModel.getPaths().get(0).setLocked(true); + plantModel.getPaths().get(0).setMaxVelocity(9876L); + plantModel.getPaths().get(0).setMaxReverseVelocity(5432L); + plantModel.getPaths().get(0).getPeripheralOperations().add( + new PeripheralOperationTO() + .setLocationName("some-loc-name") + .setExecutionTrigger("AFTER_ALLOCATION") + .setCompletionRequired(true) + ); + plantModel.getPaths().get(0).getVehicleEnvelopes().add( + new VehicleEnvelopeTO() + .setKey("some-key") + .setVertices( + List.of( + new CoupleTO() + .setX(1234L) + .setY(5678L) + ) + ) + ); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getPaths(), hasSize(1)); + assertThat(parsedModel.getPaths().get(0).getName(), is(equalTo("my-path"))); + assertThat(parsedModel.getPaths().get(0).getLength(), is(1234L)); + assertThat(parsedModel.getPaths().get(0).isLocked(), is(true)); + assertThat(parsedModel.getPaths().get(0).getMaxVelocity(), is(9876L)); + assertThat(parsedModel.getPaths().get(0).getMaxReverseVelocity(), is(5432L)); + assertThat(parsedModel.getPaths().get(0).getSourcePoint(), is(equalTo("some-source-point"))); + assertThat(parsedModel.getPaths().get(0).getDestinationPoint(), is(equalTo("some-dest-point"))); + assertThat(parsedModel.getPaths().get(0).getPeripheralOperations(), hasSize(1)); + assertThat(parsedModel.getPaths().get(0).getPeripheralOperations().get(0).getLocationName(), + is(equalTo("some-loc-name"))); + assertThat(parsedModel.getPaths().get(0).getPeripheralOperations().get(0).getExecutionTrigger(), + is(equalTo("AFTER_ALLOCATION"))); + assertThat( + parsedModel.getPaths().get(0).getPeripheralOperations().get(0).isCompletionRequired(), + is(true) + ); + assertThat(parsedModel.getPaths().get(0).getVehicleEnvelopes(), hasSize(1)); + assertThat(parsedModel.getPaths().get(0).getVehicleEnvelopes().get(0).getKey(), is("some-key")); + assertThat( + parsedModel.getPaths().get(0).getVehicleEnvelopes().get(0).getVertices(), + hasSize(1) + ); + assertThat( + parsedModel.getPaths().get(0).getVehicleEnvelopes().get(0).getVertices().get(0).getX(), + is(1234L) + ); + assertThat( + parsedModel.getPaths().get(0).getVehicleEnvelopes().get(0).getVertices().get(0).getY(), + is(5678L) + ); + } + + @Test + void persistAndMaterializeLocationTypes() + throws IOException { + plantModel.getLocationTypes().get(0).setName("my-location-type"); + plantModel.getLocationTypes().get(0).getAllowedPeripheralOperations().add( + (AllowedPeripheralOperationTO) new AllowedPeripheralOperationTO().setName("some-op") + ); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getLocationTypes(), hasSize(1)); + assertThat(parsedModel.getLocationTypes().get(0).getName(), is(equalTo("my-location-type"))); + assertThat(parsedModel.getLocationTypes().get(0).getAllowedPeripheralOperations(), hasSize(1)); + assertThat( + parsedModel.getLocationTypes().get(0).getAllowedPeripheralOperations().get(0).getName(), + is(equalTo("some-op")) + ); + } + + @Test + void persistAndMaterializeLocations() + throws IOException { + plantModel.getLocations().get(0).setName("my-location"); + plantModel.getLocations().get(0).setType("some-loc-type"); + plantModel.getLocations().get(0).setLocked(true); + plantModel.getLocations().get(0).setxPosition(1L); + plantModel.getLocations().get(0).setyPosition(2L); + plantModel.getLocations().get(0).setzPosition(3L); + plantModel.getLocations().get(0).getLinks().add( + new LocationTO.Link() + .setPoint("some-point") + .setAllowedOperations(new ArrayList<>(List.of( + (AllowedOperationTO) new AllowedOperationTO().setName("some-op") + ))) + ); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getLocations(), hasSize(1)); + assertThat(parsedModel.getLocations().get(0).getName(), is(equalTo("my-location"))); + assertThat(parsedModel.getLocations().get(0).getType(), is(equalTo("some-loc-type"))); + assertThat(parsedModel.getLocations().get(0).isLocked(), is(true)); + assertThat(parsedModel.getLocations().get(0).getxPosition(), is(1L)); + assertThat(parsedModel.getLocations().get(0).getyPosition(), is(2L)); + assertThat(parsedModel.getLocations().get(0).getzPosition(), is(3L)); + assertThat(parsedModel.getLocations().get(0).getLinks(), hasSize(1)); + assertThat(parsedModel.getLocations().get(0).getLinks().get(0).getPoint(), + is(equalTo("some-point"))); + assertThat(parsedModel.getLocations().get(0).getLinks().get(0).getAllowedOperations(), + hasSize(1)); + assertThat( + parsedModel.getLocations().get(0).getLinks().get(0).getAllowedOperations().get(0).getName(), + is(equalTo("some-op")) + ); + } + + @Test + void persistAndMaterializeBlocks() + throws IOException { + plantModel.getBlocks().get(0).setName("my-block"); + plantModel.getBlocks().get(0).setType("SAME_DIRECTION_ONLY"); + plantModel.getBlocks().get(0).getMembers().add( + (MemberTO) new MemberTO().setName("some-member") + ); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getBlocks(), hasSize(1)); + assertThat(parsedModel.getBlocks().get(0).getName(), is(equalTo("my-block"))); + assertThat(parsedModel.getBlocks().get(0).getType(), is(equalTo("SAME_DIRECTION_ONLY"))); + assertThat(parsedModel.getBlocks().get(0).getMembers(), hasSize(1)); + assertThat(parsedModel.getBlocks().get(0).getMembers().get(0).getName(), + is(equalTo("some-member"))); + } + + @Test + void persistAndMaterializeVehicles() + throws IOException { + plantModel.getVehicles().get(0).setName("my-vehicle"); + plantModel.getVehicles().get(0).setLength(1234L); + plantModel.getVehicles().get(0).setMaxVelocity(333); + plantModel.getVehicles().get(0).setMaxReverseVelocity(444); + plantModel.getVehicles().get(0).setEnergyLevelCritical(33L); + plantModel.getVehicles().get(0).setEnergyLevelGood(88L); + plantModel.getVehicles().get(0).setEnergyLevelSufficientlyRecharged(66L); + plantModel.getVehicles().get(0).setEnergyLevelFullyRecharged(99L); + + // Write to XML... + String xmlOutput = toXml(plantModel); + // ...then parse it back and verify it contains the same elements. + V005PlantModelTO parsedModel = V005PlantModelTO.fromXml(new StringReader(xmlOutput)); + + assertThat(parsedModel.getVehicles(), hasSize(1)); + assertThat(parsedModel.getVehicles().get(0).getName(), is(equalTo("my-vehicle"))); + assertThat(parsedModel.getVehicles().get(0).getLength(), is(1234L)); + assertThat(parsedModel.getVehicles().get(0).getMaxVelocity(), is(333)); + assertThat(parsedModel.getVehicles().get(0).getMaxReverseVelocity(), is(444)); + assertThat(parsedModel.getVehicles().get(0).getEnergyLevelCritical(), is(33L)); + assertThat(parsedModel.getVehicles().get(0).getEnergyLevelGood(), is(88L)); + assertThat(parsedModel.getVehicles().get(0).getEnergyLevelSufficientlyRecharged(), is(66L)); + assertThat(parsedModel.getVehicles().get(0).getEnergyLevelFullyRecharged(), is(99L)); + } + + private String toXml(V005PlantModelTO plantModel) + throws IOException { + StringWriter writer = new StringWriter(); + plantModel.toXml(writer); + return writer.toString(); + } + + private V005PlantModelTO createPlantModel() { + return (V005PlantModelTO) new V005PlantModelTO() + .setName(UUID.randomUUID().toString()) + .setPoints(new ArrayList<>(List.of( + (PointTO) new PointTO() + .setPointLayout(new PointTO.PointLayout() + .setxPosition(1L) + .setyPosition(2L) + .setxLabelOffset(20L) + .setyLabelOffset(20L) + .setLayerId(0)) + .setName(UUID.randomUUID().toString()), + (PointTO) new PointTO() + .setPointLayout(new PointTO.PointLayout() + .setxPosition(4L) + .setyPosition(5L) + .setxLabelOffset(20L) + .setyLabelOffset(20L) + .setLayerId(0)) + .setName(UUID.randomUUID().toString()) + ))) + .setPaths(new ArrayList<>(List.of( + (PathTO) new PathTO() + .setPathLayout(new PathTO.PathLayout() + .setConnectionType("DIRECT") + .setLayerId(0)) + .setName(UUID.randomUUID().toString()) + ))) + .setLocationTypes(new ArrayList<>(List.of( + (LocationTypeTO) new LocationTypeTO() + .setLocationTypeLayout(new LocationTypeTO.LocationTypeLayout() + .setLocationRepresentation("LOAD_TRANSFER_GENERIC") + ) + .setName(UUID.randomUUID().toString()) + ))) + .setLocations(List.of( + (LocationTO) new LocationTO() + .setLocationLayout(new LocationTO.LocationLayout() + .setxPosition(100L) + .setyPosition(200L) + .setxLabelOffset(20L) + .setyLabelOffset(20L) + .setLocationRepresentation("LOAD_TRANSFER_GENERIC") + .setLayerId(0)) + .setName(UUID.randomUUID().toString()) + )) + .setBlocks(List.of( + (BlockTO) new BlockTO() + .setBlockLayout( + new BlockTO.BlockLayout() + .setColor("#FF0000") + ) + .setName(UUID.randomUUID().toString()) + )) + .setVehicles(List.of( + (VehicleTO) new VehicleTO() + .setVehicleLayout( + new VehicleTO.VehicleLayout() + .setColor("#FF0000") + ) + .setName(UUID.randomUUID().toString()) + )) + .setVisualLayout( + (VisualLayoutTO) new VisualLayoutTO() + .setScaleX(50.0f) + .setScaleY(50.0f) + .setLayers(List.of(new VisualLayoutTO.Layer() + .setId(0) + .setOrdinal(0) + .setVisible(Boolean.TRUE) + .setName(UUID.randomUUID().toString()) + .setGroupId(0))) + .setLayerGroups(List.of(new VisualLayoutTO.LayerGroup() + .setId(0) + .setName(UUID.randomUUID().toString()) + .setVisible(Boolean.TRUE))) + .setName(UUID.randomUUID().toString()) + ) + .setVersion("0.0.5"); + } +} diff --git a/openTCS-Documentation/src/docs/release-notes/changelog.adoc b/openTCS-Documentation/src/docs/release-notes/changelog.adoc index 267c037a3..3f4388b99 100644 --- a/openTCS-Documentation/src/docs/release-notes/changelog.adoc +++ b/openTCS-Documentation/src/docs/release-notes/changelog.adoc @@ -24,9 +24,15 @@ This change log lists the most relevant changes for past releases in reverse chr For the latter, use of the `javax` namespace was never officially approved, so the former may be considered more official. ** Remove code for reading configuration (interfaces) via cfg4j. Reading configuration (interfaces) via gestalt, which had already been made the default previously, is now the only integrated variant. +** Remove deprecated code. * Other changes: ** Replace the configuration prefix 'plantoverviewapp' in the Model Editor and Operations Desk applications (which is reminiscent of the old Plant Overview application) with prefixes that are more suitable for the respective applications. +=== Migration notes + +* When a plant model that was created with an earlier version is intended to be used with openTCS 6.0, it is recommended to first load and save the plant model with the Model Editor of the latest openTCS 5 release, which is openTCS 5.17 at the time of this writing. + Otherwise, loading such a plant model with openTCS 6 might fail. + == Version 5.17 (2024-05-21) * Bugs fixed: diff --git a/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandler.java b/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandler.java index 14e3cfbeb..b122b436e 100644 --- a/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandler.java +++ b/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandler.java @@ -121,7 +121,7 @@ public PlantModelTO getPlantModel() { .setLocations(locationConverter.toLocationTOs(plantModel.getLocations())) .setBlocks(blockConverter.toBlockTOs(plantModel.getBlocks())) .setVehicles(vehicleConverter.toVehicleTOs(plantModel.getVehicles())) - .setVisualLayout(visualLayoutConverter.toVisualLayoutTO(plantModel.getVisualLayouts())) + .setVisualLayout(visualLayoutConverter.toVisualLayoutTO(plantModel.getVisualLayout())) .setProperties(propertyConverter.toPropertyTOs(plantModel.getProperties())); } diff --git a/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverter.java b/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverter.java index 53e0d8479..5d424d8f9 100644 --- a/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverter.java +++ b/openTCS-Kernel-Extension-HTTP-Services/src/main/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverter.java @@ -10,7 +10,6 @@ import jakarta.inject.Inject; import java.util.List; import static java.util.Objects.requireNonNull; -import java.util.Set; import java.util.stream.Collectors; import org.opentcs.access.to.model.VisualLayoutCreationTO; import org.opentcs.data.model.visualization.Layer; @@ -26,10 +25,10 @@ public class VisualLayoutConverter { private final PropertyConverter pConverter; - + @Inject public VisualLayoutConverter(PropertyConverter pConverter) { - this.pConverter=requireNonNull(pConverter, "pConverter"); + this.pConverter = requireNonNull(pConverter, "pConverter"); } public VisualLayoutCreationTO toVisualLayoutCreationTO(VisualLayoutTO vLayout) { @@ -41,17 +40,13 @@ public VisualLayoutCreationTO toVisualLayoutCreationTO(VisualLayoutTO vLayout) { .withLayerGroups(convertLayerGroups(vLayout.getLayerGroups())); } - public VisualLayoutTO toVisualLayoutTO(Set visualLayouts) { - return visualLayouts.stream() - .findFirst() - .map( - visualLayout -> new VisualLayoutTO(visualLayout.getName()) - .setProperties(pConverter.toPropertyTOs(visualLayout.getProperties())) - .setScaleX(visualLayout.getScaleX()) - .setScaleY(visualLayout.getScaleY()) - .setLayers(toLayerTOs(visualLayout.getLayers())) - .setLayerGroups(toLayerGroupTOs(visualLayout.getLayerGroups()))) - .orElse(new VisualLayoutTO("default visual layout")); + public VisualLayoutTO toVisualLayoutTO(VisualLayout visualLayout) { + return new VisualLayoutTO(visualLayout.getName()) + .setProperties(pConverter.toPropertyTOs(visualLayout.getProperties())) + .setScaleX(visualLayout.getScaleX()) + .setScaleY(visualLayout.getScaleY()) + .setLayers(toLayerTOs(visualLayout.getLayers())) + .setLayerGroups(toLayerGroupTOs(visualLayout.getLayerGroups())); } private List convertLayerGroups(List layerGroups) { diff --git a/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandlerTest.java b/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandlerTest.java index 7ca329f72..53063794a 100644 --- a/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandlerTest.java +++ b/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/PlantModelHandlerTest.java @@ -202,11 +202,7 @@ void getPlantModel() { new Vehicle("some-other-vehicle") ) ) - .withVisualLayouts( - Set.of( - new VisualLayout("some-layout") - ) - ) + .withVisualLayout(new VisualLayout("some-layout")) .withProperties( Map.of("some-key", "some-value") ); diff --git a/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverterTest.java b/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverterTest.java index 1d4a8dafe..ae16d93ed 100644 --- a/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverterTest.java +++ b/openTCS-Kernel-Extension-HTTP-Services/src/test/java/org/opentcs/kernel/extensions/servicewebapi/v1/converter/VisualLayoutConverterTest.java @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; -import java.util.Set; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.aMapWithSize; import static org.hamcrest.Matchers.hasSize; @@ -82,7 +81,7 @@ void checkVisualLayoutTO() { .withLayerGroups(List.of(new LayerGroup(3, "G1", true))) .withProperties(propertyMap); - VisualLayoutTO result = visualLayoutConverter.toVisualLayoutTO(Set.of(vLayout)); + VisualLayoutTO result = visualLayoutConverter.toVisualLayoutTO(vLayout); assertThat(result.getName(), is("V1")); assertThat(result.getScaleX(), is(50.00)); @@ -94,11 +93,4 @@ void checkVisualLayoutTO() { samePropertyValuesAs(new LayerGroupTO(3, "G1", true))); assertThat(result.getProperties(), is(propertyList)); } - - @Test - void checkToVisualLayoutTOShouldCreateDefault() { - VisualLayoutTO result = visualLayoutConverter.toVisualLayoutTO(Set.of()); - - assertThat(result.getName(), is("default visual layout")); - } } diff --git a/openTCS-Kernel-Extension-RMI-Services/src/guiceConfig/java/org/opentcs/kernel/extensions/rmi/RmiServicesModule.java b/openTCS-Kernel-Extension-RMI-Services/src/guiceConfig/java/org/opentcs/kernel/extensions/rmi/RmiServicesModule.java index 5f7045990..34103d3a1 100644 --- a/openTCS-Kernel-Extension-RMI-Services/src/guiceConfig/java/org/opentcs/kernel/extensions/rmi/RmiServicesModule.java +++ b/openTCS-Kernel-Extension-RMI-Services/src/guiceConfig/java/org/opentcs/kernel/extensions/rmi/RmiServicesModule.java @@ -34,7 +34,6 @@ public RmiServicesModule() { } @Override - @SuppressWarnings("deprecation") protected void configure() { RmiKernelInterfaceConfiguration configuration = getConfigBindingProvider().get(RmiKernelInterfaceConfiguration.PREFIX, @@ -74,7 +73,6 @@ protected void configure() { remoteServices.addBinding().to(StandardRemoteNotificationService.class); remoteServices.addBinding().to(StandardRemoteRouterService.class); remoteServices.addBinding().to(StandardRemoteDispatcherService.class); - remoteServices.addBinding().to(StandardRemoteSchedulerService.class); remoteServices.addBinding().to(StandardRemoteQueryService.class); remoteServices.addBinding().to(StandardRemotePeripheralService.class); remoteServices.addBinding().to(StandardRemotePeripheralJobService.class); diff --git a/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteRouterService.java b/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteRouterService.java index dd618eed4..227cc7ec2 100644 --- a/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteRouterService.java +++ b/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteRouterService.java @@ -155,32 +155,6 @@ public void terminate() { initialized = false; } - @Override - @Deprecated - public void updatePathLock(ClientID clientId, TCSObjectReference ref, boolean locked) { - userManager.verifyCredentials(clientId, UserPermission.MODIFY_MODEL); - - try { - kernelExecutor.submit(() -> routerService.updatePathLock(ref, locked)).get(); - } - catch (InterruptedException | ExecutionException exc) { - throw findSuitableExceptionFor(exc); - } - } - - @Override - @Deprecated - public void updateRoutingTopology(ClientID clientId) { - userManager.verifyCredentials(clientId, UserPermission.MODIFY_MODEL); - - try { - kernelExecutor.submit(() -> routerService.updateRoutingTopology()).get(); - } - catch (InterruptedException | ExecutionException exc) { - throw findSuitableExceptionFor(exc); - } - } - @Override public void updateRoutingTopology(ClientID clientId, Set> refs) throws RemoteException { @@ -194,26 +168,6 @@ public void updateRoutingTopology(ClientID clientId, Set, Route> computeRoutes( - ClientID clientId, - TCSObjectReference vehicleRef, - TCSObjectReference sourcePointRef, - Set> destinationPointRefs) { - userManager.verifyCredentials(clientId, UserPermission.MODIFY_MODEL); - - try { - return kernelExecutor.submit(() -> routerService.computeRoutes(vehicleRef, - sourcePointRef, - destinationPointRefs)) - .get(); - } - catch (InterruptedException | ExecutionException exc) { - throw findSuitableExceptionFor(exc); - } - } - @Override public Map, Route> computeRoutes( ClientID clientId, diff --git a/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteSchedulerService.java b/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteSchedulerService.java deleted file mode 100644 index 02c37e533..000000000 --- a/openTCS-Kernel-Extension-RMI-Services/src/main/java/org/opentcs/kernel/extensions/rmi/StandardRemoteSchedulerService.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.kernel.extensions.rmi; - -import jakarta.inject.Inject; -import java.rmi.NotBoundException; -import java.rmi.RemoteException; -import java.rmi.registry.Registry; -import java.rmi.server.UnicastRemoteObject; -import static java.util.Objects.requireNonNull; -import org.opentcs.access.rmi.ClientID; -import org.opentcs.access.rmi.factories.SocketFactoryProvider; -import org.opentcs.access.rmi.services.RegistrationName; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This class is the standard implementation of the {@code RemoteSchedulerService} interface. - *

- * Upon creation, an instance of this class registers itself with the RMI registry by the name - * {@link RegistrationName#REMOTE_SCHEDULER_SERVICE}. - *

- */ -@Deprecated -public class StandardRemoteSchedulerService - extends KernelRemoteService - implements org.opentcs.access.rmi.services.RemoteSchedulerService { - - /** - * This class's logger. - */ - private static final Logger LOG = LoggerFactory.getLogger(StandardRemoteSchedulerService.class); - /** - * The scheduler service to invoke methods on. - */ - private final org.opentcs.components.kernel.services.SchedulerService schedulerService; - /** - * The user manager. - */ - private final UserManager userManager; - /** - * Provides configuration data. - */ - private final RmiKernelInterfaceConfiguration configuration; - /** - * Provides socket factories used for RMI. - */ - private final SocketFactoryProvider socketFactoryProvider; - /** - * Provides the registry with which this remote service registers. - */ - private final RegistryProvider registryProvider; - /** - * The registry with which this remote service registers. - */ - private Registry rmiRegistry; - /** - * Whether this remote service is initialized or not. - */ - private boolean initialized; - - /** - * Creates a new instance. - * - * @param schedulerService The scheduler service. - * @param userManager The user manager. - * @param configuration This class' configuration. - * @param socketFactoryProvider The socket factory provider used for RMI. - * @param registryProvider The provider for the registry with which this remote service registers. - */ - @Inject - public StandardRemoteSchedulerService( - org.opentcs.components.kernel.services.SchedulerService schedulerService, - UserManager userManager, - RmiKernelInterfaceConfiguration configuration, - SocketFactoryProvider socketFactoryProvider, - RegistryProvider registryProvider) { - this.schedulerService = requireNonNull(schedulerService, "schedulerService"); - this.userManager = requireNonNull(userManager, "userManager"); - this.configuration = requireNonNull(configuration, "configuration"); - this.socketFactoryProvider = requireNonNull(socketFactoryProvider, "socketFactoryProvider"); - this.registryProvider = requireNonNull(registryProvider, "registryProvider"); - } - - @Override - public void initialize() { - if (isInitialized()) { - return; - } - - rmiRegistry = registryProvider.get(); - - // Export this instance via RMI. - try { - LOG.debug("Exporting proxy..."); - UnicastRemoteObject.exportObject(this, - configuration.remoteSchedulerServicePort(), - socketFactoryProvider.getClientSocketFactory(), - socketFactoryProvider.getServerSocketFactory()); - LOG.debug("Binding instance with RMI registry..."); - rmiRegistry.rebind(RegistrationName.REMOTE_SCHEDULER_SERVICE, this); - } - catch (RemoteException exc) { - LOG.error("Could not export or bind with RMI registry", exc); - return; - } - - initialized = true; - } - - @Override - public boolean isInitialized() { - return initialized; - } - - @Override - public void terminate() { - if (!isInitialized()) { - return; - } - - try { - LOG.debug("Unbinding from RMI registry..."); - rmiRegistry.unbind(RegistrationName.REMOTE_SCHEDULER_SERVICE); - LOG.debug("Unexporting RMI interface..."); - UnicastRemoteObject.unexportObject(this, true); - } - catch (RemoteException | NotBoundException exc) { - LOG.warn("Exception shutting down RMI interface", exc); - } - - initialized = false; - } - - @Override - public org.opentcs.access.SchedulerAllocationState fetchSchedulerAllocations(ClientID clientId) { - userManager.verifyCredentials(clientId, UserPermission.READ_DATA); - - return schedulerService.fetchSchedulerAllocations(); - } -} diff --git a/openTCS-Kernel/src/guiceConfig/java/org/opentcs/kernel/DefaultKernelInjectionModule.java b/openTCS-Kernel/src/guiceConfig/java/org/opentcs/kernel/DefaultKernelInjectionModule.java index 445437cf6..acd0a2f94 100644 --- a/openTCS-Kernel/src/guiceConfig/java/org/opentcs/kernel/DefaultKernelInjectionModule.java +++ b/openTCS-Kernel/src/guiceConfig/java/org/opentcs/kernel/DefaultKernelInjectionModule.java @@ -166,7 +166,6 @@ protected void configure() { configureWatchdogExtension(); } - @SuppressWarnings("deprecation") private void configureKernelServicesDependencies() { bind(StandardPlantModelService.class).in(Singleton.class); bind(PlantModelService.class).to(StandardPlantModelService.class); @@ -192,10 +191,6 @@ private void configureKernelServicesDependencies() { bind(StandardDispatcherService.class).in(Singleton.class); bind(DispatcherService.class).to(StandardDispatcherService.class); - bind(org.opentcs.kernel.services.StandardSchedulerService.class).in(Singleton.class); - bind(org.opentcs.components.kernel.services.SchedulerService.class) - .to(org.opentcs.kernel.services.StandardSchedulerService.class); - bind(StandardQueryService.class).in(Singleton.class); bind(QueryService.class).to(StandardQueryService.class); bind(InternalQueryService.class).to(StandardQueryService.class); diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/peripherals/NullPeripheralCommAdapter.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/peripherals/NullPeripheralCommAdapter.java index 7ae1b041d..ffa71721e 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/peripherals/NullPeripheralCommAdapter.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/peripherals/NullPeripheralCommAdapter.java @@ -77,6 +77,10 @@ public ExplainedBoolean canProcess(PeripheralJob job) { public void process(PeripheralJob job, PeripheralJobCallback callback) { } + @Override + public void abortJob() { + } + @Override public void execute(PeripheralAdapterCommand command) { } diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardPlantModelService.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardPlantModelService.java index ea0486d83..0bb3f5315 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardPlantModelService.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardPlantModelService.java @@ -105,7 +105,7 @@ public StandardPlantModelService(LocalKernel kernel, public Set> expandResources(Set> resources) throws ObjectUnknownException { requireNonNull(resources, "resources"); - + synchronized (globalSyncObject) { return plantModelManager.expandResources(resources); } @@ -156,7 +156,7 @@ public PlantModel getPlantModel() { .withLocations(fetchObjects(Location.class)) .withBlocks(fetchObjects(Block.class)) .withVehicles(fetchObjects(Vehicle.class)) - .withVisualLayouts(fetchObjects(VisualLayout.class)); + .withVisualLayout(fetchObjects(VisualLayout.class).stream().findFirst().get()); } } @@ -211,20 +211,9 @@ public Map getModelProperties() public void updateLocationLock(TCSObjectReference ref, boolean locked) throws ObjectUnknownException { requireNonNull(ref, "ref"); - - synchronized (globalSyncObject) { - plantModelManager.setLocationLocked(ref, locked); - } - } - @Deprecated - @Override - public void updateLocationReservationToken(TCSObjectReference ref, String token) - throws ObjectUnknownException, KernelRuntimeException { - requireNonNull(ref, "ref"); - synchronized (globalSyncObject) { - plantModelManager.setLocationReservationToken(ref, token); + plantModelManager.setLocationLocked(ref, locked); } } diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardRouterService.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardRouterService.java index 4bea2ac30..bd7c602ef 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardRouterService.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardRouterService.java @@ -14,7 +14,6 @@ import java.util.Set; import java.util.stream.Collectors; import org.opentcs.access.KernelRuntimeException; -import org.opentcs.access.LocalKernel; import org.opentcs.components.kernel.Router; import org.opentcs.components.kernel.services.RouterService; import org.opentcs.components.kernel.services.TCSObjectService; @@ -38,10 +37,6 @@ public class StandardRouterService * A global object to be used for synchronization within the kernel. */ private final Object globalSyncObject; - /** - * The kernel. - */ - private final LocalKernel kernel; /** * The router. */ @@ -59,43 +54,21 @@ public class StandardRouterService * Creates a new instance. * * @param globalSyncObject The kernel threads' global synchronization object. - * @param kernel The kernel. * @param router The scheduler. * @param plantModelManager The plant model manager to be used. * @param objectService The object service. */ @Inject public StandardRouterService(@GlobalSyncObject Object globalSyncObject, - LocalKernel kernel, Router router, PlantModelManager plantModelManager, TCSObjectService objectService) { this.globalSyncObject = requireNonNull(globalSyncObject, "globalSyncObject"); - this.kernel = requireNonNull(kernel, "kernel"); this.router = requireNonNull(router, "router"); this.plantModelManager = requireNonNull(plantModelManager, "plantModelManager"); this.objectService = requireNonNull(objectService, "objectService"); } - @Override - @Deprecated - public void updatePathLock(TCSObjectReference ref, boolean locked) - throws ObjectUnknownException { - requireNonNull(ref, "ref"); - - synchronized (globalSyncObject) { - plantModelManager.setPathLocked(ref, locked); - } - } - - @Override - @Deprecated - public void updateRoutingTopology() { - synchronized (globalSyncObject) { - router.updateRoutingTopology(); - } - } - @Override public void updateRoutingTopology(Set> refs) throws KernelRuntimeException { @@ -144,35 +117,4 @@ public Map, Route> computeRoutes( return result; } } - - @Deprecated - @Override - public Map, Route> computeRoutes( - TCSObjectReference vehicleRef, - TCSObjectReference sourcePointRef, - Set> destinationPointRefs) { - requireNonNull(vehicleRef, "vehicleRef"); - requireNonNull(sourcePointRef, "sourcePointRef"); - requireNonNull(destinationPointRefs, "destinationPointRefs"); - - synchronized (globalSyncObject) { - Map, Route> result = new HashMap<>(); - Vehicle vehicle = objectService.fetchObject(Vehicle.class, vehicleRef); - if (vehicle == null) { - throw new ObjectUnknownException("Unknown vehicle: " + vehicleRef.getName()); - } - Point sourcePoint = objectService.fetchObject(Point.class, sourcePointRef); - if (sourcePoint == null) { - throw new ObjectUnknownException("Unknown source point: " + sourcePointRef.getName()); - } - for (TCSObjectReference dest : destinationPointRefs) { - Point destinationPoint = objectService.fetchObject(Point.class, dest); - if (destinationPoint == null) { - throw new ObjectUnknownException("Unknown destination point: " + dest.getName()); - } - result.put(dest, router.getRoute(vehicle, sourcePoint, destinationPoint).orElse(null)); - } - return result; - } - } } diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardSchedulerService.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardSchedulerService.java deleted file mode 100644 index a4833cfe5..000000000 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardSchedulerService.java +++ /dev/null @@ -1,50 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.kernel.services; - -import jakarta.inject.Inject; -import static java.util.Objects.requireNonNull; -import org.opentcs.components.kernel.Scheduler; -import org.opentcs.customizations.kernel.GlobalSyncObject; - -/** - * This class is the standard implementation of the {@code SchedulerService} interface. - */ -@Deprecated -public class StandardSchedulerService - implements org.opentcs.components.kernel.services.SchedulerService { - - /** - * A global object to be used for synchronization within the kernel. - */ - private final Object globalSyncObject; - /** - * The scheduler. - */ - private final Scheduler scheduler; - - /** - * Creates a new instance. - * - * @param globalSyncObject The kernel threads' global synchronization object. - * @param scheduler The scheduler. - */ - @Inject - public StandardSchedulerService(@GlobalSyncObject Object globalSyncObject, - Scheduler scheduler) { - this.globalSyncObject = requireNonNull(globalSyncObject, "globalSyncObject"); - this.scheduler = requireNonNull(scheduler, "scheduler"); - } - - @Override - public org.opentcs.access.SchedulerAllocationState fetchSchedulerAllocations() { - synchronized (globalSyncObject) { - return new org.opentcs.access.SchedulerAllocationState(scheduler.getAllocations()); - } - } -} diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardVehicleService.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardVehicleService.java index 05eac1102..18b55c2d0 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardVehicleService.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/services/StandardVehicleService.java @@ -202,17 +202,6 @@ public void updateVehicleRechargeOperation(TCSObjectReference ref, } } - @Override - @Deprecated - public void updateVehicleRouteProgressIndex(TCSObjectReference ref, int index) - throws ObjectUnknownException { - requireNonNull(ref, "ref"); - - synchronized (globalSyncObject) { - plantModelManager.setVehicleRouteProgressIndex(ref, index); - } - } - @Override public void updateVehicleClaimedResources(TCSObjectReference ref, List>> resources) diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/DefaultVehicleController.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/DefaultVehicleController.java index be4d7af57..8cf575e08 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/DefaultVehicleController.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/DefaultVehicleController.java @@ -70,6 +70,7 @@ */ public class DefaultVehicleController implements VehicleController, + Scheduler.Client, PropertyChangeListener, EventHandler { @@ -385,10 +386,8 @@ public void setTransportOrder(@Nonnull TransportOrder newOrder) } } - @Override - @Deprecated - public void setDriveOrder(@Nonnull DriveOrder newOrder, - @Nonnull Map orderProperties) + private void setDriveOrder(@Nonnull DriveOrder newOrder, + @Nonnull Map orderProperties) throws IllegalArgumentException { synchronized (commAdapter) { requireNonNull(newOrder, "newOrder"); @@ -406,9 +405,6 @@ public void setDriveOrder(@Nonnull DriveOrder newOrder, currentDriveOrder = newOrder; lastCommandExecutedRouteIndex = TransportOrder.ROUTE_STEP_INDEX_DEFAULT; - vehicleService.updateVehicleRouteProgressIndex(vehicle.getReference(), - Vehicle.ROUTE_INDEX_DEFAULT); - // Set the claim for (the remainder of) this transport order. List>> claim = remainingRequiredClaim(transportOrder); scheduler.claim(this, claim); @@ -431,10 +427,8 @@ public void setDriveOrder(@Nonnull DriveOrder newOrder, } } - @Override - @Deprecated - public void updateDriveOrder(@Nonnull DriveOrder newOrder, - @Nonnull Map orderProperties) + private void updateDriveOrder(@Nonnull DriveOrder newOrder, + @Nonnull Map orderProperties) throws IllegalArgumentException { synchronized (commAdapter) { requireNonNull(newOrder, "newOrder"); @@ -460,12 +454,6 @@ public void updateDriveOrder(@Nonnull DriveOrder newOrder, // that have already been processed, so discard these. discardProcessedFutureCommands(); - // Get an up-tp-date copy of the vehicle - Vehicle updatedVehicle = vehicleService.fetchObject(Vehicle.class, vehicle.getReference()); - // Trigger the vehicle's route to be re-drawn - vehicleService.updateVehicleRouteProgressIndex(vehicle.getReference(), - updatedVehicle.getRouteProgressIndex()); - // The vehicle may now process previously restricted steps. if (canSendNextCommand()) { allocateForNextCommand(); @@ -604,9 +592,7 @@ public void abortTransportOrder(boolean immediate) { } } - @Override - @Deprecated - public void clearDriveOrder() { + private void clearDriveOrder() { synchronized (commAdapter) { currentDriveOrder = null; @@ -614,16 +600,11 @@ public void clearDriveOrder() { // abortTransportOrder(). resetPendingResourceAllocations(); - vehicleService.updateVehicleRouteProgressIndex(vehicle.getReference(), - Vehicle.ROUTE_INDEX_DEFAULT); - clearCommandQueue(); } } - @Override - @Deprecated - public void abortDriveOrder() { + private void abortDriveOrder() { synchronized (commAdapter) { if (currentDriveOrder == null) { LOG.debug("{}: No drive order to be aborted", vehicle.getName()); @@ -633,9 +614,7 @@ public void abortDriveOrder() { } } - @Override - @Deprecated - public void clearCommandQueue() { + private void clearCommandQueue() { synchronized (commAdapter) { commAdapter.clearCommandQueue(); commandsSent.clear(); @@ -685,17 +664,6 @@ public ExplainedBoolean canProcess(TransportOrder order) { } } - @Override - @Deprecated - @Nonnull - public ExplainedBoolean canProcess(@Nonnull List operations) { - requireNonNull(operations, "operations"); - - synchronized (commAdapter) { - return commAdapter.canProcess(operations); - } - } - @Override public void onVehiclePaused(boolean paused) { synchronized (commAdapter) { @@ -1073,7 +1041,6 @@ private void commandFailed(MovementCommand failedCommand) { dispatcherService.withdrawByVehicle(vehicle.getReference(), true); } - @SuppressWarnings("deprecation") private void checkForPendingCommands() { // Check if there are more commands to be processed for the current drive order. if (interactionsPendingCommand == null @@ -1088,8 +1055,6 @@ private void checkForPendingCommands() { currentDriveOrder = null; // Let the kernel/dispatcher know that the drive order has been processed completely (by // setting its state to AWAITING_ORDER). - vehicleService.updateVehicleRouteProgressIndex(vehicle.getReference(), - Vehicle.ROUTE_INDEX_DEFAULT); vehicleService.updateVehicleProcState(vehicle.getReference(), Vehicle.ProcState.AWAITING_ORDER); } @@ -1258,26 +1223,22 @@ private void updatePositionWithoutOrder(Point point) updatePosition(toReference(point), null); } - @SuppressWarnings("deprecation") private void updatePositionWithOrder(String position, Point point) { // If a drive order is being processed, check if the reported position // is the one we expect. MovementCommand moveCommand = commandsSent.getFirst(); - Point dstPoint = moveCommand.getStep().getDestinationPoint(); - if (dstPoint.getName().equals(position)) { - // Update the vehicle's progress index. - vehicleService.updateVehicleRouteProgressIndex(vehicle.getReference(), - moveCommand.getStep().getRouteIndex()); - } - else if (position == null) { + if (position == null) { LOG.info("{}: Resetting position for vehicle", vehicle.getName()); } else { - LOG.warn("{}: Reported position: {}, expected: {}", - vehicle.getName(), - position, - dstPoint.getName()); + Point dstPoint = moveCommand.getStep().getDestinationPoint(); + if (!dstPoint.getName().equals(position)) { + LOG.warn("{}: Reported position: {}, expected: {}", + vehicle.getName(), + position, + dstPoint.getName()); + } } updatePosition(toReference(point), extractNextPosition(findNextCommand())); diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandImpl.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandImpl.java deleted file mode 100644 index 001bf52b2..000000000 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.kernel.vehicles; - -import jakarta.annotation.Nonnull; -import jakarta.annotation.Nullable; -import java.util.Map; -import java.util.Objects; -import static java.util.Objects.requireNonNull; -import org.opentcs.data.model.Location; -import org.opentcs.data.model.Point; -import org.opentcs.data.order.DriveOrder; -import org.opentcs.data.order.Route; -import org.opentcs.data.order.TransportOrder; -import org.opentcs.drivers.vehicle.MovementCommand; - -/** - * The default movement command implementation. - */ -public class MovementCommandImpl - implements MovementCommand { - - /** - * The transport order this movement belongs to. - */ - private final TransportOrder transportOrder; - /** - * The drive order this movement belongs to. - */ - private final DriveOrder driveOrder; - /** - * The step describing the movement. - */ - private final Route.Step step; - /** - * The operation to be executed after moving. - */ - private final String operation; - /** - * The location at which the operation is to be executed. (May be - * null if operation is NO_OPERATION.) - */ - private final Location opLocation; - /** - * Indicates whether this movement is the final one for the drive order it belongs to. - */ - private final boolean finalMovement; - /** - * The destination position of the whole drive order. - */ - private final Point finalDestination; - /** - * The destination location of the whole drive order. - */ - private final Location finalDestinationLocation; - /** - * The operation to be executed at the destination position. - */ - private final String finalOperation; - /** - * Properties of the order this command is part of. - */ - private final Map properties; - - /** - * Creates a new instance. - * - * @param transportOrder The transport order this movement belongs to. - * @param driveOrder The drive order this movement belongs to. - * @param step The step describing the movement. - * @param operation The operation to be executed after moving. - * @param opLocation The location at which the operation is to be executed. - * May be null if newOperation is NO_OPERATION.) - * @param finalMovement Indicates whether this movement is the final one in the drive order it - * belongs to. - * @param finalDestinationLocation The destination location of the whole drive order. - * @param finalDestination The destination position of the whole drive order. - * @param finalOperation The operation to be executed at the destination - * position. - * @param properties Properties of the order this command is part of. - */ - @SuppressWarnings("deprecation") - public MovementCommandImpl(TransportOrder transportOrder, - DriveOrder driveOrder, - Route.Step step, - String operation, - Location opLocation, - boolean finalMovement, - Location finalDestinationLocation, - Point finalDestination, - String finalOperation, - Map properties) { - this.transportOrder = requireNonNull(transportOrder, "transportOrder"); - this.driveOrder = requireNonNull(driveOrder, "driveOrder"); - this.step = requireNonNull(step, "step"); - this.operation = requireNonNull(operation, "operation"); - this.finalMovement = finalMovement; - this.finalDestinationLocation = finalDestinationLocation; - this.finalDestination = requireNonNull(finalDestination, "finalDestination"); - this.finalOperation = requireNonNull(finalOperation, "finalOperation"); - this.properties = requireNonNull(properties, "properties"); - if (opLocation == null && !isEmptyOperation(operation)) { - throw new NullPointerException("opLocation"); - } - this.opLocation = opLocation; - } - - @Nonnull - @Override - public TransportOrder getTransportOrder() { - return transportOrder; - } - - @Nonnull - @Override - public DriveOrder getDriveOrder() { - return driveOrder; - } - - @Nonnull - @Override - public Route.Step getStep() { - return step; - } - - @Nonnull - @Override - public String getOperation() { - return operation; - } - - @Override - @Deprecated - public boolean isWithoutOperation() { - return isEmptyOperation(operation); - } - - @Override - public boolean hasEmptyOperation() { - return isEmptyOperation(operation); - } - - @Nullable - @Override - public Location getOpLocation() { - return opLocation; - } - - @Override - public boolean isFinalMovement() { - return finalMovement; - } - - @Nonnull - @Override - public Point getFinalDestination() { - return finalDestination; - } - - @Nullable - @Override - public Location getFinalDestinationLocation() { - return finalDestinationLocation; - } - - @Nonnull - @Override - public String getFinalOperation() { - return finalOperation; - } - - @Nonnull - @Override - public Map getProperties() { - return properties; - } - - @Override - public boolean equals(Object o) { - if (o instanceof MovementCommand) { - MovementCommand other = (MovementCommand) o; - return step.equals(other.getStep()) && operation.equals(other.getOperation()); - } - else { - return false; - } - } - - @Override - public boolean equalsInMovement(MovementCommand command) { - if (command == null) { - return false; - } - - return this.getStep().equalsInMovement(command.getStep()) - && Objects.equals(this.getOperation(), command.getOperation()); - } - - @Override - public int hashCode() { - return step.hashCode() ^ operation.hashCode(); - } - - @Override - public String toString() { - return "MovementCommandImpl{" - + "transportOrder=" + getTransportOrder() - + ", driveOrder=" + getDriveOrder() - + ", step=" + getStep() - + ", operation=" + getOperation() - + ", opLocation=" + getOpLocation() - + ", finalMovement=" + isFinalMovement() - + ", finalDestination=" + getFinalDestination() - + ", finalDestinationLocation=" + getFinalDestinationLocation() - + ", finalOperation=" + getFinalOperation() - + ", properties=" + getProperties() - + '}'; - } - - /** - * Checks whether an operation means something is to be done in addition to - * moving or not. - * - * @param operation The operation to be checked. - * @return true if, and only if, the vehicle should only move - * with the given operation. - */ - private static boolean isEmptyOperation(String operation) { - return NO_OPERATION.equals(operation) - || MOVE_OPERATION.equals(operation) - || PARK_OPERATION.equals(operation); - } -} diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandMapper.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandMapper.java index 7e6132e6e..a0f27c77d 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandMapper.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/MovementCommandMapper.java @@ -73,16 +73,16 @@ public List toMovementCommands(DriveOrder driveOrder, Location location = isFinalMovement ? finalDestinationLocation : null; result.add( - new MovementCommandImpl(transportOrder, - driveOrder, - curStep, - operation, - location, - isFinalMovement, - finalDestinationLocation, - finalDestination, - op, - mergeProperties(transportOrder.getProperties(), destProperties)) + new MovementCommand(transportOrder, + driveOrder, + curStep, + operation, + location, + isFinalMovement, + finalDestinationLocation, + finalDestination, + op, + mergeProperties(transportOrder.getProperties(), destProperties)) ); } } diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/NullVehicleController.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/NullVehicleController.java index e2083f0c0..38a7436cc 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/NullVehicleController.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/vehicles/NullVehicleController.java @@ -9,15 +9,11 @@ import jakarta.annotation.Nonnull; import java.util.ArrayDeque; -import java.util.List; -import java.util.Map; import static java.util.Objects.requireNonNull; +import java.util.Optional; import java.util.Queue; import java.util.Set; -import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.TCSResource; -import org.opentcs.data.model.Vehicle; -import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.TransportOrder; import org.opentcs.drivers.vehicle.AdapterCommand; import org.opentcs.drivers.vehicle.MovementCommand; @@ -68,43 +64,8 @@ public void setTransportOrder(TransportOrder newOrder) { LOG.warn("No comm adapter attached to vehicle {}", vehicleName); } - @Override - @Deprecated - public void setDriveOrder(DriveOrder newOrder, Map orderProperties) { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - } - - @Override - @Deprecated - public void updateDriveOrder(DriveOrder newOrder, Map orderProperties) { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - } - @Override public void abortTransportOrder(boolean immediate) { - if (immediate) { - clearDriveOrder(); - } - else { - abortDriveOrder(); - } - } - - @Override - @Deprecated - public void clearDriveOrder() { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - } - - @Override - @Deprecated - public void abortDriveOrder() { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - } - - @Override - @Deprecated - public void clearCommandQueue() { LOG.warn("No comm adapter attached to vehicle {}", vehicleName); } @@ -113,12 +74,6 @@ public ExplainedBoolean canProcess(TransportOrder order) { return new ExplainedBoolean(false, "NullVehicleController"); } - @Override - @Deprecated - public ExplainedBoolean canProcess(List operations) { - return new ExplainedBoolean(false, "NullVehicleController"); - } - @Override public void sendCommAdapterMessage(Object message) { LOG.warn("No comm adapter attached to vehicle {}", vehicleName); @@ -130,30 +85,23 @@ public void sendCommAdapterCommand(AdapterCommand command) { } @Override - public String getId() { - return vehicleName; - } - - @Override - public TCSObjectReference getRelatedVehicle() { + public Queue getCommandsSent() { LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - return null; + return new ArrayDeque<>(); } - + @Override - public boolean allocationSuccessful(Set> resources) { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - return false; + public void onVehiclePaused(boolean paused) { } @Override - public void allocationFailed(Set> resources) { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); + public Optional getInteractionsPendingCommand() { + return Optional.empty(); } @Override - public Queue getCommandsSent() { - LOG.warn("No comm adapter attached to vehicle {}", vehicleName); - return new ArrayDeque<>(); + public boolean mayAllocateNow(Set> resources) { + return false; } + } diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/PlantModelManager.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/PlantModelManager.java index f49273028..3782a8a4a 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/PlantModelManager.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/PlantModelManager.java @@ -9,9 +9,7 @@ import jakarta.annotation.Nonnull; import jakarta.inject.Inject; -import java.awt.Color; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -36,7 +34,6 @@ import org.opentcs.data.TCSObjectEvent; import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Block; -import org.opentcs.data.model.Couple; import org.opentcs.data.model.Location; import org.opentcs.data.model.LocationType; import org.opentcs.data.model.Path; @@ -47,7 +44,6 @@ import org.opentcs.data.model.TCSResourceReference; import org.opentcs.data.model.Triple; import org.opentcs.data.model.Vehicle; -import org.opentcs.data.model.visualization.ElementPropKeys; import org.opentcs.data.model.visualization.VisualLayout; import org.opentcs.data.order.OrderSequence; import org.opentcs.data.order.TransportOrder; @@ -55,8 +51,6 @@ import org.opentcs.data.peripherals.PeripheralOperation; import org.opentcs.drivers.vehicle.LoadHandlingDevice; import static org.opentcs.util.Assertions.checkState; -import org.opentcs.util.Colors; -import org.opentcs.util.annotations.ScheduledApiChange; import org.opentcs.util.event.EventHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -136,12 +130,10 @@ public void setProperties(Map properties) { /** * Removes all model objects from this model and the object pool by which it is backed. */ - @SuppressWarnings("deprecation") public void clear() { List> objects = new ArrayList<>(); objects.addAll(getObjectRepo().getObjects(VisualLayout.class)); objects.addAll(getObjectRepo().getObjects(Vehicle.class)); - objects.addAll(getObjectRepo().getObjects(org.opentcs.data.model.Group.class)); objects.addAll(getObjectRepo().getObjects(Block.class)); objects.addAll(getObjectRepo().getObjects(Path.class)); objects.addAll(getObjectRepo().getObjects(Location.class)); @@ -164,7 +156,6 @@ public void clear() { * @throws ObjectExistsException If an object with a new object's name already exists. * @throws ObjectUnknownException If any object referenced in the TO does not exist. */ - @SuppressWarnings("deprecation") public void createPlantModelObjects(PlantModelCreationTO to) throws ObjectExistsException, ObjectUnknownException { LOG.info("Plant model is being created: {}", to.getName()); @@ -189,15 +180,11 @@ public void createPlantModelObjects(PlantModelCreationTO to) for (BlockCreationTO block : to.getBlocks()) { createBlock(block); } - for (org.opentcs.access.to.model.GroupCreationTO group : to.getGroups()) { - createGroup(group); - } for (VehicleCreationTO vehicle : to.getVehicles()) { createVehicle(vehicle); } createVisualLayout(to.getVisualLayout()); - overrideLayoutData(to.getVisualLayout()); } /** @@ -740,30 +727,6 @@ public Vehicle setVehicleOrderSequence(TCSObjectReference vehicleRef, return vehicle; } - /** - * Sets a vehicle's index of the last route step travelled for the current - * drive order of its current transport order. - * - * @param vehicleRef A reference to the vehicle to be modified. - * @param index The new index. - * @return The modified vehicle. - * @throws ObjectUnknownException If the referenced vehicle does not exist. - * @deprecated Use {@link TransportOrderPoolManager#setTransportOrderCurrentRouteStepIndex( - * org.opentcs.data.TCSObjectReference, int)} instead. - */ - @Deprecated - public Vehicle setVehicleRouteProgressIndex(TCSObjectReference vehicleRef, - int index) - throws ObjectUnknownException { - Vehicle previousState = getObjectRepo().getObject(Vehicle.class, vehicleRef); - Vehicle vehicle = previousState.withRouteProgressIndex(index); - getObjectRepo().replaceObject(vehicle); - emitObjectEvent(vehicle, - previousState, - TCSObjectEvent.Type.OBJECT_MODIFIED); - return vehicle; - } - /** * Sets a vehicle's claimed resources. * @@ -809,7 +772,6 @@ public Vehicle setVehicleAllocatedResources(TCSObjectReference vehicleR * * @return A PlantModelCreationTO for this model. */ - @SuppressWarnings("deprecation") public PlantModelCreationTO createPlantModelCreationTO() { return new PlantModelCreationTO(name) .withProperties(getProperties()) @@ -819,7 +781,6 @@ public PlantModelCreationTO createPlantModelCreationTO() { .withLocationTypes(getLocationTypes()) .withLocations(getLocations()) .withBlocks(getBlocks()) - .withGroups(getGroups()) .withVisualLayout(getVisualLayout()); } @@ -910,7 +871,6 @@ private List getPoints() { * @param model The model data. * @return A list of {@link PathCreationTO Paths} for all paths in a model. */ - @SuppressWarnings("deprecation") private List getPaths() { Set paths = getObjectRepo().getObjects(Path.class); List result = new ArrayList<>(); @@ -1059,31 +1019,6 @@ private List getBlocks() { return result; } - /** - * Returns a list of GroupCreationTOs for all groups in a model. - * - * @param model The model data. - * @return A list of GroupCreationTOs for all groups in a model. - */ - @Deprecated - private List getGroups() { - Set groups - = getObjectRepo().getObjects(org.opentcs.data.model.Group.class); - List result = new ArrayList<>(); - - for (org.opentcs.data.model.Group curGroup : groups) { - result.add( - new org.opentcs.access.to.model.GroupCreationTO(curGroup.getName()) - .withMemberNames(curGroup.getMembers().stream() - .map(member -> member.getName()) - .collect(Collectors.toSet())) - .withProperties(curGroup.getProperties()) - ); - } - - return result; - } - /** * Returns a {@link VisualLayoutCreationTO} for the visual layouts in a model. * @@ -1331,181 +1266,6 @@ private Block createBlock(BlockCreationTO to) return newBlock; } - /** - * Creates a new group with a unique name and all other attributes set to - * default values. - * - * @param to The transfer object from which to create the new group. - * @return The newly created group. - * @throws ObjectExistsException If an object with the new object's name already exists. - * @throws ObjectUnknownException If any object referenced in the TO does not exist. - */ - @Deprecated - private org.opentcs.data.model.Group createGroup(org.opentcs.access.to.model.GroupCreationTO to) - throws ObjectExistsException, ObjectUnknownException { - Set> members = new HashSet<>(); - for (String memberName : to.getMemberNames()) { - members.add(getObjectRepo().getObject(memberName).getReference()); - } - org.opentcs.data.model.Group newGroup = new org.opentcs.data.model.Group(to.getName()) - .withMembers(members) - .withProperties(to.getProperties()); - getObjectRepo().addObject(newGroup); - emitObjectEvent(newGroup, - null, - TCSObjectEvent.Type.OBJECT_CREATED); - // Return the newly created group. - return newGroup; - } - - /** - * Overrides the layout data in {@code TCSObject}s with the data stored in their respective - * model layout element. - * - * @param layout The visual layout to get the layout data from. - */ - @Deprecated - @ScheduledApiChange(details = "Will be removed.", when = "6.0") - private void overrideLayoutData(VisualLayoutCreationTO layout) { - for (org.opentcs.access.to.model.ModelLayoutElementCreationTO mleTO - : layout.getModelElements()) { - TCSObject object = getObjectRepo().getObject(mleTO.getName()); - Map props = mleTO.getProperties(); - - if (object instanceof Point) { - overridePointLayoutData((Point) object, props); - } - else if (object instanceof Path) { - overridePathLayoutData((Path) object, props); - } - else if (object instanceof Location) { - overrideLocationLayoutData((Location) object, props); - } - else if (object instanceof Block) { - overrideBlockLayoutData((Block) object, props); - } - else if (object instanceof Vehicle) { - overrideVehicleLayoutData((Vehicle) object, props); - } - } - } - - private void overridePointLayoutData(Point oldPoint, Map properties) - throws NumberFormatException { - long positionX = properties.get(ElementPropKeys.POINT_POS_X) != null - ? Integer.parseInt(properties.get(ElementPropKeys.POINT_POS_X)) - : oldPoint.getLayout().getPosition().getX(); - long positionY = properties.get(ElementPropKeys.POINT_POS_Y) != null - ? Integer.parseInt(properties.get(ElementPropKeys.POINT_POS_Y)) - : oldPoint.getLayout().getPosition().getY(); - long labelOffsetX = properties.get(ElementPropKeys.POINT_LABEL_OFFSET_X) != null - ? Integer.parseInt(properties.get(ElementPropKeys.POINT_LABEL_OFFSET_X)) - : oldPoint.getLayout().getLabelOffset().getX(); - long labelOffsetY = properties.get(ElementPropKeys.POINT_LABEL_OFFSET_Y) != null - ? Integer.parseInt(properties.get(ElementPropKeys.POINT_LABEL_OFFSET_Y)) - : oldPoint.getLayout().getLabelOffset().getY(); - Point newPoint = oldPoint.withLayout( - new Point.Layout(new Couple(positionX, positionY), - new Couple(labelOffsetX, labelOffsetY), - oldPoint.getLayout().getLayerId()) - ); - getObjectRepo().replaceObject(newPoint); - emitObjectEvent(newPoint, oldPoint, TCSObjectEvent.Type.OBJECT_MODIFIED); - } - - private void overridePathLayoutData(Path oldPath, Map properties) - throws IllegalArgumentException { - String connectionTypeString - = properties.getOrDefault(ElementPropKeys.PATH_CONN_TYPE, - oldPath.getLayout().getConnectionType().name()); - Path.Layout.ConnectionType connectionType; - switch (connectionTypeString) { - case "DIRECT": - connectionType = Path.Layout.ConnectionType.DIRECT; - break; - case "ELBOW": - connectionType = Path.Layout.ConnectionType.ELBOW; - break; - case "SLANTED": - connectionType = Path.Layout.ConnectionType.SLANTED; - break; - case "POLYPATH": - connectionType = Path.Layout.ConnectionType.POLYPATH; - break; - case "BEZIER": - connectionType = Path.Layout.ConnectionType.BEZIER; - break; - case "BEZIER_3": - connectionType = Path.Layout.ConnectionType.BEZIER_3; - break; - default: - throw new IllegalArgumentException("Unhandled connection type: " + connectionTypeString); - } - - List controlPoints = oldPath.getLayout().getControlPoints(); - String controlPointsString = properties.get(ElementPropKeys.PATH_CONTROL_POINTS); - if (controlPointsString != null) { - controlPoints = Arrays.asList(controlPointsString.split(";")).stream() - .map(controlPointString -> { - String[] coordinateStrings = controlPointString.split(","); - return new Couple(Long.parseLong(coordinateStrings[0]), - Long.parseLong(coordinateStrings[1])); - }) - .collect(Collectors.toList()); - } - - Path newPath = oldPath.withLayout(new Path.Layout(connectionType, - controlPoints, - oldPath.getLayout().getLayerId())); - - getObjectRepo().replaceObject(newPath); - emitObjectEvent(newPath, oldPath, TCSObjectEvent.Type.OBJECT_MODIFIED); - } - - private void overrideLocationLayoutData(Location oldLocation, Map properties) - throws NumberFormatException { - long positionX = properties.get(ElementPropKeys.LOC_POS_X) != null - ? Integer.parseInt(properties.get(ElementPropKeys.LOC_POS_X)) - : oldLocation.getLayout().getPosition().getX(); - long positionY = properties.get(ElementPropKeys.LOC_POS_Y) != null - ? Integer.parseInt(properties.get(ElementPropKeys.LOC_POS_Y)) - : oldLocation.getLayout().getPosition().getY(); - long labelOffsetX = properties.get(ElementPropKeys.LOC_LABEL_OFFSET_X) != null - ? Integer.parseInt(properties.get(ElementPropKeys.LOC_LABEL_OFFSET_X)) - : oldLocation.getLayout().getLabelOffset().getX(); - long labelOffsetY = properties.get(ElementPropKeys.LOC_LABEL_OFFSET_Y) != null - ? Integer.parseInt(properties.get(ElementPropKeys.LOC_LABEL_OFFSET_Y)) - : oldLocation.getLayout().getLabelOffset().getY(); - Location newLocation = oldLocation.withLayout( - new Location.Layout(new Couple(positionX, positionY), - new Couple(labelOffsetX, labelOffsetY), - oldLocation.getLayout().getLocationRepresentation(), - oldLocation.getLayout().getLayerId()) - ); - getObjectRepo().replaceObject(newLocation); - emitObjectEvent(newLocation, oldLocation, TCSObjectEvent.Type.OBJECT_MODIFIED); - } - - private void overrideBlockLayoutData(Block oldBlock, Map properties) - throws NumberFormatException { - Color color = properties.get(ElementPropKeys.BLOCK_COLOR) != null - ? Colors.decodeFromHexRGB(properties.get(ElementPropKeys.BLOCK_COLOR)) - : oldBlock.getLayout().getColor(); - Block newBlock = oldBlock.withLayout(new Block.Layout(color)); - getObjectRepo().replaceObject(newBlock); - emitObjectEvent(newBlock, oldBlock, TCSObjectEvent.Type.OBJECT_MODIFIED); - } - - private void overrideVehicleLayoutData(Vehicle oldVehicle, Map properties) - throws NumberFormatException { - Color routeColor = properties.get(ElementPropKeys.VEHICLE_ROUTE_COLOR) != null - ? Colors.decodeFromHexRGB(properties.get(ElementPropKeys.VEHICLE_ROUTE_COLOR)) - : oldVehicle.getLayout().getRouteColor(); - Vehicle newVehicle = oldVehicle.withLayout(new Vehicle.Layout(routeColor)); - getObjectRepo().replaceObject(newVehicle); - emitObjectEvent(newVehicle, oldVehicle, TCSObjectEvent.Type.OBJECT_MODIFIED); - } - /** * Adds an incoming path to a point. * diff --git a/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/TransportOrderPoolManager.java b/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/TransportOrderPoolManager.java index ce0c58cb1..e69a6fe5d 100644 --- a/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/TransportOrderPoolManager.java +++ b/openTCS-Kernel/src/main/java/org/opentcs/kernel/workingset/TransportOrderPoolManager.java @@ -564,7 +564,6 @@ private Set> getDependencies(TransportOrderCr return result; } - @SuppressWarnings("deprecation") private TCSObjectReference getWrappingSequence(TransportOrderCreationTO to) throws ObjectUnknownException, IllegalArgumentException { if (to.getWrappingSequence() == null) { diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/extensions/controlcenter/vehicles/AttachmentManagerTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/extensions/controlcenter/vehicles/AttachmentManagerTest.java index 39cd3b097..95b3a2129 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/extensions/controlcenter/vehicles/AttachmentManagerTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/extensions/controlcenter/vehicles/AttachmentManagerTest.java @@ -202,13 +202,11 @@ public ExplainedBoolean canProcess(TransportOrder order) { } @Override - @Deprecated - public ExplainedBoolean canProcess(List list) { - return new ExplainedBoolean(true, ""); + public void processMessage(Object o) { } @Override - public void processMessage(Object o) { + public void onVehiclePaused(boolean paused) { } } diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/peripherals/PeripheralAttachmentManagerTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/peripherals/PeripheralAttachmentManagerTest.java index e9c20eda2..0d86c058c 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/peripherals/PeripheralAttachmentManagerTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/peripherals/PeripheralAttachmentManagerTest.java @@ -183,6 +183,10 @@ public ExplainedBoolean canProcess(PeripheralJob job) { public void process(PeripheralJob job, PeripheralJobCallback callback) { } + @Override + public void abortJob() { + } + @Override public void execute(PeripheralAdapterCommand command) { } diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandImplTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandImplTest.java deleted file mode 100644 index 16f75aa39..000000000 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandImplTest.java +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Copyright (c) The openTCS Authors. - * - * This program is free software and subject to the MIT license. (For details, - * see the licensing information (LICENSE.txt) you should have received with - * this copy of the software.) - */ -package org.opentcs.kernel.vehicles; - -import jakarta.annotation.Nonnull; -import jakarta.annotation.Nullable; -import java.util.List; -import java.util.Map; -import static java.util.Objects.requireNonNull; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.opentcs.data.model.Location; -import org.opentcs.data.model.LocationType; -import org.opentcs.data.model.Path; -import org.opentcs.data.model.Point; -import org.opentcs.data.model.Vehicle; -import org.opentcs.data.order.DriveOrder; -import org.opentcs.data.order.ReroutingType; -import org.opentcs.data.order.Route; -import org.opentcs.data.order.Route.Step; -import org.opentcs.data.order.TransportOrder; - -/** - * Test for {@link MovementCommandImpl}. - */ -public class MovementCommandImplTest { - - private Point destinationPoint; - private Location location; - - @BeforeEach - public void setUp() { - destinationPoint = new Point("p1"); - location = new Location("L1", new LocationType("LT1").getReference()); - } - - @Test - void considerIdenticalMovementCommandsEqual() { - Step stepAB = createStep("A", "B", - Vehicle.Orientation.FORWARD, - 0, true, null); - Route route = new Route(List.of(stepAB), 22); - - DriveOrder driveOrder - = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) - .withRoute(route); - TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); - - MovementCommandImpl command = new MovementCommandImpl(transportOrder, - driveOrder, - stepAB, - "some-operation", - location, - false, - location, - destinationPoint, - "final-operation", - Map.of()); - - assertTrue(command.equalsInMovement(command)); - } - - @Test - void considerMovementCommandsWithDifferentStepsNotEqual() { - Step stepAB = createStep("A", "B", - Vehicle.Orientation.FORWARD, - 0, true, null); - Route route = new Route(List.of(stepAB), 22); - - DriveOrder driveOrder - = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) - .withRoute(route); - TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); - - MovementCommandImpl commandA = new MovementCommandImpl(transportOrder, - driveOrder, - stepAB, - "some-operation", - location, - false, - location, - destinationPoint, - "final-operation", - Map.of("a", "b")); - - Step stepBC = createStep("B", "C", - Vehicle.Orientation.FORWARD, - 0, true, null); - Route route2 = new Route(List.of(stepBC), 22); - - driveOrder - = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) - .withRoute(route2); - transportOrder = new TransportOrder("some-order", List.of(driveOrder)); - - MovementCommandImpl commandB = new MovementCommandImpl(transportOrder, - driveOrder, - stepBC, - "some-operation", - location, - false, - location, - destinationPoint, - "final-operation", - Map.of("a", "b")); - - assertFalse(commandA.equalsInMovement(commandB)); - } - - @Test - void considerMovementCommandsWithOperationNotEqual() { - Step stepAB = createStep("A", "B", - Vehicle.Orientation.FORWARD, - 0, true, null); - Route route = new Route(List.of(stepAB), 22); - - DriveOrder driveOrder - = new DriveOrder(new DriveOrder.Destination(destinationPoint.getReference())) - .withRoute(route); - TransportOrder transportOrder = new TransportOrder("some-order", List.of(driveOrder)); - - MovementCommandImpl commandA = new MovementCommandImpl(transportOrder, - driveOrder, - stepAB, - "operation-a", - location, - false, - location, - destinationPoint, - "final-operation", - Map.of("a", "b")); - - MovementCommandImpl commandB = new MovementCommandImpl(transportOrder, - driveOrder, - stepAB, - "operation-b", - location, - false, - location, - destinationPoint, - "final-operation", - Map.of("a", "b")); - - assertFalse(commandA.equalsInMovement(commandB)); - } - - private Route.Step createStep(@Nonnull String srcPointName, - @Nonnull String destPointName, - @Nonnull Vehicle.Orientation orientation, - int routeIndex, - boolean executionAllowed, - @Nullable ReroutingType reroutingType) { - requireNonNull(srcPointName, "srcPointName"); - requireNonNull(destPointName, "destPointName"); - requireNonNull(orientation, "orientation"); - - Point srcPoint = new Point(srcPointName); - Point destPoint = new Point(destPointName); - Path path = new Path(srcPointName + "-" + destPointName, - srcPoint.getReference(), - destPoint.getReference()); - - return new Route.Step(path, - srcPoint, - destPoint, - orientation, - routeIndex, - executionAllowed, - reroutingType); - } -} diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandMapperTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandMapperTest.java index 333141ec0..16764a309 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandMapperTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementCommandMapperTest.java @@ -49,7 +49,6 @@ void setUp() { } @Test - @SuppressWarnings("deprecation") void mapDriveOrderToMovementCommands() { Point pointA = new Point("point-a"); Point pointB = new Point("point-b"); @@ -81,7 +80,6 @@ void mapDriveOrderToMovementCommands() { assertThat(result.get(0).getTransportOrder(), is(theInstance(transportOrder))); assertThat(result.get(0).getDriveOrder(), is(theInstance(driveOrder))); - assertThat(result.get(0).getRoute(), is(equalTo(route))); assertThat(result.get(0).getStep(), is(equalTo(stepAB))); assertThat(result.get(0).getOperation(), is(MovementCommand.NO_OPERATION)); assertThat(result.get(0).getOpLocation(), is(nullValue())); @@ -94,7 +92,6 @@ void mapDriveOrderToMovementCommands() { assertThat(result.get(1).getTransportOrder(), is(theInstance(transportOrder))); assertThat(result.get(1).getDriveOrder(), is(theInstance(driveOrder))); - assertThat(result.get(1).getRoute(), is(equalTo(route))); assertThat(result.get(1).getStep(), is(equalTo(stepBC))); assertThat(result.get(1).getOperation(), is("operation")); assertThat(result.get(1).getOpLocation(), is(destinationLocation)); diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementComparisonsTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementComparisonsTest.java index 874f3e3a5..fe95d1967 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementComparisonsTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/MovementComparisonsTest.java @@ -11,20 +11,15 @@ import jakarta.annotation.Nullable; import java.util.ArrayList; import java.util.List; -import java.util.Map; import static java.util.Objects.requireNonNull; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; -import org.opentcs.data.model.Location; import org.opentcs.data.model.Path; import org.opentcs.data.model.Point; import org.opentcs.data.model.Vehicle; -import org.opentcs.data.order.DriveOrder; import org.opentcs.data.order.ReroutingType; import org.opentcs.data.order.Route.Step; -import org.opentcs.data.order.TransportOrder; -import org.opentcs.drivers.vehicle.MovementCommand; /** * Tests for {@link MovementComparisons}. @@ -130,83 +125,4 @@ private Step createStep(@Nonnull String srcPointName, executionAllowed, reroutingType); } - - private static class TestMovementCommand - implements MovementCommand { - - private final Step step; - private final String operation; - - TestMovementCommand(Step step, String operation) { - this.step = requireNonNull(step, "step"); - this.operation = requireNonNull(operation, "operation"); - } - - @Override - public TransportOrder getTransportOrder() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public DriveOrder getDriveOrder() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Step getStep() { - return step; - } - - @Override - public String getOperation() { - return operation; - } - - @Override - @Deprecated - public boolean isWithoutOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean hasEmptyOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Location getOpLocation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isFinalMovement() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Point getFinalDestination() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Location getFinalDestinationLocation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getFinalOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean equalsInMovement(MovementCommand command) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Map getProperties() { - throw new UnsupportedOperationException("Not supported yet."); - } - - } } diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/PeripheralInteractionTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/PeripheralInteractionTest.java index 9ed9b8180..a37645547 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/PeripheralInteractionTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/vehicles/PeripheralInteractionTest.java @@ -86,7 +86,7 @@ void shouldNotWaitForOperationCompletion() { peripheralInteraction = new PeripheralInteraction(VEHICLE.getReference(), ORDER.getReference(), - new DummyMovementCommand(), + createDummyMovementCommand(), Arrays.asList(operation), peripheralJobService, RESERVATION_TOKEN); @@ -115,7 +115,7 @@ void shouldWaitForOperationCompletion() { peripheralInteraction = new PeripheralInteraction(VEHICLE.getReference(), ORDER.getReference(), - new DummyMovementCommand(), + createDummyMovementCommand(), Arrays.asList(operation), peripheralJobService, RESERVATION_TOKEN); @@ -147,7 +147,7 @@ void shouldCallbackOnFailedRequiredInteraction() { peripheralInteraction = new PeripheralInteraction(VEHICLE.getReference(), ORDER.getReference(), - new DummyMovementCommand(), + createDummyMovementCommand(), Arrays.asList(operation), peripheralJobService, RESERVATION_TOKEN); @@ -172,84 +172,23 @@ private Location createLocation() { return new Location("Location-01", locationType.getReference()); } - private class DummyMovementCommand - implements MovementCommand { - - private final Route.Step dummyStep; - - DummyMovementCommand() { - Point srcPoint = new Point("Point-01"); - Point destPoint = new Point("Point-02"); - Path path = new Path("Point-01 --- Point-02", - srcPoint.getReference(), - destPoint.getReference()); - dummyStep = new Route.Step(path, srcPoint, destPoint, Vehicle.Orientation.FORWARD, 0); - } - - @Override - public TransportOrder getTransportOrder() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public DriveOrder getDriveOrder() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Route.Step getStep() { - return dummyStep; - } - - @Override - public String getOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - @Deprecated - public boolean isWithoutOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean hasEmptyOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Location getOpLocation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean isFinalMovement() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Point getFinalDestination() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Location getFinalDestinationLocation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public String getFinalOperation() { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public boolean equalsInMovement(MovementCommand command) { - throw new UnsupportedOperationException("Not supported yet."); - } - - @Override - public Map getProperties() { - throw new UnsupportedOperationException("Not supported yet."); - } + private MovementCommand createDummyMovementCommand() { + Point srcPoint = new Point("Point-01"); + Point destPoint = new Point("Point-02"); + Path path = new Path("Point-01 --- Point-02", + srcPoint.getReference(), + destPoint.getReference()); + Route.Step step = new Route.Step(path, srcPoint, destPoint, Vehicle.Orientation.FORWARD, 0); + + return new MovementCommand(new TransportOrder("dummy-transport-order", List.of()), + new DriveOrder(new DriveOrder.Destination(destPoint.getReference())), + step, + MovementCommand.MOVE_OPERATION, + null, + true, + null, + destPoint, + MovementCommand.MOVE_OPERATION, + Map.of()); } } diff --git a/openTCS-Kernel/src/test/java/org/opentcs/kernel/workingset/PlantModelManagerTest.java b/openTCS-Kernel/src/test/java/org/opentcs/kernel/workingset/PlantModelManagerTest.java index fc919d347..35a789e3d 100644 --- a/openTCS-Kernel/src/test/java/org/opentcs/kernel/workingset/PlantModelManagerTest.java +++ b/openTCS-Kernel/src/test/java/org/opentcs/kernel/workingset/PlantModelManagerTest.java @@ -19,7 +19,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.opentcs.access.to.model.BlockCreationTO; -import org.opentcs.access.to.model.GroupCreationTO; import org.opentcs.access.to.model.LocationCreationTO; import org.opentcs.access.to.model.LocationTypeCreationTO; import org.opentcs.access.to.model.PathCreationTO; @@ -29,7 +28,6 @@ import org.opentcs.access.to.model.VisualLayoutCreationTO; import org.opentcs.access.to.peripherals.PeripheralOperationCreationTO; import org.opentcs.data.model.Block; -import org.opentcs.data.model.Group; import org.opentcs.data.model.Location; import org.opentcs.data.model.LocationType; import org.opentcs.data.model.Path; @@ -49,7 +47,6 @@ class PlantModelManagerTest { private PlantModelCreationTO plantModelCreationTo; @BeforeEach - @SuppressWarnings("deprecation") void setUp() { objectRepo = new TCSObjectRepository(); plantModelManager = new PlantModelManager(objectRepo, new SimpleEventBus()); @@ -73,14 +70,12 @@ void setUp() { .withLink("point1", Set.of("some-op")) ) .withBlock(new BlockCreationTO("some-block")) - .withGroup(new GroupCreationTO("some-group")) .withVehicle(new VehicleCreationTO("some-vehicle")) .withVisualLayout(new VisualLayoutCreationTO("some-visual-layout")) .withProperty("some-prop-key", "some-prop-value"); } @Test - @SuppressWarnings("deprecation") void importPlantModel() { plantModelManager.createPlantModelObjects(plantModelCreationTo); @@ -97,8 +92,6 @@ void importPlantModel() { assertThat(objectRepo.getObject(Location.class, "some-location"), is(notNullValue())); assertThat(objectRepo.getObjects(Block.class), hasSize(1)); assertThat(objectRepo.getObject(Block.class, "some-block"), is(notNullValue())); - assertThat(objectRepo.getObjects(Group.class), hasSize(1)); - assertThat(objectRepo.getObject(Group.class, "some-group"), is(notNullValue())); assertThat(objectRepo.getObjects(Vehicle.class), hasSize(1)); assertThat(objectRepo.getObject(Vehicle.class, "some-vehicle"), is(notNullValue())); assertThat(objectRepo.getObjects(VisualLayout.class), hasSize(1)); @@ -106,7 +99,6 @@ void importPlantModel() { } @Test - @SuppressWarnings("deprecation") void exportPlantModel() { plantModelManager.createPlantModelObjects(plantModelCreationTo); @@ -118,12 +110,10 @@ void exportPlantModel() { assertThat(exportedModel.getLocationTypes(), hasSize(1)); assertThat(exportedModel.getLocations(), hasSize(1)); assertThat(exportedModel.getBlocks(), hasSize(1)); - assertThat(exportedModel.getGroups(), hasSize(1)); assertThat(exportedModel.getVehicles(), hasSize(1)); } @Test - @SuppressWarnings("deprecation") void clearPlantModel() { plantModelManager.createPlantModelObjects(plantModelCreationTo); @@ -134,7 +124,6 @@ void clearPlantModel() { assertThat(objectRepo.getObjects(LocationType.class), is(empty())); assertThat(objectRepo.getObjects(Location.class), is(empty())); assertThat(objectRepo.getObjects(Block.class), is(empty())); - assertThat(objectRepo.getObjects(Group.class), is(empty())); assertThat(objectRepo.getObjects(Vehicle.class), is(empty())); assertThat(objectRepo.getObjects(VisualLayout.class), is(empty())); } diff --git a/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/application/action/draw/DefaultPointSelectedAction.java b/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/application/action/draw/DefaultPointSelectedAction.java index dd897bc88..aa21e6624 100644 --- a/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/application/action/draw/DefaultPointSelectedAction.java +++ b/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/application/action/draw/DefaultPointSelectedAction.java @@ -125,8 +125,6 @@ private ImageIcon getImageIconByType(PointModel.Type pointType) { switch (pointType) { case HALT: return ImageDirectory.getImageIcon("/toolbar/point-halt.22.png"); - case REPORT: - return ImageDirectory.getImageIcon("/toolbar/point-report.22.png"); case PARK: return ImageDirectory.getImageIcon("/toolbar/point-park.22.png"); default: @@ -138,8 +136,6 @@ private ImageIcon getLargeImageIconByType(PointModel.Type pointType) { switch (pointType) { case HALT: return ImageDirectory.getImageIcon("/toolbar/point-halt-arrow.22.png"); - case REPORT: - return ImageDirectory.getImageIcon("/toolbar/point-report-arrow.22.png"); case PARK: return ImageDirectory.getImageIcon("/toolbar/point-park-arrow.22.png"); default: diff --git a/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/persistence/unified/PlantModelElementConverter.java b/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/persistence/unified/PlantModelElementConverter.java index d1779f5e5..05264bfcc 100644 --- a/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/persistence/unified/PlantModelElementConverter.java +++ b/openTCS-ModelEditor/src/main/java/org/opentcs/modeleditor/persistence/unified/PlantModelElementConverter.java @@ -322,15 +322,12 @@ public LayoutModel importLayout(VisualLayoutCreationTO layoutTO) { return model; } - @SuppressWarnings("deprecation") private PointModel.Type mapPointType(Point.Type type) { switch (type) { case HALT_POSITION: return PointModel.Type.HALT; case PARK_POSITION: return PointModel.Type.PARK; - case REPORT_POSITION: - return PointModel.Type.REPORT; default: throw new IllegalArgumentException("Unhandled point type: " + type); } diff --git a/openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report-arrow.22.png b/openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report-arrow.22.png deleted file mode 100644 index 93024d31d4a34c31b678bd96ffec6487055955d2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3679 zcmV-l4xsUgP)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l90Z_aBhs|Iw0E)7{bq;-T z9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g z$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL1(`yIK=_}U_z%PWq}jQa ziQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{wo%_#%{(V=tO#a9gB!7-$ zM?^BX5>d|Vn*3S!?g~$*UQipUP zL&zMmg;!4Do9IA%up=Rh?=qPj=x&RGBx1dpI68aT- z2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3O zju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvDRIYI4MQ`g1<+DyrL=EogS06Xii({|v`U^zjmmKqDIK93(F5q| z^fLNk`gQs{RV`IdRle#b)i%{Ds;|}NsClUI)k@Ub)kf6bsWa4l)YH_rsduU0(?DsM zX@qO!YV6TCtMPOWZH~(v?wpc2hv(eZgf-1HBQ#fN?$aF5oYvCT^3%%Fs?s{6^;Da# z?V+8jy+iwi_M{F~$4y6|vqR^k&SQoO!;_KDsATjprgSxR{dFa}^}2()GkV5)QF?`X z?Rxk03HmJkB>f%wz4}uIItC#I1qQ7Kw+-=zEW;GTU55RJuZ@h2VvIHzbs0S}Rx=JT z&Npr~zH34@aW`3J(qMAU6l2OVO*7qXdf5y%vo}jIt1%lghs_<#1?IcWhb_<+P8LFo z28$a^64R5J!)#@aTGB0pEekEXET35!SjAgyv+B3{Xl-wuZrx~o$A)4PXj5p@WAm%6 znJw40#`fA=@?77!tLJvleQsxN$G6*KchjC~A7a13zSsVPgQJ7Uq0M2^(ZDg$vDWbh zi^d9LZDyT!LOXdmt#&%*^w!zIS?qk+`4<X~g?%562@eae34a)26HyS+zks@6 z$%2*zuOhu7%OdYYnM6sVdZQJi6QY}=U&naIl*dS8tzuWkUW(I*6U24LW8oFzvR(TOpMEs5_rp_~TJ^wNN(wM(bC zZ0;`Z6P^ce2XB(^$}i_nB)KM)Cp}7bP2Qe7nc|*Ok@8f)7E}wKr~0SXrM^xJP1~RL zDLp2=Jp-4Km~m7{5vB?IGPN`FGKaIwvx>8%%bb_(Ts9>N5;bK**^9Ef#WdN^)PTf9 zvR*Qp{o-l7TcBI8wqSIn=gRt3(5j`Y zdRObOE?Pal#&6AmwS={4Ykw%TE-Wv6xh`g1Pmxy9nxe7we(PI{6^cd0H#WFzsN0Cz zDA+i-Y3`<~O&?2mB^OJrODjs>Z{}{k_?699m0x|@lC)*8%%N=0R?Jr6*6Z8cw;d=~ zF3&F?+a9vLa|dHb$&Qyhm+ZVyVOLSNi?B>BD~E ze(8aT1AWbo&CM;EEoH56tE6@EV8X%6-*|u1-NtOIZ>P7H9s-9XhaP{M`0e$>L5F*f zu#U8SXZT%h2eqT56Y5;vIn|ZYCGC#u9zGg)w718lr{jCe@An_mJyvsE<#^c%!il02 zpHAkVoIaIx>gnm^(__6$dheWxJ#(!uyl?Pq(Ao3ne9xWf_v}A;-u3*k3(gmgUSwVD zy5w-FbHIL};|Kd6ItCpEJBJ*Hx-UCj?irppeBz4xmD5+fub#UWaP88_{E^}7QP*$Y zNVp-r$-DXJR{E{yw{vdK+*xxMeYfPE(!GlNn)e%iH2tw%>L5Kn>ODH}V8MesW8ASP zKV|>)e!S=*`C-L`&P4Mg+egPHeJ3wJUif(YN!F8@r^P=j|6Kdbc>FRj6+1Ql zT=e|YubW?}zu5oM?q%6XKddMj$o2PGeRO9j_5e8?^OgUux- zhkgK`pJ9W)S;0^`g=u1Uch~+t6r%C*aoXPArlO)EGMmjpXMTR3hK7d7U@%Z)V`D*+ z+uf$u>#tz#6~KQS0V~kC)zwu?dwV-YBN1}BTvStAOXcO|hfcM&wno#_(=;+NLSJWR zsiULAZnawHz_=jcI@R$fR#sLlUayyo#l`fxzn@I7l4EcXkEftmNGHn5sJXeBoK7co zc6L%rOA7@80gKIMn}Gg#c8j#wzqhw%fBfi?fIjQ$B7J^7#SabySRG&nvm`VcDlILg z?(S}CZEYo9JMiX>JuffM54AQO78T>+UI@pE;P|il`UErqD-(%?kaVyHP>u2}AG$uD zkM7*QP0YA?>()K!zhsL&h<+gl%60j&I6gz;3OJqttW7%w2ezT1K?K`#?OGwS#lztG z#l=MteGXJov66*-E8pc{YZm%Ky_gn88|RfW>N43?4z=^`M~? za_!e3ZA_>rnNo2jP-?eGsN5v-^CwMy_&^?yhrs&HOdS+A0qJ#nJpNfUlovfc^c3}< zuh*xn$yj+TS}pDF>`*sa0A~aktkQe#+}YzYD>_l*4UeBZv2zo8==an82M>h5WuB_R zGTnYfqXHU(Z_$JZjHRZgt8bw;t5cN!az90PnhOSlqHVU^y(`-0#hMx_vsey+IZ$6d zf2NO_RC9A+r%9V!q7ejbWGbSWv diff --git a/openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report.22.png b/openTCS-ModelEditor/src/main/resources/org/opentcs/guing/res/symbols/toolbar/point-report.22.png deleted file mode 100644 index 042ed9d83913d8257df3ae9754b71bc8d573e34d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3646 zcmV-E4#Dw>P)f6Xi@@54ZTQ_E-Enz5K6$1 z03tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUFWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il z#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|>%+C|c55>;RS}qbKr-&IQ zTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bf ze_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l90Z_aBhs|Iw0E)7{bq;-T z9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g z$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL1(`yIK=_}U_z%PWq}jQa ziQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{wo%_#%{(V=tO#a9gB!7-$ zM?^BX5>d|Vn*3S!?g~$*UQipUP zL&zMmg;!4Do9IA%up=Rh?=qPj=x&RGBx1dpI68aT- z2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3O zju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvDRIYI4MQ`g1<+DyrL=EogS06Xii({|v`U^zjmmKqDIK93(F5q| z^fLNk`gQs{RV`IdRle#b)i%{Ds;|}NsClUI)k@Ub)kf6bsWa4l)YH_rsduU0(?DsM zX@qO!YV6TCtMPOWZH~(v?wpc2hv(eZgf-1HBQ#fN?$aF5oYvCT^3%%Fs?s{6^;Da# z?V+8jy+iwi_M{F~$4y6|vqR^k&SQoO!;_KDsATjprgSxR{dFa}^}2()GkV5)QF?`X z?Rxk03HmJkB>f%wz4}uIItC#I1qQ7Kw+-=zEW;GTU55RJuZ@h2VvIHzbs0S}Rx=JT z&Npr~zH34@aW`3J(qMAU6l2OVO*7qXdf5y%vo}jIt1%lghs_<#1?IcWhb_<+P8LFo z28$a^64R5J!)#@aTGB0pEekEXET35!SjAgyv+B3{Xl-wuZrx~o$A)4PXj5p@WAm%6 znJw40#`fA=@?77!tLJvleQsxN$G6*KchjC~A7a13zSsVPgQJ7Uq0M2^(ZDg$vDWbh zi^d9LZDyT!LOXdmt#&%*^w!zIS?qk+`4<X~g?%562@eae34a)26HyS+zks@6 z$%2*zuOhu7%OdYYnM6sVdZQJi6QY}=U&naIl*dS8tzuWkUW(I*6U24LW8oFzvR(TOpMEs5_rp_~TJ^wNN(wM(bC zZ0;`Z6P^ce2XB(^$}i_nB)KM)Cp}7bP2Qe7nc|*Ok@8f)7E}wKr~0SXrM^xJP1~RL zDLp2=Jp-4Km~m7{5vB?IGPN`FGKaIwvx>8%%bb_(Ts9>N5;bK**^9Ef#WdN^)PTf9 zvR*Qp{o-l7TcBI8wqSIn=gRt3(5j`Y zdRObOE?Pal#&6AmwS={4Ykw%TE-Wv6xh`g1Pmxy9nxe7we(PI{6^cd0H#WFzsN0Cz zDA+i-Y3`<~O&?2mB^OJrODjs>Z{}{k_?699m0x|@lC)*8%%N=0R?Jr6*6Z8cw;d=~ zF3&F?+a9vLa|dHb$&Qyhm+ZVyVOLSNi?B>BD~E ze(8aT1AWbo&CM;EEoH56tE6@EV8X%6-*|u1-NtOIZ>P7H9s-9XhaP{M`0e$>L5F*f zu#U8SXZT%h2eqT56Y5;vIn|ZYCGC#u9zGg)w718lr{jCe@An_mJyvsE<#^c%!il02 zpHAkVoIaIx>gnm^(__6$dheWxJ#(!uyl?Pq(Ao3ne9xWf_v}A;-u3*k3(gmgUSwVD zy5w-FbHIL};|Kd6ItCpEJBJ*Hx-UCj?irppeBz4xmD5+fub#UWaP88_{E^}7QP*$Y zNVp-r$-DXJR{E{yw{vdK+*xxMeYfPE(!GlNn)e%iH2tw%>L5Kn>ODH}V8MesW8ASP zKV|>)e!S=*`C-L`&P4Mg+egPHeJ3wJUif(YN!F8@r^P=j|6Kdbc>FRj6+1Ql zT=e|YubW?}zu5oM?q%gV(h1NE-i8nnokx2w)`P zLoNiaG#>P30twJc;eZDDXzPDAZ<|LcQ8$@v``+wtXJ=;rPnS$4Dbv7nBPI{b1#`em z%Bv{s3+xkYQlrttGOgET0A9o7hxyLV&aQ{UVfyy{sv~z~f$QaC{{gPB$^lo}8RGK1@#1%*+fO9UW0YK>?Y~X5q8GzD{FfW0aqtPxbZn z*B^L1FZ6nS9oE(X{{0eIfv#yxVZSjsdjdDXmN3oCMG86 z^Xe+~^z=AvHrpB)cO+b=I{xg|)|S=h^O4bDp!dVWWI~i&gY$Si1;s+TVX;tib2GVI zE(!*N)Y8&I0|NtAyWKtu|8h=?j5u(5dg|!v>=e-6zCP0D=2HCpT!7UDW-wbKD~pPX ziYOEcQCnLZ@!FBmQAbWrP5^E%bXa7-k7tuORs_d?H#8)m2}GGlB!s1dvjELfp5?;V z@AuP_$B&5_kD8jE!T$|M>_zqSxKQqz8gYDv#uacp16Z4O3NCDIZLKJ_x1k{q-Qs0% z_2%ZLs6H1esYJ=fxt0Ir;Ak1DOG`^tRTWK5O%b!o%F3$wy_5UYfZSS86wYfZQl2?_ z6_}&dVvZ|Nxe*tX8O#FM$zXFV79*3%lq!@oxdFrZKZ8;QRDkN@a!Q!RKQG<9OhazM z(f#XSaKvad+BP;eu5^+|mJweyxT}x`@sq(}+>=tJ5LP<%9oA3V0(h@yvY)k=@N}<$|3Mju%+h7T6nE@8NEiiZjeb)~` z$>Y0UiMBD}M#+|nD}_?0MMC8!k-a^dpPM7E*GpjiWTp;|2Y|fwc)fvD2+HgJetL=f zpR3oWqRDvk*tA+Y`Td(hkO1xoFxcfSGi6rK7jU{nI4Vf~g%F3}T_Dw6xR(`|pqG9~_YC2mmMv QOaK4?07*qoM6N<$f(B6at^fc4 diff --git a/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/PointModel.java b/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/PointModel.java index 02793624b..6f50fcaf8 100644 --- a/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/PointModel.java +++ b/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/PointModel.java @@ -34,7 +34,6 @@ import org.opentcs.guing.base.model.AbstractModelComponent; import org.opentcs.guing.base.model.FigureDecorationDetails; import org.opentcs.guing.base.model.PositionableModelComponent; -import org.opentcs.util.annotations.ScheduledApiChange; /** * Basic implementation of a point. @@ -293,15 +292,6 @@ public enum Type { */ HALT(ResourceBundle.getBundle(BUNDLE_PATH).getString("pointModel.type.halt.description"), ResourceBundle.getBundle(BUNDLE_PATH).getString("pointModel.type.halt.helptext")), - /** - * A reporting position. - * - * @deprecated Support for report points will be removed. - */ - @Deprecated - @ScheduledApiChange(when = "6.0", details = "Will be removed") - REPORT(ResourceBundle.getBundle(BUNDLE_PATH).getString("pointModel.type.report.description"), - ResourceBundle.getBundle(BUNDLE_PATH).getString("pointModel.type.report.helptext")), /** * A parking position. */ diff --git a/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/VehicleModel.java b/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/VehicleModel.java index ba1e5d9ca..8d015ce1e 100644 --- a/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/VehicleModel.java +++ b/openTCS-PlantOverview-Base/src/main/java/org/opentcs/guing/base/model/elements/VehicleModel.java @@ -606,7 +606,6 @@ private void createProperties() { pState.setModellingEditable(false); setProperty(STATE, pState); - @SuppressWarnings("deprecation") SelectionProperty pProcState = new SelectionProperty<>(this, Arrays.asList(Vehicle.ProcState.values()), diff --git a/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle.properties b/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle.properties index ee631063c..af2a99997 100644 --- a/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle.properties +++ b/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle.properties @@ -157,8 +157,6 @@ pointModel.type.halt.description=Halt point pointModel.type.halt.helptext=Creates a point where a vehicle can stop pointModel.type.park.description=Park point pointModel.type.park.helptext=Creates a point where a vehicle can park -pointModel.type.report.description=Report point -pointModel.type.report.helptext=Creates a point where a vehicle may report its position propertiesCollection.description=Multiple objects selected vehicleModel.description=Vehicle vehicleModel.property_allocatedResources.description=Allocated resources diff --git a/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle_de.properties b/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle_de.properties index abc33c2c5..f4a2619ee 100644 --- a/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle_de.properties +++ b/openTCS-PlantOverview-Base/src/main/resources/i18n/org/opentcs/plantoverview/base/Bundle_de.properties @@ -156,8 +156,6 @@ pointModel.type.halt.description=Haltepunkt pointModel.type.halt.helptext=Erstellt ein Punkt an dem ein Fahrzeug stoppen kann pointModel.type.park.description=Parkposition pointModel.type.park.helptext=Erstellt einen Punkt wo ein Fahrzeug parken kann -pointModel.type.report.description=Meldepunkt -pointModel.type.report.helptext=Erstellt einen Punkt an dem ein Fahrzeug seine Position melden kann propertiesCollection.description=Mehrere Objekte ausgew\u00e4hlt vehicleModel.description=Fahrzeug vehicleModel.property_allocatedResources.description=Zugewiesene Ressourcen diff --git a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/components/drawing/figures/PointFigure.java b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/components/drawing/figures/PointFigure.java index 80ecd045f..1cb130312 100644 --- a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/components/drawing/figures/PointFigure.java +++ b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/components/drawing/figures/PointFigure.java @@ -45,10 +45,6 @@ public class PointFigure * A color for parking positions. */ private static final Color C_PARK = Color.BLUE; - /** - * A color for report positions. - */ - private static final Color C_REPORT = Color.WHITE; /** * A color for halt positions. */ @@ -187,7 +183,6 @@ private void drawDecoration(Graphics2D g, Stroke stroke, Color color) { g.draw(this.getShape()); } - @SuppressWarnings("deprecation") @Override protected void drawFill(Graphics2D g) { Rectangle rect = fDisplayBox; @@ -195,9 +190,6 @@ protected void drawFill(Graphics2D g) { if (getModel().getPropertyType().getValue() == PointModel.Type.PARK) { g.setColor(C_PARK); } - else if (getModel().getPropertyType().getValue() == PointModel.Type.REPORT) { - g.setColor(C_REPORT); - } else { g.setColor(C_HALT); } diff --git a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/PointAdapter.java b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/PointAdapter.java index 6b6e462fc..820ad2e6d 100644 --- a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/PointAdapter.java +++ b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/PointAdapter.java @@ -108,7 +108,6 @@ private void updateModelLayoutProperties(PointModel model, Point point, LayoutMo model.getPropertyLayerWrapper().setValue(layerWrapper); } - @SuppressWarnings("deprecation") private void updateModelType(PointModel model, Point point) { PointModel.Type value; @@ -116,9 +115,6 @@ private void updateModelType(PointModel model, Point point) { case PARK_POSITION: value = PointModel.Type.PARK; break; - case REPORT_POSITION: - value = PointModel.Type.REPORT; - break; case HALT_POSITION: default: value = PointModel.Type.HALT; @@ -158,14 +154,11 @@ private PointCreationTO.Layout getLayout(PointModel model) { ); } - @SuppressWarnings("deprecation") private Point.Type convertPointType(PointModel.Type type) { requireNonNull(type, "type"); switch (type) { case PARK: return Point.Type.PARK_POSITION; - case REPORT: - return Point.Type.REPORT_POSITION; case HALT: return Point.Type.HALT_POSITION; default: diff --git a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/ProcessAdapterUtil.java b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/ProcessAdapterUtil.java index 8a1bc4dc5..a92d0ce76 100644 --- a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/ProcessAdapterUtil.java +++ b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/exchange/adapter/ProcessAdapterUtil.java @@ -34,7 +34,6 @@ public class ProcessAdapterUtil { private final VehicleAdapter vehicleAdapter; @Inject - @SuppressWarnings("deprecation") public ProcessAdapterUtil(BlockAdapter blockAdapter, LayoutAdapter layoutAdapter, LinkAdapter linkAdapter, diff --git a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/persistence/OpenTCSModelManager.java b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/persistence/OpenTCSModelManager.java index 7878a18ae..c904ef650 100644 --- a/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/persistence/OpenTCSModelManager.java +++ b/openTCS-PlantOverview-Common/src/main/java/org/opentcs/guing/common/persistence/OpenTCSModelManager.java @@ -307,7 +307,6 @@ private List
associateFiguresWithOrigin(List
figures, Origin ori } @Override - @SuppressWarnings("deprecation") public void restoreModel(KernelServicePortal portal) { requireNonNull(portal, "portal"); diff --git a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/peripherals/dispatching/DefaultPeripheralJobDispatcher.java b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/peripherals/dispatching/DefaultPeripheralJobDispatcher.java index 59dead18f..9e565aeae 100644 --- a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/peripherals/dispatching/DefaultPeripheralJobDispatcher.java +++ b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/peripherals/dispatching/DefaultPeripheralJobDispatcher.java @@ -235,22 +235,6 @@ private boolean isRelatedToNonFinalTransportOrder(PeripheralJob job) { .getState().isFinalState(); } - @Override - @Deprecated - public void peripheralJobFinished(@Nonnull PeripheralJob job) { - requireNonNull(job, "job"); - - peripheralJobFinished(job.getReference()); - } - - @Override - @Deprecated - public void peripheralJobFailed(@Nonnull PeripheralJob job) { - requireNonNull(job, "job"); - - peripheralJobFailed(job.getReference()); - } - @Override public void peripheralJobFinished(@Nonnull TCSObjectReference ref) { requireNonNull(ref, "ref"); diff --git a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/routing/DefaultRouter.java b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/routing/DefaultRouter.java index 1fef717fa..37a24acf6 100644 --- a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/routing/DefaultRouter.java +++ b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/routing/DefaultRouter.java @@ -22,7 +22,6 @@ import org.opentcs.components.kernel.Router; import org.opentcs.components.kernel.routing.GroupMapper; import org.opentcs.components.kernel.services.TCSObjectService; -import org.opentcs.data.TCSObjectReference; import org.opentcs.data.model.Location; import org.opentcs.data.model.LocationType; import org.opentcs.data.model.Path; @@ -100,7 +99,7 @@ public void initialize() { synchronized (this) { routesByVehicle.clear(); - topologyChanged(); + pointRouterProvider.invalidate(); initialized = true; } } @@ -123,20 +122,6 @@ public void terminate() { } } - @Override - @Deprecated - public void topologyChanged() { - this.updateRoutingTopology(); - } - - @Override - @Deprecated - public void updateRoutingTopology() { - synchronized (this) { - pointRouterProvider.invalidate(); - } - } - @Override public void updateRoutingTopology(Set paths) { requireNonNull(paths, "paths"); @@ -194,32 +179,6 @@ public Optional> getRoute(Vehicle vehicle, } } - @Deprecated - @Override - public Optional getRoute(Vehicle vehicle, - Point sourcePoint, - Point destinationPoint) { - requireNonNull(vehicle, "vehicle"); - requireNonNull(sourcePoint, "sourcePoint"); - requireNonNull(destinationPoint, "destinationPoint"); - - synchronized (this) { - PointRouter pointRouter = pointRouterProvider - .getPointRouterForVehicle(vehicle, (TransportOrder) null); - long costs = pointRouter.getCosts(sourcePoint, destinationPoint); - if (costs == INFINITE_COSTS) { - return Optional.empty(); - } - List steps = pointRouter.getRouteSteps(sourcePoint, destinationPoint); - if (steps.isEmpty()) { - // If the list of steps is empty, we're already at the destination point - // Create a single step without a path. - steps.add(new Route.Step(null, null, sourcePoint, Vehicle.Orientation.UNDEFINED, 0)); - } - return Optional.of(new Route(steps, costs)); - } - } - @Override public Optional getRoute(Vehicle vehicle, Point sourcePoint, @@ -247,38 +206,6 @@ public Optional getRoute(Vehicle vehicle, } } - @Deprecated - @Override - public long getCosts(Vehicle vehicle, - Point sourcePoint, - Point destinationPoint) { - requireNonNull(vehicle, "vehicle"); - requireNonNull(sourcePoint, "sourcePoint"); - requireNonNull(destinationPoint, "destinationPoint"); - - synchronized (this) { - return pointRouterProvider - .getPointRouterForVehicle(vehicle, (TransportOrder) null) - .getCosts(sourcePoint, destinationPoint); - } - } - - @Deprecated - @Override - public long getCostsByPointRef(Vehicle vehicle, - TCSObjectReference srcPointRef, - TCSObjectReference dstPointRef) { - requireNonNull(vehicle, "vehicle"); - requireNonNull(srcPointRef, "srcPointRef"); - requireNonNull(dstPointRef, "dstPointRef"); - - synchronized (this) { - return pointRouterProvider - .getPointRouterForVehicle(vehicle, (TransportOrder) null) - .getCosts(srcPointRef, dstPointRef); - } - } - @Override public long getCosts(Vehicle vehicle, Point sourcePoint, diff --git a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/AllocationAdvisor.java b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/AllocationAdvisor.java index 5d1f33709..3b3ee3639 100644 --- a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/AllocationAdvisor.java +++ b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/AllocationAdvisor.java @@ -80,28 +80,6 @@ public boolean isInitialized() { return initialized; } - @Override - @Deprecated - public void claim(Scheduler.Client client, List>> resources) { - requireNonNull(client, "client"); - requireNonNull(resources, "resources"); - - for (Scheduler.Module module : modules) { - LOG.debug("Module {}: Claiming resources {} for client{}.", module, resources, client); - module.claim(client, resources); - } - } - - @Override - @Deprecated - public void unclaim(Scheduler.Client client) { - requireNonNull(client, "client"); - - for (Scheduler.Module module : modules) { - module.unclaim(client); - } - } - @Override public void setAllocationState(@Nonnull Scheduler.Client client, @Nonnull Set> alloc, diff --git a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DefaultScheduler.java b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DefaultScheduler.java index 886a95087..8d69ebb9f 100644 --- a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DefaultScheduler.java +++ b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DefaultScheduler.java @@ -153,20 +153,6 @@ public void claim(Client client, List>> resources) { } } - @Override - @Deprecated - public void unclaim(Client client) { - requireNonNull(client, "client"); - - synchronized (globalSyncObject) { - reservationPool.setClaim(client, new ArrayList<>()); - - allocationAdvisor.setAllocationState(client, - reservationPool.allocatedResources(client), - new ArrayList<>()); - } - } - @Override public void allocate(Client client, Set> resources) { requireNonNull(client, "client"); diff --git a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DummyScheduler.java b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DummyScheduler.java index d25f9f7cb..183961649 100644 --- a/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DummyScheduler.java +++ b/openTCS-Strategies-Default/src/main/java/org/opentcs/strategies/basic/scheduling/DummyScheduler.java @@ -86,6 +86,10 @@ public boolean mayAllocateNow(Client resourceUser, Set> resources public void allocateNow(Client resourceUser, Set> resources) { } + @Override + public void clearPendingAllocations(Client client) { + } + @Override public void reschedule() { } diff --git a/openTCS-Strategies-Default/src/test/java/org/opentcs/strategies/basic/routing/edgeevaluator/EdgeEvaluatorCompositeTest.java b/openTCS-Strategies-Default/src/test/java/org/opentcs/strategies/basic/routing/edgeevaluator/EdgeEvaluatorCompositeTest.java index f3a8744da..df30f326f 100644 --- a/openTCS-Strategies-Default/src/test/java/org/opentcs/strategies/basic/routing/edgeevaluator/EdgeEvaluatorCompositeTest.java +++ b/openTCS-Strategies-Default/src/test/java/org/opentcs/strategies/basic/routing/edgeevaluator/EdgeEvaluatorCompositeTest.java @@ -55,9 +55,9 @@ void setUp() { evaluatorMock = mock(EdgeEvaluator.class); evaluators.put(EVALUATOR_MOCK, evaluatorMock); - evaluators.put(EVALUATOR_1, (someEdge, someVehicle) -> 1.0); - evaluators.put(EVALUATOR_2, (someEdge, someVehicle) -> 0.9); - evaluators.put(EVALUATOR_3, (someEdge, someVehicle) -> Double.POSITIVE_INFINITY); + evaluators.put(EVALUATOR_1, new FixedValueEdgeEvaluator(1.0)); + evaluators.put(EVALUATOR_2, new FixedValueEdgeEvaluator(0.9)); + evaluators.put(EVALUATOR_3, new FixedValueEdgeEvaluator(Double.POSITIVE_INFINITY)); } @Test @@ -111,4 +111,27 @@ void computeInfinityIfAnyComponentReturnsInfinity() { verifyNoInteractions(evaluatorMock); assertThat(edgeEvaluator.computeWeight(edge, vehicle), is(Double.POSITIVE_INFINITY)); } + + private static class FixedValueEdgeEvaluator + implements EdgeEvaluator { + + private final double value; + + FixedValueEdgeEvaluator(double value) { + this.value = value; + } + + @Override + public void onGraphComputationStart(Vehicle vehicle) { + } + + @Override + public void onGraphComputationEnd(Vehicle vehicle) { + } + + @Override + public double computeWeight(Edge edge, Vehicle vehicle) { + return value; + } + } }