A12PathPart

data class A12PathPart(val name: String, val repetitionIndex: Int)

One part of an exact A12 pointer โ€” the counterpart of A12's PathPart: a name and a repetitionIndex.

The domain is PathPartImpl's, and it is looser than the pointer STRING grammar. A non-empty name and repetitionIndex >= 0 ("repetition index must be > 0, or 0 for wildcard, but not negative") โ€” and nothing else. PathPart.of("a/b", 1) and PathPart.of("Order$", 1) are both accepted by the kernel and survive into DocumentPointer.fullName(); only DocumentPointer.of(String) refuses those names, because a written pointer has to parse back to the same value. This type previously imposed the string grammar here, which made a legal A12 part unrepresentable โ€” an over-rejection on the read path as much as the authoring one.

Whether a 0 may sit at this position is the pointer's rule, not the part's, exactly as in A12: DocumentPointerImpl's constructor decides that, and its assertion records that "PathPart is responsible for repetition indexes >= 0".

A data class is safe here where it is not on A12Pointer: this holds no collection, so copy() re-runs the primary constructor and re-validates rather than side-stepping a snapshot.

Constructors

Link copied to clipboard
constructor(name: String, repetitionIndex: Int)

Properties

Link copied to clipboard
val name: String
Link copied to clipboard

Functions

Link copied to clipboard
open override fun toString(): String

PathPartImpl.toString: the index is written only when it is not the implicit 1.