Class Gap<T extends Slot>
java.lang.Object
com.amalgamasimulation.core.intervals.Interval
com.amalgamasimulation.core.scheduling.TimeInterval
com.amalgamasimulation.core.scheduling.Gap<T>
- Type Parameters:
T- type of slots
- All Implemented Interfaces:
IntervalLike,Comparable<IntervalLike>
Class representing a (possibly infinite) gap between at most two slots in a
Sequence. A gap can be bounded by prevSlot() in the
beginning and by nextSlot() in the end. Like any other
TimeInterval, a gap has TimeInterval.beginTime(),
TimeInterval.endTime() and TimeInterval.duration(). Both begin time and end time
can be infinite. Gaps of negative duration are not allowed.- Author:
- Andrey Malykhanov
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Gap<?> dummy(double time) Creates a dummy instance ofGapused primarily as a key in search and comparison methods.getIntersection(Gap<?> gap) Returns the gap that is the result of intersecting this gap with the specified other gap, ornullif this gap does not intersect with the specified other gap.getIntersection(Slot slot) Returns the gap that is the result of intersecting this gap with the specified slot, ornullif this gap does not intersect with the specified slot.nextSlot()Returns the slot limiting this gap from the right.prevSlot()Returns the slot limiting this gap from the left.sequence()Returns theSequenceto which this gap belongs.toString()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, 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
-
Constructor Details
-
Gap
Creates a new gap with the specified begin time, end time, begin slot and end slot.- Parameters:
sequence- sequence of slots to which this gap belongsbeginTime- begin time of the gap, possibly aDouble.NEGATIVE_INFINITYendTime- end time of the gap, possibly aDouble.POSITIVE_INFINITYprevSlot- previous slot limiting this gap, possiblynullnextSlot- next slot limiting this gap, possiblynull
-
-
Method Details
-
dummy
Creates a dummy instance ofGapused primarily as a key in search and comparison methods.- Parameters:
time- time used as a search key- Returns:
- dummy instance of
Gap
-
sequence
Returns theSequenceto which this gap belongs.- Returns:
Sequenceto which this gap belongs
-
prevSlot
Returns the slot limiting this gap from the left. Can benullif this gap is not limited from the left by any slot.- Returns:
- reference to
Slotlimiting this gap from the left, ornull
-
nextSlot
Returns the slot limiting this gap from the right. Can benullif this gap is not limited from the right by any slot.- Returns:
- reference to
Slotlimiting this gap from the right, ornull
-
toString
-
getIntersection
Returns the gap that is the result of intersecting this gap with the specified slot, ornullif this gap does not intersect with the specified slot.- Parameters:
slot- specified slot- Returns:
- gap that is the result of intersecting this gap with the specified
slot, or
null
-
getIntersection
Returns the gap that is the result of intersecting this gap with the specified other gap, ornullif this gap does not intersect with the specified other gap.- Parameters:
gap- specified other gap- Returns:
- gap that is the result of intersecting this gap with the specified
other gap, or
null
-