PdfNumberTree Class

Definition

A number tree: a sorted map from integer keys to objects, spread over a tree of node dictionaries. A live view.

[SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "The name is the ISO 32000-2 term (§7.9.7).")]
public sealed class PdfNumberTree : IEnumerable<KeyValuePair<int, CosObject>>, IEnumerable

Remarks

ISO 32000-2 §7.9.7, Table 37 (PDF 1.3). Like PdfNameTree with integer keys in ascending numerical order, held in Nums arrays. Keys are 32-bit integers. Lookups are guided by each node's Limits; TryGetFloor(Int32, out Int32, out CosObject) and enumeration read the whole tree. Values come back resolved one level.

Damage is read leniently, as for PdfNameTree: each deviation is reported once per node when it is first read (in strict mode the lookup or enumeration that meets it throws), lookups fall back to an index of every key built once, and a key that appears twice resolves to its first occurrence in tree order. A key written as a real with an integral value is used as that integer, with a diagnostic; any other non-integer key is skipped.

Editable in place (issue #146): Set(Int32, CosObject) inserts or replaces a key and Remove(Int32) removes one, changing only the nodes on the way from the root to the key's leaf and keeping every Limits entry correct; see CreateNumberTree(IEnumerable<KeyValuePair<Int32, CosObject>>) for building a new tree. A damaged tree is rebuilt balanced on its first edit.

Safe for concurrent reads while nobody changes the document; edits are single-threaded, like every change to a document.

Tip: use kind:method, kind:property, kind:ctor. Press Esc to clear.

Properties (2)

Methods (6)

Explicit Interface Implementation Methods (1)