Compare commits

...

3 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 82a9978b4b README
- Updated docs
2024-05-04 10:50:10 +02:00
Tristan B. Velloza Kildaire f1c46316a9 Graph (unittests)
- Added test for `opDollar()`
2024-05-04 10:49:00 +02:00
Tristan B. Velloza Kildaire 1ebed93db7 Graph
- Implemented `getValue()`

Graph (unittests)

- Added tests for `getValue()`
2024-05-04 10:48:10 +02:00
2 changed files with 18 additions and 1 deletions

View File

@ -39,7 +39,7 @@ is expected to grow over time.
* Some textual manipulation routines as well
* `niknaks.containers`
* Some useful container types
* Things such as `CacheMap`
* Things such as `CacheMap`, `Graph` and `VisitationTree`
* `niknaks.mechanisms`
* User-defined input prompter, retry mechanisms
* `niknaks.config`

View File

@ -764,6 +764,17 @@ public class Graph(T)
this.value = value;
}
/**
* Obtains the value associated with
* this graph node
*
* Returns: the value `T`
*/
public T getValue()
{
return this.value;
}
/**
* Appends another graph node
* to the array of children
@ -1054,6 +1065,12 @@ unittest
assert(treeOfStrings.opIndex!(Graph!(string))(1) == subtree_2);
assert(treeOfStrings.opIndex!(Graph!(string))(2) == subtree_3);
assert(treeOfStrings[0] == subtree_1.getValue());
assert(treeOfStrings[1] == subtree_2.getValue());
assert(treeOfStrings[2] == subtree_3.getValue());
assert(treeOfStrings.opDollar() == 3);
InclusionStratergy!(string) strat = toDelegate(&Always!(string));
TouchStratergy!(string) touch = toDelegate(&DebugTouch!(string));