private void retrieveWaypoints(SearchQuery query,ArrayList<Waypoint> waypoints){
  String queryLikeSelection2="%" + query.textQuery + "%";
  String[] waypointSelectionArgs=new String[]{queryLikeSelection2,queryLikeSelection2,queryLikeSelection2};
  Cursor cursor=null;
  try {
    cursor=providerUtils.getWaypointCursor(WAYPOINT_SELECTION_QUERY,waypointSelectionArgs,WAYPOINT_SELECTION_ORDER,MAX_SCORED_WAYPOINTS);
    if (cursor != null) {
      waypoints.ensureCapacity(cursor.getCount());
      while (cursor.moveToNext()) {
        Waypoint waypoint=providerUtils.createWaypoint(cursor);
        if (LocationUtils.isValidLocation(waypoint.getLocation())) {
          waypoints.add(waypoint);
        }
      }
    }
  }
  finally {
    if (cursor != null) {
      cursor.close();
    }
  }
}

private void retrieveWaypoints ( SearchQuery query , ArrayList < Waypoint > waypoints ) { String queryLikeSelection2 = "%" + query . textQuery + "%" ; String [ ] waypointSelectionArgs = new String [ ] { queryLikeSelection2 , queryLikeSelection2 , queryLikeSelection2 } ; Cursor cursor = null ; try { cursor = providerUtils . getWaypointCursor ( WAYPOINT_SELECTION_QUERY , waypointSelectionArgs , WAYPOINT_SELECTION_ORDER , MAX_SCORED_WAYPOINTS ) ; if ( cursor != null ) { waypoints . ensureCapacity ( cursor . getCount ( ) ) ; while ( cursor . moveToNext ( ) ) { Waypoint waypoint = providerUtils . createWaypoint ( cursor ) ; if ( LocationUtils . isValidLocation ( waypoint . getLocation ( ) ) ) { waypoints . add ( waypoint ) ; } } } } finally { if ( cursor != null ) { cursor . close ( ) ; } } }
retrieves waypoints matching the given query from the database .
