The master equation theory of precompound and compound nuclear reactions has been generalized to include the conservation of angular momentum and parity. Based on this improved semi-classical theory, the UNF code has been developed as a tool for calculating nucleon-induced reaction cross sections and double-differential cross sections at incident neutron energies below 20 MeV. It is demonstrated that the code contains the Hauser-Feshbach model and the exciton models as the limiting cases. The unified treatment of equilibrium and pre-equilibrium reaction processes includes the introduction of composite particle formation factors in calculations of pickup-type composite particle emissions. A method to calculate the double-differential cross sections for all kinds of particles is proposed based on the leading particle model.