import { Edit } from "../model/Edit.js"; import { HorizontalSpan } from "../model/Feature.js"; import { AnySymbol } from "../model/Symbol.js"; import { Millimeters } from "../model/Quantity.js"; /** * A value taken at each end of a feature: where it begins and where it stops. * @category Collation and alignment */ export interface BothEnds { from: T; to: T; } /** * How far one text puts a feature from where another puts it, at either end. * @category Collation and alignment */ export type Displacement = BothEnds; /** * The window two readings of one feature must fall in to be collated: * how far apart they may lie at either end, and where that window is * centred. * * The centre is worth stating. Two copies of one roll differ by a * systematic offset as well as by scatter, and a window centred on * nothing has to be widened by the whole of that offset before it * admits what the offset alone displaces. Naming the offset lets the * tolerance stand for the scatter only. A window that names none is * centred on nothing, which is what every window written before the * offset was held here means. * @category Format types */ export interface CollationTolerance { /** How far the two readings may lie apart at the start of a feature, measured from `offsetStart`. */ toleranceStart: Millimeters; /** How far they may lie apart at the end, measured from `offsetEnd`. */ toleranceEnd: Millimeters; /** * How much later the derived version puts the start of a feature * than the version it is read against, where the two differ * systematically. Nothing where they do not. * * The direction is the one a collation measures in, the child less * the parent, and it is not symmetric: stored the other way round * the window sits on the wrong side of the readings and merges what * it should separate. A measurement taken over the parent's copies * gives the negative of this, which is what `toleranceAcross` asks * the side for. */ offsetStart?: Millimeters; /** The same at the end of a feature, in the same direction. */ offsetEnd?: Millimeters; } /** * The window a derivation that states none is collated at: five * millimetres at either end, centred on nothing. * @category Collation and alignment */ export declare const defaultCollationTolerance: CollationTolerance; /** * Where the window is centred at the start of a feature, on nothing where it names no offset. * @category Collation and alignment */ export declare const offsetStartOf: (tolerance: CollationTolerance) => Millimeters; /** * Where the window is centred at the end of a feature. * @category Collation and alignment */ export declare const offsetEndOf: (tolerance: CollationTolerance) => Millimeters; /** * Whether the window admits the displacement at each end, taken apart. * * The two ends answer different questions. The onset, with the kind, * decides identity: whether the two copies read one command. The end * decides duration: whether the same command was lengthened or * shortened. A collation joins two readings only where both admit, so a * separation may be the work of either, and an editor looking at one * wants to know which. * * A difference at the end alone has at least three causes and only the * first is an editorial act. A punch may genuinely have been lengthened * or shortened. A chain of punches, bridged to keep the paper strong, * may have been read as one perforation on one copy and as repeated * notes on the other, which Phillips names as a common error of roll * scanning and which runs in both directions (p. 173). Or a reading may * report something other than the punched slot, as a pneumatic reader * reports how long a valve stayed open. Long held notes are where the * second is likeliest, since that is where the chains are. * @category Collation and alignment */ export declare const admittedAtEnds: (tolerance: CollationTolerance, displacement: Displacement) => BothEnds; /** * Whether the window admits the displacement: within the tolerance of the offset, at both ends. * @category Collation and alignment */ export declare const admits: (tolerance: CollationTolerance, displacement: Displacement) => boolean; /** * Where a symbol lies along the roll, as its carriers put it, or nothing for a symbol without a place. * @category Collation and alignment */ export type Locate = (symbol: AnySymbol) => Readonly | undefined; /** * Two symbols collate when they are of one kind, say the same thing * (pitch, or expression type and scope), and lie at about the same * place along the roll. * @category Collation and alignment */ export declare const isCollatable: (a: AnySymbol, b: AnySymbol, locate: Locate, tolerance?: CollationTolerance) => boolean; /** * One of a version's own symbols together with an inherited symbol it * collates with, as `collationsOf` pairs them. * @category Collation and alignment */ export type Collation = { symbol: Readonly; counterpart: Readonly; }; /** * Each of the own symbols with every inherited symbol it collates with, both in the order given. * @category Collation and alignment */ export declare const collationsOf: (own: readonly Readonly[], inherited: readonly Readonly[], locate: Locate, tolerance?: CollationTolerance) => Collation[]; /** * Whether the edit is the program's: one that a collation or a proposal * wrote and nobody has explained, so that collating again or proposing * the edits again may write it anew. It carries no belief and names no * motivation of the editor's: only the kind of change it is, the generic * musical or technical one a program states (`musicalChange`, * `technicalChange`), or none. * * Everything else is the editor's and stays: an edit that says why it * was made, or that is held under a belief. A grouping of the editor's stays theirs once it says * why; one that says nothing reads as the program's would. * * An exchange a collation draws again over the very same symbols is * kept as it stands, with its identifier and whatever was written on * it (`connectVersions`). * @category Collation and alignment */ export declare const isCollationsOwn: (edit: Readonly) => boolean;