Package org.opentcs.data.order

# Class TransportOrder

java.lang.Object
org.opentcs.data.TCSObject<TransportOrder>
org.opentcs.data.order.TransportOrder

All Implemented Interfaces:
  `java.io.Serializable`

    public class TransportOrder
    extends TCSObject<TransportOrder>
    implements java.io.Serializable

Represents a sequence of movements and operations that are to be executed by a `Vehicle`.

A TransportOrder basically encapsulates a list of `DriveOrder` instances.

Transport orders may depend on other transport orders in the systems, which means they may not be processed before the orders they depend on have been processed.

See Also:
  Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type | Class | Description
  --- | --- | ---
  `static class` | `TransportOrder.State` | This enumeration defines the various states a transport order may be in.

- ## Field Summary

  ### Fields inherited from class org.opentcs.data.TCSObject

  `reference`

- ## Constructor Summary

  Constructors
  Constructor | Description
  --- | ---
  `TransportOrder​(java.lang.String name, java.util.List<DriveOrder> driveOrders)` | Creates a new TransportOrder.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `java.util.List<DriveOrder>` | `getAllDriveOrders()` | Returns a list of all drive orders, i.e.
  `java.time.Instant` | `getCreationTime()` | Returns this transport order's creation time.
  `DriveOrder` | `getCurrentDriveOrder()` | Returns the current drive order, or `null`, if no drive order is currently being processed.
  `int` | `getCurrentDriveOrderIndex()` | Returns the index of the currently processed drive order.
  `java.time.Instant` | `getDeadline()` | Returns this transport order's deadline.
  `java.util.Set<TCSObjectReference<TransportOrder>>` | `getDependencies()` | Returns the set of transport orders this order depends on.
  `java.time.Instant` | `getFinishedTime()` | Returns the point of time at which this transport order was finished.
  `java.util.List<DriveOrder>` | `getFutureDriveOrders()` | Returns a list of DriveOrders that still need to be processed.
  `TCSObjectReference<Vehicle>` | `getIntendedVehicle()` | Returns a reference to the vehicle that is intended to process this transport order.
  `java.util.List<DriveOrder>` | `getPastDriveOrders()` | Returns a list of DriveOrders that have been processed already.
  `java.lang.String` | `getPeripheralReservationToken()` | Returns an optional token for reserving peripheral devices while processing this transport order.
  `TCSObjectReference<Vehicle>` | `getProcessingVehicle()` | Returns a reference to the vehicle currently processing this transport order.
  `TransportOrder.State` | `getState()` | Returns this transport order's current state.
  `java.lang.String` | `getType()` | Retruns this transport order's type.
  `TCSObjectReference<OrderSequence>` | `getWrappingSequence()` | Returns the order sequence this order belongs to, or `null`, if it doesn't belong to any sequence.
  `boolean` | `hasState​(TransportOrder.State otherState)` | Checks if this transport order's current state is equal to the given one.
  `boolean` | `isDispensable()` | Checks if this order is dispensable.
  `java.lang.String` | `toString()` |
  `TransportOrder` | `withCreationTime​(java.time.Instant creationTime)` | Creates a copy of this object, with the given creation time.
  `TransportOrder` | `withCurrentDriveOrderIndex​(int currentDriveOrderIndex)` | Creates a copy of this object, with the given drive order index.
  `TransportOrder` | `withCurrentDriveOrderState​(DriveOrder.State driveOrderState)` | Creates a copy of this object, with the given current drive order state.
  `TransportOrder` | `withDeadline​(java.time.Instant deadline)` | Creates a copy of this object, with the given deadline.
  `TransportOrder` | `withDependencies​(java.util.Set<TCSObjectReference<TransportOrder>> dependencies)` | Creates a copy of this object, with the given dependencies.
  `TransportOrder` | `withDispensable​(boolean dispensable)` | Creates a copy of this object, with the given dispensable flag.
  `TransportOrder` | `withDriveOrders​(java.util.List<DriveOrder> driveOrders)` | Creates a copy of this object, with the given drive orders.
  `TransportOrder` | `withFinishedTime​(java.time.Instant finishedTime)` | Creates a copy of this object, with the given finished time.
  `TransportOrder` | `withHistory​(ObjectHistory history)` | Creates a copy of this object, with the given history.
  `TransportOrder` | `withHistoryEntry​(ObjectHistory.Entry entry)` | Creates a copy of this object, with the given history entry integrated.
  `TransportOrder` | `withIntendedVehicle​(TCSObjectReference<Vehicle> intendedVehicle)` | Creates a copy of this object, with the given intended vehicle.
  `TransportOrder` | `withPeripheralReservationToken​(java.lang.String peripheralReservationToken)` | Creates a copy of this object, with the given reservation token.
  `TransportOrder` | `withProcessingVehicle​(TCSObjectReference<Vehicle> processingVehicle)` | Creates a copy of this object, with the given processing vehicle.
  `TransportOrder` | `withProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)` | Creates a copy of this object, with the given properties.
  `TransportOrder` | `withProperty​(java.lang.String key, java.lang.String value)` | Creates a copy of this object, with the given property integrated.
  `TransportOrder` | `withState​(TransportOrder.State state)` | Creates a copy of this object, with the given state.
  `TransportOrder` | `withType​(java.lang.String type)` | Creates a copy of this obejct, with the given type.
  `TransportOrder` | `withWrappingSequence​(TCSObjectReference<OrderSequence> wrappingSequence)` | Creates a copy of this object, with the given wrapping sequence.

  ### Methods inherited from class org.opentcs.data.TCSObject

  `equals, getHistory, getName, getProperties, getProperty, getReference, hashCode, listWithoutNullValues, mapWithoutNullValues, propertiesWith, setWithoutNullValues`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### TransportOrder

    public TransportOrder​(java.lang.String name, java.util.List<DriveOrder> driveOrders)
    Creates a new TransportOrder.
    Parameters:
      `name` - This transport order's name.
      `driveOrders` - A list of drive orders to be processed when processing this transport order.

