本文整理汇总了Java中nxt.db.DbIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java DbIterator.next方法的具体用法?Java DbIterator.next怎么用?Java DbIterator.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nxt.db.DbIterator
的用法示例。
在下文中一共展示了DbIterator.next方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processRequest
import nxt.db.DbIterator; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(JSONObject request, Peer peer) {
JSONObject response = new JSONObject();
try {
Long accountId = Convert.parseAccountId((String)request.get("account"));
Account account = Account.getAccount(accountId);
JSONArray transactions = new JSONArray();
if(account != null) {
DbIterator<? extends Transaction> iterator = Nxt.getBlockchain().getTransactions(account, 0, (byte)-1, (byte)0, 0, 0, 9);
while(iterator.hasNext()) {
Transaction transaction = iterator.next();
transactions.add(nxt.http.JSONData.transaction(transaction));
}
}
response.put("transactions", transactions);
}
catch(Exception e) {
}
return response;
}
示例2: getEscrowTransactionsByParticipent
import nxt.db.DbIterator; //导入方法依赖的package包/类
public static Collection<Escrow> getEscrowTransactionsByParticipent(Long accountId) {
List<Escrow> filtered = new ArrayList<>();
DbIterator<Decision> it = decisionTable.getManyBy(new DbClause.LongClause("account_id", accountId), 0, -1);
while(it.hasNext()) {
Decision decision = it.next();
Escrow escrow = escrowTable.get(escrowDbKeyFactory.newKey(decision.escrowId));
if(escrow != null) {
filtered.add(escrow);
}
}
return filtered;
}
示例3: processRequest
import nxt.db.DbIterator; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
JSONObject response = new JSONObject();
Account targetAccount = ParameterParser.getAccount(req);
long height = Nxt.getBlockchain().getLastBlock().getHeight();
JSONArray accounts = new JSONArray();
/*for(Account account : Account.getAllAccounts()) {
long recip;
if(account.getRewardRecipientFrom() > height + 1) {
recip = 0L; // this api is intended for pools, so drop changing users a few blocks early to avoid overpaying
}
else {
recip = account.getRewardRecipient();
}
if(targetAccount.getId() == recip) {
accounts.add(Convert.toUnsignedLong(account.getId()));
}
}*/
DbIterator<Account.RewardRecipientAssignment> assignments = Account.getAccountsWithRewardRecipient(targetAccount.getId());
while(assignments.hasNext()) {
Account.RewardRecipientAssignment assignment = assignments.next();
accounts.add(Convert.toUnsignedLong(assignment.accountId));
}
if(targetAccount.getRewardRecipientAssignment() == null) {
accounts.add(Convert.toUnsignedLong(targetAccount.getId()));
}
response.put("accounts", accounts);
return response;
}
示例4: processRequest
import nxt.db.DbIterator; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) throws NxtException {
long sellerId = ParameterParser.getSellerId(req);
int firstIndex = ParameterParser.getFirstIndex(req);
int lastIndex = ParameterParser.getLastIndex(req);
boolean inStockOnly = !"false".equalsIgnoreCase(req.getParameter("inStockOnly"));
JSONObject response = new JSONObject();
JSONArray goodsJSON = new JSONArray();
response.put("goods", goodsJSON);
DbIterator<DigitalGoodsStore.Goods> goods = null;
try {
if (sellerId == 0) {
if (inStockOnly) {
goods = DigitalGoodsStore.getGoodsInStock(firstIndex, lastIndex);
} else {
goods = DigitalGoodsStore.getAllGoods(firstIndex, lastIndex);
}
} else {
goods = DigitalGoodsStore.getSellerGoods(sellerId, inStockOnly, firstIndex, lastIndex);
}
while (goods.hasNext()) {
DigitalGoodsStore.Goods good = goods.next();
goodsJSON.add(JSONData.goods(good));
}
} finally {
DbUtils.close(goods);
}
return response;
}
示例5: checkComplete
import nxt.db.DbIterator; //导入方法依赖的package包/类
private DecisionType checkComplete() {
Decision senderDecision = decisionTable.get(decisionDbKeyFactory.newKey(id, senderId));
if(senderDecision.getDecision() == DecisionType.RELEASE) {
return DecisionType.RELEASE;
}
Decision recipientDecision = decisionTable.get(decisionDbKeyFactory.newKey(id, recipientId));
if(recipientDecision.getDecision() == DecisionType.REFUND) {
return DecisionType.REFUND;
}
int countRelease = 0;
int countRefund = 0;
int countSplit = 0;
DbIterator<Decision> decisions = decisionTable.getManyBy(new DbClause.LongClause("escrow_id", id), 0, -1);
while(decisions.hasNext()) {
Decision decision = decisions.next();
if(decision.getAccountId().equals(senderId) ||
decision.getAccountId().equals(recipientId)) {
continue;
}
switch(decision.getDecision()) {
case RELEASE:
countRelease++;
break;
case REFUND:
countRefund++;
break;
case SPLIT:
countSplit++;
break;
default:
break;
}
}
if(countRelease >= requiredSigners) {
return DecisionType.RELEASE;
}
if(countRefund >= requiredSigners) {
return DecisionType.REFUND;
}
if(countSplit >= requiredSigners) {
return DecisionType.SPLIT;
}
return DecisionType.UNDECIDED;
}