@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
44 lines (43 loc) • 2.27 kB
TypeScript
import { Ternary } from '../../util/logic';
import { AbstractDomain } from './abstract-domain';
import { Bottom, Top } from './lattice';
import type { SatisfiableDomain } from './satisfiable-domain';
/** The type of the actual values of the singleton domain as single value */
type SingletonValue<T> = T;
/** The type of the Top element of the singleton domain as {@link Top} symbol */
type SingletonTop = typeof Top;
/** The type of the Bottom element of the singleton domain as {@link Bottom} symbol */
type SingletonBottom = typeof Bottom;
/** The type of the abstract values of the singleton domain that are Top, Bottom, or actual values */
type SingletonLift<T> = SingletonValue<T> | SingletonTop | SingletonBottom;
/**
* The singleton abstract domain as a single possible value.
* The Bottom element is defined as {@link Bottom} symbol and the Top element is defined as {@link Top} symbol.
* @template T - Type of the value in the abstract domain
* @template Value - Type of the constraint in the abstract domain (Top, Bottom, or an actual value)
*/
export declare class SingletonDomain<T, Value extends SingletonLift<T> = SingletonLift<T>> extends AbstractDomain<T, SingletonValue<T>, SingletonTop, SingletonBottom, Value> implements SatisfiableDomain<T> {
create(value: SingletonLift<T>): this;
static top<T>(): SingletonDomain<T, SingletonTop>;
static bottom<T>(): SingletonDomain<T, SingletonBottom>;
static abstract<T>(concrete: ReadonlySet<T> | typeof Top): SingletonDomain<T>;
top(): this & SingletonDomain<T, SingletonTop>;
bottom(): this & SingletonDomain<T, SingletonBottom>;
equals(other: this): boolean;
leq(other: this): boolean;
join(other: SingletonLift<T>): this;
join(other: this): this;
meet(other: SingletonLift<T>): this;
meet(other: this): this;
widen(other: this): this;
narrow(other: this): this;
concretize(): ReadonlySet<T> | typeof Top;
abstract(concrete: ReadonlySet<T> | typeof Top): this;
satisfies(value: T): Ternary;
toJson(): unknown;
toString(): string;
isTop(): this is SingletonDomain<T, SingletonTop>;
isBottom(): this is SingletonDomain<T, SingletonBottom>;
isValue(): this is SingletonDomain<T, SingletonValue<T>>;
}
export {};