jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
116 lines • 3.86 kB
TypeScript
import { MessageCode, cLog } from "../internal_modules";
import { Message } from "../internal_modules";
import { Result } from "../internal_modules";
/**
* Calculation result for one iteration.
* May include value of the Nub's calculated parameter (if any), and/or other
* values (previously known as extraResults)
*/
export declare class ResultElement {
/** local messages, related to this calculation iteration */
log: cLog;
/** pointer to parent result */
private _parent;
/**
* result values by symbol; generally contains at least the symbol of the calculated
* parameter and its associated calculated value (aka. vCalc)
*/
private _values;
/** latest key assigned to vCalc (this key might change) */
private _vCalcSymbol;
/**
* @param v value of calculated parameter, or key-values map, or (usually error) Message
*/
constructor(v?: number | Message | {
[]: number;
});
get parent(): Result;
set parent(r: Result);
/**
* @returns value of the calculated parameter (main result); might be undefined,
* for ex. with SectionParametree
*/
get vCalc(): number;
/**
* sets value of the calculated parameter (main result)
*/
set vCalc(r: number);
get vCalcSymbol(): string;
setVCalc(r: number, keepSymbol?: boolean): void;
/**
* Hack to update the key of vCalc, when Result.symbol is updated
* after Equation() returned a ResultElement
*/
updateVCalcSymbol(s: string): void;
/**
* Sets vCalcSymbol back to the parent Nub's calculated parameter symbol
*/
resetVCalcSymbol(): void;
/**
* Adds given values map to the local values map; in case of key conflict,
* precedence goes to the given value
*/
mergeValues(values: {
[]: number;
}): void;
/**
* Returns an array of all the keys in the local values map,
* where vCalcSymbol is always in first position (used by
* GUI to iterate on displayable results)
*/
get keys(): string[];
/** Returns the whole key-value map */
get values(): {
[]: number;
};
/**
* @returns the result value associated to the given symbol, or undefined if the given
* symbol was not found in the local values map
*/
getValue(symbol: string): number;
get firstValue(): number;
count(): number;
/**
* @returns true if local values map is not empty, and local log has no error-level
* message (log still might have non-error level messages)
*/
get ok(): boolean;
/**
* @returns true if local values map has at least one key-value pair
*/
hasValues(): boolean;
/**
* Adds a key-value pair to the values map
*/
addExtraResult(name: string, value: any): void;
/**
* Returns a copy of the local key-values map, without vCalc (only "extra" results)
*/
get extraResults(): any;
/**
* Removes all values that are not vCalc
*/
removeExtraResults(): void;
/**
* Removes all values
*/
removeValues(): void;
toString(): string;
/** adds a message to the global log */
addMessage(m: Message): void;
/** @returns true if current log has at least one message */
hasLog(): boolean;
/**
* @returns true if at least one of the log messages has an error level,
* i.e. if calculation has failed
*/
hasErrorMessages(): boolean;
/** @returns true if at least one of the log messages has a warning level */
hasWarningMessages(): boolean;
hasMessage(code: MessageCode): boolean;
/**
* compute error, warning, info count on all log messages
*/
logStats(stats?: any): any;
}
//# sourceMappingURL=resultelement.d.ts.map