UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

55 lines (54 loc) 3.38 kB
import { Ternary } from '../../util/logic'; import { AbstractDomain } from './abstract-domain'; import { Bottom, Top } from './lattice'; import { type SatisfiableDomain, SetComparator } from './satisfiable-domain'; /** The type of the actual values of the set upper bound domain as set */ type SetUpperBoundValue<T> = ReadonlySet<T>; /** The type of the Top element of the set upper bound domain as {@link Top} symbol */ type SetUpperBoundTop = typeof Top; /** The type of the Bottom element of the set upper bound domain as {@link Bottom} symbol */ type SetUpperBoundBottom = typeof Bottom; /** The type of the abstract values of the set upper bound domain that are Top, Bottom, or actual values */ type SetUpperBoundLift<T> = SetUpperBoundValue<T> | SetUpperBoundTop | SetUpperBoundBottom; /** * The set upper bound abstract domain as sets capturing possible values of the concrete set bounded by a `limit` for the maximum number of inferred values. * The Bottom element is defined as the{@link Bottom} and the Top element is defined as {@link Top} symbol. * @template T - Type of the values in the abstract domain * @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value) */ export declare class SetUpperBoundDomain<T, Value extends SetUpperBoundLift<T> = SetUpperBoundLift<T>> extends AbstractDomain<ReadonlySet<T>, SetUpperBoundValue<T>, SetUpperBoundTop, SetUpperBoundBottom, Value> implements SatisfiableDomain<ReadonlySet<T>> { readonly limit: number; private readonly setType; /** * @param limit - A limit for the maximum number of elements to store in the set * @param newSet - An optional set constructor for the domain elements if the type `T` is not storable in a HashSet */ constructor(value: Value | T[], limit?: number, setType?: typeof Set<T>); create(value: SetUpperBoundLift<T> | T[]): this; static top<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundTop>; static bottom<T>(limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T, SetUpperBoundBottom>; static abstract<T>(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top, limit?: number, setType?: typeof Set<T>): SetUpperBoundDomain<T>; top(): this & SetUpperBoundDomain<T, SetUpperBoundTop>; bottom(): this & SetUpperBoundDomain<T, SetUpperBoundBottom>; equals(other: this): boolean; leq(other: this): boolean; join(other: SetUpperBoundLift<T> | T[]): this; join(other: this): this; meet(other: SetUpperBoundLift<T> | T[]): this; meet(other: this): this; /** * Subtracts another abstract value from the current abstract value by removing all elements of the other abstract value from the current abstract value. */ subtract(other: this | SetUpperBoundLift<T> | T[]): this; widen(other: this): this; narrow(other: this): this; concretize(limit: number): ReadonlySet<ReadonlySet<T>> | typeof Top; abstract(concrete: ReadonlySet<ReadonlySet<T>> | typeof Top): this; satisfies(set: ReadonlySet<T> | T[], comparator?: SetComparator): Ternary; toJson(): unknown; toString(): string; isTop(): this is SetUpperBoundDomain<T, SetUpperBoundTop>; isBottom(): this is SetUpperBoundDomain<T, SetUpperBoundBottom>; isValue(): this is SetUpperBoundDomain<T, SetUpperBoundValue<T>>; } export {};