Perform operations (and track) auctions in their 'natural order', which is to say sorted by end date.
- A jbidwatcher/trunk/src/com/jbidwatcher/util/SortedList.java
- M jbidwatcher/trunk/src/com/jbidwatcher/auction/AuctionList.java view
- M jbidwatcher/trunk/src/com/jbidwatcher/my/MyJBidwatcher.java view
| 463 | 576 | |
|---|---|---|
| 1 | 1 | package com.jbidwatcher.auction; |
| 2 | 2 | |
| 3 | 3 | import com.jbidwatcher.util.Comparison; |
| 4 | import com.jbidwatcher.util.SortedList; | |
| 4 | 5 | |
| 5 | 6 | import java.util.List; |
| 6 | 7 | import java.util.ArrayList; |
| 7 | 8 | import java.util.Collections; |
| 9 | import java.util.TreeSet; | |
| 8 | 10 | |
| 9 | 11 | /** |
| 10 | 12 | * Created by IntelliJ IDEA. |
| --- | --- | |
| 14 | 16 | * To change this template use File | Settings | File Templates. |
| 15 | 17 | */ |
| 16 | 18 | 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>()); | |
| 18 | 20 | |
| 19 | 21 | public int size() { synchronized(mList) { return mList.size(); } } |
| 20 | 22 | public AuctionEntry get(int i) { synchronized (mList) { return mList.get(i); } } |
| 554 | 576 | |
|---|---|---|
| 18 | 18 | * A set of methods to communicate with the 'my.jbidwatcher.com' site. |
| 19 | 19 | */ |
| 20 | 20 | public class MyJBidwatcher { |
| 21 | private static MyJBidwatcher sInstance; | |
| 21 | private static MyJBidwatcher sInstance = null; | |
| 22 | 22 | |
| 23 | 23 | public String recognizeBidpage(String identifier, StringBuffer page) { |
| 24 | String url = "http://my.jbidwatcher.com/advanced/recognize"; | |
| 25 | 24 | |
| 26 | 25 | Parameters p = new Parameters(); |
| 27 | 26 | if(identifier != null) p.put("item", identifier); |
| 28 | 27 | p.put("user", JConfig.queryConfiguration("my.jbidwatcher.id")); |
| 29 | 28 | p.put("body", page); |
| 29 | String url = "http://my.jbidwatcher.com/advanced/recognize"; | |
| 30 | 30 | return Http.postTo(url, p); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | public String reportException(String sb) { |
| 34 | String url = "http://my.jbidwatcher.com/advanced/report"; | |
| 35 | 34 | Parameters p = new Parameters(); |
| 36 | 35 | p.put("user", JConfig.queryConfiguration("my.jbidwatcher.id")); |
| 37 | 36 | p.put("body", sb); |
| 37 | String url = "http://my.jbidwatcher.com/advanced/report"; | |
| 38 | 38 | return Http.postTo(url, p); |
| 39 | 39 | } |
| 40 | 40 | |
