Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
earlbread committed Oct 15, 2019
1 parent b7220ed commit c564b61
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion Libplanet/Blockchain/BlockChain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
[assembly: InternalsVisibleTo("Libplanet.Tests")]
namespace Libplanet.Blockchain
{
/// <summary>
/// A class have <see cref="Block{T}"/>s, <see cref="Transaction{T}"/>s, and the chain
/// information.
/// </summary>
/// <typeparam name="T">An <see cref="IAction"/> type. It should match
/// to <see cref="Block{T}"/>'s type parameter.</typeparam>
/// <seealso cref="IAction"/>
/// <seealso cref="Block{T}"/>
/// <seealso cref="Transaction{T}"/>
public class BlockChain<T> : IReadOnlyList<Block<T>>
where T : IAction, new()
{
Expand Down Expand Up @@ -46,6 +55,13 @@ public class BlockChain<T> : IReadOnlyList<Block<T>>
/// </summary>
private IDictionary<TxId, Transaction<T>> _transactions;

/// <summary>
/// Initializes a new instance of the <see cref="BlockChain{T}"/> class.
/// </summary>
/// <param name="policy"><see cref="IBlockPolicy{T}"/> to use in the
/// <see cref="BlockChain{T}"/>.</param>
/// <param name="store"><see cref="IStore"/> to store <see cref="Block{T}"/>s,
/// <see cref="Transaction{T}"/>s, and <see cref="BlockChain{T}"/> information.</param>
public BlockChain(IBlockPolicy<T> policy, IStore store)
: this(
policy,
Expand Down Expand Up @@ -117,9 +133,20 @@ public Block<T> Tip

internal IStore Store { get; }

/// <inheritdoc/>
/// <summary>
/// Gets the block corresponding to the <paramref name="index"/>.
/// </summary>
/// <param name="index">A number of index of <see cref="Block{T}"/>.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the given index of
/// <see cref="Block{T}"/> does not exist.</exception>
public Block<T> this[int index] => this[(long)index];

/// <summary>
/// Gets the block corresponding to the <paramref name="index"/>.
/// </summary>
/// <param name="index">A number of index of <see cref="Block{T}"/>.</param>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the given index of
/// <see cref="Block{T}"/> does not exist.</exception>
public Block<T> this[long index]
{
get
Expand Down

0 comments on commit c564b61

Please sign in to comment.