nxt

## Class Generator

- java.lang.Object
- - nxt.Generator

- All Implemented Interfaces:
    java.lang.Comparable<Generator>

      public final class Generator
      extends java.lang.Object
      implements java.lang.Comparable<Generator>

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Generator.ActiveGenerator` Active generator
    `static class` | `Generator.Event`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `addListener(Listener<Generator> listener, Generator.Event eventType)`
    `int` | `compareTo(Generator g)`
    `long` | `getAccountId()`
    `static java.util.Collection<Generator>` | `getAllGenerators()`
    `long` | `getDeadline()`
    `static Generator` | `getGenerator(java.lang.String secretPhrase)`
    `static int` | `getGeneratorCount()`
    `long` | `getHitTime()`
    `static java.util.List<Generator.ActiveGenerator>` | `getNextGenerators()` Return a list of generators for the next block.
    `static long` | `getNextHitTime(long lastBlockId, int curTime)`
    `byte[]` | `getPublicKey()`
    `static java.util.List<Generator>` | `getSortedForgers()`
    `static boolean` | `removeListener(Listener<Generator> listener, Generator.Event eventType)`
    `static Generator` | `startForging(java.lang.String secretPhrase)`
    `static int` | `stopForging()`
    `static Generator` | `stopForging(java.lang.String secretPhrase)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### addListener

          public static boolean addListener(Listener<Generator> listener,
                                            Generator.Event eventType)

    - #### removeListener

          public static boolean removeListener(Listener<Generator> listener,
                                               Generator.Event eventType)

    - #### startForging

          public static Generator startForging(java.lang.String secretPhrase)

    - #### stopForging

          public static Generator stopForging(java.lang.String secretPhrase)

    - #### stopForging

          public static int stopForging()

    - #### getGenerator

          public static Generator getGenerator(java.lang.String secretPhrase)

    - #### getGeneratorCount

          public static int getGeneratorCount()

    - #### getAllGenerators

          public static java.util.Collection<Generator> getAllGenerators()

    - #### getSortedForgers

          public static java.util.List<Generator> getSortedForgers()

    - #### getNextHitTime

          public static long getNextHitTime(long lastBlockId,
                                            int curTime)

    - #### getPublicKey

          public byte[] getPublicKey()

    - #### getAccountId

          public long getAccountId()

    - #### getDeadline

          public long getDeadline()

    - #### getHitTime

          public long getHitTime()

    - #### compareTo

          public int compareTo(Generator g)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<Generator>`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getNextGenerators

          public static java.util.List<Generator.ActiveGenerator> getNextGenerators()

      Return a list of generators for the next block. The caller must hold the blockchain read lock to ensure the integrity of the returned list.
      Returns:
        List of generator account identifiers