UNPKG

mathjslab

Version:

MathJSLab - An interpreter with language syntax like MATLAB®/Octave, ISBN 978-65-00-82338-7.

107 lines (106 loc) 2.77 kB
import { ComplexType } from './Complex'; import { type ElementType, MultiArray } from './MultiArray'; import { Evaluator } from './Evaluator'; declare class Structure { static readonly STRUCTURE = 4; readonly type = 4; parent: any; field: Record<string, ElementType>; private static readonly invalidReferenceMessage; static isInstanceOf: (value: unknown) => boolean; /** * Structure constructor. If an object is passed as parameter then create * a Structure with same fields and values of object. If an array of field * names as string is passed then create a Structure with this field * branch and nested field value set to empty array. * @param field An object with fields and values or an array of field names. */ constructor(field: Record<string, ElementType> | string[]); /** * Return true if obj is a structure or a structure array. * @param obj * @returns */ static isStructure: (obj: ElementType) => boolean; /** * * @param S * @param field * @param value */ static setField: (S: Structure, field: string[], value?: ElementType) => void; /** * * @param S * @param field * @param value */ static setNewField: (S: Structure, field: string[], value?: ElementType) => void; /** * * @param obj * @param field * @returns */ static getField: (obj: ElementType, field: string[]) => ElementType; /** * * @param obj * @param field * @returns */ static getFields: (obj: ElementType, field: string[]) => ElementType[]; /** * * @param S * @param evaluator * @returns */ static unparse: (S: Structure, evaluator: Evaluator, parentPrecedence?: number) => string; /** * * @param S * @param evaluator * @returns */ static unparseMathML: (S: Structure, evaluator: Evaluator, parentPrecedence?: number) => string; /** * * @param S * @returns */ static copy: (S: Structure) => Structure; /** * * @returns */ copy(): Structure; /** * * @param S * @returns */ static cloneFields: (S: Structure) => Structure; /** * * @param S * @returns */ static toLogical: (S: Structure) => ComplexType; /** * * @returns */ toLogical(): ComplexType; /** * Set empty field in all elements of MultiArray if it is not cell array and if field not defined. * @param M * @param field */ static setEmptyField: (M: MultiArray, field: string) => void; } export { Structure }; declare const _default: { Structure: typeof Structure; }; export default _default;