UNPKG

1.51 kBTypeScriptView Raw
1import { Mapping } from "./Mapping";
2/**
3 * Style of logical composition
4 */
5export declare enum PredicateMappingCompositionStyle {
6 And = "and",
7 Or = "or",
8 Not = "not"
9}
10/**
11 * Mapping to a boolean
12 */
13export interface PredicateMapping<F> extends Mapping<F, boolean> {
14 /**
15 * If this predicate has internal structure,
16 * the components and how they are applied.
17 * For internal and tooling use.
18 */
19 readonly structure?: {
20 components: Array<PredicateMapping<F>>;
21 readonly compositionStyle: PredicateMappingCompositionStyle;
22 };
23}
24/**
25 * Implemented by types whose behavior is potentially explicable by a single PredicateMapping
26 */
27export interface Predicated<F> {
28 /**
29 * The test for the contribution. Contributions may be
30 * applied in various ways.
31 */
32 test?: PredicateMapping<F>;
33}
34/**
35 * Function that can visit a PredicateMappings.
36 * @return whether to visit the mapping's subcomponents, if any
37 */
38export declare type PredicateMappingVisitor<F> = (pm: PredicateMapping<F>) => boolean;
39/**
40 * Visit the PredicateMappings, returning whether to continue
41 * @param pm predicate mapping to visit. Always visits root,
42 * and any subcomponents as long as the visitor returns true
43 * @param v visitor
44 * @return {boolean} whether to visit the mapping's structure, if any
45 */
46export declare function visitPredicateMappings<F>(pm: PredicateMapping<F>, v: PredicateMappingVisitor<F>): void;
47//# sourceMappingURL=PredicateMapping.d.ts.map
\No newline at end of file