Spin waves, vortices, and the structure of equilibrium states in the classicalXY model