70 snprintf(keyname, 256,
"OCCURRENCES COUNT IN %p : ", (
CTree*)root);
81 for (
int i=0; i<t->
arity(); i++) {
Symbol * unique(const char *str)
Returns a new unique symbol of name strxxx.
void countOccurrences(Tree t)
Increment the occurrences count of t and its subtrees.
void setCount(Tree t, int c)
Set the number of occurrences of t.
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const Node & node() const
return the content of the tree
Tree specificKey(Tree root)
Creates a specific property key for occurrences count in root.
int arity() const
return the number of branches (subtrees) of a tree
void setProperty(Tree t, Tree key, Tree val)
int getCount(Tree t)
Get the number of occurrences of t.
Occurrences(Tree root)
Count the number of occurrences of each subtree of root.
Tree branch(int i) const
return the ith branch (subtree) of a tree
bool getProperty(Tree t, Tree key, Tree &val)