java.lang.Object
com.darkcollective.relix.processor.generator.NaturalsGenerator
All Implemented Interfaces:
Generator

public final class NaturalsGenerator extends Object implements Generator
Naturals — the canonical infinite leaf: the natural numbers ℕ₀ 0, 1, 2, 3, … in a single column n:NUMBER. Takes no arguments.

The rows are produced by an arbitrary-precision BigInteger counter, so the stream never overflows — it is genuinely unbounded. unbounded() is therefore true: a blocking operator over Naturals (e.g. γ count (Naturals)) is a plan-time error, while a streaming consumer with a bound — λ 10 (Naturals) — pulls only as many rows as it needs (the limit operator consumes the stream lazily). The series is strictly increasing, so it is duplicateFree().

  • Constructor Details

    • NaturalsGenerator

      public NaturalsGenerator()
  • Method Details

    • name

      public String name()
      Specified by:
      name in interface Generator
      Returns:
      the registered generator name (e.g. "Range"); case-insensitive at lookup
    • schema

      public Schema schema(Map<String,String> args)
      Description copied from interface: Generator
      The schema (heading) this generator produces for the given arguments. Implementations should keep this total where possible — argument validation that only affects the rows belongs in Generator.rows(java.util.Map<java.lang.String, java.lang.String>, com.darkcollective.relix.symbol.Schema).
      Specified by:
      schema in interface Generator
      Parameters:
      args - the raw generator arguments
      Returns:
      the output schema
    • rows

      public Stream<Row> rows(Map<String,String> args, Schema schema)
      Description copied from interface: Generator
      Lazily produces the generator's rows.
      Specified by:
      rows in interface Generator
      Parameters:
      args - the raw generator arguments (e.g. lo/hi/step)
      schema - the schema returned by Generator.schema(Map) for the same args
      Returns:
      a lazy stream of rows; the caller closes it
    • unbounded

      public boolean unbounded()
      Description copied from interface: Generator
      Whether this generator is provably infinite. Read by GeneratorBoundednessSource; finite generators (the default) report false.
      Specified by:
      unbounded in interface Generator
      Returns:
      true if the generator has no last row
    • duplicateFree

      public boolean duplicateFree()
      Description copied from interface: Generator
      Whether this generator is inherently duplicate-free (every row distinct). Read by GeneratorDistinctnessSource, which feeds distinctness-driven δ elimination (DIST-001).
      Specified by:
      duplicateFree in interface Generator
      Returns:
      true if the generator never emits a duplicate row
    • ascendingColumn

      public Optional<String> ascendingColumn()
      Description copied from interface: Generator
      The single column on which this generator emits values in strictly ascending order, when it is an unbounded generator — the seam the optimizer's GEN-001 pass consults to fold an upper-bound selection into a production stop. Returning a column declares "an upper bound on this column is a sound termination condition" (a takeWhile).

      The default is empty: finite generators terminate on their own, and a non-monotone generator cannot be safely stopped by a value threshold.

      Specified by:
      ascendingColumn in interface Generator
      Returns:
      the ascending value column, or empty when not an ascending unbounded generator