All Implemented Interfaces:
IntervalLike, Comparable<IntervalLike>
Direct Known Subclasses:
BookingSlot

public class Slot extends TimeInterval
Class representing a (possibly infinite) slot in statistical data or schedule for some object being planned and/or simulated. Slot is a TimeInterval that can reference a Sequence of slots. Slot can either belong to some sequence, or not belong to any sequence.

Like any other TimeInterval, a slot has TimeInterval.beginTime(), TimeInterval.endTime() and TimeInterval.duration(). Both begin time and end time can be infinite. Slots of negative duration are not allowed.

Sequence, Slot and Gap classes provide basic API for scheduling.

Author:
Andrey Malykhanov
  • Field Details

    • minDuration

      protected double minDuration
    • sequence

      protected Sequence<? extends Slot> sequence
  • Constructor Details

    • Slot

      public Slot(double beginTime, double endTime)
      Creates a new slot with the specified begin time and end time.
      Parameters:
      beginTime - begin time of the slot, possibly a Double.NEGATIVE_INFINITY
      endTime - end time of the gap, possibly a Double.POSITIVE_INFINITY
    • Slot

      public Slot(double beginTime, double endTime, double minDuration)
      Creates a new slot with the specified begin time, end time and minimum possible duration.
      Parameters:
      beginTime - begin time of the slot, possibly a Double.NEGATIVE_INFINITY
      endTime - end time of the gap, possibly a Double.POSITIVE_INFINITY
      minDuration - minimum possible duration of this slot
  • Method Details

    • dummy

      public static Slot dummy(double time)
      Creates a dummy instance of Slot used primarily as a key in search and comparison methods.
      Parameters:
      time - time used as a search key
      Returns:
      dummy instance of Slot
    • copy

      public Slot copy()
      Returns a copy of this slot.
      Returns:
      copy of this slot
    • minDuration

      public double minDuration()
      Returns the minimum possible duration of this slot.
      Returns:
      minimum possible duration of this slot
    • sequence

      public Sequence<? extends Slot> sequence()
      Returns reference to Sequence to which this slot belongs, or null if this sequence does not belong to any sequence.
      Returns:
      reference to Sequence to which this slot belongs, or null
    • setMinDuration

      public void setMinDuration(double minDuration)
      Sets the minimum possible duration of this slot.

      Note that this is mutating method; avoid using mutating methods where possible.

      Parameters:
      minDuration - new minimum possible duration of this slot