struct Novika::EachRelativeFetch(T)

Overview

Executes a fetcher callback on every visited vertex in the block graph starting from an entrypoint block, until the callback returns T, or until there are no more blocks to explore.

The quintessence of Novika, when looking up a single entry takes a 70+ LoC object and a bunch of heap. Don't worry though; this is the heavy artillery and it is not reached during simple lookup cases (and most of Novika code consists of such simple cases).

What is done here is a weird combination of DFS and BFS that also tracks everything so as to not follow cyclic references forever. All this complexity arose for historical reasons (a bunch of random decisions, really) and simply for (the user's!) convenience.

Parent-based lookup is a DFS under the hood, and friends lookup is BFS-ish. And then all this recurses, and voilá! Don't break your neck if you do choose to leap!

Defined in:

novika/forms/block.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(fetcher : Block -> T | Nil, marked : BlockIdMap, history : Block | Nil = nil) #

Instance Method Detail

def on(entrypoint : Block, ignore : Nil) : T | Nil #

Executes the fetcher callback on every visited vertex in the block graph starting from an entrypoint block, and until the callback returns T, or until exhausted all reachable vertices.


def on(entrypoint : Block, ignore : PIlist) : T | Nil #

Same as #on(entrypoint : Block, ignore : Nil), the difference being that immediately adjacent block ignore list is taken into account.

Note that entrypoint is also ignored even though it is not specified in the ignore list.