public static double distanceToNearestPoint ( Point point , Front front , PointDistance distance ) { if ( front == null ) { throw new NullFrontException ( ) ; } else if ( front . getNumberOfPoints ( ) == 0 ) { throw new EmptyFrontException ( ) ; } else if ( point == null ) { throw new JMetalException ( "The point is null" ) ; } double minDistance = Double . MAX_VALUE ; for ( int i = 0 ; i < front . getNumberOfPoints ( ) ; i ++ ) { double aux = distance . compute ( point , front . getPoint ( i ) ) ; if ( ( aux < minDistance ) && ( aux > 0.0 ) ) { minDistance = aux ; } } return minDistance ; }
Gets the distance between a point and the nearest one in a front . If a distance equals to 0 is found that means that the point is in the front so it is excluded