AutoMovie API
    Preparing search index...

    Class ArchetypeDrawSession<Dimension>

    One producer's draws for one archetype: the dimensions it draws from its bands and the read models it picks, with where each value came from.

    A producer opens one session with its name, the unit of each of its dimensions, the seed and the dimensions the author fixed, and makes every draw through it; the builder takes the session and the archetype keeps its record. The values and their provenance are written by the same call, so the band a dimension was drawn in and the model a figure came from can never disagree with the value the archetype carries.

    Each dimension is drawn on its own counter-based stream, keyed by the seed, the producer's name and the dimension's name (the engine's Philox streams, createAutoMovieRandom), so the same parameters and seed give the same values bit for bit, a dimension's value does not depend on which others exist or in what order they are read, and two producers given one seed do not move together. A model is picked on its axis's stream, keyed the same way by the axis's name, so adding an axis never moves another's draws. A number seed and the text of that number are the same seed.

    Type Parameters

    • Dimension extends string

      The producer's dimensions, a closed union it declares.

    Index
    • A session with nothing drawn yet.

      Type Parameters

      • Dimension extends string

        The producer's dimensions, a closed union it declares.

      Parameters

      • archetype: string

        The producer's name, which keys the streams and names refusals.

      • units: Readonly<Record<Dimension, ArchetypeDrawSession.Unit>>

        Each dimension's unit, declared once by the producer: the unit of the dimension, whether a band draws it or a model gives it.

      • seed: string | number | undefined

        The seed; absent, every dimension takes the middle of its band and every axis its first model.

      • fixed: NoInfer<Partial<Record<Dimension, number | undefined>>> = {}

        Dimensions the author fixed, each in its band's unit; an absent or undefined entry is drawn. Members that are not dimensions, such as a model's name or the id, are not looked at.

      Returns ArchetypeDrawSession<Dimension>

    archetype: string

    The producer's name, which keys the streams and names refusals.

    • A value that follows from the others by the producer's own rule, such as a heart girth from a height, recorded with its dimension's unit and with no band and no model, since it was neither drawn nor picked.

      Parameters

      • dimension: Dimension

        The dimension.

      • value: number

        Its value, in the dimension's unit.

      Returns number

      The value.

    • One read model on a named axis, given or picked whole, with its read figures, the figures and the model's name recorded.

      A given model is checked against the models' names. Absent, one is drawn uniformly from them on the axis's own stream; with no seed either, it is the first, the producer's stated default. The figures are the picked model's, by dimension, for the producer to lay over its drawn dimensions. A variant with no models on the axis has none: the name is undefined, the figures empty, and a model given is refused. A dependent axis, such as a door that must stay below the car it serves, passes only the models an earlier pick admits. A figure is the model's own, so an author who fixed that dimension is refused, never overridden in silence: the author names the model instead. A dimension the model lacks stays the producer's to draw from its band.

      Type Parameters

      • Name extends string

      Parameters

      • axis: string

        The axis's name, which keys the stream, names refusals and keys the record: model for a producer with one axis.

      • value: Name | undefined

        The model given, or undefined to pick one.

      • models:
            | Readonly<
                Partial<Record<Name, Readonly<Partial<Record<Dimension, number>>>>>,
            >
            | undefined

        The variant's models on the axis by name, each with its read figures, the default first; absent or empty when it has none.

      Returns ArchetypeDrawSession.IModel<Name, Dimension>

      The model's name, undefined when the variant has none on the axis, and its figures.

      When a given model is not one of the variant's, or the variant has none, or a fixed dimension is one of the model's figures.