The Design of Electron and Ion Guns, Beams, and Collectors