HereditaryStratumOrderedStoreList

class HereditaryStratumOrderedStoreList

Interchangeable backing container for HereditaryStratigraphicColumn.

Stores deposited strata using a list implementation. Retained strata are stored from most ancient (index 0, front) to most recent (back). Cloned stores instantiate an independent list (although strata are not deepcopied themselves).

Potentially useful in scenarios where moderate strata counts are retained, many strata are deposited without column cloning, deleted strata tend to be more recent (i.e., not more ancient and toward the front of the list), or many comparisons to estimate most recent common ancestor are made between stratigraphic columns.

__init__()[source]

Initialize instance variables.

Methods

Clone() HereditaryStratumOrderedStoreList[source]

Create an independent copy of the store.

Returned copy contains identical data but may be freely altered without affecting data within this store.

DelRanks(ranks: Iterator[int], get_column_index_of_rank: Callable | None = None) None[source]

Purge strata with specified deposition ranks from the store.

Parameters

ranksiterator over int

The ranks that are to be deleted.

get_column_index_of_rankcallable, optional

Callable that returns the deposition rank of the stratum positioned at index i among retained strata.

DepositStratum(rank: int | None, stratum: HereditaryStratum) None[source]

Insert a new stratum into the store.

Parameters

ranktyping.Optional[int]

The position of the stratum being deposited within the sequence of strata deposited into the column. Precisely, the number of strata that have been deposited before stratum.

stratumHereditaryStratum

The stratum to deposit.

GetColumnIndexOfRank(rank: int) int | None[source]

Map from column position to deposition generation

What is the index position within retained strata of the stratum deposited at rank r? Returns None if no stratum with rank r is present within the store.

GetNumStrataRetained() int[source]

How many strata are present in the store?

May be fewer than the number of strata deposited if deletions have occured.

GetRankAtColumnIndex(index: int) int[source]

Map from deposition generation to column position.

What is the deposition rank of the stratum positioned at index i among retained strata? Index order is from most ancient (index 0) to most recent.

GetStratumAtColumnIndex(index: int, get_rank_at_column_index: Callable | None = None) HereditaryStratum[source]

Get the stratum positioned at index i among retained strata.

Index order is from most ancient (index 0) to most recent.

Parameters

ranksiterator over int

The ranks that are to be deleted.

get_column_index_of_rankcallable, optional

Callable that returns the index position within retained strata of the stratum deposited at rank r.

IterRankDifferentiaZip(get_rank_at_column_index: Callable | None = None, start_column_index: int = 0) Iterator[Tuple[int, int]][source]

Iterate over differentia and corresponding deposition ranks.

Values yielded as tuples. Guaranteed ordered from most ancient to most recent.

Parameters

get_rank_at_column_indexcallable, optional

Callable that returns the deposition rank of the stratum positioned at index i among retained strata.

start_column_indexcallable, optional

Number of strata to skip over before yielding first result from the iterator. Default 0, meaning no strata are skipped over.

IterRetainedRanks() Iterator[int][source]

Iterate over deposition ranks of strata present in the store from most ancient to most recent.

The store may be altered during iteration without iterator invalidation, although subsequent updates will not be reflected in the iterator.

IterRetainedStrata() Iterator[HereditaryStratum][source]

Iterate over stored strata from most ancient to most recent.

__init__()[source]

Initialize instance variables.