当前位置: 首页>>代码示例>>Java>>正文


Java Convert.toUnsignedLong方法代码示例

本文整理汇总了Java中nxt.util.Convert.toUnsignedLong方法的典型用法代码示例。如果您正苦于以下问题:Java Convert.toUnsignedLong方法的具体用法?Java Convert.toUnsignedLong怎么用?Java Convert.toUnsignedLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nxt.util.Convert的用法示例。


在下文中一共展示了Convert.toUnsignedLong方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateAttachment

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
void validateAttachment(Transaction transaction) throws NxtException.ValidationException {
    Attachment.ColoredCoinsAssetTransfer attachment = (Attachment.ColoredCoinsAssetTransfer)transaction.getAttachment();
    if (transaction.getAmountNQT() != 0
            || attachment.getComment() != null && attachment.getComment().length() > Constants.MAX_ASSET_TRANSFER_COMMENT_LENGTH
            || attachment.getAssetId() == 0) {
        throw new NxtException.NotValidException("Invalid asset transfer amount or comment: " + attachment.getJSONObject());
    }
    if (transaction.getVersion() > 0 && attachment.getComment() != null) {
        throw new NxtException.NotValidException("Asset transfer comments no longer allowed, use message " +
                "or encrypted message appendix instead");
    }
    Asset asset = Asset.getAsset(attachment.getAssetId());
    if (attachment.getQuantityQNT() <= 0 || (asset != null && attachment.getQuantityQNT() > asset.getQuantityQNT())) {
        throw new NxtException.NotValidException("Invalid asset transfer asset or quantity: " + attachment.getJSONObject());
    }
    if (asset == null) {
        throw new NxtException.NotCurrentlyValidException("Asset " + Convert.toUnsignedLong(attachment.getAssetId()) +
                " does not exist yet");
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:22,代码来源:TransactionType.java

示例2: checkBalance

import nxt.util.Convert; //导入方法依赖的package包/类
private static void checkBalance(long accountId, long confirmed, long unconfirmed) {
    if (confirmed < 0) {
        throw new DoubleSpendingException("Negative balance or quantity for account " + Convert.toUnsignedLong(accountId));
    }
    if (unconfirmed < 0) {
        throw new DoubleSpendingException("Negative unconfirmed balance or quantity for account " + Convert.toUnsignedLong(accountId));
    }
    if (unconfirmed > confirmed) {
        throw new DoubleSpendingException("Unconfirmed exceeds confirmed balance or quantity for account " + Convert.toUnsignedLong(accountId));
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:12,代码来源:Account.java

示例3: apply

import nxt.util.Convert; //导入方法依赖的package包/类
void apply(byte[] key, int height) {
    if (! setOrVerify(key, this.creationHeight)) {
        throw new IllegalStateException("Public key mismatch");
    }
    if (this.publicKey == null) {
        throw new IllegalStateException("Public key has not been set for account " + Convert.toUnsignedLong(id)
                +" at height " + height + ", key height is " + keyHeight);
    }
    if (this.keyHeight == -1 || this.keyHeight > height) {
        this.keyHeight = height;
        accountTable.insert(this);
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:14,代码来源:Account.java

示例4: getAccount

import nxt.util.Convert; //导入方法依赖的package包/类
public static Account getAccount(byte[] publicKey) {
    Account account = accountTable.get(accountDbKeyFactory.newKey(getId(publicKey)));
    if (account == null) {
        return null;
    }
    if (account.getPublicKey() == null || Arrays.equals(account.getPublicKey(), publicKey)) {
        return account;
    }
    throw new RuntimeException("DUPLICATE KEY for account " + Convert.toUnsignedLong(account.getId())
            + " existing key " + Convert.toHexString(account.getPublicKey()) + " new key " + Convert.toHexString(publicKey));
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:12,代码来源:Account.java

示例5: doValidateAttachment

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
void doValidateAttachment(Transaction transaction) throws NxtException.ValidationException {
    Attachment.DigitalGoodsDelisting attachment = (Attachment.DigitalGoodsDelisting) transaction.getAttachment();
    DigitalGoodsStore.Goods goods = DigitalGoodsStore.getGoods(attachment.getGoodsId());
    if (goods != null && transaction.getSenderId() != goods.getSellerId()) {
        throw new NxtException.NotValidException("Invalid digital goods delisting - seller is different: " + attachment.getJSONObject());
    }
    if (goods == null || goods.isDelisted()) {
        throw new NxtException.NotCurrentlyValidException("Goods " + Convert.toUnsignedLong(attachment.getGoodsId()) +
                "not yet listed or already delisted");
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:13,代码来源:TransactionType.java

示例6: isDuplicate

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
boolean isDuplicate(Transaction transaction, Map<TransactionType, Set<String>> duplicates) {
	Attachment.AdvancedPaymentEscrowSign attachment = (Attachment.AdvancedPaymentEscrowSign) transaction.getAttachment();
	String uniqueString = Convert.toUnsignedLong(attachment.getEscrowId()) + ":" +
						  Convert.toUnsignedLong(transaction.getSenderId());
	return isDuplicate(AdvancedPayment.ESCROW_SIGN, uniqueString, duplicates);
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:8,代码来源:TransactionType.java

示例7: getStringId

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
public String getStringId() {
    if (stringId == null) {
        getId();
        if (stringId == null) {
            stringId = Convert.toUnsignedLong(id);
        }
    }
    return stringId;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:11,代码来源:BlockImpl.java

示例8: preVerify

import nxt.util.Convert; //导入方法依赖的package包/类
public void preVerify(byte[] scoopData) throws BlockchainProcessor.BlockNotAcceptedException {
synchronized(this) {
	// Remove from todo-list:
	synchronized(BlockchainProcessorImpl.blockCache) {
		BlockchainProcessorImpl.unverified.remove(this.getId());
	}

	// Just in case its already verified
	if(this.pocTime != null)
		return;

	try {
	    // Pre-verify poc:
           if(scoopData == null) {
               this.pocTime = Nxt.getGenerator().calculateHit(getGeneratorId(), nonce, generationSignature, getScoopNum());
           }
           else {
               this.pocTime = Nxt.getGenerator().calculateHit(getGeneratorId(), nonce, generationSignature, scoopData);
           }
	} catch (RuntimeException e) {
	    Logger.logMessage("Error pre-verifying block generation signature", e);
	    return;
	}

       for(TransactionImpl transaction : getTransactions()) {
           if(!transaction.verifySignature()) {
               Logger.logMessage("Bad transaction signature during block pre-verification for tx: " + Convert.toUnsignedLong(transaction.getId()) + " at block height: " + getHeight());
               throw new BlockchainProcessor.TransactionNotAcceptedException("Invalid signature for tx: " + Convert.toUnsignedLong(transaction.getId()) + "at block height: " + getHeight(), transaction);
           }
       }
}
   }
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:33,代码来源:BlockImpl.java

示例9: updateQuantityQNT

import nxt.util.Convert; //导入方法依赖的package包/类
private void updateQuantityQNT(long quantityQNT) {
    super.setQuantityQNT(quantityQNT);
    if (quantityQNT > 0) {
        askOrderTable.insert(this);
    } else if (quantityQNT == 0) {
        askOrderTable.delete(this);
    } else {
        throw new IllegalArgumentException("Negative quantity: " + quantityQNT
                + " for order: " + Convert.toUnsignedLong(getId()));
    }
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:12,代码来源:Order.java

示例10: getATLong

import nxt.util.Convert; //导入方法依赖的package包/类
public static String getATLong(HttpServletRequest req) {
	String hex = req.getParameter("hexString");
	ByteBuffer bf = ByteBuffer.allocate(8);
	bf.order(ByteOrder.LITTLE_ENDIAN);
	bf.put(Convert.parseHexString(hex));
	
	String ret = Convert.toUnsignedLong(bf.getLong(0));
	return ret;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:10,代码来源:ParameterParser.java

示例11: toString

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
public String toString() {
    return "AccountAsset account_id: " + Convert.toUnsignedLong(accountId) + " asset_id: " + Convert.toUnsignedLong(assetId)
            + " quantity: " + quantityQNT + " unconfirmedQuantity: " + unconfirmedQuantityQNT;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Account.java

示例12: toString

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
public String toString() {
    return getClass().getSimpleName() + " id: " + Convert.toUnsignedLong(id) + " account: " + Convert.toUnsignedLong(accountId)
            + " asset: " + Convert.toUnsignedLong(assetId) + " price: " + priceNQT + " quantity: " + quantityQNT + " height: " + creationHeight;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Order.java

示例13: toString

import nxt.util.Convert; //导入方法依赖的package包/类
@Override
public String toString() {
    return "Trade asset: " + Convert.toUnsignedLong(assetId) + " ask: " + Convert.toUnsignedLong(askOrderId)
            + " bid: " + Convert.toUnsignedLong(bidOrderId) + " price: " + priceNQT + " quantity: " + quantityQNT + " height: " + height;
}
 
开发者ID:muhatzg,项目名称:burstcoin,代码行数:6,代码来源:Trade.java


注:本文中的nxt.util.Convert.toUnsignedLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。