Exemplo n.º 1
0
 public ItemId getNextItemId(UserId seller_id) {
   Integer cnt = this.seller_item_cnt.get(seller_id);
   if (cnt == null || cnt == 0) {
     cnt = seller_id.getItemCount();
     this.seller_item_cnt.put(seller_id, cnt);
   }
   this.seller_item_cnt.put(seller_id);
   return (new ItemId(seller_id, cnt.intValue()));
 }
Exemplo n.º 2
0
  private AuctionMarkProfile copyProfile(AuctionMarkWorker worker, AuctionMarkProfile other) {
    this.client_id = worker.getId();
    this.scale_factor = other.scale_factor;
    this.loaderStartTime = other.loaderStartTime;
    this.loaderStopTime = other.loaderStopTime;
    this.users_per_itemCount = other.users_per_itemCount;
    this.items_per_category = other.items_per_category;
    this.gag_ids = other.gag_ids;

    // Initialize the UserIdGenerator so we can figure out whether our
    // client should even have these ids
    this.initializeUserIdGenerator(this.client_id);
    assert (this.userIdGenerator != null);

    for (int i = 0; i < this.allItemSets.length; i++) {
      LinkedList<ItemInfo> list = this.allItemSets[i];
      assert (list != null);
      LinkedList<ItemInfo> origList = other.allItemSets[i];
      assert (origList != null);

      for (ItemInfo itemInfo : origList) {
        UserId sellerId = itemInfo.getSellerId();
        if (this.userIdGenerator.checkClient(sellerId)) {
          this.seller_item_cnt.set(sellerId, sellerId.getItemCount());
          list.add(itemInfo);
        }
      } // FOR
      Collections.shuffle(list);
    } // FOR

    for (ItemCommentResponse cr : other.pending_commentResponses) {
      UserId sellerId = new UserId(cr.sellerId);
      if (this.userIdGenerator.checkClient(sellerId)) {
        this.pending_commentResponses.add(cr);
      }
    } // FOR

    if (LOG.isTraceEnabled()) LOG.trace("SellerItemCounts:\n" + this.seller_item_cnt);

    return (this);
  }