Subversion Repositories SmartDukaan

Rev

Rev 2793 | Rev 2797 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2793 Rev 2795
Line 21... Line 21...
21
public class ComparisonStatsFetcher implements Serializable{
21
public class ComparisonStatsFetcher implements Serializable{
22
	private static final long serialVersionUID = 1L;
22
	private static final long serialVersionUID = 1L;
23
	public static final String GOOGLE_COMPARE_DATA_URL = "http://saholic-datastore.appspot.com/show-comparisons";
23
	public static final String GOOGLE_COMPARE_DATA_URL = "http://saholic-datastore.appspot.com/show-comparisons";
24
		
24
		
25
	class ValueComparator implements Comparator, Serializable {
25
	class ValueComparator implements Comparator, Serializable {
-
 
26
		private static final long serialVersionUID = 1L;
26
	      Map base;
27
	    Map base;
27
	      public ValueComparator(Map base) {
28
        public ValueComparator(Map base) {
28
	          this.base = base;
29
	    this.base = base;
29
	      }
30
	  }
30
	      public int compare(Object a, Object b) {
31
	  public int compare(Object a, Object b) {
31
	        if((Long)base.get(a) < (Long)base.get(b)) {
32
	    if((Long)base.get(a) < (Long)base.get(b)) {
32
	          return 1;
33
	      return 1;
33
	        } else {
34
	    } else {
34
	          return -1;
35
	      return -1;
35
	        }
-
 
36
	      }
-
 
37
	    }
36
	    }
-
 
37
	  }
-
 
38
	}
38
 
39
 
39
	
40
	
40
	public void fetchAndStoreComparisonStats(long fromDate, long toDate){
41
	public void fetchAndStoreComparisonStats(long fromDate, long toDate){
41
		String requestParameters = "fromdate=" +  fromDate + "&todate=" + toDate;
42
		String requestParameters = "fromdate=" +  fromDate + "&todate=" + toDate;
42
		String data = ComparisonStatsFetcher.sendGetRequest(GOOGLE_COMPARE_DATA_URL, requestParameters);
43
		String data = ComparisonStatsFetcher.sendGetRequest(GOOGLE_COMPARE_DATA_URL, requestParameters);