Package com.aelitis.azureus.core.metasearch

Examples of com.aelitis.azureus.core.metasearch.Result


  mapResults(
    Result[]  results )
  {
    for (int i=0;i<results.length;i++){
     
      Result result = results[i];
     
      for (int j=0;j<first_level_mapping.size();j++){
       
        FieldRemapper mapper = (FieldRemapper)first_level_mapping.get(j);
       
View Full Code Here


  }
 
  public Result[] filter(Result[] results) {
    List<Result> filteredResults = new ArrayList<Result>(results.length);
    for(int i = 0 ; i < results.length ; i++) {
      Result result = results[i];
     
      String name = result.getName();
      //Results need a name, or they are by default invalid
      if(name == null) {
        continue;
      }
      name = name.toLowerCase();
     
      boolean valid = true;
      for(int j = 0 ; j < textFilters.length ; j++) {
       
        //If one of the text filters do not match, let's not keep testing the others
        // and mark the result as not valid
        if(name.indexOf(textFilters[j]) == -1) {
         
            // double check against reg-expr if exists
         
          Pattern p = textFilterPatterns[j];
         
          if ( p == null  || !p.matcher( name ).find()){
         
            valid = false;
         
            break;
          }
        }
      }
     
      //if invalid after name check, let's get to the next result
      if(!valid) {
        continue;
      }
     
      for(int j = 0 ; j < excludeTextFilters.length ; j++) {
       
        //If one of the text filters do not match, let's not keep testing the others
        // and mark the result as not valid
        if(name.indexOf(excludeTextFilters[j]) != -1) {
          valid = false;
          break;
        }else{
          Pattern p = excludeTextFilterPatterns[j];
         
          if ( p != null  && p.matcher( name ).find()){
            valid = false;
            break;
          }
        }
      }
     
      //if invalid after name check, let's get to the next result
      if(!valid) {
        continue;
      }
     
      long size = result.getSize();
     
      if(minSize > -1) {
        if(minSize > size) {
          continue;
        }
      }
     
      if(maxSize > -1) {
        if(maxSize < size) {
          continue;
        }
      }
     
      if(minSeeds > -1) {
        if(minSeeds < result.getNbSeeds()) {
          continue;
        }
      }
     
      if(categoryFilter != null) {
        String category = result.getCategory();
        if(category == null || !category.equalsIgnoreCase(categoryFilter)) {
          continue;
        }
      }
     
View Full Code Here

TOP

Related Classes of com.aelitis.azureus.core.metasearch.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.