use case-clause as partial function.
add condition for PartialFunction apply.