UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

100 lines (99 loc) 3.74 kB
import * as Inputs from "../inputs"; /** * Contains various logic methods. */ export declare class Logic { /** * Creates a boolean value - true or false * @param inputs a true or false boolean * @returns boolean * @group create * @shortname boolean * @drawable false */ boolean(inputs: Inputs.Logic.BooleanDto): boolean; /** * Creates a random boolean list of predefined length * @param inputs a length and a threshold for randomization of true values * @returns booleans * @group create * @shortname random booleans * @drawable false */ randomBooleans(inputs: Inputs.Logic.RandomBooleansDto): boolean[]; /** * Creates a random boolean list of true and false values based on a list of numbers. * All values between true threshold will be true, all values above false threshold will be false, * and the rest will be distributed between true and false based on the number of levels in a gradient pattern. * That means that the closer the number gets to the false threshold the bigger the chance will be to get random false value. * @param inputs a length and a threshold for randomization of true values * @returns booleans * @group create * @shortname 2 threshold random gradient * @drawable false */ twoThresholdRandomGradient(inputs: Inputs.Logic.TwoThresholdRandomGradientDto): boolean[]; /** * Creates a boolean list based on a list of numbers and a threshold. * @param inputs a length and a threshold for randomization of true values * @returns booleans * @group create * @shortname threshold boolean list * @drawable false */ thresholdBooleanList(inputs: Inputs.Logic.ThresholdBooleanListDto): boolean[]; /** * Creates a boolean list based on a list of numbers and a gap thresholds. Gap thresholds are pairs of numbers that define a range of numbers that will be true. * @param inputs a length and a threshold for randomization of true values * @returns booleans * @group create * @shortname threshold gaps boolean list * @drawable false */ thresholdGapsBooleanList(inputs: Inputs.Logic.ThresholdGapsBooleanListDto): boolean[]; /** * Apply not operator on the boolean * @param inputs a true or false boolean * @returns boolean * @group edit * @shortname not * @drawable false */ not(inputs: Inputs.Logic.BooleanDto): boolean; /** * Apply not operator on a list of booleans * @param inputs a list of true or false booleans * @returns booleans * @group edit * @shortname not list * @drawable false */ notList(inputs: Inputs.Logic.BooleanListDto): boolean[]; /** * Does comparison between first and second values * @param inputs two values to be compared * @returns Result of the comparison * @group operations * @shortname compare * @drawable false */ compare<T>(inputs: Inputs.Logic.ComparisonDto<T>): boolean; /** * Transmits a value if boolean provided is true and undefined if boolean provided is false * @param inputs a value and a boolean value * @returns value or undefined * @group operations * @shortname value gate * @drawable false */ valueGate<T>(inputs: Inputs.Logic.ValueGateDto<T>): T | undefined; /** * Returns first defined value out of two * @param inputs two values * @returns value or undefined * @group operations * @shortname first defined value gate * @drawable false */ firstDefinedValueGate<T, U>(inputs: Inputs.Logic.TwoValueGateDto<T, U>): T | U | undefined; }