avatar

576

Perform operations (and track) auctions in their 'natural order', which is to say sorted by end date.

by mrs, 26 Jul, 2008 10:20 AM
463 576  
11 package com.jbidwatcher.auction;
22 
33 import com.jbidwatcher.util.Comparison;
4 import com.jbidwatcher.util.SortedList;
45 
56 import java.util.List;
67 import java.util.ArrayList;
78 import java.util.Collections;
9 import java.util.TreeSet;
810 
911 /**
1012  * Created by IntelliJ IDEA.
------
1416 * To change this template use File | Settings | File Templates.
1517 */
1618 public class AuctionList {
17   private final List<AuctionEntry> mList = Collections.synchronizedList(new ArrayList<AuctionEntry>());
19   private final List<AuctionEntry> mList = Collections.synchronizedList(new SortedList<AuctionEntry>());
1820 
1921   public int size() { synchronized(mList) { return mList.size(); } }
2022   public AuctionEntry get(int i) { synchronized (mList) { return mList.get(i); } }
554 576  
1818  * A set of methods to communicate with the 'my.jbidwatcher.com' site.
1919  */
2020 public class MyJBidwatcher {
21   private static MyJBidwatcher sInstance;
21   private static MyJBidwatcher sInstance = null;
2222 
2323   public String recognizeBidpage(String identifier, StringBuffer page) {
24     String url = "http://my.jbidwatcher.com/advanced/recognize";
2524 
2625     Parameters p = new Parameters();
2726     if(identifier != null) p.put("item", identifier);
2827     p.put("user", JConfig.queryConfiguration("my.jbidwatcher.id"));
2928     p.put("body", page);
29     String url = "http://my.jbidwatcher.com/advanced/recognize";
3030     return Http.postTo(url, p);
3131   }
3232 
3333   public String reportException(String sb) {
34     String url = "http://my.jbidwatcher.com/advanced/report";
3534     Parameters p = new Parameters();
3635     p.put("user", JConfig.queryConfiguration("my.jbidwatcher.id"));
3736     p.put("body", sb);
37     String url = "http://my.jbidwatcher.com/advanced/report";
3838     return Http.postTo(url, p);
3939   }
4040