Checks if the position is longer than the max length lmax = ln + lz of the system,
the condition of an OverflowError.
The position to check.
Checks if the length of the position reached the threshold lϰ = ceil((1 - fϰ) * lmax),
the condition of a ThresholdReachedError.
The position to check.
import Staquia from "staquia";
// lϰ = ceil((1 - 0.15) * 20) = 17
const system = Staquia.create("!", "a", "z", 5, 15, 0.15);
// A position of 17 characters is valid, but it comes inside the error
const long = system.forge("mmmmmmmmmmmmmmmmm");
if (!long.ok && "position" in long.error) {
console.log(system.isThresholdReached(long.error.position)); // true
console.log(system.hasOverflow(long.error.position)); // false
}
Checks a position you already have against the limits of the system, with the same conditions as the
OverflowErrorand theThresholdReachedError.Staquiaimplements it.