Module org.refcodes.generator
Package org.refcodes.generator
package org.refcodes.generator
This artifact provides word morphs mass production functionality for
generating arbitrary distinct IDs similar to UUIDs (as of the
UniqueIdGenerator
type) or for generating
permutations of words with a given alphabet and permutation rules (as of the
AlphabetCounter
alongside the
AlphabetCounterComposite
types) as well as
multi threading concurrency support (as of the
ConcurrentBufferedGeneratorDecorator
and the
ThreadLocalBufferedGeneratorDecorator
types)
for such Generator
(Iterator
) types.
Please refer to the refcodes-generator: Mass produce password permutations and distinct IDs documentation for an up-to-date and detailed description on the usage of this artifact.
-
ClassDescriptionThe
AbstractCounterComposite
combines severalCounter
instances which to use when generating data by daisy chaining the provided generator instances (end of counter 1 increases counter 2, end of counter 2 increases counter 3, ..., end of counter n-1 increases counter n, the end of a counter is determined withAbstractCounterComposite.hasNext()
and a counter is increased byGenerator.next()
).TheAlphabetCounter
generates values by counting with an an alphabet of "digits", a decimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8" and "9", a hexadecimal alphabet would contain the characters "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F".TheAlphabetCounterComposite
creates aIdCounterComposite
composed ofAlphabetCounter
instances which's alphabets are retrieved from expressions each (to be combined to a singleIdCounter
).TheAlphabetCounterMetrics
define the metrics for configuring anAlphabetCounter
such as the characters used as alphabet and the counter's min and max lengths (duplicate definitions of characters are ignored).Base interface for aGenerator
using a buffer being filled upon demand or time schedule and which's buffering functionality may be suspended (Suspendable.suspend()
) so that theGenerator
does only emit elements already present in the puffer till all elements in the buffer are expended (and does not place any new elements into the buffer to be emitted).TheConcurrentBufferedGeneratorDecorator
decorates aGenerator
with read-ahead functionality by buffering generated IDs till a predefined maximum is reached and refilling the buffer periodically upon dropping below a threshold.Counter<T>ACounter
is aGenerator
with means to reset theCounter
state to its initial position (value) from which to begin counting again, e.g. whenGenerator.hasNext()
returns false, then callingResetable.reset()
will make theCounter
instance to start again from the very first beginning andGenerator.hasNext()
will return true until the "end" of the countable elements has been reached (by consuming them withGenerator.next()
).Generator<T>AGenerator
generates objects of a dedicated type in mass production.TheIdCounterComposite
combines severalIdCounter
instances which to use when generating data by daisy chaining the provided generator instances (end of counter 1 increases counter 2, end of counter 2 increases counter 3, ..., end of counter n-1 increases counter n, the end of a counter is determined withAbstractCounterComposite.hasNext()
and a counter is increased byIdCounterComposite.next()
).TheIdGenerator
interface defines generator functionality forString
instances.TheSeriesMonitor
is aGenerator
with means to monitor the last fully processed (completed) ID of the series of generated IDs with all preceding generated IDs also being fully processed (completed): All IDs till the last fully processed (completed) ID have been processed.TheSeriesMonitorDecorator
decorates aGenerator
with means to monitor the last fully processed (completed) ID of the series of generated IDs with all preceding generated IDs also being fully processed (completed): All IDs till the last fully processed (completed) ID have been processed.TheThreadLocalBufferedGeneratorDecorator
decorates aGenerator
with read-ahead functionality by buffering generated IDs on a perThread
basis: The resultingGenerator
is thread safe!.TheUniqueIdGenerator
is an implementation of theGenerator
capable of generating TIDString
instances unique on the system on which them were generated to IDs generated with the sameUniqueIdGenerator
on another system.Defines the type of BASE-64 encoding to use for generated IDs.The Class UniqueIdGeneratorSingleton.