code: public Coordinate snap(Coordinate coordinate, double distance) {
  		// Some initialization:
  		calculatedDistance = distance;
  		hasSnapped = false;
  		Coordinate snappingPoint = coordinate;
  
  		// Go over all geometries and consider only the intersecting ones:
  		for (Geometry geometry : geometries) {
  			if (MathService.isWithin(geometry, coordinate)) {
  				NearestVertexSnapAlgorithm nearestVertex = new NearestVertexSnapAlgorithm();
  				nearestVertex.setGeometries(new Geometry[] { geometry });
  				Coordinate temp = nearestVertex.snap(coordinate, calculatedDistance);
  				if (nearestVertex.hasSnapped()) {
  					hasSnapped = true;
  					calculatedDistance = nearestVertex.getCalculatedDistance();
  					snappingPoint = temp;
  				}
  			}
  		}
  
  		return snappingPoint;
  	}
docs: Execute the snap operation.
  
  @param coordinate The original location.
  @param distance   The maximum distance allowed for snapping.
  @return The new location. If no snapping target was found, this may return the original location.