protected boolean checkPreconditions ( List < SquareNode > cluster ) { for ( int i = 0 ; i < cluster . size ( ) ; i ++ ) { SquareNode n = cluster . get ( i ) ; for ( int j = 0 ; j < n . square . size ( ) ; j ++ ) { SquareEdge e0 = n . edges [ j ] ; if ( e0 == null ) continue ; for ( int k = j + 1 ; k < n . square . size ( ) ; k ++ ) { SquareEdge e1 = n . edges [ k ] ; if ( e1 == null ) continue ; if ( e0 . destination ( n ) == e1 . destination ( n ) ) { return false ; } } } } return true ; }
Checks basic preconditions . 1 ) No node may be linked two more than once