NRF SDK 0.9

Reference

ToolTopology

Track traversal using observed distances and connections.

Usage context

ModulePackageSDK source
Kotlin/Nativenimbykotlin/src/nimby/ToolTopology.kt

Public API for SDK 0.9.0-alpha.2. Each entry provides the Kotlin signature and its contract: what the value means, conditions of use and effects to understand. Choose imports from the module shown above.

Imports on this page
import nimby.ToolTrackEnd
import nimby.ToolTrackConnection
import nimby.ToolRouteTrack
import nimby.ToolTopology
import nimby.topology

ToolTrackEnd

nimby · class
enum class ToolTrackEnd {
    A,
    B
}

Geometric end of a track, independent of a train’s current direction.

ToolTrackEnd.A

nimby · enum-entry
A

Geometric origin: fraction zero and distance zero. A traversal entering at A continues towards B.

ToolTrackEnd.B

nimby · enum-entry
B

Other end: fraction one and distance equal to the length. A traversal entering at B continues towards A.

ToolTrackConnection

nimby · interface
sealed interface ToolTrackConnection

Typed observed-connection result: usable Join, explicitly handled Junction, or Unknown. Selects no junction branch.

ToolTrackConnection.Unknown

nimby · object
data object Unknown : ToolTrackConnection

Insufficiently known, absent or ambiguous connection, or one leading to a track without usable length. Does not mean a dead end; stop traversal.

ToolTrackConnection.Junction

nimby · object
data object Junction : ToolTrackConnection

A junction occupies this end. The SDK does not select a branch; your tool must stop or apply an explicit routing policy.

ToolTrackConnection.Join

nimby · class
data class Join(val trackId: Long, val entry: ToolTrackEnd) : ToolTrackConnection

Reciprocal connection to a known track with usable length. entry identifies the arrival end on that other track.

ToolTrackConnection.Join.trackId

nimby · val
val trackId: Long

Identifier of the next track in this topology, resolved with track(trackId).

ToolTrackConnection.Join.entry

nimby · val
val entry: ToolTrackEnd

End through which traversal enters the next track. A implies movement towards B, and conversely.

ToolRouteTrack

nimby · class
data class ToolRouteTrack(
    val id: Long,
    val lengthM: Double,
    val a: ToolTrackConnection,
    val b: ToolTrackConnection,
    val junctionOffsetsM: List<Double>,
)

Track view usable for distance calculation: known length, typed connections and junction positions. Interior junctions must also be checked.

ToolRouteTrack.id

nimby · val
val id: Long

Identifier stable within the topology copy; does not authorize building in the world’s current state.

ToolRouteTrack.lengthM

nimby · val
val lengthM: Double

Finite, strictly positive length in metres; tracks without known length are excluded from this view.

ToolRouteTrack.a

nimby · val
val a: ToolTrackConnection

Typed connection at end A; also inspect junctionOffsetsM before reaching that end.

ToolRouteTrack.b

nimby · val
val b: ToolTrackConnection

Typed connection at end B; no branch is selected implicitly.

ToolRouteTrack.junctionOffsetsM

nimby · val
val junctionOffsetsM: List<Double>

Sorted junction positions in metres from A, including trailing connections. An empty list describes this copy only.

ToolRouteTrack.connection

nimby · fun
fun connection(end: ToolTrackEnd): ToolTrackConnection

Returns a or b for the requested end without rereading the network or selecting a branch.

ToolTopology

nimby · class
class ToolTopology

Indexed copy obtained through ToolNetwork.topology. Omits tracks without known length and their signals, leaving connections unknown. Reuse it for calculation, then reread before mutation; construction is reserved for the SDK.

ToolTopology.worldId

nimby · val
val worldId: String

World identity of the original copy. Compare it with the context before reusing a plan.

ToolTopology.generation

nimby · val
val generation: Long

Topology session generation, retained from ToolNetwork.

ToolTopology.tracks

nimby · val
val tracks: List<ToolRouteTrack>

Known-length tracks with typed connections. For a short route, prefer track(id) to repeatedly searching the entire list.

ToolTopology.signals

nimby · val
val signals: List<ToolSignal>

Signals attached to usable tracks in this topology; those on omitted tracks are not retained here.

ToolTopology.track

nimby · fun
fun track(id: Long): ToolRouteTrack?

Looks up a track by ID in the copy; null if absent or without known length. Triggers no game read.

ToolTopology.signal

nimby · fun
fun signal(id: Long): ToolSignal?

Looks up a retained signal in the copy; null if absent or attached to an omitted track. Does not prove in-game deletion.

topology

nimby · fun
fun ToolNetwork.topology(): ToolTopology

Validates the copy and prepares distance, junction and connection lookups. Rejects duplicate identities and invalid lengths, fractions or directions. Absent or ambiguous links become Unknown; takes no additional capture.