Class AtomicChainsSet<T extends Transaction>

java.lang.Object
nxt.blockchain.atomictxs.AtomicChainsSet<T>

public class AtomicChainsSet<T extends Transaction> extends Object
Set of transactions that tracks the atomic chains formed by the transactions in the set.

The priority order of the chains in the set is according to a comparator provided in the constructor of this class. The highest priority ones are in the beginning of the set, the lowest priority ones are in the end and can be removed with removeLastChain()

Public access is synchronized except from the getAllChains(). Users of this method should synchronize by locking the AtomicChainsSet instance
  • Field Details

  • Constructor Details

    • AtomicChainsSet

      public AtomicChainsSet(Comparator<AtomicChain<T>> comparator)
      Construct a new set of atomic chains
      Parameters:
      comparator -

      Order of the chains, the less significant ones being stored last.

      If null, the natural ordering of the AtomicChains is used.

      This comparator must be consistent with equals
  • Method Details

    • add

      public boolean add(T transaction)
    • remove

      public boolean remove(Long id)
    • peekLastChain

      public AtomicChain<T> peekLastChain()
    • removeLastChain

      public AtomicChain<T> removeLastChain()
    • getTransaction

      public T getTransaction(Long id)
    • hasTransaction

      public boolean hasTransaction(Long id)
    • transactionsCount

      public int transactionsCount()
    • clear

      public void clear()
    • getCompleteChains

      public List<AtomicChain<T>> getCompleteChains()
    • getAllChains

      public Collection<AtomicChain<T>> getAllChains()
      Returns an unmodifiable collection containing all chains in the set. Note that concurrent modifications to the set may lead to concurrency issues with the returned collection. Ensure the set instance is locked during the usage of the returned collection.
      Returns:
      an unmodifiable collection of chains
    • toTransactionsList

      public ArrayList<T> toTransactionsList()