foresttest

package
v0.0.0-...-44dad58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(desc string) *forest.Forest

Create creates a forest with len(desc) namespaces, consecutively named a, b, etc. Each entry in the string defines both who the parent of the respective namespace is, as well as whether it's a subnamespace as well: * If the string element is a hyphen ('-'), the namespace is a root. * If the string element is a lowercase letter, the referenced namespace is a normal parent.

  • If the referenced namespace is not in len(desc), it will not exist and we'll set ParentMissing on the child.

* If the string element is an uppercase letter, that namespaces will be the parent and the *current* namespace will be a subnamespace.

Examples:

  • "-" -> creates a single namespace "a" that is a root
  • "-a" -> creates the tree a <- b
  • "-A" -> creates the tree a <- b where b is a subnamespace of a
  • "z" -> creates the tree z <- a where z does not exist and a has ParentMissing
  • "-aa" -> creates namespace `a` with two children, `b` and `c`
  • "-aA" -> as above, but c is a subnamespace and b is a full namespace
  • "ba" -> creates a cycle
  • "-aa-dd" -> creates two trees, one with root `a` and children `b` and `c`, the other with root `d` and children `e` and `f`

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL