State pattern sample