How to best program this function with cases?

I use it for separating components of complex models. For example: