Consider the initial-value problem for Burgers' Equation $$\left\{ \begin{array}{ll} u_{t} + (\frac{u^{2}}{2})_{x}=0 & \mathbb{R} \times (0, \infty) \\ u=g & \text{on } \mathbb{R} \times {t=0} \end{array} \right.$$
with initial data $$g(x)= \begin{cases} 1, & x\leq 0 ,\\ 1-x, & 0\leq x \leq 1 ,\\ 0, & x \geq 1.\end{cases}$$
This is an example out of Evans PDE Text (Ex. 1 p. 139) and I am trying to understand how we can find $u(x,t)$ from here, it just says in the book and thus $$u(x,t) = \begin{cases} 1, & x\leq t ,\\ \tfrac{1-x}{1-t}, & t \leq x \leq 1,\\ 0, & x \geq 1.\end{cases} \quad (0 \leq t \leq 1)$$
What is the general way to write down this form for $u(x,t)$? How does the author find $u(x,t)$ for this problem? The book omits any details.