import { Disposable, Listener } from '@vertexvis/utils'; import { MeasurementEntity } from './entities'; import { MeasurementOutcome } from './outcomes'; import { MeasurementResult } from './results'; /** * A model representing the state of measurement. * * Measurement contains a set of `MeasureEntity`s that represent what's being * measured, and a set of `MeasurementResult`s representing the results of the * measurement. * * Views can register event listeners to the model to be notified when new * measurements have been added. */ export declare class MeasurementModel { private entities; private outcome?; private results; private entitiesChanged; private outcomeChanged; /** * Registers an entity to be measured with the model. * * @param entity An entity to measure. * @returns `true` if the entity has been added. */ addEntity(entity: MeasurementEntity): boolean; /** * Clears all registered entities from the model. */ clearEntities(): void; /** * Clears the outcome containing the results of a measurement. */ clearOutcome(): void; /** * Sets the outcome containing the results of a measurement. * * Emits a _outcome changed_ event. * * @param outcome The outcome containing results. */ setOutcome(outcome: MeasurementOutcome | undefined): void; /** * Returns all the entities registered with the model. */ getEntities(): MeasurementEntity[]; /** * Returns the outcome that contains the results of a measurement. */ getOutcome(): MeasurementOutcome | undefined; /** * Returns all the measurement results of the model. */ getResults(): MeasurementResult[]; /** * Unregisters an entity from the model. * * @param entity The entity to remove. * @returns `true` if the entity was removed. */ removeEntity(entity: MeasurementEntity): boolean; /** * Sets the set of entities to be measured with the model. * * @param entities A set of entities to measure. * @returns `true` if the entity has been added. */ setEntities(entities: Set): boolean; /** * Registers an event listener that will be invoked when the model's outcome * changes. * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onOutcomeChanged(listener: Listener): Disposable; /** * Registers an event listener that will be invoked when the model's * measurement entities change. * * @param listener The listener to add. * @returns A disposable that can be used to remove the listener. */ onEntitiesChanged(listener: Listener): Disposable; }