Class summary | |
---|---|
tree | |
tree-node |
Method summary | |
---|---|
add-node | tree node &key &allow-other-keys |
all-children | node &key key |
children | tree-node |
copy-object-content | (source tree-node) (destination tree-node) |
copy-object-content | (source tree) (destination tree) |
cut-node | tree node |
depth | node |
empty? | container |
find-node | tree node &key key test &allow-other-keys |
id | tree-node |
insert-node | tree node &optional parent |
leaf? | node |
leafs | tree |
make-s-dot | object &key &allow-other-keys |
nodes | tree |
parent | tree-node |
parents | node &key key |
replace-node | tree old-node new-node |
string-for-s-dot | object &key &allow-other-keys |
top | tree |
top? | node |
traverse | tree func &key &allow-other-keys |
Function summary | |
---|---|
mkdotstr | symbol |
A node is a very general object. When a class subclasses from a node all it means is that it can be maintained in a tree structure.
:id | [Initarg] |
:parent | [Initarg] |
:children | [Initarg] |
id | [Slot] |
Needed for drawing. You can overwrite them as long as each node has a unique ID.
Returns and (with setf) changes the children of the specified tree-node
Returns and (with setf) changes the parent of the specified tree-node
A basic tree keeping all the nodes and a reference to the top.
:nodes | [Initarg] |
:top | [Initarg] |
Traverses the tree and evaluates the function for every node. The key parameter from allows you to specify another start-node than the top of the tree. The traversal is depth-first.
Finds the node based on the given key and test in the tree. If not found returns nil.
Adds the given node to the tree. It can only allow adding under existing nodes. This means that the first element added has to be the top.
replaces the old-node by the new-node in the tree. It only works when old-node is a leaf.
Destructively cuts the node from the tree. Returns the tree if successful, nil if the top node is cut.
Returns the depth of a certain node (eg. the number of parent nodes to the top of the tree).
Traverses the branch of the given node upwards and returns these elements in a list (i.e. its parents). The first element will be the top (root).
Traverses the branch of the given node downwards and returns these elements in a list (i.e. all its children).
Should return a short string (one word) for the object so that it fits in a node for exporting to dot.
Should return a valid s-dot expression for the object. If in doubt use s-dot:check-syntax function.