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


Java UInt32类代码示例

本文整理汇总了Java中com.ripple.core.coretypes.uint.UInt32的典型用法代码示例。如果您正苦于以下问题:Java UInt32类的具体用法?Java UInt32怎么用?Java UInt32使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


UInt32类属于com.ripple.core.coretypes.uint包,在下文中一共展示了UInt32类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: forType

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private static TypeTranslator forType(Type type) {
    switch (type) {

        case STObject:      return translate;
        case Amount:        return Amount.translate;
        case UInt16:        return UInt16.translate;
        case UInt32:        return UInt32.translate;
        case UInt64:        return UInt64.translate;
        case Hash128:       return Hash128.translate;
        case Hash256:       return Hash256.translate;
        case Blob:          return Blob.translate;
        case AccountID:     return AccountID.translate;
        case STArray:       return STArray.translate;
        case UInt8:         return UInt8.translate;
        case Hash160:       return Hash160.translate;
        case PathSet:       return PathSet.translate;
        case Vector256:     return Vector256.translate;

        default:            throw new RuntimeException("Unknown type");
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:22,代码来源:STObject.java

示例2: doUpdate

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private boolean doUpdate(UInt32 txnIndex, UInt32 ledgerIndex) {
    if (le == null && !deleted) {
        return true;
    }
    if (prevLedger == null) {
        return true;
    }
    int ledgerCmp = ledgerIndex.compareTo(prevLedger);
    if (ledgerCmp == 1) {
        return true;
    }
    if (ledgerCmp == 0) {
        if (prevTxnIndex == null) {
            // We don't know, should log a warning or something
            // Should we keep the first one that we have of this index
            // or can we assume that the latest is the best?
            return true;
        }
        if (txnIndex.compareTo(prevTxnIndex) == 1) {
            // This happened AFTER
            return true;
        }
    }
    //ledgerCmp == -1  or txnIndex <= previousTxnIndex                                                                          ss
    return false;
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:27,代码来源:SLECache.java

示例3: updateFromTransactionResult

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void updateFromTransactionResult(TransactionResult tr) {
    if (!tr.validated) {
        return;
    }

    TransactionMeta meta = tr.meta;
    UInt32 ledgerIndex = tr.ledgerIndex;
    UInt32 txnIndex = meta.transactionIndex();

    for (AffectedNode an : meta.affectedNodes()) {
        Hash256 index = an.ledgerIndex();
        CacheEntry ce = getOrCreate(index);
        ce.upateLedgerEntry(an.isDeletedNode() ? null : (LedgerEntry) an.nodeAsFinal(),
                            ledgerIndex,
                            txnIndex);
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:18,代码来源:SLECache.java

示例4: cancelAllOffers

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private void cancelAllOffers(JSONObject data) throws JSONException {
	JSONArray offers = data.optJSONArray("offers");
	if (offers == null) {
		log.info("There is no offer for account" + data.toString(4));
		return;
	}

	int offersLength = offers.length();
	for (int i = 0; i < offersLength; i++) {
		JSONObject offer = offers.getJSONObject(i);
		OfferCancel offerCancel = new OfferCancel();
		offerCancel.account(rippleAccount.id());
		offerCancel.put(Field.OfferSequence, new UInt32(offer.optString("seq")));
		log.info("Cancell All Offers " + offerCancel.toJSON());
		template.convertAndSend(Channels.OFFER_CANCEL, offerCancel.toJSON().toString());
	}

}
 
开发者ID:mileschet,项目名称:ripple-marketmaker,代码行数:19,代码来源:RippleAccountOffersPublisher.java

示例5: testSerializedPaymentTransaction

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
@Test
public void testSerializedPaymentTransaction() {
    String expectedSerialization = "120000240000000561D4C44364C5BB00000000000000000000000000005553440000000000B5F762798A53D543A014CAF8B297CFF8F2F937E868400000000000000F73210330E7FC9D56BB25D6893BA3F317AE5BCF33B3291BD63DB32654A313222F7FD0208114B5F762798A53D543A014CAF8B297CFF8F2F937E88314FD94A75318DE40B1D513E6764ECBCB6F1E7056ED";

    IKeyPair kp = Seed.getKeyPair(TestFixtures.master_seed);
    AccountID ac = AccountID.fromKeyPair(kp);

    Payment payment = new Payment();

    payment.put(AccountID.Account, ac);
    payment.put(AccountID.Destination, TestFixtures.bob_account);

    payment.putTranslated(UInt32.Sequence, 5);
    payment.putTranslated(Amount.Fee, "15");
    payment.putTranslated(Blob.SigningPubKey, kp.canonicalPubHex());
    payment.putTranslated(Amount.Amount, "12/USD/" + ac.address);

    assertEquals(expectedSerialization, payment.toHex());
}
 
开发者ID:ripple,项目名称:ripple-lib-java,代码行数:20,代码来源:STObjectTest.java

示例6: testUINT

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
@Test
public void testUINT() {

    STObject so = STObject.fromJSON("{\"Expiration\" : 21}");
    assertEquals(21, so.get(UInt32.Expiration).longValue());

    byte[] bytes =  (new UInt8 (1)).toBytes();
    byte[] bytes2 = (new UInt16(1)).toBytes();
    byte[] bytes4 = (new UInt32(1)).toBytes();
    byte[] bytes8 = (new UInt64(1)).toBytes();

    assertEquals(bytes.length, 1);
    assertEquals(bytes2.length, 2);
    assertEquals(bytes4.length, 4);
    assertEquals(bytes8.length, 8);
}
 
开发者ID:ripple,项目名称:ripple-lib-java,代码行数:17,代码来源:STObjectTest.java

示例7: onTransactionResult

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void onTransactionResult(TransactionResult tr) {
    log(Level.INFO, "Transaction {0} is validated", tr.hash);
    Map<AccountID, STObject> affected = tr.modifiedRoots();

    if (affected != null) {
        Hash256 transactionHash = tr.hash;
        UInt32 transactionLedgerIndex = tr.ledgerIndex;

        for (Map.Entry<AccountID, STObject> entry : affected.entrySet()) {
            Account account = accounts.get(entry.getKey());
            if (account != null) {
                STObject rootUpdates = entry.getValue();
                account.getAccountRoot()
                        .updateFromTransaction(
                                transactionHash, transactionLedgerIndex, rootUpdates);
            }
        }
    }

    Account initator = accounts.get(tr.initiatingAccount());
    if (initator != null) {
        log(Level.INFO, "Found initiator {0}, notifying transactionManager", initator);
        initator.transactionManager().notifyTransactionResult(tr);
    } else {
        log(Level.INFO, "Can't find initiating account!");
    }
    emit(OnValidatedTransaction.class, tr);
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:29,代码来源:Client.java

示例8: updateFromTransaction

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void updateFromTransaction(Hash256 transactionHash, UInt32 transactionLedgerIndex, STObject rootUpdates) {
    // TODO, rethink this
    // If transactionLedgerIndex is higher than current also apply it
    // If we have a direct transaction chain, apply it
    if (!updated  || PreviousTxnID.equals(rootUpdates.get(Hash256.PreviousTxnID))) {
        setFromSTObject(rootUpdates.get(STObject.FinalFields));
        PreviousTxnID = transactionHash;
        PreviousTxnLgrSeq = transactionLedgerIndex;
    } else {
        logger.fine("hrmmm .... "); // We should keep track of these and try and form a chain
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:13,代码来源:TrackedAccountRoot.java

示例9: setUnfundedAccount

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void setUnfundedAccount(AccountID account) {
    Account = account;
    Balance = Amount.fromString("0");
    Sequence = new UInt32(1);
    OwnerCount = new UInt32(0);
    Flags = new UInt32(0);
    PreviousTxnID = new Hash256(new byte[32]);
    PreviousTxnLgrSeq = new UInt32(0);

    notifyUpdate();
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:12,代码来源:TrackedAccountRoot.java

示例10: setFromSTObject

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void setFromSTObject(STObject so) {

        if (so.has(AccountID.Account))         Account            = so.get(AccountID.Account);
        if (so.has(Amount.Balance))            Balance            = so.get(Amount.Balance);
        if (so.has(UInt32.Sequence))           Sequence           = so.get(UInt32.Sequence);
        if (so.has(UInt32.OwnerCount))         OwnerCount         = so.get(UInt32.OwnerCount);
        if (so.has(UInt32.Flags))              Flags              = so.get(UInt32.Flags);
        if (so.has(Hash256.PreviousTxnID))     PreviousTxnID      = so.get(Hash256.PreviousTxnID);
        if (so.has(UInt32.PreviousTxnLgrSeq))  PreviousTxnLgrSeq  = so.get(UInt32.PreviousTxnLgrSeq);

        notifyUpdate();
    }
 
开发者ID:cping,项目名称:RipplePower,代码行数:13,代码来源:TrackedAccountRoot.java

示例11: locallyPreemptedSubmissionSequence

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private UInt32 locallyPreemptedSubmissionSequence() {
    if (!accountRoot.primed()) {
        throw new IllegalStateException("The AccountRoot hasn't been populated from the server");
    }
    long server = accountRoot.Sequence.longValue();
    if (server > sequence) {
        sequence = server;
    }
    return new UInt32(sequence++);
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:11,代码来源:TransactionManager.java

示例12: resubmitGreaterThan

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private void resubmitGreaterThan(UInt32 submitSequence) {
    for (ManagedTxn txn : getPending()) {
        if (txn.sequence().compareTo(submitSequence) == 1) {
            resubmitWithSameSequence(txn);
        }
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:8,代码来源:TransactionManager.java

示例13: resubmitFirstTransactionWithTakenSequence

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private void resubmitFirstTransactionWithTakenSequence(UInt32 sequence) {
    for (ManagedTxn txn : getPending()) {
        if (txn.sequence().compareTo(sequence) == 0) {
            resubmitWithNewSequence(txn);
            break;
        }
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:9,代码来源:TransactionManager.java

示例14: resubmitWithNewSequence

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
private void resubmitWithNewSequence(final ManagedTxn txn) {
    // A sequence plug's sole purpose is to plug a Sequence
    // so that transactions may clear.
    if (txn.isSequencePlug()) {
        // The sequence has already been plugged (somehow)
        // So:
        return; // without further ado.
    }

    // ONLY ONLY ONLY if we've actually seen the Sequence
    if (txnNotFinalizedAndSeenValidatedSequence(txn)) {
        resubmit(txn, locallyPreemptedSubmissionSequence());
    } else {
        // requesting account_tx now and then (as we do) should ensure that
        // this doesn't stall forever. We'll either finalize the transaction
        // or Sequence will be seen to have been consumed by another txn.
        on(OnValidatedSequence.class,
            new CallbackContext() {
                @Override
                public boolean shouldExecute() {
                    return !txn.isFinalized();
                }

                @Override
                public boolean shouldRemove() {
                    return txn.isFinalized();
                }
            },
            new OnValidatedSequence() {
                @Override
                public void called(UInt32 uInt32) {
                    // Again, just to be safe.
                    if (txnNotFinalizedAndSeenValidatedSequence(txn)) {
                        resubmit(txn, locallyPreemptedSubmissionSequence());
                    }
                }
        });
    }
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:40,代码来源:TransactionManager.java

示例15: trackSubmitRequest

import com.ripple.core.coretypes.uint.UInt32; //导入依赖的package包/类
public void trackSubmitRequest(Request submitRequest, long ledger_index) {
    Submission submission = new Submission(submitRequest,
                                           sequence(),
                                           hash,
                                           ledger_index,
                                           txn.get(Amount.Fee),
                                           txn.get(UInt32.LastLedgerSequence));
    submissions.add(submission);
    trackSubmittedID();
}
 
开发者ID:cping,项目名称:RipplePower,代码行数:11,代码来源:ManagedTxn.java


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