Package org.opentcs.data.order
Class TransportOrder
java.lang.Object
- 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 Modifier and Type Field Description static int
ROUTE_STEP_INDEX_DEFAULT
A value indicating that no route steps have been travelled for a drive order, yet. -
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, ornull
, if no drive order is currently being processed.int
getCurrentDriveOrderIndex()
Returns the index of the currently processed drive order.int
getCurrentRouteStepIndex()
Returns the index of the last route step travelled for 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, ornull
, 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
withCurrentRouteStepIndex(int currentRouteStepIndex)
Creates a copy of this object, with the given route step index.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
-
Field Details
-
ROUTE_STEP_INDEX_DEFAULT
public static final int ROUTE_STEP_INDEX_DEFAULTA value indicating that no route steps have been travelled for a drive order, yet.- See Also:
- Constant Field Values
-
-
Constructor Details
-
TransportOrder
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
Description copied from class:TCSObject
Creates a copy of this object, with the given property integrated.- Specified by:
withProperty
in classTCSObject<TransportOrder>
- Parameters:
key
- The key of the property to be changed.value
- The new value of the property, ornull
, if the property is to be removed.- Returns:
- A copy of this object, with the given property integrated.
-
withProperties
Description copied from class:TCSObject
Creates a copy of this object, with the given properties.- Specified by:
withProperties
in classTCSObject<TransportOrder>
- Parameters:
properties
- The properties.- Returns:
- A copy of this object, with the given properties.
-
withHistoryEntry
Description copied from class:TCSObject
Creates a copy of this object, with the given history entry integrated.- Specified by:
withHistoryEntry
in classTCSObject<TransportOrder>
- Parameters:
entry
- The history entry to be integrated.- Returns:
- A copy of this object, with the given history entry integrated.
-
withHistory
Description copied from class:TCSObject
Creates a copy of this object, with the given history.- Specified by:
withHistory
in classTCSObject<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
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
Returns this transport order's current state.- Returns:
- This transport order's current state.
-
hasState
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
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
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 valueInstant.MAX
is returned.- Returns:
- This transport order's deadline or the initial deadline value.
Instant.MAX
, if the deadline was not changed.
-
withDeadline
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
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
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
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
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
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
Returns a list of DriveOrders that have been processed already.- Returns:
- A list of DriveOrders that have been processed already.
-
getFutureDriveOrders
Returns a list of DriveOrders that still need to be processed.- Returns:
- A list of DriveOrders that still need to be processed.
-
withDriveOrders
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
Returns the current drive order, ornull
, if no drive order is currently being processed.- Returns:
- the current drive order, or
null
, if no drive order is currently being processed.
-
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
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.
-
getCurrentRouteStepIndex
public int getCurrentRouteStepIndex()Returns the index of the last route step travelled for the currently processed drive order.- Returns:
- The index of the last route step travelled for the currently processed drive order.
-
withCurrentRouteStepIndex
Creates a copy of this object, with the given route step index.- Parameters:
currentRouteStepIndex
- The value to be set in the copy.- Returns:
- A copy of this object, differing in the given value.
-
withCurrentDriveOrderState
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
Returns the order sequence this order belongs to, ornull
, 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
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 classTCSObject<TransportOrder>
-