Class Slot
java.lang.Object
com.amalgamasimulation.core.intervals.Interval
com.amalgamasimulation.core.scheduling.TimeInterval
com.amalgamasimulation.core.scheduling.Slot
- All Implemented Interfaces:
IntervalLike,Comparable<IntervalLike>
- Direct Known Subclasses:
BookingSlot
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 Summary
FieldsModifier and TypeFieldDescriptionprotected double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncopy()Returns a copy of this slot.static Slotdummy(double time) Creates a dummy instance ofSlotused primarily as a key in search and comparison methods.doubleReturns the minimum possible duration of this slot.sequence()Returns reference toSequenceto which this slot belongs, ornullif this sequence does not belong to any sequence.voidsetMinDuration(double minDuration) Sets the minimum possible duration of this slot.Methods inherited from class com.amalgamasimulation.core.scheduling.TimeInterval
beginTime, contains, duration, endTime, getExclusion, getIntersection, intersectsWithMethods inherited from class com.amalgamasimulation.core.intervals.Interval
asIntervalSet, contains, equals, equalsWithinEpsilon, equalsWithinEpsilon, exclusion, hashCode, hasNonZeroIntersectionWith, intersection, isEmpty, isUniverse, leftSubset, max, min, of, of, rightSubset, shift, size, toCodeString, toString, unionMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.amalgamasimulation.core.intervals.IntervalLike
compareTo, complement, contains, isFinite, isZeroLength, length
-
Field Details
-
minDuration
protected double minDuration -
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 aDouble.NEGATIVE_INFINITYendTime- end time of the gap, possibly aDouble.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 aDouble.NEGATIVE_INFINITYendTime- end time of the gap, possibly aDouble.POSITIVE_INFINITYminDuration- minimum possible duration of this slot
-
-
Method Details
-
dummy
Creates a dummy instance ofSlotused primarily as a key in search and comparison methods.- Parameters:
time- time used as a search key- Returns:
- dummy instance of
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
Returns reference toSequenceto which this slot belongs, ornullif this sequence does not belong to any sequence.- Returns:
- reference to
Sequenceto which this slot belongs, ornull
-
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
-