Java BigDecimal getSid(BigDecimal total, AtomicLong sid)

Here you can find the source of getSid(BigDecimal total, AtomicLong sid)

Description

get Sid

License

Open Source License

Declaration

public static BigDecimal getSid(BigDecimal total, AtomicLong sid) 

Method Source Code


//package com.java2s;
/*/*from  w  ww.  j a va  2s.  c o  m*/
 * Copyright(C) 2011-2012 Alibaba Group Holding Limited
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License version 2 as
 *  published by the Free Software Foundation.
 *
 *  Authors:
 *    wentong <wentong@taobao.com>
 */

import java.math.BigDecimal;

import java.util.concurrent.atomic.AtomicLong;

public class Main {
    public static BigDecimal getSid(BigDecimal total, AtomicLong sid) {
        BigDecimal ret = new BigDecimal(sid.getAndIncrement());
        if (ret.longValue() > total.longValue()) {
            sid.set(1);
        }
        return ret;
    }
}

Related

  1. getRandomPriceChangeFactor(BigDecimal currentPrice)
  2. getRecordSize(List> columnBaseData)
  3. getRSBigDecimal(Object object)
  4. getScale(BigDecimal bd1, BigDecimal bd2)
  5. getScaledDouble(BigDecimal input)
  6. getSignedBalance(BigDecimal balance)
  7. getTensVal(BigDecimal val)
  8. getTotalSum(List subTotals)
  9. getUnscaledBytes(BigDecimal bd)