List of usage examples for java.math BigInteger ZERO
BigInteger ZERO
To view the source code for java.math BigInteger ZERO.
Click Source Link
From source file:com.bonsai.wallet32.HDWallet.java
public void sendAccountCoins(Wallet wallet, int acctnum, Address dest, long value, long fee, boolean spendUnconfirmed) throws RuntimeException { // Which account are we using for this send? HDAccount acct = mAccounts.get(acctnum); SendRequest req = SendRequest.to(dest, BigInteger.valueOf(value)); req.fee = BigInteger.valueOf(fee); req.feePerKb = BigInteger.ZERO; req.ensureMinRequiredFee = false;//from www . j a v a2 s. c o m req.changeAddress = acct.nextChangeAddress(); req.coinSelector = acct.coinSelector(spendUnconfirmed); req.aesKey = mAesKey; try { wallet.sendCoins(req); } catch (InsufficientMoneyException e) { throw new RuntimeException("Not enough BTC in account"); } }
From source file:org.sparkbit.jsonrpc.SparkBitJSONRPCServiceImpl.java
@Override public Boolean deleteasset(String walletname, String assetRef) throws com.bitmechanic.barrister.RpcException { log.info("DELETE ASSET"); log.info("wallet name = " + walletname); log.info("asset ref = " + assetRef); Wallet w = getWalletForWalletName(walletname); boolean success = false; CSAsset asset = getAssetForAssetRefString(w, assetRef); if (asset != null) { int assetID = asset.getAssetID(); BigInteger x = w.CS.getAssetBalance(assetID).total; boolean canDelete = x.equals(BigInteger.ZERO); // Delete invalid asset if property allows String s = controller.getModel().getUserPreference(BitcoinModel.CAN_DELETE_INVALID_ASSETS); boolean isAssetInvalid = asset.getAssetState() != CSAsset.CSAssetState.VALID; boolean deleteInvalidAsset = false; if (Boolean.TRUE.toString().equals(s) && isAssetInvalid) { deleteInvalidAsset = true;/* ww w. ja v a 2s .c o m*/ } if (canDelete || deleteInvalidAsset) { success = w.CS.deleteAsset(asset); if (success) { // Note: the event can be fired, but the listener can do nothing if in headless mode. // We want main asset panel to refresh, since there isn't an event fired on manual reset. CSEventBus.INSTANCE.postAsyncEvent(CSEventType.ASSET_DELETED, assetID); } else { JSONRPCError.DELETE_ASSET_FAILED.raiseRpcException(); } } else { if (isAssetInvalid) { JSONRPCError.DELETE_INVALID_ASSET_FAILED.raiseRpcException(); } else { JSONRPCError.DELETE_ASSET_NONZERO_BALANCE.raiseRpcException(); } } } else { if (isAssetRefValid(assetRef)) { JSONRPCError.ASSETREF_NOT_FOUND.raiseRpcException(); } else { JSONRPCError.ASSETREF_INVALID.raiseRpcException(); } } return success; }
From source file:models.persistence.lecture.Lecture.java
/** * calculate cost of this lecture/*w w w. j a v a2 s. c om*/ * the more costs a lecture have it will be more important to place it first */ @JsonIgnore public BigInteger getDifficulty() { BigInteger ret = BigInteger.ZERO; if (criteriaContainer != null) { ret = ret.add(BigInteger.valueOf(criteriaContainer.calculateDifficultLevel())); } if (docents != null) { ret = ret.add(BigInteger.valueOf(docents.parallelStream() .mapToLong(d -> d.getCriteriaContainer().calculateDifficultLevel()).sum())); } if (participants != null) { ret = ret.add(BigInteger.valueOf(participants.size())); } ret = ret.add(BigInteger.valueOf(calculateNumberOfParticipants())); ret = ret.add(difficultLevel); ret = ret.add(BigInteger.valueOf(duration.getSortIndex())); return ret; }
From source file:com.feathercoin.wallet.feathercoin.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (ACTION_CANCEL_COINS_RECEIVED.equals(intent.getAction())) { notificationCount = 0;/* w ww . j av a2s . c om*/ notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } if (ACTION_HOLD_WIFI_LOCK.equals(intent.getAction())) { Log.d(TAG, "acquiring wifilock"); wifiLock.acquire(); } else { Log.d(TAG, "releasing wifilock"); wifiLock.release(); } if (ACTION_RESET_BLOCKCHAIN.equals(intent.getAction())) { Log.d(TAG, "resetting blockchain"); resetBlockchainOnShutdown = true; stopSelf(); } return START_NOT_STICKY; }
From source file:de.schildbach.wallet.digitalcoin.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(intent.getAction())) { notificationCount = 0;/*from w w w.j av a 2 s. c o m*/ notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } if (BlockchainService.ACTION_HOLD_WIFI_LOCK.equals(intent.getAction())) { Log.d(TAG, "acquiring wifilock"); wifiLock.acquire(); } else { Log.d(TAG, "releasing wifilock"); wifiLock.release(); } if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(intent.getAction())) { Log.d(TAG, "resetting blockchain"); resetBlockchainOnShutdown = true; stopSelf(); } return START_NOT_STICKY; }
From source file:de.schildbach.wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(intent.getAction())) { notificationCount = 0;/* ww w .j a v a2s. co m*/ notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } if (BlockchainService.ACTION_HOLD_WIFI_LOCK.equals(intent.getAction())) { Log.d(TAG, "acquiring wifilock"); wifiLock.acquire(); } else { Log.d(TAG, "releasing wifilock"); wifiLock.release(); } if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(intent.getAction())) { resetBlockchainOnShutdown = true; stopSelf(); } return START_NOT_STICKY; }
From source file:de.schildbach.wallet.elysium.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(intent.getAction())) { notificationCount = 0;//from w w w. j a va 2 s. com notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } if (BlockchainService.ACTION_HOLD_WIFI_LOCK.equals(intent.getAction())) { Log.d(TAG, "acquiring wifilock"); wifiLock.acquire(); } else { Log.d(TAG, "releasing wifilock"); wifiLock.release(); } if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(intent.getAction())) { Log.d(TAG, "resetting blockchain"); resetBlockchainOnShutdown = true; stopSelf(); } return START_NOT_STICKY; }
From source file:hashengineering.digitalcoin.wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(intent.getAction())) { notificationCount = 0;/*from w w w .j a va 2 s . c o m*/ notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } if (BlockchainService.ACTION_HOLD_WIFI_LOCK.equals(intent.getAction())) { log.debug("acquiring wifilock"); wifiLock.acquire(); } else { log.debug("releasing wifilock"); wifiLock.release(); } if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(intent.getAction())) { log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; stopSelf(); } return START_NOT_STICKY; }
From source file:com.tribesman.wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (intent != null) { log.info("service start command: " + intent + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT) ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")" : "")); final String action = intent.getAction(); if (ACTION_CANCEL_COINS_RECEIVED.equals(action)) { notificationCount = 0;//from w w w. j a va 2 s . c om notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } else if (ACTION_RESET_BLOCKCHAIN.equals(action)) { log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; stopSelf(); } else if (ACTION_BROADCAST_TRANSACTION.equals(action)) { final Sha256Hash hash = new Sha256Hash(intent.getByteArrayExtra(ACTION_BROADCAST_TRANSACTION_HASH)); final Transaction tx = application.getWallet().getTransaction(hash); if (peerGroup != null) { log.info("broadcasting transaction " + tx.getHashAsString()); peerGroup.broadcastTransaction(tx); } else { log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString()); } } } else { log.warn("service restart, although it was started as non-sticky"); } return START_NOT_STICKY; }
From source file:com.bushstar.htmlcoin_android_wallet.service.BlockchainServiceImpl.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { if (intent != null) { log.info("service start command: " + intent + (intent.hasExtra(Intent.EXTRA_ALARM_COUNT) ? " (alarm count: " + intent.getIntExtra(Intent.EXTRA_ALARM_COUNT, 0) + ")" : "")); final String action = intent.getAction(); if (BlockchainService.ACTION_CANCEL_COINS_RECEIVED.equals(action)) { notificationCount = 0;//from w w w . j a v a2 s. c o m notificationAccumulatedAmount = BigInteger.ZERO; notificationAddresses.clear(); nm.cancel(NOTIFICATION_ID_COINS_RECEIVED); } else if (BlockchainService.ACTION_RESET_BLOCKCHAIN.equals(action)) { log.info("will remove blockchain on service shutdown"); resetBlockchainOnShutdown = true; stopSelf(); } else if (BlockchainService.ACTION_BROADCAST_TRANSACTION.equals(action)) { final Sha256Hash hash = new Sha256Hash( intent.getByteArrayExtra(BlockchainService.ACTION_BROADCAST_TRANSACTION_HASH)); final Transaction tx = application.getWallet().getTransaction(hash); if (peerGroup != null) { log.info("broadcasting transaction " + tx.getHashAsString()); peerGroup.broadcastTransaction(tx); } else { log.info("peergroup not available, not broadcasting transaction " + tx.getHashAsString()); } } } else { log.warn("service restart, although it was started as non-sticky"); } return START_NOT_STICKY; }