How to implement N-Opt in Genetic Algorithm To Solve the Travelesman Problem?

Hi Guys,
How to implement N-Opt in Genetic Algorithm To Solve the Travelesman Problem?

Im trying to implement 2-opt in a GA algorithm, but im confused in how-to…
Should i implement it in the mutate() method or mate() method?

https://bitbucket.org/dermetfan/tsm-ga-solver/src/73f2a35bf2e036bdcca03bef4340eeb683dc620e/core/src/main/net/nexusteam/tsmGaSolver/ann/TSPGeneticAlgorithm.java?at=default

https://bitbucket.org/dermetfan/tsm-ga-solver/src/73f2a35bf2e036bdcca03bef4340eeb683dc620e/core/src/main/net/nexusteam/tsmGaSolver/ann/TSPChromosome.java?at=default

//

https://bitbucket.org/dermetfan/tsm-ga-solver/src/73f2a35bf2e036bdcca03bef4340eeb683dc620e/core/src/main/net/JeffHeatonCode/GeneticAlgorithm.java?at=default

https://bitbucket.org/dermetfan/tsm-ga-solver/src/73f2a35bf2e036bdcca03bef4340eeb683dc620e/core/src/main/net/JeffHeatonCode/Chromosome.java?at=default

I know in theory how 2-opt should WORK :

Example :
For 4 Cities A,B,C,D

A B
C D

A–> D -->C -->B

Their connections form concorrent lines…
The method should be capable to Transform that into either these :

A–>B–>D–>C
or
A–>C–>D–>B

The one with less cost obviously.

Im not getting how to do it.
I know how to identify if a line intersects other by using

f(x) = mx + b
Or is there any other way i should do it?