Skip to content

AIDC Toolkit / Utility / CharacterSetCreator

Class: CharacterSetCreator ​

Defined in: character-set.ts:271

Character set creator. Maps numeric values to strings using the character set as digits.

Extends ​

Properties ​

MAXIMUM_STRING_LENGTH ​

readonly static MAXIMUM_STRING_LENGTH: 40 = 40

Defined in: character-set.ts:275

Maximum string length supported.

Constructors ​

Constructor ​

new CharacterSetCreator(characterSet, ...exclusionSupport): CharacterSetCreator

Defined in: character-set.ts:349

Constructor.

Parameters ​

characterSet ​

readonly string[]

Character set. Each element is a single-character string, unique within the array, that defines the character set.

exclusionSupport ​

...readonly Exclusion[]

Exclusions supported by the character set. All character sets implicitly support Exclusions.None.

Returns ​

CharacterSetCreator

Overrides ​

CharacterSetValidator.constructor

Accessors ​

characterSet ​

Get Signature ​

get characterSet(): readonly string[]

Defined in: character-set.ts:103

Get the character set.

Returns ​

readonly string[]

Inherited from ​

CharacterSetValidator.characterSet


characterSetSize ​

Get Signature ​

get characterSetSize(): number

Defined in: character-set.ts:110

Get the character set size.

Returns ​

number

Inherited from ​

CharacterSetValidator.characterSetSize


exclusionSupport ​

Get Signature ​

get exclusionSupport(): readonly Exclusion[]

Defined in: character-set.ts:117

Get the exclusions supported by the character set.

Returns ​

readonly Exclusion[]

Inherited from ​

CharacterSetValidator.exclusionSupport

Methods ​

powerOf10() ​

static powerOf10(power): bigint

Defined in: character-set.ts:312

Get a power of 10.

Parameters ​

power ​

number

Power.

Returns ​

bigint

10**power.


create() ​

create<TTransformerInput>(length, valueOrValues, exclusion, tweak?, creatorCallback?): TransformerOutput<TTransformerInput, string>

Defined in: character-set.ts:542

Create string(s) by mapping value(s) to the equivalent characters in the character set across the length of the string.

Type Parameters ​

TTransformerInput ​

TTransformerInput extends TransformerInput<number | bigint>

Transformer input type.

Parameters ​

length ​

number

Required string length.

valueOrValues ​

TTransformerInput

Numeric value(s) of the string(s).

exclusion ​

Exclusion = Exclusions.None

String(s) to be excluded from the range of outputs. See Exclusions for possible values and their meaning.

tweak? ​

If provided, the numerical value of the string(s) is/are "tweaked" using an encryption transformer.

number | bigint

creatorCallback? ​

IndexedCallback<string, string>

If provided, called after each string is constructed to create the final value.

Returns ​

TransformerOutput<TTransformerInput, string>

String(s) created from the value(s).


valueFor() ​

valueFor(s, exclusion, tweak?): bigint

Defined in: character-set.ts:597

Determine the value for a string.

Parameters ​

s ​

string

String.

exclusion ​

Exclusion = Exclusions.None

Strings excluded from the range of inputs. See Exclusions for possible values and their meaning.

tweak? ​

If provided, the numerical value of the string was "tweaked" using an encryption transformer.

number | bigint

Returns ​

bigint

Numeric value of the string.


character() ​

character(index): string

Defined in: character-set.ts:130

Get the character at an index.

Parameters ​

index ​

number

Index into the character set.

Returns ​

string

Character at the index.

Inherited from ​

CharacterSetValidator.character


characterIndex() ​

characterIndex(c): number | undefined

Defined in: character-set.ts:143

Get the index for a character.

Parameters ​

c ​

string

Character.

Returns ​

number | undefined

Index for the character or undefined if the character is not in the character set.

Inherited from ​

CharacterSetValidator.characterIndex


characterIndexes() ​

characterIndexes(s): readonly (number | undefined)[]

Defined in: character-set.ts:156

Get the indexes for all characters in a string.

Parameters ​

s ​

string

String.

Returns ​

readonly (number | undefined)[]

Array of indexes for each character or undefined if the character is not in the character set.

Inherited from ​

CharacterSetValidator.characterIndexes


validateExclusion() ​

protected validateExclusion(exclusion): void

Defined in: character-set.ts:180

Validate that an exclusion is supported. If not, an error is thrown.

Parameters ​

exclusion ​

Exclusion

Exclusion.

Returns ​

void

Inherited from ​

CharacterSetValidator.validateExclusion


validate() ​

validate(s, validation?): void

Defined in: character-set.ts:198

Validate a string. If the string violates the character set or any of the character set validation parameters, an error is thrown.

Parameters ​

s ​

string

String.

validation? ​

CharacterSetValidation

Character set validation parameters.

Returns ​

void

Inherited from ​

CharacterSetValidator.validate