Class PrimesGenerator
java.lang.Object
com.darkcollective.relix.processor.generator.PrimesGenerator
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe single column on which this generator emits values in strictly ascending order, when it is an unbounded generator — the seam the optimizer'sGEN-001pass consults to fold an upper-bound selection into a production stop.booleanWhether this generator is inherently duplicate-free (every row distinct).name()Lazily produces the generator's rows.The schema (heading) this generator produces for the given arguments.booleanWhether this generator is provably infinite.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.darkcollective.relix.processor.generator.Generator
cardinality
-
Constructor Details
-
PrimesGenerator
public PrimesGenerator()
-
-
Method Details
-
name
-
schema
Description copied from interface:GeneratorThe schema (heading) this generator produces for the given arguments. Implementations should keep this total where possible — argument validation that only affects the rows belongs inGenerator.rows(java.util.Map<java.lang.String, java.lang.String>, com.darkcollective.relix.symbol.Schema). -
rows
Description copied from interface:GeneratorLazily produces the generator's rows.- Specified by:
rowsin interfaceGenerator- Parameters:
args- the raw generator arguments (e.g.lo/hi/step)schema- the schema returned byGenerator.schema(Map)for the same args- Returns:
- a lazy stream of rows; the caller closes it
-
unbounded
public boolean unbounded()Description copied from interface:GeneratorWhether this generator is provably infinite. Read byGeneratorBoundednessSource; finite generators (the default) reportfalse. -
duplicateFree
public boolean duplicateFree()Description copied from interface:GeneratorWhether this generator is inherently duplicate-free (every row distinct). Read byGeneratorDistinctnessSource, which feeds distinctness-drivenδelimination (DIST-001).- Specified by:
duplicateFreein interfaceGenerator- Returns:
trueif the generator never emits a duplicate row
-
ascendingColumn
Description copied from interface:GeneratorThe single column on which this generator emits values in strictly ascending order, when it is an unbounded generator — the seam the optimizer'sGEN-001pass 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" (atakeWhile).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:
ascendingColumnin interfaceGenerator- Returns:
- the ascending value column, or empty when not an ascending unbounded generator
-