Package edu.brown.benchmark.auctionmark.util

Examples of edu.brown.benchmark.auctionmark.util.ItemInfo


        public ItemId processItemRecord(VoltTable vt) {
            ItemId itemId = new ItemId(vt.getLong("i_id"));
            TimestampType endDate = vt.getTimestampAsTimestamp("i_end_date");
            short numBids = (short)vt.getLong("i_num_bids");
            double currentPrice = vt.getDouble("i_current_price");
            ItemInfo itemInfo = new ItemInfo(itemId, currentPrice, endDate, numBids);
            if (vt.hasColumn("ip_id")) itemInfo.status = ItemStatus.CLOSED;
            if (vt.hasColumn("i_status")) itemInfo.status = ItemStatus.get(vt.getLong("i_status"));
           
            UserId sellerId = new UserId(vt.getLong("i_u_id"));
            assert (itemId.getSellerId().equals(sellerId));
View Full Code Here


            TimestampType i_end_date = vt.getTimestampAsTimestamp(col++);
            int i_num_bids = (int)vt.getLong(col++);
            ItemStatus i_status = ItemStatus.get(vt.getLong(col++));
            assert(i_status == status);
           
            ItemInfo itemInfo = new ItemInfo(i_id, i_current_price, i_end_date, i_num_bids);
            this.addItemToProperQueue(itemInfo, false);
            ctr++;
        } // WHILE
       
        if (debug.val)
View Full Code Here

        synchronized (itemSet) {
            if (itemSet.contains(itemInfo)) {
                // HACK: Always swap existing ItemInfos with our new one, since it will
                // more up-to-date information
                int idx = itemSet.indexOf(itemInfo);
                ItemInfo existing = itemSet.set(idx, itemInfo);
                assert(existing != null);
                return (true);
            }
            if (itemInfo.hasCurrentPrice())
                assert(itemInfo.getCurrentPrice() > 0) : "Negative current price for " + itemInfo;
View Full Code Here

     * @param needCurrentPrice
     * @param needFutureEndDate TODO
     * @return
     */
    private ItemInfo getRandomItem(LinkedList<ItemInfo> itemSet, boolean needCurrentPrice, boolean needFutureEndDate) {
        ItemInfo itemInfo = null;
        Set<ItemInfo> seen = new HashSet<ItemInfo>();
        TimestampType currentTime = this.updateAndGetCurrentTime();
       
        synchronized (itemSet) {
            int num_items = itemSet.size();
            Integer partition = null;
            int idx = -1;
           
            if (trace.val)
                LOG.trace(String.format("Getting random ItemInfo [numItems=%d, currentTime=%s, needCurrentPrice=%s]",
                                       num_items, currentTime, needCurrentPrice));
            long tries = 1000;
            while (num_items > 0 && tries-- > 0 && seen.size() < num_items) {
                partition = null;
                idx = this.rng.nextInt(num_items);
                ItemInfo temp = itemSet.get(idx);
                assert(temp != null);
                if (seen.contains(temp)) continue;
                seen.add(temp);
               
                // Needs to have an embedded currentPrice
                if (needCurrentPrice && temp.hasCurrentPrice() == false) {
                    continue;
                }
               
                // If they want an item that is ending in the future, then we compare it with
                // the current timestamp
                if (needFutureEndDate) {
                    boolean compareTo = (temp.getEndDate().compareTo(currentTime) < 0);
                    if (trace.val)
                        LOG.trace("CurrentTime:" + currentTime + " / EndTime:" + temp.getEndDate() + " [compareTo=" + compareTo + "]");
                    if (temp.hasEndDate() == false || compareTo) {
                        continue;
                    }
                }
               
                // Uniform
                if (this.window_size == null) {
                    itemInfo = temp;
                    break;
                }
                // Temporal Skew
                partition = this.getPartition(temp.getSellerId());
                if (this.window_partitions.contains(partition)) {
                    this.window_histogram.put(partition);
                    itemInfo = temp;
                    break;
                }
View Full Code Here

TOP

Related Classes of edu.brown.benchmark.auctionmark.util.ItemInfo

Copyright © 2018 www.massapicom. 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.