Relationship between X-shaped radio sources and double-double radio galaxies