BoundedBatchArbiter

class BoundedBatchArbiter(val batchSize: Int, val maxWait: Double) : CrossingArbiterIfc(source)

Gap acceptance: this group finishes, new arrivals hold.

A turn opens once batchSize people are waiting, or once the one at the head has waited maxWait; it then admits only those already queued when it opened, so a stream of arrivals cannot extend one turn indefinitely. That bound is the whole of the discipline, and it is the one that behaves like a real crossing with a warden on it.

Parameters

batchSize

how many waiting people open a turn

maxWait

how long the first of them will wait before a turn opens regardless

Constructors

Link copied to clipboard
constructor(batchSize: Int, maxWait: Double)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun admitsPedestrian(crossing: ZoneCrossing): Boolean

May a pedestrian step onto the crossing now?

Link copied to clipboard
open override fun barsVehicles(crossing: ZoneCrossing): Boolean

Should the crossing be held shut against vehicles?

Link copied to clipboard
open override fun reset()

Clears whatever the discipline remembers between replications. Does nothing by default.

Link copied to clipboard
open override fun reviewAt(crossing: ZoneCrossing): Double

When the crossing should ask again even though nothing has happened.

Link copied to clipboard
open override fun turnEnded(crossing: ZoneCrossing)

Told that a turn has ended, so a discipline with a memory can advance it.