proposit-core
    Preparing search index...

    Class VariableManager<TVar>

    Registry for propositional variables within an argument, shared across all premises.

    Enforces uniqueness of both variable IDs and symbols. This class is an internal building block owned by ArgumentEngine and passed by reference to each PremiseEngine. It is not part of the public API.

    Type Parameters

    Index

    Constructors

    • Type Parameters

      • TVar extends
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            } =
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            }

      Parameters

      Returns VariableManager<TVar>

    Methods

    • Returns the variable with the given symbol, or undefined if not found.

      Parameters

      • symbol: string

      Returns TVar | undefined

    • Returns true if a variable with the given ID is registered.

      Parameters

      • variableId: string

      Returns boolean

    • Removes a variable by ID.

      Parameters

      • variableId: string

      Returns TVar | undefined

      The removed variable, or undefined if not found.

    • Changes the symbol of an existing variable.

      Parameters

      • variableId: string
      • newSymbol: string

      Returns void

      If the variable does not exist.

      If the new symbol is already in use by a different variable.

    • Updates fields on an existing variable. Handles symbol updates via the symbol index; all other provided fields are spread onto the stored variable.

      Parameters

      • variableId: string
      • updates: Partial<TVar>

      Returns TVar | undefined

      The updated variable, or undefined if not found.

      If the new symbol is already in use by a different variable.

    • Creates a new VariableManager from a previously captured snapshot.

      Type Parameters

      • TVar extends
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            } =
            | {
                argumentId: string;
                argumentVersion: number;
                checksum: string;
                claimId: string;
                claimVersion: number;
                id: string;
                symbol: string;
            }
            | {
                argumentId: string;
                argumentVersion: number;
                boundArgumentId: string;
                boundArgumentVersion: number;
                boundPremiseId: string;
                checksum: string;
                id: string;
                symbol: string;
            }

      Parameters

      Returns VariableManager<TVar>