Theoretical analysis of coherent passive and self mode-locking in lasers