DirectionLock

data class DirectionLock(val forward: Boolean, val count: Int)(source)

The travel direction currently permitted on a bidirectional link, and how many transporters are relying on it.

A lock is engaged by the first transporter to enter an empty bidirectional link and released when the last one leaves. While it is engaged, a transporter wanting the opposite direction waits. Declared here in the static layer so that a link owns its own lock, but not exercised until transporters exist and can move.

Parameters

forward

true when travel runs from the link's beginning intersection toward its ending intersection, false for the reverse

count

how many transporters currently hold the link in that direction, always positive while the lock is engaged

Constructors

Link copied to clipboard
constructor(forward: Boolean, count: Int)

Properties

Link copied to clipboard
val count: Int
Link copied to clipboard