import { ValidationBase } from "../helpers/validation/ValidationBase"; import { Serializable } from "../interfaces/Serializable"; import { Expression as SBDraft2Expression } from "../../mappings/d2sb/Expression"; import { Expression as V1Expression } from "../../mappings/v1.0/Expression"; import { EventHub } from "../helpers/EventHub"; export declare abstract class ExpressionModel extends ValidationBase implements Serializable { protected eventHub: EventHub; customProps: {}; protected cachedContext: any; result: any; /** Internal type */ protected _type: "string" | "expression" | "number"; /** Getter for model type. Returns internal representation */ /** Setter for model type. Model holds either expression or primitive like "string" */ type: "string" | "expression" | "number"; /** Flag if model contains expression */ readonly isExpression: boolean; constructor(loc?: string, eventHub?: EventHub); /** * Returns CWL representation. */ abstract serialize(): any; /** * Sets CWL representation as internal value */ abstract deserialize(attr: any): void; /** * Evaluates expression and sets its result to result property. * * If expression throws a SyntaxError, no result is returned and the syntax error is pushed to * validation.errors. If expression throws any other exception, it is pushed to validation.warnings * * @param context * @returns {any} */ abstract evaluate(context: any): Promise; /** * Returns script value of expression.script, or undefined if not set. * @returns {string} */ abstract getScript(): string; /** * Sets value of expression.script or primitive based on type parameter. */ abstract setValue(val: number | string | SBDraft2Expression | V1Expression, type: "expression" | "string" | "number"): any; /** * Returns string representation of expression.script or primitive value. * @returns {string} */ abstract toString(): string; validate(context?: any): Promise; protected _evaluate(value: number | string | SBDraft2Expression, context: any, version: "v1.0" | "draft-2"): Promise; abstract clone(): ExpressionModel; abstract cloneStatus(clone: ExpressionModel): any; }