Fleet
0.0.9
Inference in the LOT
|
#include <BaseNode.h>
Classes | |
class | NodeIterator |
Public Member Functions | |
BaseNode (size_t n=0, this_t *p=nullptr, size_t i=0) | |
Constructor of basenode – sizes children to n. More... | |
BaseNode (const this_t &n) | |
BaseNode (this_t &&n) | |
void | operator= (const this_t &t) |
void | operator= (const this_t &&t) |
void | make_root () |
Make a node root – just nulls the parent. More... | |
virtual | ~BaseNode () |
virtual std::string | string (bool usedot=true) const |
virtual std::string | my_string () const |
virtual bool | operator== (const this_t &n) const |
NodeIterator | begin () const |
NodeIterator | end () const |
virtual bool | operator!= (const this_t &n) const |
void | reserve_children (const size_t n) |
decltype(children) & | get_children () |
decltype(children) const & | get_children () const |
this_t & | child (const size_t i) |
const this_t & | child (const size_t i) const |
template<typename... Args> | |
void | fill (size_t n, Args... args) |
size_t | nchildren () const |
this_t * | left_descend () const |
size_t | depth () const |
void | fix_child_info () |
void | check_child_info () const |
this_t & | operator[] (const size_t i) |
const this_t & | operator[] (const size_t i) const |
void | set_child (const size_t i, this_t &n) |
void | set_child (const size_t i, this_t &&n) |
void | push_back (this_t &n) |
void | push_back (this_t &&n) |
virtual bool | is_root () const |
Am I a root node? I am if my parent is nullptr. More... | |
this_t * | root () |
Find the root of this node by walking up the tree. More... | |
this_t * | get_via (std::function< bool(this_t &)> &f) |
Return a pointer to the first node satisfying predicate f, in standard traversal; nullptr otherwise. More... | |
virtual size_t | count () const |
How many nodes total are below me? More... | |
virtual size_t | count (const this_t &n) const |
How many nodes below me are equal to n? More... | |
virtual bool | is_terminal () const |
Am I a terminal? I am if I have no children. More... | |
virtual size_t | count_terminals () const |
virtual this_t * | get_nth (int n, std::function< int(const this_t &)> &f) |
virtual this_t * | get_nth (int n) |
template<typename T > | |
T | sum (std::function< T(const this_t &)> &f) const |
template<typename T > | |
T | sum (T(*f)(const this_t &)) const |
bool | all (std::function< bool(const this_t &)> &f) const |
void | map (const std::function< void(this_t &)> &f) |
void | show (size_t t=0) const |
Public Attributes | |
this_t * | parent |
size_t | pi |
Static Public Attributes | |
static NodeIterator | EndNodeIterator = NodeIterator(nullptr) |
Protected Attributes | |
std::vector< this_t > | children |
|
inline |
Constructor of basenode – sizes children to n.
n | |
p | |
i |
|
inline |
Check if f is true of me and every node below
f |
|
inline |
|
inline |
assert that all of the child info is correct
|
inline |
Get a reference to my i'th child
i |
|
inline |
|
inlinevirtual |
How many nodes total are below me?
n |
|
inlinevirtual |
How many nodes below me are equal to n?
n |
|
inlinevirtual |
How many terminals are below me?
|
inline |
|
inline |
|
inline |
Fill in all of my immediate children with Null nodes (via NullRule)
|
inline |
Fix my immediate children's pointers to ensure that children's parent pointers and indices are correct.
|
inline |
|
inlinevirtual |
Return a pointer to the n'th child satisfying f (f's output is cast to bool)
n | |
f |
|
inlinevirtual |
|
inline |
Return a pointer to the first node satisfying predicate f, in standard traversal; nullptr otherwise.
f |
|
inlinevirtual |
Am I a root node? I am if my parent is nullptr.
|
inlinevirtual |
Am I a terminal? I am if I have no children.
|
inline |
Go down a tree and find the leftmost child
|
inline |
Make a node root – just nulls the parent.
|
inline |
Apply f to me and everything below.
f |
|
inlinevirtual |
just print myself, not all my kids (single row per node display)
Reimplemented in BindingTree.
|
inline |
How many children do I have?
|
inlinevirtual |
|
inline |
|
inline |
|
inlinevirtual |
Reimplemented in Node.
|
inline |
Index my i'th child
i |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Find the root of this node by walking up the tree.
|
inline |
Set my child to n. NOTE: This one needs to be used, rather than accessing children directly, because we have to set parent pointers and indices.
i | |
n |
|
inline |
Child setter for move
i |
|
inline |
|
inlinevirtual |
Reimplemented in Node, and BindingTree.
|
inline |
Apply f to me and everything below me, adding up the result.
f |
|
inline |
|
protected |
|
static |
this_t* BaseNode< this_t >::parent |
size_t BaseNode< this_t >::pi |