Package

Source Code of SearchEngine


import java.sql.ResultSet;
import java.util.ArrayList;

import Infrastructure.DAO;

public class SearchEngine {

  public native void print();
 
  public native double imageCompareResult(String Source);
  public native int imageHistCompare(String upload,String store);
  /**
   * @param args
   */
  public static void main(String[] args){ 
 
  /*try
   {
     SearchEngine obj= new SearchEngine();
     double meanValue=obj.imageCompareResult("E:\\images\\title.jpg");
         System.out.println("The Mean Value of Histogram of Image: "+meanValue+"\n");
         DAO d= new DAO();
         System.out.println("The Simialr Image Location on WWW found are: \n");
         d.getEmployees(meanValue);
   }catch(Exception ex)
   {
    
   }*/
    SearchEngine obj= new SearchEngine();
        obj.HistCompare("E:\\upload\\b-b-new.jpg", "E:\\source");
   
  }
 
 
 
  public  ArrayList<String> HistCompare(String upload,String store){
   
    int count=0;
    int n=0;
    ArrayList<String> listOfLinks=new ArrayList<String>();
    DAO d= new DAO();
    ResultSet rs=null;
    do{
      n=0;
      rs=d.getImages(count);
     
      try{
        
           while(rs.next()) {
                   n=1;
                   String ImageName = rs.getString("ImageName");
                   String ImageUrl =rs.getString("ImageUrl");
                   String ImageLocation=  store+"\\"+ImageName;
                 String extension=ImageName.substring(ImageName.lastIndexOf('.')+1,ImageName.length()).trim();
                   if(extension.equalsIgnoreCase("gif")==false && ( extension.equalsIgnoreCase("jpg") || extension.equalsIgnoreCase("jpeg")
                  || extension.equalsIgnoreCase("png") || extension.equalsIgnoreCase("bmp")))
                   {
                      System.out.println(ImageLocation);
                       if( imageHistCompare(upload,ImageLocation)==1 ){
                        
                         listOfLinks.add(ImageUrl);
                       
                       }                 
                   }
                 count++;
               }
          
      }
       catch (Exception EX)
      {
         System.out.println("software");
      }
        
     
     
    }while(n==1);
   
   
 
    for(String links:listOfLinks)
    {
      System.out.println(links);
     
    }

    return listOfLinks;
   
  }
 
 
 
 
 
  static{
  System.loadLibrary("compare");
  }
 
}
TOP

Related Classes of SearchEngine

TOP
Copyright © 2018 www.massapi.com. 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.