@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
48 lines (47 loc) • 3.26 kB
TypeScript
import { Ternary } from '../../util/logic';
import { AbstractDomain } from './abstract-domain';
import { Top } from './lattice';
import type { ValueDomain } from './value-abstract-domain';
/** The Bottom element of the bounded set domain as empty set */
export declare const SetBottom: ReadonlySet<never>;
/** The type of the actual values of the bounded set domain as set */
type BoundedSetValue<T> = ReadonlySet<T>;
/** The type of the Top element of the bounded set domain as {@link Top} symbol */
type BoundedSetTop = typeof Top;
/** The type of the Bottom element of the bounded set domain as empty set */
type BoundedSetBottom = typeof SetBottom;
/** The type of the abstract values of the bounded set domain that are Top, Bottom, or actual values */
type BoundedSetLift<T> = BoundedSetValue<T> | BoundedSetTop | BoundedSetBottom;
/**
* The bounded set abstract domain as sets of possible values bounded by a `limit` indicating the maximum number of inferred values.
* The Bottom element is defined as the empty set 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 BoundedSetDomain<T, Value extends BoundedSetLift<T> = BoundedSetLift<T>> extends AbstractDomain<BoundedSetValue<T>, BoundedSetTop, BoundedSetBottom, Value> implements ValueDomain<T> {
readonly limit: number;
protected readonly setType: typeof Set<T>;
/**
* @param limit - A limit for the maximum number of elements to store in the set
* @param setType - 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: BoundedSetLift<T> | T[]): this;
from(...values: T[]): this;
static top<T>(limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T, BoundedSetTop>;
static bottom<T>(limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T, BoundedSetBottom>;
static from<T>(values: T | T[], limit?: number, setType?: typeof Set<T>): BoundedSetDomain<T>;
top(): this & BoundedSetDomain<T, BoundedSetTop>;
bottom(): this & BoundedSetDomain<T, BoundedSetBottom>;
protected equalsValue(this: BoundedSetDomain<T, BoundedSetValue<T>>, other: BoundedSetDomain<T, BoundedSetValue<T>>): boolean;
protected leqValue(this: BoundedSetDomain<T, BoundedSetValue<T>>, other: BoundedSetDomain<T, BoundedSetValue<T>>): boolean;
protected joinValue(this: this & BoundedSetDomain<T, BoundedSetValue<T>>, other: BoundedSetDomain<T, BoundedSetValue<T>>): this;
protected meetValue(this: this & BoundedSetDomain<T, BoundedSetValue<T>>, other: BoundedSetDomain<T, BoundedSetValue<T>>): this;
satisfies(value: T): Ternary;
protected jsonify(this: BoundedSetDomain<T, BoundedSetValue<T>>): unknown;
protected stringify(this: BoundedSetDomain<T, BoundedSetValue<T>>): string;
isTop(): this is this & BoundedSetDomain<T, BoundedSetTop>;
isBottom(): this is this & BoundedSetDomain<T, BoundedSetBottom>;
isValue(): this is this & BoundedSetDomain<T, BoundedSetValue<T>>;
}
export {};