import { Bounds } from "./Math/Bounds";
import { ComponentId } from "./Types";
/** Class that creates a key from the id (ignoring the current state of the component. */
export declare class ComponentIdKeyGenerator implements IKeyGenerator<ComponentId> {
    key(id: ComponentId): number;
}
/** Class that creates a key for the id respecting the current transformation of the object.
 *  Thus using this class to generate keys for the same id after it has changed e.g. its position will result in different keys.
 */
export declare class ComponentTransformationKeyGenerator implements IKeyGenerator<ComponentId> {
    key(id: ComponentId): number;
}
/** Class that associates a component id with the corresponding local bounds. */
export declare class IdBoundsAssociator implements IAssociator<ComponentId, Bounds> {
    getAssociate(id: ComponentId): Bounds;
}
/**
 * Method for creating a hash (number) from a string.
 * Solution from http://stackoverflow.com/questions/7616461/generate-a-hash-from-string-in-javascript-jquery
 */
export declare function generateHash(stringToHash: string): number;
/** Generic key generator template. */
export interface IKeyGenerator<T> {
    key(obj: T): number;
}
/** Generic Associator template. */
export interface IAssociator<U, T> {
    getAssociate(obj: U): T;
}
/** Abstract cache class. This cache takes a key generator and an associator.
 *  Values are saved and acquired via the first parameter (U). Cached values are of type T.
 *  E.g. if you want to implement a cache that saved the points of an object and access it by the objects id,
 *  you would need a key generator for the id (that gives an unique key depending on the state of the object) and
 *  an associator which will associate the id with the corresponding points.
 */
export declare class Cache<U, T> {
    /** Internal storage for the cached values. */
    private cache;
    /** The key generator. */
    private generator;
    /** The associator */
    private associator;
    /**
     * The constructor. Takes the generator and associator and initializes the empty internal cache.
     * @param generator: the generator
     * @param associator the associator
     */
    constructor(generator: IKeyGenerator<U>, associator: IAssociator<U, T>);
    /**
     * Gets the cached value associated with the object.
     * @param obj
     * @returns The cached value if it exists, undefined otherwise.
     */
    get(obj: U): T;
    /**
     * Saves the associated value of the object as a value in the cache, if there is no object matching the key.
     * Uses the generator and the associator
     * @param obj the object
     */
    put(obj: U): void;
    /**
     * Puts all associated values of the objects into the cache.
     * @param objects
     */
    putAll(objects: Array<U>): void;
    /**
     * Empties the internal cache.
     */
    flush(): void;
}
/** Class that contains caches. */
export declare class Caches {
    /** Cache for the local bounds. */
    static boundsCache: Cache<ComponentId, Bounds>;
}
