def _select_index(self, row, col):
nr, nc = self._size<EOL>nr = nr-<NUM_LIT:1><EOL>nc = nc-<NUM_LIT:1><EOL>if (row > nr and col >= nc) or (row >= nr and col > nc):<EOL><INDENT>self._select_index(<NUM_LIT:0>, <NUM_LIT:0>)<EOL><DEDENT>elif (row <= <NUM_LIT:0> and col < <NUM_LIT:0>) or  (row < <NUM_LIT:0> and col <= <NUM_LIT:0>):<EOL><INDENT>self._select_index(nr, nc)<EOL><DEDENT>elif row > nr :<EOL><INDENT>self._select_index(<NUM_LIT:0>, col+<NUM_LIT:1>)<EOL><DEDENT>elif row < <NUM_LIT:0> :<EOL><INDENT>self._select_index(nr, col-<NUM_LIT:1>)<EOL><DEDENT>elif col > nc :<EOL><INDENT>self._select_index(row+<NUM_LIT:1>, <NUM_LIT:0>)<EOL><DEDENT>elif col < <NUM_LIT:0> :<EOL><INDENT>self._select_index(row-<NUM_LIT:1>, nc)<EOL><DEDENT>elif <NUM_LIT:0> <= row and row <= nr and <NUM_LIT:0> <= col and col <= nc :<EOL><INDENT>self._index = (row, col)<EOL><DEDENT>else :<EOL><INDENT>raise NotImplementedError("<STR_LIT>"%(row, col, nr, nc) )<EOL><DEDENT>
Change the selection index, and make sure it stays in the right range

        A little more complicated than just dooing modulo the number of row columns
        to be sure to cycle through all element.

        horizontaly, the element are maped like this :
        to r <-- a b c d e f --> to g
        to f <-- g h i j k l --> to m
        to l <-- m n o p q r --> to a

        and vertically
        a d g j m p
        b e h k n q
        c f i l o r