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

public final class PrimesGenerator extends Object implements Generator
Primes — the conceptual driver of the generator story: the prime numbers 2, 3, 5, 7, 11, … in a single column n:NUMBER, in ascending order. Takes no arguments.

Primes are enumerated lazily via BigInteger.nextProbablePrime() starting at 2, so the stream is genuinely infinite and never overflows. unbounded() is true: γ count (Primes) is a plan-time error, while λ 10 (Primes) streams the first ten primes. The series is strictly increasing, so it is duplicateFree().

There is no existence probe: σ n = 17 (Primes) enumerates up to 17 rather than testing 17 for primality directly.

  • Constructor Details

    • PrimesGenerator

      public PrimesGenerator()
  • 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