merge three switch case into one