FleetSpaceIfc

What a fleet needs from the layout it works over: named places, how far apart they are, and whether one can be reached from another.

The companion of VehicleMovementIfc, and the second of the two things that stood between a fleet and a substrate. That one answers how a vehicle gets somewhere; this one answers what and where "somewhere" is. Between them a dispatcher, a tour, a stop and a line can be written without naming a guide path, a projection or a plane.

Places are named, and that is deliberate. A modeller posts a transport from "Machining" to "Paint", declares a stop at "Depot", and reads a report row that says where a vehicle went. Names are what a model is written in; a LocationIfc is what a space is written in. This interface is the join, and it is the reason the fleet layer never had to be retyped to carry location objects around.

Distance here is between two places, not from a vehicle. How far a vehicle is from somewhere is VehicleMovementIfc.pathDistanceTo, which may differ: on a one-way loop a vehicle standing just past a junction must go all the way round, and no fact about the layout alone can say so. A policy that scores a whole journey uses both -- this for the leg between two fixed places, that for the leg the vehicle has yet to make.

GuidedPathNetwork implements it directly, since its intersections and station aliases are already named places. Any SpatialModel with SpatialModel.namedLocations joins through SpatialModelFleetSpace.

Inheritors

Properties

Link copied to clipboard
abstract val name: String

What the layout is called, for messages that have to name it.

Functions

Link copied to clipboard
abstract fun distance(fromLocation: LocationIfc, toLocation: LocationIfc): Double

How far apart two places are, by this layout's own metric.

Link copied to clipboard
abstract fun isReachable(fromLocation: LocationIfc, toLocation: LocationIfc): Boolean

True when toLocation can be reached from fromLocation at all.

Link copied to clipboard
abstract fun location(name: String): LocationIfc?

The place this name refers to, or null when the layout has no such place.

Link copied to clipboard
abstract fun requireLocation(name: String): LocationIfc

The place this name refers to. Raises when there is none, naming what was asked for.