- ## Method Details

  - ### withProperty

    public TransportOrder withProperty​(java.lang.String key, java.lang.String value)
    Description copied from class: `TCSObject`
    Creates a copy of this object, with the given property integrated.
    Specified by:
      `withProperty` in class `TCSObject<TransportOrder>`
    Parameters:
      `key` - The key of the property to be changed.
      `value` - The new value of the property, or `null`, if the property is to be removed.
    Returns:
      A copy of this object, with the given property integrated.

  - ### withProperties

    public TransportOrder withProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
    Description copied from class: `TCSObject`
    Creates a copy of this object, with the given properties.
    Specified by:
      `withProperties` in class `TCSObject<TransportOrder>`
    Parameters:
      `properties` - The properties.
    Returns:
      A copy of this object, with the given properties.

  - ### withHistoryEntry

    public TransportOrder withHistoryEntry​(ObjectHistory.Entry entry)
    Description copied from class: `TCSObject`
    Creates a copy of this object, with the given history entry integrated.
    Specified by:
      `withHistoryEntry` in class `TCSObject<TransportOrder>`
    Parameters:
      `entry` - The history entry to be integrated.
    Returns:
      A copy of this object, with the given history entry integrated.

  - ### withHistory

    public TransportOrder withHistory​(ObjectHistory history)
    Description copied from class: `TCSObject`
    Creates a copy of this object, with the given history.
    Specified by:
      `withHistory` in class `TCSObject<TransportOrder>`
    Parameters:
      `history` - The history.
    Returns:
      A copy of this object, with the given history.

  - ### getType

    public java.lang.String getType()
    Retruns this transport order's type.
    Returns:
      This transport order's type.

  - ### withType

    public TransportOrder withType​(java.lang.String type)
    Creates a copy of this obejct, with the given type.
    Parameters:
      `type` - The tpye to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getState

    public TransportOrder.State getState()
    Returns this transport order's current state.
    Returns:
      This transport order's current state.

  - ### hasState

    public boolean hasState​(TransportOrder.State otherState)
    Checks if this transport order's current state is equal to the given one.
    Parameters:
      `otherState` - The state to compare to this transport order's one.
    Returns:
      `true` if, and only if, the given state is equal to this transport order's one.

  - ### withState

    public TransportOrder withState​(@Nonnull TransportOrder.State state)
    Creates a copy of this object, with the given state.
    Parameters:
      `state` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getCreationTime

    public java.time.Instant getCreationTime()
    Returns this transport order's creation time.
    Returns:
      This transport order's creation time.

  - ### withCreationTime

    public TransportOrder withCreationTime​(java.time.Instant creationTime)
    Creates a copy of this object, with the given creation time.
    Parameters:
      `creationTime` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getDeadline

    public java.time.Instant getDeadline()
    Returns this transport order's deadline. If the value of transport order's deadline was not changed, the initial value `Instant.MAX` is returned.
    Returns:
      This transport order's deadline or the initial deadline value.`Instant.MAX`, if the deadline was not changed.

  - ### withDeadline

    public TransportOrder withDeadline​(java.time.Instant deadline)
    Creates a copy of this object, with the given deadline.
    Parameters:
      `deadline` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getFinishedTime

    public java.time.Instant getFinishedTime()
    Returns the point of time at which this transport order was finished. If the transport order has not been finished, yet, `Instant.MAX` is returned.
    Returns:
      The point of time at which this transport order was finished, or `Instant.MAX`, if the transport order has not been finished, yet.

  - ### withFinishedTime

    public TransportOrder withFinishedTime​(java.time.Instant finishedTime)
    Creates a copy of this object, with the given finished time.
    Parameters:
      `finishedTime` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getIntendedVehicle

    @Nullable public TCSObjectReference<Vehicle> getIntendedVehicle()
    Returns a reference to the vehicle that is intended to process this transport order.
    Returns:
      A reference to the vehicle that is intended to process this transport order. If this order is free to be processed by any vehicle, `null` is returned.

  - ### withIntendedVehicle

    public TransportOrder withIntendedVehicle​(@Nullable TCSObjectReference<Vehicle> intendedVehicle)
    Creates a copy of this object, with the given intended vehicle.
    Parameters:
      `intendedVehicle` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getProcessingVehicle

    @Nullable public TCSObjectReference<Vehicle> getProcessingVehicle()
    Returns a reference to the vehicle currently processing this transport order.
    Returns:
      A reference to the vehicle currently processing this transport order. If this transport order is not currently being processed, `null` is returned.

  - ### withProcessingVehicle

    public TransportOrder withProcessingVehicle​(@Nullable TCSObjectReference<Vehicle> processingVehicle)
    Creates a copy of this object, with the given processing vehicle.
    Parameters:
      `processingVehicle` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getDependencies

    public java.util.Set<TCSObjectReference<TransportOrder>> getDependencies()
    Returns the set of transport orders this order depends on.
    Returns:
      The set of transport orders this order depends on.

  - ### withDependencies

    public TransportOrder withDependencies​(@Nonnull java.util.Set<TCSObjectReference<TransportOrder>> dependencies)
    Creates a copy of this object, with the given dependencies.
    Parameters:
      `dependencies` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getPastDriveOrders

    @Nonnull public java.util.List<DriveOrder> getPastDriveOrders()
    Returns a list of DriveOrders that have been processed already.
    Returns:
      A list of DriveOrders that have been processed already.

  - ### getFutureDriveOrders

    @Nonnull public java.util.List<DriveOrder> getFutureDriveOrders()
    Returns a list of DriveOrders that still need to be processed.
    Returns:
      A list of DriveOrders that still need to be processed.

  - ### withDriveOrders

    public TransportOrder withDriveOrders​(@Nonnull java.util.List<DriveOrder> driveOrders)
    Creates a copy of this object, with the given drive orders.
    Parameters:
      `driveOrders` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getCurrentDriveOrder

    @Nullable public DriveOrder getCurrentDriveOrder()
    Returns the current drive order, or `null`, if no drive order is currently being processed.
    Returns:
      the current drive order, or `null`, if no drive order is currently being processed.

  - ### getAllDriveOrders

    @Nonnull public java.util.List<DriveOrder> getAllDriveOrders()
    Returns a list of all drive orders, i.e. the past, current and future drive orders.
    Returns:
      A list of all drive orders, i.e. the past, current and future drive orders. If no drive orders exist, the returned list is empty.

  - ### getPeripheralReservationToken

    @Nullable public java.lang.String getPeripheralReservationToken()
    Returns an optional token for reserving peripheral devices while processing this transport order.
    Returns:
      An optional token for reserving peripheral devices while processing this transport order.

  - ### withPeripheralReservationToken

    public TransportOrder withPeripheralReservationToken​(@Nullable java.lang.String peripheralReservationToken)
    Creates a copy of this object, with the given reservation token.
    Parameters:
      `peripheralReservationToken` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getCurrentDriveOrderIndex

    public int getCurrentDriveOrderIndex()
    Returns the index of the currently processed drive order.
    Returns:
      The index of the currently processed drive order.

  - ### withCurrentDriveOrderIndex

    public TransportOrder withCurrentDriveOrderIndex​(int currentDriveOrderIndex)
    Creates a copy of this object, with the given drive order index.
    Parameters:
      `currentDriveOrderIndex` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### withCurrentDriveOrderState

    public TransportOrder withCurrentDriveOrderState​(@Nonnull DriveOrder.State driveOrderState)
    Creates a copy of this object, with the given current drive order state.
    Parameters:
      `driveOrderState` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### getWrappingSequence

    @Nullable public TCSObjectReference<OrderSequence> getWrappingSequence()
    Returns the order sequence this order belongs to, or `null`, if it doesn't belong to any sequence.
    Returns:
      The order sequence this order belongs to, or `null`, if it doesn't belong to any sequence.

  - ### withWrappingSequence

    public TransportOrder withWrappingSequence​(@Nullable TCSObjectReference<OrderSequence> wrappingSequence)
    Creates a copy of this object, with the given wrapping sequence.
    Parameters:
      `wrappingSequence` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### isDispensable

    public boolean isDispensable()
    Checks if this order is dispensable.
    Returns:
      `true` if, and only if, this order is dispensable.

  - ### withDispensable

    public TransportOrder withDispensable​(boolean dispensable)
    Creates a copy of this object, with the given dispensable flag.
    Parameters:
      `dispensable` - The value to be set in the copy.
    Returns:
      A copy of this object, differing in the given value.

  - ### toString

    public java.lang.String toString()
    Overrides:
      `toString` in class `TCSObject<TransportOrder>`