TimelineIdGenerator

TimelineIdGenerator(_counters=dict(), _id_to_meta=dict())

Generates systematic timeline IDs based on type.

Timeline IDs follow the pattern {prefix}{N} where prefix encodes the timeline type (domain + continuity) and N is a 1-indexed counter scoped to this generator instance.

When a role is specified, the ID becomes {role}:{prefix}{N} (e.g., score:clt1, perf:dlt3).

The counter N is scoped per prefix per generator. Each generator instance maintains its own counter state, so different loaders do not interfere with each other.

Attributes: _counters: Per-prefix counter state. _id_to_meta: Maps generated IDs to metadata dicts for lookup.

Examples: >>> gen = TimelineIdGenerator() >>> gen.next_id(“ContinuousLogicalTimeline”) ‘clt1’ >>> gen.next_id(“ContinuousLogicalTimeline”) ‘clt2’ >>> gen.next_id(“DiscreteLogicalTimeline”) ‘dlt1’ >>> gen.next_id_with_role(“DiscreteLogicalTimeline”, “perf”) ‘perf:dlt2’

Attributes

Name Description
count Total number of IDs generated.

Methods

Name Description
get_meta Retrieve metadata associated with a generated ID.
next_id Generate the next ID for a given timeline type.
next_id_with_role Generate the next ID with a role prefix.
reset Reset all counters and metadata.

get_meta

TimelineIdGenerator.get_meta(timeline_id)

Retrieve metadata associated with a generated ID.

Args: timeline_id: A previously generated timeline ID.

Returns: The metadata dict, or None if no metadata was stored.

next_id

TimelineIdGenerator.next_id(timeline_type, *, meta=None)

Generate the next ID for a given timeline type.

Args: timeline_type: A timeline class or class name string. meta: Optional metadata to associate with this ID.

Returns: An ID like clt1, dlt2, etc.

next_id_with_role

TimelineIdGenerator.next_id_with_role(timeline_type, role, *, meta=None)

Generate the next ID with a role prefix.

The role is prepended as {role}:{prefix}{N}.

Args: timeline_type: A timeline class or class name string. role: The role prefix (e.g., ‘score’, ‘perf’). meta: Optional metadata to associate with this ID.

Returns: An ID like score:clt1, perf:dlt3.

reset

TimelineIdGenerator.reset()

Reset all counters and metadata.