Given the inviscid Burgers' equation with piecewise initial data $$ u_t + u u_x = 0,\qquad u(x,0) = \left\lbrace \begin{aligned} &0 && \text{if } x<-1 \\ &2 && \text{if } {-1}<x<0 \\ &4 && \text{if } {0}<x<1 \\ &2 && \text{if } 1\leq x<2 \\ &0 && \text{if } x\geq 2 \end{aligned}\right. $$
I want to find the exact solution of this problem represented in a single piecewise function.
Progress and Confusion
I know the Riemann problem has exact solution for rarefaction waves and shock waves respectively.
So for region $(-1,1)$ at $x=-1$ and $x=0$, characteristics separate, I will obtain the rarefaction waves and the solution will be in same form within different spatial region as following:
$$
u(x,t) = \left\lbrace
\begin{aligned}
&0 && \text{if } x<0 \\
&\frac{x}{t} && \text{if } {0}<x<2t \\
&2 && \text{if } x>2t \\
\end{aligned}\right.
,and\;\;\;
u(x,t) = \left\lbrace
\begin{aligned}
&2 && \text{if } x<2t \\
&\frac{x}{t} && \text{if } {2t}<x<4t \\
&4 && \text{if } x>4t \\
\end{aligned}\right.
$$
and the shock wave solution will occur in region (1,2) and also be in same form within different spatial region as following:
$$
u(x,t) = \left\lbrace
\begin{aligned}
&4 && \text{if } x<3t \\
&2 && \text{if } x>3t \\
\end{aligned}\right.
,and\;\;\;
u(x,t) = \left\lbrace
\begin{aligned}
&2 && \text{if } x<t \\
&0 && \text{if } x>t \\
\end{aligned}\right.
$$
Those different solution profiles have clearly overleaping in the spatial region, I am not sure what will happen in those overleaping area, and how could I condense them into a single piecewise function to represent the solution for entire region.
For the rarefaction waves case, according to the spatial region profile, I guess the first two rarefaction waves will merge together at first as following: $$ u(x,t) = \left\lbrace \begin{aligned} &0 && \text{if } x<0 \\ &\frac{x}{t} && \text{if } {0}<x<4t \\ &4 && \text{if } x>4t \\ \end{aligned}\right. $$ But for the two shocks, since the first shock is faster than second, the first shock seems to swallow up the second shock, and therefore only the first shock waves left: $$ u(x,t) = \left\lbrace \begin{aligned} &4 && \text{if } x<3t \\ &0 && \text{if } x>3t \end{aligned}\right. $$ Am I got correct in those intermediate state? And also, what will be the case when the rarefaction waves meet with the shock waves?