static SquareNode pickNot ( SquareNode target , SquareNode child0 , SquareNode child1 ) { for ( int i = 0 ; i < 4 ; i ++ ) { SquareEdge e = target . edges [ i ] ; if ( e == null ) continue ; SquareNode c = e . destination ( target ) ; if ( c != child0 && c != child1 ) return c ; } throw new RuntimeException ( "There was no odd one out some how" ) ; }
There are only three edges on target and two of them are known . Pick the one which isn t an inptu child