import { FuzzySet } from "vaguely"; import { CasesExprContext, FuzzyExprContext } from "../antlr/CertusParser"; import { Artifact, Indicator, IndicatorCategory, NodeType } from "./Argument"; import { EvaluationError } from "../parser/Evaluator"; import { Macro } from "../macro/Macro"; import { SyntaxIssue } from "../parser/CertusErrorListener"; export type FZ = FuzzySet | null; export type Valuation = { id: string; valuation: FZ; type: NodeType; }; export declare class ContextError extends Error { constructor(msg: any); } export declare class CertusContext { private readonly UI; private _root; private _children; private _childrenTypes; private canonicalNames; private readonly canonicalSets; private readonly namedSets; private readonly namedOps; private readonly macros; private readonly indicators; private readonly indicatorCategories; private readonly artifacts; private syntaxErrors; private evaluationErrors; constructor(); getRoot(): Valuation; setRoot(id: string, valuation?: FZ, type?: NodeType): void; setRootValuation(valuation: FZ): void; hasRoot(id: string): boolean; get children(): string[]; addChild(c: string, t: NodeType, valuation?: FZ): void; hasChild(id: string): boolean; getChildValuation(id: string): FZ; getChildType(id: string): NodeType; removeAllChildren(): void; removeChild(id: string): void; addNamedSet(name: string, set?: FZ): void; addCanonicalSet(set: FZ, sort?: boolean): void; hasCanonicalSet(name: string): boolean; getCanonicalSet(name: string): FZ | null; getCanonicalSets(): FZ[]; getDefaultCanonical(t: NodeType): FZ; private sortCanonical; private recomputeCanonicalNames; getNamedSets(): FZ[]; getNamedSet(name: string): FZ; hasNamedSet(name: string): boolean; removeNamedSet(name: string): void; addNamedOp(op: Operation): void; getNamedOps(): Operation[]; getNamedOp(name: string): Operation | null; hasNamedOp(name: string): boolean; removeNamedOp(name: string): void; hasMacro(name: string): boolean; addMacro(m: Macro): void; getMacro(name: string): Macro | null; getMacros(): Macro[]; hasIndicator(id: string): boolean; addIndicator(ind: Indicator): void; getIndicator(id: string): Indicator | null; getIndicators(): Indicator[]; removeIndicator(id: string): void; hasIndicatorCategory(id: string): boolean; addIndicatorCategory(cat: IndicatorCategory): void; getIndicatorCategory(id: string): IndicatorCategory | null; removeIndicatorCategory(id: string): void; getIndicatorCategories(): IndicatorCategory[]; indicatorIsCategory(ind: Indicator, cat: IndicatorCategory): boolean; hasArtifact(id: string): boolean; addArtifact(artifact: Artifact): void; getArtifact(id: string): Artifact | null; getArtifacts(): Artifact[]; removeArtifact(id: string): void; addSyntaxErrors(...e: SyntaxIssue[]): void; clearSyntaxErrors(): void; getSyntaxErrors(): SyntaxIssue[]; addEvaluationErrors(...e: (EvaluationError | RangeError)[]): void; clearEvaluationErrors(): void; getEvaluationErrors(): (EvaluationError | RangeError)[]; clone(): CertusContext; buildTrap(a: any, b: any, c: any, d: number): FZ; buildTri(a: any, b: any, c: number): FZ; buildUp(a: any, b: number): FZ; buildDown(a: any, b: number): FZ; buildConstant(a: number): FZ; /** * Computes the fuzzy set inversion (mirror image) of the provided set * preferring to return a mirror image based on a canonical * set if it matches (e.g., vhigh -> vopp). Otherwise, directly * computes the mirror image. * * @param fz fuzzy set to compute complement for * @returns Complement of the set */ computeSetInversion(fz: FZ): FZ; /** * Performs an efficient ranking of fuzzy sets. Checks for canonical sets * and then compares them directly. If either set is not a canonical set, * then uses the FuzzySet.rank() function from Vaguely. * * @param A the first fuzzy set to compare * @param B the second fuzzy set to compare * @return +1 if A > B, -1 if A < B, and 0 otherwise. */ rankSets(A: FZ, B: FZ): number; /** * Canonical sets are: * - reject * - vopp * - opp * - uncert * - low * - high * - vhigh * - certain */ private initCanonicalSets; private sanitizeNodeId; private sanitizeIndicator; private sanitizeArtifact; } export declare class Operation { readonly name: any; readonly params: TypedParameter[]; readonly expr: FuzzyExprContext | CasesExprContext; constructor(name: any, params: TypedParameter[], expr: FuzzyExprContext | CasesExprContext); check(): void; private checkSelfRecursion; private checkDuplicateParams; clone(): Operation; } export declare class TypedParameter { readonly name: any; readonly type: any; constructor(name: any, type: any); clone(): TypedParameter; } //# sourceMappingURL=Context.d.ts.map