This function is used to set the number of bells that will be in the rows to be matched against. This provides a way for the algorithms to know when they are finished processing the expressions or row.
This function is used to add the supplied expression (
md), to the tree. The location in the expression to look at is supplied byi, thekeyis the reference number that themusicclass stores themdexpression against, and theposis the number of bells deep we are in the tree.Depending on the item in the expression at index
i, the algorithm will do different things, normally, it will call theadd_to_subtree(...)function which in turn will usually call this function again; sometimes it will call itself (in the case of a '*') to move along the current expression without necessarily adding it to a subtree. Hence, theadd(...)function is an iterative one.
This private function is used to create a branch (if required) and add an expression to a branch of a node. If it cannot allocate memory for the new node, it will either throw a
memory_errorexception (if enabled), or it will simply return without going any further.The
placeparameter provides the branch number (= bell) to create and add to, theprocess_starparameter is used to indicate if the number of *s remaining should be processed or ignored. The rest of the parameters are as for theadd(...)function.
This function is iterative and is used to match the expressions stored to a row,
r. If a node is found to have an expression ending there, the number of counts for that expression are incremented according to the specifiedstroke. Theposparameter is used to specify the current position in the rowr, and theresultsparameter is the expressions for which the indexes have previously been stored, and against which the count should be incremented as appropriate.