  Let $J\subset I$ be monomial ideals. We show that the Stanley depth of $I/J$
can be computed in a finite number of steps. We also introduce the $\fdepth$ of
a monomial ideal which is defined in terms of prime filtrations and show that
it can also be computed in a finite number of steps. In both cases it is shown
that these invariants can be determined by considering partitions of suitable
finite posets into intervals.
