It's not exclusive to those categories.
If you're military or a diplomat, that counts toward your 5 years, even if that time was spent outside the US.
Any one born outside the United States, if one parent is an alien and as long as the other parent is a citizen of the U.S. who lived in the U.S. for at least five years
See?
ok