001    package market.swing;
002    
003    import java.io.Serializable;
004    import java.util.Comparator;
005    
006    import market.CIOpenPurchaseOrders;
007    
008    /**
009     * Compares {@link market.CIOpenPurchaseOrders} by their stocks' values
010     */
011    public class CmpOpoNumbers implements Comparator, Serializable {
012    
013        /**
014         * The actual comparison.
015         * @param o1 the first CIOpenPurchaseOrder.
016         * @param o2 the second CIOpenPurchaseOrder.
017         * @return an int representing the result of the comparison.
018         */
019        public int compare(Object o1, Object o2) {
020            CIOpenPurchaseOrders c1 = (CIOpenPurchaseOrders)o1;
021            CIOpenPurchaseOrders c2 = (CIOpenPurchaseOrders)o2;
022            return c1.getOrdersValue().compareTo(c2.getOrdersValue());
023        }
024    }