Package org.opentcs.components.kernel

# Interface Scheduler.Module

All Superinterfaces:
  `Lifecycle`

Enclosing interface:
  Scheduler

    public static interface Scheduler.Module
    extends Lifecycle

A scheduler module.

- ## Method Summary

  Modifier and Type | Method | Description
  --- | --- | ---
  `void` | `allocationReleased​(Scheduler.Client client, java.util.Set<TCSResource<?>> resources)` | Informs this module about resources being fully released by a client.
  `default void` | `claim​(Scheduler.Client client, java.util.List<java.util.Set<TCSResource<?>>> claim)` | Deprecated. Redundant - use `setAllocationState(org.opentcs.components.kernel.Scheduler.Client, java.util.Set, java.util.List)` instead/exclusively.
  `boolean` | `hasPreparedAllocation​(Scheduler.Client client, java.util.Set<TCSResource<?>> resources)` | Checks if this module is done preparing the given resources for a client.
  `boolean` | `mayAllocate​(Scheduler.Client client, java.util.Set<TCSResource<?>> resources)` | Checks if the resulting system state is safe if the given set of resources would be allocated by the given resource user.
  `void` | `prepareAllocation​(Scheduler.Client client, java.util.Set<TCSResource<?>> resources)` | Lets this module prepare the given resources so they can be allocated to a client.
  `void` | `setAllocationState​(Scheduler.Client client, java.util.Set<TCSResource<?>> alloc, java.util.List<java.util.Set<TCSResource<?>>> remainingClaim)` | Informs this module about a client's current allocation state.
  `default void` | `unclaim​(Scheduler.Client client)` | Deprecated. Redundant - use `setAllocationState(org.opentcs.components.kernel.Scheduler.Client, java.util.Set, java.util.List)` instead/exclusively.

  ### Methods inherited from interface org.opentcs.components.Lifecycle

  `initialize, isInitialized, terminate`

- ## Method Details

  - ### claim

    @Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void claim​(@Nonnull Scheduler.Client client, @Nonnull java.util.List<java.util.Set<TCSResource<?>>> claim)
    Deprecated.
    Redundant - use `setAllocationState(org.opentcs.components.kernel.Scheduler.Client, java.util.Set, java.util.List)` instead/exclusively.
    Sets a client's total claim. With vehicles, this is equivalent to the route a vehicle plans to take.
    Parameters:
      `client` - The client the resource sequence is claimed by.
      `claim` - The resource sequence, i.e. total claim.

  - ### unclaim

    @Deprecated @ScheduledApiChange(when="6.0", details="Will be removed.") default void unclaim​(@Nonnull Scheduler.Client client)
    Deprecated.
    Redundant - use `setAllocationState(org.opentcs.components.kernel.Scheduler.Client, java.util.Set, java.util.List)` instead/exclusively.
    Resets a client's total claim.
    Parameters:
      `client` - The client for which to reset the claim.

  - ### setAllocationState

    void setAllocationState​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> alloc, @Nonnull java.util.List<java.util.Set<TCSResource<?>>> remainingClaim)
    Informs this module about a client's current allocation state.
    Parameters:
      `client` - The client.
      `alloc` - The client's currently allocated resources.
      `remainingClaim` - The client's remaining claim.

  - ### mayAllocate

    boolean mayAllocate​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
    Checks if the resulting system state is safe if the given set of resources would be allocated by the given resource user.
    Parameters:
      `client` - The `ResourceUser` requesting resources set.
      `resources` - The requested resources.
    Returns:
      `true` if this module thinks the given resources may be allocated for the given client.

  - ### prepareAllocation

    void prepareAllocation​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
    Lets this module prepare the given resources so they can be allocated to a client.
    Parameters:
      `client` - The client the resources are being prepared for.
      `resources` - The resources to be prepared.

  - ### hasPreparedAllocation

    boolean hasPreparedAllocation​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
    Checks if this module is done preparing the given resources for a client.
    Parameters:
      `client` - The client the resources are being prepared for.
      `resources` - The resources to be checked.
    Returns:
      `true` if the resoruces are prepared for a client.

  - ### allocationReleased

    void allocationReleased​(@Nonnull Scheduler.Client client, @Nonnull java.util.Set<TCSResource<?>> resources)
    Informs this module about resources being fully released by a client.
    Parameters:
      `client` - The client releasing the resources.
      `resources` - The resources being released.