diff --git a/core/src/main/java/org/bitcoinj/core/Block.java b/core/src/main/java/org/bitcoinj/core/Block.java index cc4e9f75..f10f5661 100644 --- a/core/src/main/java/org/bitcoinj/core/Block.java +++ b/core/src/main/java/org/bitcoinj/core/Block.java @@ -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 * the Bitcoin technical paper for - * more detail on blocks.
+ * more detail on blocks. * *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}.
diff --git a/core/src/main/java/org/bitcoinj/core/Coin.java b/core/src/main/java/org/bitcoinj/core/Coin.java index 7f2fb0f9..370f15db 100644 --- a/core/src/main/java/org/bitcoinj/core/Coin.java +++ b/core/src/main/java/org/bitcoinj/core/Coin.java @@ -116,13 +116,9 @@ public final class Coin implements Monetary, Comparable- * Parses an amount expressed in the way humans are used to. - *
- *- * This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", - * "1.23E3", "1234.5E-5". - *
+ *Parses an amount expressed in the way humans are used to.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
* * @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- * Parses an amount expressed in the way humans are used to. The amount is cut to satoshi precision. - *
- *- * This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", - * "1.23E3", "1234.5E-5". - *
+ *Parses an amount expressed in the way humans are used to. The amount is cut to satoshi precision.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
* * @throws IllegalArgumentException * if you try to specify a value out of range. diff --git a/core/src/main/java/org/bitcoinj/core/Message.java b/core/src/main/java/org/bitcoinj/core/Message.java index 464f93d3..9cdb583e 100644 --- a/core/src/main/java/org/bitcoinj/core/Message.java +++ b/core/src/main/java/org/bitcoinj/core/Message.java @@ -136,7 +136,7 @@ public abstract class Message { /** *To be called before any change of internal values including any setters. This ensures any cached byte array is - * removed.
+ * removed. *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.
*/ @@ -186,19 +186,20 @@ public abstract class Message { } /** - * Serialize this message to a byte array that conforms to the bitcoin wire protocol. - *Serialize this message to a byte array that conforms to the bitcoin wire protocol.
+ * + *This method may return the original byte array used to construct this message if the + * following conditions are met:
+ * *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.
* * @return a byte array owned by this object, do NOT mutate it. */ diff --git a/core/src/main/java/org/bitcoinj/core/PartialMerkleTree.java b/core/src/main/java/org/bitcoinj/core/PartialMerkleTree.java index dbcae6cc..ef726a4c 100644 --- a/core/src/main/java/org/bitcoinj/core/PartialMerkleTree.java +++ b/core/src/main/java/org/bitcoinj/core/PartialMerkleTree.java @@ -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. * *The serialization is fixed and provides a hard guarantee about the encoded size, - * SIZE <= 10 + ceil(32.25*N) 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:
* *@@ -45,14 +45,16 @@ import com.google.common.base.Objects; * N <= 1 + matched_transactions*tree_height *
* - *The serialization format: + *+ *The serialization format:
+ ** - 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.- * + *
The size constraints follow from this.
+ * *Instances of this class are not safe for use by multiple threads.
*/ public class PartialMerkleTree extends Message { diff --git a/core/src/main/java/org/bitcoinj/core/PeerGroup.java b/core/src/main/java/org/bitcoinj/core/PeerGroup.java index 7bf7c9a6..d6ceec51 100644 --- a/core/src/main/java/org/bitcoinj/core/PeerGroup.java +++ b/core/src/main/java/org/bitcoinj/core/PeerGroup.java @@ -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- * Implementation of native segwit addresses. They are composed of two parts: + *
Implementation of native segwit addresses. They are composed of two parts:
+ * *- * However, you don't need to care about the internals. Use {@link #fromBech32(NetworkParameters, String)}, + * + *
See BIP173 for details.
+ * + *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. - *
+ * segwit address. */ public class SegwitAddress extends Address { public static final int WITNESS_PROGRAM_LENGTH_PKH = 20; diff --git a/core/src/main/java/org/bitcoinj/core/TransactionInput.java b/core/src/main/java/org/bitcoinj/core/TransactionInput.java index 208acaec..756912f2 100644 --- a/core/src/main/java/org/bitcoinj/core/TransactionInput.java +++ b/core/src/main/java/org/bitcoinj/core/TransactionInput.java @@ -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. */ diff --git a/core/src/main/java/org/bitcoinj/core/UnsafeByteArrayOutputStream.java b/core/src/main/java/org/bitcoinj/core/UnsafeByteArrayOutputStream.java index 4d5fcd6b..726300a8 100644 --- a/core/src/main/java/org/bitcoinj/core/UnsafeByteArrayOutputStream.java +++ b/core/src/main/java/org/bitcoinj/core/UnsafeByteArrayOutputStream.java @@ -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(). + *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. - *
- * Unless the final length can be accurately predicted the only performance this will yield is due to unsynchronized - * methods. + * 'serialized to stream' method. + * + *Unless the final length can be accurately predicted the only performance this will yield is due to unsynchronized + * methods.
* * @author git */ diff --git a/core/src/main/java/org/bitcoinj/core/VersionMessage.java b/core/src/main/java/org/bitcoinj/core/VersionMessage.java index 9897bf7a..cdd4d5f6 100644 --- a/core/src/main/java/org/bitcoinj/core/VersionMessage.java +++ b/core/src/main/java/org/bitcoinj/core/VersionMessage.java @@ -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 + *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.
+ * users might look like "/bitcoinj:0.13/MultiBit:1.2/" where libraries come further to the left.
* - * There can be as many components as you feel a need for, and the version string can be anything, but it is + *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.
+ * and version are not allowed to contain such characters.
* - * Anything put in the "comments" field will appear in brackets and may be used for platform info, or anything + *Anything put in the "comments" field will appear in brackets and may be used for platform info, or anything * else. For example, calling appendToSubVer("MultiBit", "1.0", "Windows") 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.
+ * components. If you don't want to add a comment (recommended), pass null.
* - * See BIP 14 for more information. + *See BIP 14 for more information.
* * @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() { diff --git a/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java b/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java index b7937874..dfec946b 100644 --- a/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java +++ b/core/src/main/java/org/bitcoinj/crypto/HDKeyDerivation.java @@ -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, ImmutableListA generic full pruned block store for a relational database. This generic class requires * certain table structures for the block store.
* - *The following are the tables and field names/types that are assumed:-
+ *The following are the tables and field names/types that are assumed:
* - *- * setting table *
Field Name | Type (generic) |
---|---|
name | string |
value | binary |
- * headers table
*
Field Name | Type (generic) |
---|---|
hash | binary |
chainwork | binary |
header | binary |
wasundoable | boolean |
- * undoableblocks table
*
Field Name | Type (generic) |
---|---|
hash | binary |
height | integer |
txoutchanges | binary |
transactions | binary |
- * openoutputs table
*
Field Name | Type (generic) |
---|---|
hash | binary |
index | integer |
addresstargetable | integer |
coinbase | boolean |
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.
* diff --git a/core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java b/core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java index c8c6dc1e..d23a666e 100644 --- a/core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java +++ b/core/src/main/java/org/bitcoinj/utils/BlockFileLoader.java @@ -39,11 +39,13 @@ import java.util.NoSuchElementException; *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.
* - *To blindly import all files which can be found in Bitcoin Core (version >= 0.8) datadir automatically,
- * try this code fragment:
- * BlockFileLoader loader = new BlockFileLoader(BlockFileLoader.getReferenceClientBlockFileList());
- * for (Block block : loader) {
- * try { chain.add(block); } catch (Exception e) { }
+ *
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) { } + * } * }
*/ public class BlockFileLoader implements IterableThis 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.
* *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.
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.
* @see java.text.Format * @see java.text.NumberFormat diff --git a/core/src/main/java/org/bitcoinj/utils/BtcFormat.java b/core/src/main/java/org/bitcoinj/utils/BtcFormat.java index e182f16b..a49c530d 100644 --- a/core/src/main/java/org/bitcoinj/utils/BtcFormat.java +++ b/core/src/main/java/org/bitcoinj/utils/BtcFormat.java @@ -48,13 +48,15 @@ import java.util.regex.Pattern; /** *Instances of this class format and parse locale-specific numerical - * representations of Bitcoin monetary values. + * representations of Bitcoin monetary values.
* *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:
Basic usage is very simple:
+ * + *For example, depending on your locale, values might be formatted - * and parsed as follows: + * and parsed as follows:
* ** ** BtcFormat f = BtcFormat.getInstance(); @@ -85,13 +89,13 @@ import java.util.regex.Pattern; * *Auto-Denomination versus Fixed-Denomination
* - * There are two provided concrete classes, one that automatically denominates values to + *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}.
* - *Automatic Denomination
+ *Automatic Denomination
* - * Automatic denomination means that the formatter adjusts the denominational units in which a + *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 "฿"}.
* *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
฿1.00where a value - * exceeding that by one satoshi would beµ฿1,000,000.01+ * 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} * - *Fixed Denomination
+ *Fixed Denomination
* - * Fixed denomination means that the same denomination of units is used for every value that is + *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}.
* *Construction
* - * There are two ways to obtain an instance of this class:+ *
There are two ways to obtain an instance of this class:
+ * + **
* @@ -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. * - *- Use one of the factory methods; or *
- Use a {@link BtcFormat.Builder} object.
Factory Methods
+ *Factory Methods
* - * Although formatting and parsing is performed by one of the concrete + *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.
* *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:
* ** - ** 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: * *+ * String s = m.format(Coin.COIN); // "1,000,000.00" + *BtcFormat m = BtcFormat.getInstance(6); - *String s = m.format(Coin.COIN); // "1,000,000.00" - *This class provides several constants bound to common scale values: + *
This class provides several constants bound to common scale values:
* ** @@ -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. * *BtcFormat milliFormat = BtcFormat.getInstance(MILLICOIN_SCALE);+ ** BtcFormat s = BtcFormat.getInstance(SYMBOL); * Coin value = Coin.parseCoin("0.1234"); * String mil = s.format(value); // "₥฿123.40" * String mic = s.format(value.divide(1000)); // "µ฿123.40" - *
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)}.
* *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.
* - * For example, here we construct four instances for the same locale that each format - * differently the same one-bitcoin value: + *For example, here we construct four instances for the same locale that each format + * differently the same one-bitcoin value:
* ** - * Omitting such a {@link Locale} parameter will give you a - * formatter for your default locale. + ** // Next line returns "1,00 BTC" @@ -209,15 +215,15 @@ import java.util.regex.Pattern; * BtcFormat.getInstance(4, Locale.GERMANY).format(Coin.COIN); *
Omitting such a {@link Locale} parameter will give you a + * formatter for your default locale.
* *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.
* *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.
* - *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.
* *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.
* ** - ** BtcFormat.Builder builder = BtcFormat.builder(); @@ -256,7 +262,7 @@ import java.util.regex.Pattern; * String out = f.format(COIN); // "XBT 1.00" *
See the documentation of the {@link BtcFormat.Builder} class for details. + *
See the documentation of the {@link BtcFormat.Builder} class for details.
* *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:
* ** 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. * *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:
* ** 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: * ** - * If you need to vertically-align columns printed in a proportional font, + ** BtcFormat de = BtcFormat.getInstance(Locale.GERMANY); @@ -332,7 +338,7 @@ import java.util.regex.Pattern; *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.
* ** - ** BtcFixedFormat kilo = (BtcFixedFormat)BtcFormat(-3); // scale -3 for kilocoins @@ -344,11 +350,11 @@ import java.util.regex.Pattern; * BtcFormat(4).code(); // unnamed denomination has no code; raises exception *Formatting for Tabular Columns
+ *Formatting for Tabular Columns
* - * When displaying tables of monetary values, you can lessen the + *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:
* *@@ -386,9 +392,9 @@ import java.util.regex.Pattern; * 0.00000001 ** // The elements of this array are the values we will format: @@ -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]); * } *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.
* *Parsing
* @@ -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. * - *The {@link BtcAutoFormat#parse(String)} method of {@link BtcAutoFormat} (and of + *
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.
* *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.
* *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.
* *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.
* *Limitations
* - *Parsing
+ *Parsing
* - * Parsing is performed by an underlying {@link java.text.NumberFormat} object. While this + *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 this article by Joe Sam * Shirah. 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.
* - *Exotic Locales
+ *Exotic Locales
* - * This class is not well-tested in locales that use non-ascii + *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.
* *Thread-Safety
* - *Instances of this class are immutable. + *
Instances of this class are immutable.
* * @see java.text.Format * @see java.text.NumberFormat diff --git a/core/src/main/java/org/bitcoinj/utils/Fiat.java b/core/src/main/java/org/bitcoinj/utils/Fiat.java index fc49e7b8..434a7592 100644 --- a/core/src/main/java/org/bitcoinj/utils/Fiat.java +++ b/core/src/main/java/org/bitcoinj/utils/Fiat.java @@ -73,13 +73,9 @@ public final class Fiat implements Monetary, Comparable, Serializable { } /** - * - * Parses an amount expressed in the way humans are used to. - *
- *- * This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", - * "1.23E3", "1234.5E-5". - *
+ *Parses an amount expressed in the way humans are used to.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
* * @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, Serializable { } /** - * - * Parses an amount expressed in the way humans are used to. The amount is cut to 4 digits after the comma. - *
- *- * This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", - * "1.23E3", "1234.5E-5". - *
+ *Parses an amount expressed in the way humans are used to. The amount is cut to 4 digits after the comma.
+ *This takes string in a format understood by {@link BigDecimal#BigDecimal(String)}, for example "0", "1", "0.10", + * "1.23E3", "1234.5E-5".
* * @throws IllegalArgumentException * if you try to specify a value out of range. diff --git a/core/src/main/java/org/bitcoinj/wallet/MarriedKeyChain.java b/core/src/main/java/org/bitcoinj/wallet/MarriedKeyChain.java index 66edd207..c01f41d4 100644 --- a/core/src/main/java/org/bitcoinj/wallet/MarriedKeyChain.java +++ b/core/src/main/java/org/bitcoinj/wallet/MarriedKeyChain.java @@ -81,7 +81,7 @@ public class MarriedKeyChain extends DeterministicKeyChain { } /** - * Threshold, or {@code (followingKeys.size() + 1) / 2 + 1)} (majority) if unspecified. + *Threshold, or {@code (followingKeys.size() + 1) / 2 + 1)} (majority) if unspecified.
*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
diff --git a/core/src/main/java/org/bitcoinj/wallet/Wallet.java b/core/src/main/java/org/bitcoinj/wallet/Wallet.java index 1a466c17..e2bb7e7f 100644 --- a/core/src/main/java/org/bitcoinj/wallet/Wallet.java +++ b/core/src/main/java/org/bitcoinj/wallet/Wallet.java @@ -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: - *+ * {@code * MarriedKeyChain chain = MarriedKeyChain.builder() * .random(new SecureRandom()) * .followingKeys(followingKeys) * .threshold(2).build(); * wallet.addAndActivateHDChain(chain); - * + * } */ public void addAndActivateHDChain(DeterministicKeyChain chain) { keyChainGroupLock.lock(); @@ -1422,7 +1422,7 @@ public class Wallet extends BaseTaggableObject * delayTime. 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. * - *An event listener can be provided. If a delay >0 was specified, it will be called on a background thread + *
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.
* @@ -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). - * *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.
*/ @@ -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.- *
- * Note: the current implementation is O(num transactions in wallet). Regardless of how many transactions are + *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.
+ *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).
*/ public ListgetRecentTransactions(int numTransactions, boolean includeDead) { lock.lock(); diff --git a/wallettemplate/src/main/java/wallettemplate/utils/easing/ElasticInterpolator.java b/wallettemplate/src/main/java/wallettemplate/utils/easing/ElasticInterpolator.java index 4c16783e..50493bdc 100644 --- a/wallettemplate/src/main/java/wallettemplate/utils/easing/ElasticInterpolator.java +++ b/wallettemplate/src/main/java/wallettemplate/utils/easing/ElasticInterpolator.java @@ -28,10 +28,9 @@ import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; /** - * This interpolator simulates an elastic behavior. - * - * The following curve illustrates the interpolation. - * + * This interpolator simulates an elastic behavior.
+ *The following curve illustrates the interpolation.
+ * {@code * - * - * The math in this class is taken from - * http://www.robertpenner.com/easing/. + * } + *The math in this class is taken from + * http://www.robertpenner.com/easing/.
* * @author Christian Schudt */