mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-12 10:15:52 +00:00
JavaDoc: Fix HTML structure.
This commit is contained in:
parent
bdfc1b3716
commit
fa5bdbb672
@ -36,7 +36,7 @@ import static org.bitcoinj.core.Sha256Hash.*;
|
||||
* It records a set of {@link Transaction}s together with some data that links it into a place in the global block
|
||||
* chain, and proves that a difficult calculation was done over its contents. See
|
||||
* <a href="http://www.bitcoin.org/bitcoin.pdf">the Bitcoin technical paper</a> for
|
||||
* more detail on blocks. <p/>
|
||||
* more detail on blocks.</p>
|
||||
*
|
||||
* <p>To get a block, you can either build one from the raw bytes you can get from another implementation, or request one
|
||||
* specifically using {@link Peer#getBlock(Sha256Hash)}, or grab one from a downloaded {@link BlockChain}.</p>
|
||||
|
@ -116,13 +116,9 @@ public final class Coin implements Monetary, Comparable<Coin>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Parses an amount expressed in the way humans are used to.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".
|
||||
* </p>
|
||||
* <p>Parses an amount expressed in the way humans are used to.</p>
|
||||
* <p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".</p>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if you try to specify fractional satoshis, or a value out of range.
|
||||
@ -137,13 +133,9 @@ public final class Coin implements Monetary, Comparable<Coin>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Parses an amount expressed in the way humans are used to. The amount is cut to satoshi precision.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".
|
||||
* <p/>
|
||||
* <p>Parses an amount expressed in the way humans are used to. The amount is cut to satoshi precision.</p>
|
||||
* <p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".</p>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if you try to specify a value out of range.
|
||||
|
@ -136,7 +136,7 @@ public abstract class Message {
|
||||
|
||||
/**
|
||||
* <p>To be called before any change of internal values including any setters. This ensures any cached byte array is
|
||||
* removed.<p/>
|
||||
* removed.</p>
|
||||
* <p>Child messages of this object(e.g. Transactions belonging to a Block) will not have their internal byte caches
|
||||
* invalidated unless they are also modified internally.</p>
|
||||
*/
|
||||
@ -186,19 +186,20 @@ public abstract class Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize this message to a byte array that conforms to the bitcoin wire protocol.
|
||||
* <br/>
|
||||
* This method may return the original byte array used to construct this message if the
|
||||
* following conditions are met:
|
||||
* <p>Serialize this message to a byte array that conforms to the bitcoin wire protocol.</p>
|
||||
*
|
||||
* <p>This method may return the original byte array used to construct this message if the
|
||||
* following conditions are met:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>1) The message was parsed from a byte array with parseRetain = true</li>
|
||||
* <li>2) The message has not been modified</li>
|
||||
* <li>3) The array had an offset of 0 and no surplus bytes</li>
|
||||
* </ol>
|
||||
*
|
||||
* If condition 3 is not met then an copy of the relevant portion of the array will be returned.
|
||||
* <p>If condition 3 is not met then an copy of the relevant portion of the array will be returned.
|
||||
* Otherwise a full serialize will occur. For this reason you should only use this API if you can guarantee you
|
||||
* will treat the resulting array as read only.
|
||||
* will treat the resulting array as read only.</p>
|
||||
*
|
||||
* @return a byte array owned by this object, do NOT mutate it.
|
||||
*/
|
||||
|
@ -37,7 +37,7 @@ import com.google.common.base.Objects;
|
||||
* depth-first traversal is performed, consuming bits and hashes as they were written during encoding.</p>
|
||||
*
|
||||
* <p>The serialization is fixed and provides a hard guarantee about the encoded size,
|
||||
* <tt>SIZE <= 10 + ceil(32.25*N)</tt> where N represents the number of leaf nodes of the partial tree. N itself
|
||||
* {@code SIZE <= 10 + ceil(32.25*N)} where N represents the number of leaf nodes of the partial tree. N itself
|
||||
* is bounded by:</p>
|
||||
*
|
||||
* <p>
|
||||
@ -45,14 +45,16 @@ import com.google.common.base.Objects;
|
||||
* N <= 1 + matched_transactions*tree_height
|
||||
* </p>
|
||||
*
|
||||
* <p><pre>The serialization format:
|
||||
* <p>The serialization format:</p>
|
||||
* <pre>
|
||||
* - uint32 total_transactions (4 bytes)
|
||||
* - varint number of hashes (1-3 bytes)
|
||||
* - uint256[] hashes in depth-first order (<= 32*N bytes)
|
||||
* - varint number of bytes of flag bits (1-3 bytes)
|
||||
* - byte[] flag bits, packed per 8 in a byte, least significant bit first (<= 2*N-1 bits)
|
||||
* The size constraints follow from this.</pre></p>
|
||||
*
|
||||
* </pre>
|
||||
* <p>The size constraints follow from this.</p>
|
||||
*
|
||||
* <p>Instances of this class are not safe for use by multiple threads.</p>
|
||||
*/
|
||||
public class PartialMerkleTree extends Message {
|
||||
|
@ -1631,9 +1631,9 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the PeerGroup to download only block headers before a certain time and bodies after that. Call this
|
||||
* Tells the {@link PeerGroup} to download only block headers before a certain time and bodies after that. Call this
|
||||
* before starting block chain download.
|
||||
* Do not use a time > NOW - 1 block, as it will break some block download logic.
|
||||
* Do not use a {@code time > NOW - 1} block, as it will break some block download logic.
|
||||
*/
|
||||
public void setFastCatchupTimeSecs(long secondsSinceEpoch) {
|
||||
lock.lock();
|
||||
@ -1908,7 +1908,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
* {@link #waitForPeersOfVersion(int, long)} with zero as the protocol version.
|
||||
*
|
||||
* @param numPeers How many peers to wait for.
|
||||
* @return a future that will be triggered when the number of connected peers >= numPeers
|
||||
* @return a future that will be triggered when the number of connected peers is greater than or equals numPeers
|
||||
*/
|
||||
public ListenableFuture<List<Peer>> waitForPeers(final int numPeers) {
|
||||
return waitForPeersOfVersion(numPeers, 0);
|
||||
@ -1920,7 +1920,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
*
|
||||
* @param numPeers How many peers to wait for.
|
||||
* @param protocolVersion The protocol version the awaited peers must implement (or better).
|
||||
* @return a future that will be triggered when the number of connected peers implementing protocolVersion or higher >= numPeers
|
||||
* @return a future that will be triggered when the number of connected peers implementing protocolVersion or higher is greater than or equals numPeers
|
||||
*/
|
||||
public ListenableFuture<List<Peer>> waitForPeersOfVersion(final int numPeers, final long protocolVersion) {
|
||||
List<Peer> foundPeers = findPeersOfAtLeastVersion(protocolVersion);
|
||||
@ -1963,7 +1963,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
*
|
||||
* @param numPeers How many peers to wait for.
|
||||
* @param mask An integer representing a bit mask that will be ANDed with the peers advertised service masks.
|
||||
* @return a future that will be triggered when the number of connected peers implementing protocolVersion or higher >= numPeers
|
||||
* @return a future that will be triggered when the number of connected peers implementing protocolVersion or higher is greater than or equals numPeers
|
||||
*/
|
||||
public ListenableFuture<List<Peer>> waitForPeersWithServiceMask(final int numPeers, final int mask) {
|
||||
lock.lock();
|
||||
@ -2130,7 +2130,7 @@ public class PeerGroup implements TransactionBroadcaster {
|
||||
* Sets the period between pings for an individual peer. Setting this lower means more accurate and timely ping
|
||||
* times are available via {@link org.bitcoinj.core.Peer#getLastPingTime()} but it increases load on the
|
||||
* remote node. It defaults to {@link PeerGroup#DEFAULT_PING_INTERVAL_MSEC}.
|
||||
* Setting the value to be <= 0 disables pinging entirely, although you can still request one yourself
|
||||
* Setting the value to be smaller or equals 0 disables pinging entirely, although you can still request one yourself
|
||||
* using {@link org.bitcoinj.core.Peer#ping()}.
|
||||
*/
|
||||
public void setPingIntervalMsec(long pingIntervalMsec) {
|
||||
|
@ -33,7 +33,7 @@ public class Ping extends Message {
|
||||
|
||||
/**
|
||||
* Create a Ping with a nonce value.
|
||||
* Only use this if the remote node has a protocol version > 60000
|
||||
* Only use this if the remote node has a protocol version greater than 60000
|
||||
*/
|
||||
public Ping(long nonce) {
|
||||
this.nonce = nonce;
|
||||
@ -42,7 +42,7 @@ public class Ping extends Message {
|
||||
|
||||
/**
|
||||
* Create a Ping without a nonce value.
|
||||
* Only use this if the remote node has a protocol version <= 60000
|
||||
* Only use this if the remote node has a protocol version lower than or equal 60000
|
||||
*/
|
||||
public Ping() {
|
||||
this.hasNonce = false;
|
||||
|
@ -32,7 +32,7 @@ public class Pong extends Message {
|
||||
|
||||
/**
|
||||
* Create a Pong with a nonce value.
|
||||
* Only use this if the remote node has a protocol version > 60000
|
||||
* Only use this if the remote node has a protocol version greater than 60000
|
||||
*/
|
||||
public Pong(long nonce) {
|
||||
this.nonce = nonce;
|
||||
|
@ -27,22 +27,20 @@ import org.bitcoinj.script.Script.ScriptType;
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Implementation of native segwit addresses. They are composed of two parts:
|
||||
* <p>Implementation of native segwit addresses. They are composed of two parts:</p>
|
||||
*
|
||||
* <ul>
|
||||
* <li>A human-readable part (HRP) which is a string the specifies the network. See
|
||||
* {@link NetworkParameters#getSegwitAddressHrp()}.</li>
|
||||
* <li>A data part, containing the witness version (encoded as an OP_N operator) and program (encoded by re-arranging
|
||||
* bits into groups of 5).</li>
|
||||
* </ul>
|
||||
* See <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki">BIP173</a> for details.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* However, you don't need to care about the internals. Use {@link #fromBech32(NetworkParameters, String)},
|
||||
*
|
||||
* <p>See <a href="https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki">BIP173</a> for details.</p>
|
||||
*
|
||||
* <p>However, you don't need to care about the internals. Use {@link #fromBech32(NetworkParameters, String)},
|
||||
* {@link #fromHash(NetworkParameters, byte[])} or {@link #fromKey(NetworkParameters, ECKey)} to construct a native
|
||||
* segwit address.
|
||||
* </p>
|
||||
* segwit address.</p>
|
||||
*/
|
||||
public class SegwitAddress extends Address {
|
||||
public static final int WITNESS_PROGRAM_LENGTH_PKH = 20;
|
||||
|
@ -306,7 +306,7 @@ public class TransactionInput extends ChildMessage {
|
||||
* Connecting means updating the internal pointers and spent flags. If the mode is to ABORT_ON_CONFLICT then
|
||||
* the spent output won't be changed, but the outpoint.fromTx pointer will still be updated.
|
||||
*
|
||||
* @param transactions Map of txhash->transaction.
|
||||
* @param transactions Map of txhash to transaction.
|
||||
* @param mode Whether to abort if there's a pre-existing connection or not.
|
||||
* @return NO_SUCH_TX if the prevtx wasn't found, ALREADY_SPENT if there was a conflict, SUCCESS if not.
|
||||
*/
|
||||
|
@ -21,12 +21,12 @@ import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* An unsynchronized implementation of ByteArrayOutputStream that will return the backing byte array if its length == size().
|
||||
* <p>An unsynchronized implementation of ByteArrayOutputStream that will return the backing byte array if its length == size().
|
||||
* This avoids unneeded array copy where the BOS is simply being used to extract a byte array of known length from a
|
||||
* 'serialized to stream' method.
|
||||
* <p/>
|
||||
* Unless the final length can be accurately predicted the only performance this will yield is due to unsynchronized
|
||||
* methods.
|
||||
* 'serialized to stream' method.</p>
|
||||
*
|
||||
* <p>Unless the final length can be accurately predicted the only performance this will yield is due to unsynchronized
|
||||
* methods.</p>
|
||||
*
|
||||
* @author git
|
||||
*/
|
||||
|
@ -240,21 +240,21 @@ public class VersionMessage extends Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the given user-agent information to the subVer field. The subVer is composed of a series of
|
||||
* <p>Appends the given user-agent information to the subVer field. The subVer is composed of a series of
|
||||
* name:version pairs separated by slashes in the form of a path. For example a typical subVer field for bitcoinj
|
||||
* users might look like "/bitcoinj:0.13/MultiBit:1.2/" where libraries come further to the left.<p>
|
||||
* users might look like "/bitcoinj:0.13/MultiBit:1.2/" where libraries come further to the left.</p>
|
||||
*
|
||||
* There can be as many components as you feel a need for, and the version string can be anything, but it is
|
||||
* <p>There can be as many components as you feel a need for, and the version string can be anything, but it is
|
||||
* recommended to use A.B.C where A = major, B = minor and C = revision for software releases, and dates for
|
||||
* auto-generated source repository snapshots. A valid subVer begins and ends with a slash, therefore name
|
||||
* and version are not allowed to contain such characters. <p>
|
||||
* and version are not allowed to contain such characters.</p>
|
||||
*
|
||||
* Anything put in the "comments" field will appear in brackets and may be used for platform info, or anything
|
||||
* <p>Anything put in the "comments" field will appear in brackets and may be used for platform info, or anything
|
||||
* else. For example, calling <tt>appendToSubVer("MultiBit", "1.0", "Windows")</tt> will result in a subVer being
|
||||
* set of "/bitcoinj:1.0/MultiBit:1.0(Windows)/". Therefore the / ( and ) characters are reserved in all these
|
||||
* components. If you don't want to add a comment (recommended), pass null.<p>
|
||||
* components. If you don't want to add a comment (recommended), pass null.</p>
|
||||
*
|
||||
* See <a href="https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki">BIP 14</a> for more information.
|
||||
* <p>See <a href="https://github.com/bitcoin/bips/blob/master/bip-0014.mediawiki">BIP 14</a> for more information.</p>
|
||||
*
|
||||
* @param comments Optional (can be null) platform or other node specific information.
|
||||
* @throws IllegalArgumentException if name, version or comments contains invalid characters.
|
||||
@ -276,14 +276,16 @@ public class VersionMessage extends Message {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the clientVersion field is >= Pong.MIN_PROTOCOL_VERSION. If it is then ping() is usable.
|
||||
* Returns true if the clientVersion field is {@link NetworkParameters.ProtocolVersion#PONG} or higher.
|
||||
* If it is then {@link Peer#ping()} is usable.
|
||||
*/
|
||||
public boolean isPingPongSupported() {
|
||||
return clientVersion >= params.getProtocolVersionNum(NetworkParameters.ProtocolVersion.PONG);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the clientVersion field is >= FilteredBlock.MIN_PROTOCOL_VERSION. If it is then Bloom filtering
|
||||
* Returns true if the clientVersion field is {@link NetworkParameters.ProtocolVersion#BLOOM_FILTER} or higher.
|
||||
* If it is then Bloom filtering
|
||||
* is available and the memory pool of the remote peer will be queried when the downloadData property is true.
|
||||
*/
|
||||
public boolean isBloomFilteringSupported() {
|
||||
|
@ -57,8 +57,8 @@ public final class HDKeyDerivation {
|
||||
* broken by attackers (this is not theoretical, people have had money stolen that way). This method checks
|
||||
* that the given seed is at least 64 bits long.
|
||||
*
|
||||
* @throws HDDerivationException if generated master key is invalid (private key 0 or >= n).
|
||||
* @throws IllegalArgumentException if the seed is less than 8 bytes and could be brute forced.
|
||||
* @throws HDDerivationException if generated master key is invalid (private key not between 0 and n inclusive)
|
||||
* @throws IllegalArgumentException if the seed is less than 8 bytes and could be brute forced
|
||||
*/
|
||||
public static DeterministicKey createMasterPrivateKey(byte[] seed) throws HDDerivationException {
|
||||
checkArgument(seed.length > 8, "Seed is too short and could be brute forced");
|
||||
@ -79,7 +79,7 @@ public final class HDKeyDerivation {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws HDDerivationException if privKeyBytes is invalid (0 or >= n).
|
||||
* @throws HDDerivationException if privKeyBytes is invalid (not between 0 and n inclusive).
|
||||
*/
|
||||
public static DeterministicKey createMasterPrivKeyFromBytes(byte[] privKeyBytes, byte[] chainCode)
|
||||
throws HDDerivationException {
|
||||
@ -88,7 +88,7 @@ public final class HDKeyDerivation {
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws HDDerivationException if privKeyBytes is invalid (0 or >= n).
|
||||
* @throws HDDerivationException if privKeyBytes is invalid (not between 0 and n inclusive).
|
||||
*/
|
||||
public static DeterministicKey createMasterPrivKeyFromBytes(byte[] privKeyBytes, byte[] chainCode,
|
||||
ImmutableList<ChildNumber> childNumberPath) throws HDDerivationException {
|
||||
|
@ -145,7 +145,7 @@ public class ScriptBuilder {
|
||||
}
|
||||
|
||||
/** Adds the given number as a push data chunk.
|
||||
* This is intended to use for negative numbers or values > 16, and although
|
||||
* This is intended to use for negative numbers or values greater than 16, and although
|
||||
* it will accept numbers in the range 0-16 inclusive, the encoding would be
|
||||
* considered non-standard.
|
||||
*
|
||||
@ -169,7 +169,7 @@ public class ScriptBuilder {
|
||||
|
||||
/**
|
||||
* Adds the given number as a push data chunk to the given index in the program.
|
||||
* This is intended to use for negative numbers or values > 16, and although
|
||||
* This is intended to use for negative numbers or values greater than 16, and although
|
||||
* it will accept numbers in the range 0-16 inclusive, the encoding would be
|
||||
* considered non-standard.
|
||||
*
|
||||
|
@ -31,8 +31,8 @@ import static org.bitcoinj.script.ScriptOpCodes.*;
|
||||
*/
|
||||
public class ScriptPattern {
|
||||
/**
|
||||
* Returns true if this script is of the form DUP HASH160 <pubkey hash> EQUALVERIFY CHECKSIG, ie, payment to an
|
||||
* address like 1VayNert3x1KzbpzMGt2qdqrAThiRovi8. This form was originally intended for the case where you wish
|
||||
* Returns true if this script is of the form {@code DUP HASH160 <pubkey hash> EQUALVERIFY CHECKSIG}, ie, payment to an
|
||||
* address like {@code 1VayNert3x1KzbpzMGt2qdqrAThiRovi8}. This form was originally intended for the case where you wish
|
||||
* to send somebody money with a written code because their node is offline, but over time has become the standard
|
||||
* way to make payments due to the short and recognizable base58 form addresses come in.
|
||||
*/
|
||||
@ -80,7 +80,7 @@ public class ScriptPattern {
|
||||
// template, not the logical program structure. Thus you can have two programs that look identical when
|
||||
// printed out but one is a P2SH script and the other isn't! :(
|
||||
// We explicitly test that the op code used to load the 20 bytes is 0x14 and not something logically
|
||||
// equivalent like OP_HASH160 OP_PUSHDATA1 0x14 <20 bytes of script hash> OP_EQUAL
|
||||
// equivalent like {@code OP_HASH160 OP_PUSHDATA1 0x14 <20 bytes of script hash> OP_EQUAL}
|
||||
if (chunks.size() != 3)
|
||||
return false;
|
||||
if (!chunks.get(0).equalsOpCode(OP_HASH160))
|
||||
@ -107,7 +107,7 @@ public class ScriptPattern {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this script is of the form <pubkey> OP_CHECKSIG. This form was originally intended for transactions
|
||||
* Returns true if this script is of the form {@code <pubkey> OP_CHECKSIG}. This form was originally intended for transactions
|
||||
* where the peers talked to each other directly via TCP/IP, but has fallen out of favor with time due to that mode
|
||||
* of operation being susceptible to man-in-the-middle attacks. It is still used in coinbase outputs and can be
|
||||
* useful more exotic types of transaction, but today most payments are to addresses.
|
||||
@ -138,7 +138,7 @@ public class ScriptPattern {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this script is of the form OP_0 <hash>. This can either be a P2WPKH or P2WSH scriptPubKey. These
|
||||
* Returns true if this script is of the form {@code OP_0 <hash>}. This can either be a P2WPKH or P2WSH scriptPubKey. These
|
||||
* two script types were introduced with segwit.
|
||||
*/
|
||||
public static boolean isPayToWitnessHash(Script script) {
|
||||
@ -157,7 +157,7 @@ public class ScriptPattern {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this script is of the form OP_0 <hash> and hash is 20 bytes long. This can only be a P2WPKH
|
||||
* Returns true if this script is of the form {@code OP_0 <hash>} and hash is 20 bytes long. This can only be a P2WPKH
|
||||
* scriptPubKey. This script type was introduced with segwit.
|
||||
*/
|
||||
public static boolean isPayToWitnessPubKeyHash(Script script) {
|
||||
@ -171,7 +171,7 @@ public class ScriptPattern {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this script is of the form OP_0 <hash> and hash is 32 bytes long. This can only be a P2WSH
|
||||
* Returns true if this script is of the form {@code OP_0 <hash>} and hash is 32 bytes long. This can only be a P2WSH
|
||||
* scriptPubKey. This script type was introduced with segwit.
|
||||
*/
|
||||
public static boolean isPayToWitnessScriptHash(Script script) {
|
||||
@ -194,7 +194,8 @@ public class ScriptPattern {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether this script matches the format used for multisig outputs: [n] [keys...] [m] CHECKMULTISIG
|
||||
* Returns whether this script matches the format used for multisig outputs:
|
||||
* {@code [n] [keys...] [m] CHECKMULTISIG}
|
||||
*/
|
||||
public static boolean isSentToMultisig(Script script) {
|
||||
List<ScriptChunk> chunks = script.chunks;
|
||||
|
@ -37,20 +37,17 @@ import java.util.*;
|
||||
* <p>A generic full pruned block store for a relational database. This generic class requires
|
||||
* certain table structures for the block store.</p>
|
||||
*
|
||||
* <p>The following are the tables and field names/types that are assumed:-</p>
|
||||
* <p>The following are the tables and field names/types that are assumed:</p>
|
||||
*
|
||||
* <p>
|
||||
* <b>setting</b> table
|
||||
* <table>
|
||||
* <caption><b>setting</b> table</caption>
|
||||
* <tr><th>Field Name</th><th>Type (generic)</th></tr>
|
||||
* <tr><td>name</td><td>string</td></tr>
|
||||
* <tr><td>value</td><td>binary</td></tr>
|
||||
* </table>
|
||||
* </p>
|
||||
*
|
||||
* <p><br/>
|
||||
* <b>headers</b> table
|
||||
* <table>
|
||||
* <caption><b>headers</b> table</caption>
|
||||
* <tr><th>Field Name</th><th>Type (generic)</th></tr>
|
||||
* <tr><td>hash</td><td>binary</td></tr>
|
||||
* <tr><td>chainwork</td><td>binary</td></tr>
|
||||
@ -58,22 +55,18 @@ import java.util.*;
|
||||
* <tr><td>header</td><td>binary</td></tr>
|
||||
* <tr><td>wasundoable</td><td>boolean</td></tr>
|
||||
* </table>
|
||||
* </p>
|
||||
*
|
||||
* <p><br/>
|
||||
* <b>undoableblocks</b> table
|
||||
* <table>
|
||||
* <caption><b>undoableblocks</b> table</caption>
|
||||
* <tr><th>Field Name</th><th>Type (generic)</th></tr>
|
||||
* <tr><td>hash</td><td>binary</td></tr>
|
||||
* <tr><td>height</td><td>integer</td></tr>
|
||||
* <tr><td>txoutchanges</td><td>binary</td></tr>
|
||||
* <tr><td>transactions</td><td>binary</td></tr>
|
||||
* </table>
|
||||
* </p>
|
||||
*
|
||||
* <p><br/>
|
||||
* <b>openoutputs</b> table
|
||||
* <table>
|
||||
* <caption><b>openoutputs</b> table</caption>
|
||||
* <tr><th>Field Name</th><th>Type (generic)</th></tr>
|
||||
* <tr><td>hash</td><td>binary</td></tr>
|
||||
* <tr><td>index</td><td>integer</td></tr>
|
||||
@ -84,8 +77,6 @@ import java.util.*;
|
||||
* <tr><td>addresstargetable</td><td>integer</td></tr>
|
||||
* <tr><td>coinbase</td><td>boolean</td></tr>
|
||||
* </table>
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
public abstract class DatabaseFullPrunedBlockStore implements FullPrunedBlockStore {
|
||||
private static final Logger log = LoggerFactory.getLogger(DatabaseFullPrunedBlockStore.class);
|
||||
|
@ -32,7 +32,7 @@ import org.bitcoinj.core.*;
|
||||
*
|
||||
* <p>It should store the {@link StoredUndoableBlock}s of a number of recent blocks before verifiedHead.height and
|
||||
* all those after verifiedHead.height.
|
||||
* It is advisable to store any {@link StoredUndoableBlock} which has a height > verifiedHead.height - N.
|
||||
* It is advisable to store any {@link StoredUndoableBlock} which has a {@code height > verifiedHead.height - N}.
|
||||
* Because N determines the memory usage, it is recommended that N be customizable. N should be chosen such that
|
||||
* re-orgs beyond that point are vanishingly unlikely, for example, a few thousand blocks is a reasonable choice.</p>
|
||||
*
|
||||
|
@ -39,11 +39,13 @@ import java.util.NoSuchElementException;
|
||||
* <p>In order to comply with {@link Iterator}, this class swallows a lot of {@link IOException}s, which may result in a few
|
||||
* blocks being missed followed by a huge set of orphan blocks.</p>
|
||||
*
|
||||
* <p>To blindly import all files which can be found in Bitcoin Core (version >= 0.8) datadir automatically,
|
||||
* try this code fragment:<br>
|
||||
* BlockFileLoader loader = new BlockFileLoader(BlockFileLoader.getReferenceClientBlockFileList());<br>
|
||||
* for (Block block : loader) {<br>
|
||||
* try { chain.add(block); } catch (Exception e) { }<br>
|
||||
* <p>To blindly import all files which can be found in Bitcoin Core (version 0.8 or higher) datadir automatically,
|
||||
* try this code fragment:
|
||||
* {@code
|
||||
* BlockFileLoader loader = new BlockFileLoader(BlockFileLoader.getReferenceClientBlockFileList());
|
||||
* for (Block block : loader) {
|
||||
* try { chain.add(block); } catch (Exception e) { }
|
||||
* }
|
||||
* }</p>
|
||||
*/
|
||||
public class BlockFileLoader implements Iterable<Block>, Iterator<Block> {
|
||||
|
@ -28,16 +28,17 @@ import java.util.List;
|
||||
/**
|
||||
* <p>This class, a concrete extension of {@link BtcFormat}, is distinguished in that each
|
||||
* instance formats and by-default parses all Bitcoin monetary values in units of a single
|
||||
* denomination that is specified at the time that instance is constructed.
|
||||
* denomination that is specified at the time that instance is constructed.</p>
|
||||
*
|
||||
* <p>By default, neither currency codes nor symbols are included in formatted values as
|
||||
* output, nor recognized in parsed values as input. The can be overridden by applying a
|
||||
* custom pattern using either the {@link BtcFormat.Builder#localizedPattern} or {@link BtcFormat.Builder#localizedPattern} methods, as described in the documentation for the {@link BtcFormat.Builder}
|
||||
* class.<ol>
|
||||
* custom pattern using either the {@link BtcFormat.Builder#localizedPattern} or
|
||||
* {@link BtcFormat.Builder#localizedPattern} methods, as described in the documentation for
|
||||
* the {@link BtcFormat.Builder} class.</p>
|
||||
*
|
||||
* <p>A more detailed explanation, including examples, is in the documentation for the
|
||||
* {@link BtcFormat} class, and further information beyond that is in the documentation for the
|
||||
* {@link java.text.Format} class, from which this class descends.
|
||||
* {@link java.text.Format} class, from which this class descends.</p>
|
||||
|
||||
* @see java.text.Format
|
||||
* @see java.text.NumberFormat
|
||||
|
@ -48,13 +48,15 @@ import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <p>Instances of this class format and parse locale-specific numerical
|
||||
* representations of Bitcoin monetary values.
|
||||
* representations of Bitcoin monetary values.</p>
|
||||
*
|
||||
* <p>A primary goal of this class is to minimize the danger of
|
||||
* human-misreading of monetary values due to mis-counting the number
|
||||
* of zeros (or, more generally, of decimal places) in the number that
|
||||
* represents a Bitcoin monetary value. Some of the features offered for doing this
|
||||
* are: <ol>
|
||||
* are:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>automatic adjustment of denominational units in which a
|
||||
* value is represented so as to lessen the number of adjacent zeros,
|
||||
* <li>use of locale-specific decimal-separators to group digits in
|
||||
@ -65,7 +67,9 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* <h3>Basic Usage</h3>
|
||||
*
|
||||
* Basic usage is very simple: <ol>
|
||||
* <p>Basic usage is very simple:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>Construct a new formatter object using one of the factory methods.
|
||||
* <li>Format a value by passing it as an argument to the
|
||||
* {@link BtcFormat#format(Object)} method.
|
||||
@ -73,7 +77,7 @@ import java.util.regex.Pattern;
|
||||
* representation of it to the {@link BtcFormat#parse(String)} method.</ol>
|
||||
*
|
||||
* <p>For example, depending on your locale, values might be formatted
|
||||
* and parsed as follows:
|
||||
* and parsed as follows:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat f = BtcFormat.getInstance();
|
||||
@ -85,13 +89,13 @@ import java.util.regex.Pattern;
|
||||
*
|
||||
* <h3>Auto-Denomination versus Fixed-Denomination</h3>
|
||||
*
|
||||
* There are two provided concrete classes, one that automatically denominates values to
|
||||
* <p>There are two provided concrete classes, one that automatically denominates values to
|
||||
* be formatted, {@link BtcAutoFormat}, and another that formats any value in units of a
|
||||
* fixed, specified denomination, {@link BtcFixedFormat}.
|
||||
* fixed, specified denomination, {@link BtcFixedFormat}.</p>
|
||||
*
|
||||
* <h5>Automatic Denomination</h5>
|
||||
* <h4>Automatic Denomination</h4>
|
||||
*
|
||||
* Automatic denomination means that the formatter adjusts the denominational units in which a
|
||||
* <p>Automatic denomination means that the formatter adjusts the denominational units in which a
|
||||
* formatted number is expressed based on the monetary value that number represents. An
|
||||
* auto-denominating formatter is defined by its style, specified by one of the enumerated
|
||||
* values of {@link BtcAutoFormat.Style}. There are two styles constants: {@link
|
||||
@ -99,28 +103,30 @@ import java.util.regex.Pattern;
|
||||
* difference is that the {@code CODE} style uses an internationally-distinct currency
|
||||
* code, such as {@code "BTC"}, to indicate the units of denomination, while the
|
||||
* {@code SYMBOL} style uses a possibly-ambiguous currency symbol such as
|
||||
* {@code "฿"}.
|
||||
* {@code "฿"}.</p>
|
||||
*
|
||||
* <p>The denomination used when formatting will be either bitcoin, millicoin
|
||||
* or microcoin, depending on the value being represented, chosen so as to minimize the number
|
||||
* of consecutive zeros displayed without losing precision. For example, depending on the
|
||||
* locale, a value of one bitcoin might be formatted as <pre>฿1.00</pre> where a value
|
||||
* exceeding that by one satoshi would be <pre>µ฿1,000,000.01</pre>
|
||||
* locale, a value of one bitcoin might be formatted as {@code ฿1.00} where a value
|
||||
* exceeding that by one satoshi would be {@code µ฿1,000,000.01}</p>
|
||||
*
|
||||
* <h5>Fixed Denomination</h5>
|
||||
* <h4>Fixed Denomination</h4>
|
||||
*
|
||||
* Fixed denomination means that the same denomination of units is used for every value that is
|
||||
* <p>Fixed denomination means that the same denomination of units is used for every value that is
|
||||
* formatted or parsed by a given formatter instance. A fixed-denomination formatter is
|
||||
* defined by its scale, which is the number of places one must shift the decimal point in
|
||||
* increasing precision to convert the representation of a given quantity of bitcoins into a
|
||||
* representation of the same value denominated in the formatter's units. For example, a scale
|
||||
* value of {@code 3} specifies a denomination of millibitcoins, because to represent
|
||||
* {@code 1.0000 BTC}, or one bitcoin, in millibitcoins, one shifts the decimal point
|
||||
* three places, that is, to {@code 1000.0 mBTC}.
|
||||
* three places, that is, to {@code 1000.0 mBTC}.</p>
|
||||
*
|
||||
* <h3>Construction</h3>
|
||||
*
|
||||
* There are two ways to obtain an instance of this class: <ol>
|
||||
* <p>There are two ways to obtain an instance of this class:</p>
|
||||
*
|
||||
* <ol>
|
||||
* <li>Use one of the factory methods; or
|
||||
* <li>Use a {@link BtcFormat.Builder} object.</ol>
|
||||
*
|
||||
@ -128,15 +134,15 @@ import java.util.regex.Pattern;
|
||||
* configuration is either used or modified. The {@link Builder}
|
||||
* class provides more control over the configuration, and gives
|
||||
* access to some features not available through the factory methods,
|
||||
* such as using custom formatting patterns and currency symbols.
|
||||
* such as using custom formatting patterns and currency symbols.</p>
|
||||
*
|
||||
* <h5>Factory Methods</h5>
|
||||
* <h4>Factory Methods</h4>
|
||||
*
|
||||
* Although formatting and parsing is performed by one of the concrete
|
||||
* <p>Although formatting and parsing is performed by one of the concrete
|
||||
* subclasses, you can obtain formatters using the various static factory
|
||||
* methods of this abstract base class {@link BtcFormat}. There
|
||||
* are a variety of overloaded methods that allow you to obtain a
|
||||
* formatter that behaves according to your needs.
|
||||
* formatter that behaves according to your needs.</p>
|
||||
*
|
||||
* <p>The primary distinction is between automatic- and
|
||||
* fixed-denomination formatters. By default, the
|
||||
@ -144,7 +150,7 @@ import java.util.regex.Pattern;
|
||||
* automatic-denominating {@link BtcAutoFormat} instance for your
|
||||
* default locale that will display exactly two fractional decimal
|
||||
* places and a currency code. For example, if you happen to be in
|
||||
* the USA:
|
||||
* the USA:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat f = BtcFormat.getInstance();
|
||||
@ -157,13 +163,13 @@ import java.util.regex.Pattern;
|
||||
* of that {@code int} will be interpreted as the decimal-place scale of
|
||||
* the {@link BtcFixedFormat} instance that is returned, and thus will
|
||||
* determine its denomination. For example, if you want to format
|
||||
* values in units of microbitcoins:
|
||||
* values in units of microbitcoins:</p>
|
||||
*
|
||||
* <blockquote><pre>BtcFormat m = BtcFormat.getInstance(6);
|
||||
*String s = m.format(Coin.COIN); <strong>// "1,000,000.00"</strong>
|
||||
* </blockquote>
|
||||
* String s = m.format(Coin.COIN); <strong>// "1,000,000.00"</strong>
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p>This class provides several constants bound to common scale values:
|
||||
* <p>This class provides several constants bound to common scale values:</p>
|
||||
*
|
||||
* <blockquote><pre>BtcFormat milliFormat = BtcFormat.getInstance(MILLICOIN_SCALE);</pre></blockquote>
|
||||
*
|
||||
@ -172,14 +178,14 @@ import java.util.regex.Pattern;
|
||||
* {@link BtcAutoFormat.Style} type, either {@link BtcAutoFormat.Style#CODE} or
|
||||
* {@link BtcAutoFormat.Style#SYMBOL}, then you will get a {@link BtcAutoFormat}
|
||||
* instance that uses either a currency code or symbol, respectively,
|
||||
* to indicate the results of its auto-denomination.
|
||||
* to indicate the results of its auto-denomination.</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat s = BtcFormat.getInstance(SYMBOL);
|
||||
* Coin value = Coin.parseCoin("0.1234");
|
||||
* String mil = s.format(value); <strong>// "₥฿123.40"</strong>
|
||||
* String mic = s.format(value.divide(1000)); <strong>// "µ฿123.40"</strong>
|
||||
* </blockquote>
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p>An alternative way to specify whether you want an auto- or fixed-denomination formatter
|
||||
* is to use one of the factory methods that is named to indicate that characteristics of the
|
||||
@ -189,14 +195,14 @@ import java.util.regex.Pattern;
|
||||
* {@code 0}, {@code 3} and {@code 6}, respectively. For auto-denominating
|
||||
* formatters the relevant factory methods are {@link #getCodeInstance()} and {@link
|
||||
* #getSymbolInstance()}, which are equivalent to {@code getInstance(Style.CODE)}, and
|
||||
* {@code getInstance(Style.SYMBOL)}.
|
||||
* {@code getInstance(Style.SYMBOL)}.</p>
|
||||
*
|
||||
* <p>Regardless of how you specify whether your new formatter is to be of automatic- or
|
||||
* fixed-denomination, the next (and possibly first) parameter to each of the factory methods
|
||||
* is an optional {@link Locale} value.
|
||||
* is an optional {@link Locale} value.</p>
|
||||
*
|
||||
* For example, here we construct four instances for the same locale that each format
|
||||
* differently the same one-bitcoin value:
|
||||
* <p>For example, here we construct four instances for the same locale that each format
|
||||
* differently the same one-bitcoin value:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* <strong>// Next line returns "1,00 BTC"</strong>
|
||||
@ -209,15 +215,15 @@ import java.util.regex.Pattern;
|
||||
* BtcFormat.getInstance(4, Locale.GERMANY).format(Coin.COIN);
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* Omitting such a {@link Locale} parameter will give you a
|
||||
* formatter for your default locale.
|
||||
* <p>Omitting such a {@link Locale} parameter will give you a
|
||||
* formatter for your default locale.</p>
|
||||
*
|
||||
* <p>The final (and possibly only) arguments to the factory methods serve to set the default
|
||||
* number of fractional decimal places that will be displayed when formatting monetary values.
|
||||
* In the case of an auto-denominating formatter, this can be a single {@code int} value,
|
||||
* which will determine the number of fractional decimal places to be used in all cases, except
|
||||
* where either (1) doing so would provide a place for fractional satoshis, or (2) that default
|
||||
* value is overridden when invoking the {@code format()} method as described below.
|
||||
* value is overridden when invoking the {@code format()} method as described below.</p>
|
||||
*
|
||||
* <p>In the case of a fixed-denomination formatter, you can pass any number of
|
||||
* {@code int} values. The first will determine the minimum number of fractional decimal
|
||||
@ -225,20 +231,20 @@ import java.util.regex.Pattern;
|
||||
* decimal-places to be displayed only if useful for expressing precision. As with auto-denominating
|
||||
* formatters, numbers will never be formatted with a decimal place that represents a
|
||||
* fractional quantity of satoshis, and these defaults can be overridden by arguments to the
|
||||
* {@code format()} method. See below for examples.
|
||||
* {@code format()} method. See below for examples.</p>
|
||||
*
|
||||
* <h5>The {@link Builder} Class</h5>
|
||||
* <h4>The {@link Builder} Class</h4>
|
||||
*
|
||||
* A new {@link BtcFormat.Builder} instance is returned by the {@link #builder()} method. Such
|
||||
* <p>A new {@link BtcFormat.Builder} instance is returned by the {@link #builder()} method. Such
|
||||
* an object has methods that set the configuration parameters of a {@link BtcFormat}
|
||||
* object. Its {@link Builder#build()} method constructs and returns a {@link BtcFormat} instance
|
||||
* configured according to those settings.
|
||||
* configured according to those settings.</p>
|
||||
*
|
||||
* <p>In addition to setter-methods that correspond to the factory-method parameters explained
|
||||
* above, a {@link Builder} also allows you to specify custom formatting and parsing
|
||||
* patterns and currency symbols and codes. For example, rather than using the default
|
||||
* currency symbol, which has the same unicode character point as the national currency symbol of
|
||||
* Thailand, some people prefer to use a capital letter "B" with a vertical overstrike.
|
||||
* Thailand, some people prefer to use a capital letter "B" with a vertical overstrike.</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat.Builder builder = BtcFormat.builder();
|
||||
@ -256,7 +262,7 @@ import java.util.regex.Pattern;
|
||||
* String out = f.format(COIN); <strong>// "XBT 1.00"</strong>
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <p>See the documentation of the {@link BtcFormat.Builder} class for details.
|
||||
* <p>See the documentation of the {@link BtcFormat.Builder} class for details.</p>
|
||||
*
|
||||
* <h3>Formatting</h3>
|
||||
*
|
||||
@ -268,7 +274,7 @@ import java.util.regex.Pattern;
|
||||
* number of bitcoins. A value having a fractional amount of satoshis is rounded to the
|
||||
* nearest whole satoshi at least, and possibly to a greater unit depending on the number of
|
||||
* fractional decimal-places displayed. The {@code format()} method will not accept an
|
||||
* argument whose type is {@link String}, {@link Float} nor {@link Double}.
|
||||
* argument whose type is {@link String}, {@link Float} nor {@link Double}.</p>
|
||||
*
|
||||
* <p>Subsequent to the monetary value to be formatted, the {@link #format(Object)} method also
|
||||
* accepts as arguments optional {@code int} values that specify the number of decimal
|
||||
@ -281,7 +287,7 @@ import java.util.regex.Pattern;
|
||||
* {@link BtcFixedFormat} also accept a variable-length sequence of additional {@code int}
|
||||
* values, each of which specifies the size of a group of fractional decimal-places to be used
|
||||
* in addition to all preceding places, only if useful to express precision, and only to a
|
||||
* maximum precision of satoshis. For example:
|
||||
* maximum precision of satoshis. For example:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat f = BtcFormat.getCoinInstance();
|
||||
@ -298,7 +304,7 @@ import java.util.regex.Pattern;
|
||||
* place to fractions of satoshis, then the size of that group will be reduced to a maximum
|
||||
* precision of satoshis. Either all or none of the allowed decimal places of that group will
|
||||
* still be applied as doing so is useful for expressing the precision of the value being
|
||||
* formatted.
|
||||
* formatted.</p>
|
||||
*
|
||||
* <p>Several convenient constants of repeating group-size sequences are provided:
|
||||
* {@link BtcFixedFormat#REPEATING_PLACES}, {@link
|
||||
@ -307,7 +313,7 @@ import java.util.regex.Pattern;
|
||||
* of one, two and three decimals places, respectively. For example,
|
||||
* to display only as many fractional places as useful in order to
|
||||
* prevent hanging zeros on the least-significant end of formatted
|
||||
* numbers:
|
||||
* numbers:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* format(value, 0, REPEATING_PLACES);
|
||||
@ -318,7 +324,7 @@ import java.util.regex.Pattern;
|
||||
* currency-units indicator, as well as any other field in the
|
||||
* formatted output, by using a {@link java.text.FieldPosition} instance
|
||||
* constructed using an appropriate constant from the {@link
|
||||
* java.text.NumberFormat.Field} class:
|
||||
* java.text.NumberFormat.Field} class:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFormat de = BtcFormat.getInstance(Locale.GERMANY);
|
||||
@ -332,7 +338,7 @@ import java.util.regex.Pattern;
|
||||
* <p>When using a fixed-denomination formatter whose scale can be expressed as a standard
|
||||
* "metric" prefix, you can invoke the {@code code()} and {@code symbol()} methods to
|
||||
* obtain a {@link String} whose value is the appropriate currency code or symbol,
|
||||
* respectively, for that formatter.
|
||||
* respectively, for that formatter.</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* BtcFixedFormat kilo = (BtcFixedFormat)BtcFormat(-3); <strong>// scale -3 for kilocoins</strong>
|
||||
@ -344,11 +350,11 @@ import java.util.regex.Pattern;
|
||||
* BtcFormat(4).code(); <strong>// unnamed denomination has no code; raises exception</strong>
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* <h5>Formatting for Tabular Columns</h5>
|
||||
* <h4>Formatting for Tabular Columns</h4>
|
||||
*
|
||||
* When displaying tables of monetary values, you can lessen the
|
||||
* <p>When displaying tables of monetary values, you can lessen the
|
||||
* risk of human misreading-error by vertically aligning the decimal
|
||||
* separator of those values. This example demonstrates one way to do that:
|
||||
* separator of those values. This example demonstrates one way to do that:</p>
|
||||
*
|
||||
* <blockquote><pre>
|
||||
* <strong>// The elements of this array are the values we will format:</strong>
|
||||
@ -361,12 +367,12 @@ import java.util.regex.Pattern;
|
||||
* String[] output = new String[rows.length];
|
||||
* int[] indexes = new int[rows.length];
|
||||
* int maxIndex = 0;
|
||||
* for (int i = 0; i < rows.length; i++) {
|
||||
* for (int i = 0; i < rows.length; i++) {
|
||||
* output[i] = f.format(rows[i], new StringBuffer(), fp).toString();
|
||||
* indexes[i] = fp.getBeginIndex();
|
||||
* if (indexes[i] > maxIndex) maxIndex = indexes[i];
|
||||
* if (indexes[i] > maxIndex) maxIndex = indexes[i];
|
||||
* }
|
||||
* for (int i = 0; i < output.length; i++) {
|
||||
* for (int i = 0; i < output.length; i++) {
|
||||
* System.out.println(repeat(" ", (maxIndex - indexes[i])) + output[i]);
|
||||
* }
|
||||
* </pre></blockquote>
|
||||
@ -386,9 +392,9 @@ import java.util.regex.Pattern;
|
||||
* 0.00000001
|
||||
* </pre></blockquote>
|
||||
*
|
||||
* If you need to vertically-align columns printed in a proportional font,
|
||||
* <p>If you need to vertically-align columns printed in a proportional font,
|
||||
* then see the documentation for the {@link java.text.NumberFormat} class
|
||||
* for an explanation of how to do that.
|
||||
* for an explanation of how to do that.</p>
|
||||
*
|
||||
* <h3>Parsing</h3>
|
||||
*
|
||||
@ -402,9 +408,9 @@ import java.util.regex.Pattern;
|
||||
* interpret every number as being denominated in the units that were specified when
|
||||
* constructing the instance doing the parsing. This default behavior of {@link
|
||||
* BtcFixedFormat} can be overridden by setting a parsing pattern that includes a currency sign
|
||||
* using the {@link BtcFormat.Builder#pattern()} method.
|
||||
* using the {@link BtcFormat.Builder#pattern()} method.</p>
|
||||
*
|
||||
* <p>The {@link BtcAutoFormat#parse(String)}</code> method of {@link BtcAutoFormat} (and of
|
||||
* <p>The {@link BtcAutoFormat#parse(String)} method of {@link BtcAutoFormat} (and of
|
||||
* {@link BtcAutoFormat} configured with applicable non-default pattern) will recognize a
|
||||
* variety of currency symbols and codes, including all standard international (metric)
|
||||
* prefixes from micro to mega. For example, denominational units of microcoins may be
|
||||
@ -412,7 +418,7 @@ import java.util.regex.Pattern;
|
||||
* {@code µBTC} or other appropriate permutations of those characters. Additionally, if
|
||||
* either or both of a custom currency code or symbol is configured using {@link
|
||||
* BtcFormat.Builder#code} or {@link BtcFormat.Builder#code}, then such code or symbol will
|
||||
* be recognized in addition to those recognized by default..
|
||||
* be recognized in addition to those recognized by default.</p>
|
||||
*
|
||||
* <p>Instances of this class that recognize currency signs will recognize both currency
|
||||
* symbols and codes, regardless of which that instance uses for formatting. However, if the
|
||||
@ -422,42 +428,42 @@ import java.util.regex.Pattern;
|
||||
* be separated by a space from the number is determined by the locale. The {@link
|
||||
* BtcFormat#pattern()} method returns a representation of the pattern that
|
||||
* can be examined to determine whether a space must separate currency signs from numbers in
|
||||
* parsed {@link String}s.
|
||||
* parsed {@link String}s.</p>
|
||||
*
|
||||
* <p>When parsing, if the currency-units indicator is absent, then a {@link BtcAutoFormat}
|
||||
* instance will infer a denomination of bitcoins while a {@link BtcFixedFormat} will infer the
|
||||
* denomination in which it expresses formatted values. Note: by default (unless overridden by
|
||||
* a custom pattern), if the locale or style requires a space to separate the number from the
|
||||
* units indicator, that space must be present in the String to be parsed, even if the units
|
||||
* indicator is absent.
|
||||
* indicator is absent.</p>
|
||||
*
|
||||
* <p>The {@code parse()} method returns an instance of the
|
||||
* {@link Coin} class. Therefore, attempting to parse a value greater
|
||||
* than the maximum that a {@code Coin} object can represent will
|
||||
* raise a {@code ParseException}, as will any other detected
|
||||
* parsing error.
|
||||
* parsing error.</p>
|
||||
*
|
||||
* <h3>Limitations</h3>
|
||||
*
|
||||
* <h5>Parsing</h5>
|
||||
* <h4>Parsing</h4>
|
||||
*
|
||||
* Parsing is performed by an underlying {@link java.text.NumberFormat} object. While this
|
||||
* <p>Parsing is performed by an underlying {@link java.text.NumberFormat} object. While this
|
||||
* delivers the benefit of recognizing locale-specific patterns, some have criticized other
|
||||
* aspects of its behavior. For example, see <a
|
||||
* href="http://www.ibm.com/developerworks/library/j-numberformat/">this article by Joe Sam
|
||||
* Shirah</a>. In particular, explicit positive-signs are not recognized. If you are parsing
|
||||
* input from end-users, then you should consider whether you would benefit from any of the
|
||||
* work-arounds mentioned in that article.
|
||||
* work-arounds mentioned in that article.</p>
|
||||
*
|
||||
* <h5>Exotic Locales</h5>
|
||||
* <h4>Exotic Locales</h4>
|
||||
*
|
||||
* This class is not well-tested in locales that use non-ascii
|
||||
* <p>This class is not well-tested in locales that use non-ascii
|
||||
* character sets, especially those where writing proceeds from
|
||||
* right-to-left. Helpful feedback in that regard is appreciated.
|
||||
* right-to-left. Helpful feedback in that regard is appreciated.</p>
|
||||
*
|
||||
* <h3>Thread-Safety</h3>
|
||||
*
|
||||
* <p>Instances of this class are immutable.
|
||||
* <p>Instances of this class are immutable.</p>
|
||||
*
|
||||
* @see java.text.Format
|
||||
* @see java.text.NumberFormat
|
||||
|
@ -73,13 +73,9 @@ public final class Fiat implements Monetary, Comparable<Fiat>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Parses an amount expressed in the way humans are used to.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".
|
||||
* <p/>
|
||||
* <p>Parses an amount expressed in the way humans are used to.</p>
|
||||
* <p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".</p>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if you try to specify more than 4 digits after the comma, or a value out of range.
|
||||
@ -94,13 +90,9 @@ public final class Fiat implements Monetary, Comparable<Fiat>, Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Parses an amount expressed in the way humans are used to. The amount is cut to 4 digits after the comma.
|
||||
* <p/>
|
||||
* <p>
|
||||
* This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".
|
||||
* <p/>
|
||||
* <p>Parses an amount expressed in the way humans are used to. The amount is cut to 4 digits after the comma.</p>
|
||||
* <p>This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10",
|
||||
* "1.23E3", "1234.5E-5".</p>
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
* if you try to specify a value out of range.
|
||||
|
@ -81,7 +81,7 @@ public class MarriedKeyChain extends DeterministicKeyChain {
|
||||
}
|
||||
|
||||
/**
|
||||
* Threshold, or {@code (followingKeys.size() + 1) / 2 + 1)} (majority) if unspecified.</p>
|
||||
* <p>Threshold, or {@code (followingKeys.size() + 1) / 2 + 1)} (majority) if unspecified.</p>
|
||||
* <p>IMPORTANT: As of Bitcoin Core 0.9 all multisig transactions which require more than 3 public keys are non-standard
|
||||
* and such spends won't be processed by peers with default settings, essentially making such transactions almost
|
||||
* nonspendable</p>
|
||||
|
@ -755,13 +755,13 @@ public class Wallet extends BaseTaggableObject
|
||||
/**
|
||||
* Add a pre-configured keychain to the wallet. Useful for setting up a complex keychain,
|
||||
* such as for a married wallet. For example:
|
||||
* <pre>
|
||||
* {@code
|
||||
* MarriedKeyChain chain = MarriedKeyChain.builder()
|
||||
* .random(new SecureRandom())
|
||||
* .followingKeys(followingKeys)
|
||||
* .threshold(2).build();
|
||||
* wallet.addAndActivateHDChain(chain);
|
||||
* </p>
|
||||
* }
|
||||
*/
|
||||
public void addAndActivateHDChain(DeterministicKeyChain chain) {
|
||||
keyChainGroupLock.lock();
|
||||
@ -1422,7 +1422,7 @@ public class Wallet extends BaseTaggableObject
|
||||
* delayTime. <b>You should still save the wallet manually using {@link Wallet#saveToFile(File)} when your program
|
||||
* is about to shut down as the JVM will not wait for the background thread.</b></p>
|
||||
*
|
||||
* <p>An event listener can be provided. If a delay >0 was specified, it will be called on a background thread
|
||||
* <p>An event listener can be provided. If a delay greater than 0 was specified, it will be called on a background thread
|
||||
* with the wallet locked when an auto-save occurs. If delay is zero or you do something that always triggers
|
||||
* an immediate save, like adding a key, the event listener will be invoked on the calling threads.</p>
|
||||
*
|
||||
@ -2113,7 +2113,6 @@ public class Wallet extends BaseTaggableObject
|
||||
* transactions are extracted and sent to us UNLESS the new block caused a re-org, in which case this will
|
||||
* not be called (the {@link Wallet#reorganize(StoredBlock, java.util.List, java.util.List)} method will
|
||||
* call this one in that case).</p>
|
||||
* <p/>
|
||||
* <p>Used to update confidence data in each transaction and last seen block hash. Triggers auto saving.
|
||||
* Invokes the onWalletChanged event listener if there were any affected transactions.</p>
|
||||
*/
|
||||
@ -2893,12 +2892,11 @@ public class Wallet extends BaseTaggableObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an list of N transactions, ordered by increasing age. Transactions on side chains are not included.
|
||||
* Dead transactions (overridden by double spends) are optionally included. <p>
|
||||
* <p/>
|
||||
* Note: the current implementation is O(num transactions in wallet). Regardless of how many transactions are
|
||||
* <p>Returns an list of N transactions, ordered by increasing age. Transactions on side chains are not included.
|
||||
* Dead transactions (overridden by double spends) are optionally included.</p>
|
||||
* <p>Note: the current implementation is O(num transactions in wallet). Regardless of how many transactions are
|
||||
* requested, the cost is always the same. In future, requesting smaller numbers of transactions may be faster
|
||||
* depending on how the wallet is implemented (eg if backed by a database).
|
||||
* depending on how the wallet is implemented (eg if backed by a database).</p>
|
||||
*/
|
||||
public List<Transaction> getRecentTransactions(int numTransactions, boolean includeDead) {
|
||||
lock.lock();
|
||||
|
@ -28,10 +28,9 @@ import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
|
||||
/**
|
||||
* This interpolator simulates an elastic behavior.
|
||||
* <p/>
|
||||
* The following curve illustrates the interpolation.
|
||||
* </p>
|
||||
* <p>This interpolator simulates an elastic behavior.</p>
|
||||
* <p>The following curve illustrates the interpolation.</p>
|
||||
* {@code
|
||||
* <svg style="width:300px;" xmlns="http://www.w3.org/2000/svg" viewBox="-2 -40 124 140">
|
||||
* <line style="stroke: rgb(187, 187, 187); stroke-width: 1px;" y2="60" y1="0" x2="0" x1="0"/>
|
||||
* <text style="font-size: 12px; fill: rgb(187, 187, 187);" y="6" x="2">x</text>
|
||||
@ -39,10 +38,9 @@ import javafx.beans.property.SimpleDoubleProperty;
|
||||
* <text style="font-size: 12px; fill: rgb(187, 187, 187);" y="57" x="115">t</text>
|
||||
* <path style="fill: rgba(255, 255, 255, 0);stroke: black;stroke-width: 2px;"
|
||||
* d="M0,60 L1.2,54.8 2.4,47.7 3.6,39.4 4.8,30.4 6.0,21.2 7.2,12.2 8.4,3.9 9.6,-3.6 10.8,-9.9 12.0,-15.0 13.2,-18.7 14.4,-21.1 15.6,-22.3 16.8,-22.2 18.0,-21.2 19.2,-19.4 20.4,-16.9 21.6,-13.9 22.8,-10.8 24.0,-7.5 25.2,-4.3 26.4,-1.4 27.6,1.3 28.8,3.5 30.0,5.3 31.2,6.6 32.4,7.5 33.6,7.9 34.8,7.9 36.0,7.5 37.2,6.8 38.4,6.0 39.6,4.9 40.8,3.8 42.0,2.7 43.2,1.5 44.4,0.5 45.6,-0.5 46.8,-1.2 48.0,-1.9 49.2,-2.3 50.4,-2.6 51.6,-2.8 52.8,-2.8 54.0,-2.7 55.2,-2.4 56.4,-2.1 57.6,-1.7 58.8,-1.3 60.0,-0.9 61.2,-0.5 62.4,-0.2 63.6,0.2 64.8,0.4 66.0,0.7 67.2,0.8 68.4,0.9 69.6,1.0 70.8,1.0 72.0,0.9 73.2,0.9 74.4,0.7 75.6,0.6 76.8,0.5 78.0,0.3 79.2,0.2 80.4,0.1 81.6,-0.1 82.8,-0.2 84.0,-0.2 85.2,-0.3 86.4,-0.3 87.6,-0.3 88.8,-0.3 90.0,-0.3 91.2,-0.3 92.4,-0.3 93.6,-0.2 94.8,-0.2 96.0,-0.1 97.2,-0.1 98.4,-0.0 99.6,0.0 100.8,0.1 102.0,0.1 103.2,0.1 104.4,0.1 105.6,0.1 106.8,0.1 108.0,0.1 109.2,0.1 110.4,0.1 111.6,0.1 112.8,0.1 114.0,0.0 115.2,0.0 116.4,0.0 117.6,-0.0 118.8,-0.0 120.0,0.0"/>
|
||||
* </svg>
|
||||
* <p/>
|
||||
* The math in this class is taken from
|
||||
* <a href="http://www.robertpenner.com/easing/">http://www.robertpenner.com/easing/</a>.
|
||||
* </svg>}
|
||||
* <p>The math in this class is taken from
|
||||
* <a href="http://www.robertpenner.com/easing/">http://www.robertpenner.com/easing/</a>.</p>
|
||||
*
|
||||
* @author Christian Schudt
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user