function XPathOptimizationCache(newMaxSize) {
// private
    var cache = new BoundedCache(newMaxSize);

// public
    /**
     * Returns the optimized item by document markup and XPath, or null if
     * it is not found in the cache. Never calls put() on the underlying cache.
     */
    this.get = function(html, xpath) {
        var byHtml = cache.get(html);

        return byHtml ? byHtml[xpath] : null;
    };

    /**
     * Returns the optimization item by document markup and XPath. Returns an
     * empty map object that has been added to the cache if the item did not
     * exist previously. Never returns null.
     */
    this.getOrCreate = function(html, xpath) {
        var byHtml = cache.get(html);

        if (byHtml == null) {
            var result = {};
            var optimizations = {};

            optimizations[xpath] = result;
            cache.put(html, optimizations);
            return result;
        }

        var item = byHtml[xpath];

        if (item == null) {
            var result = {};

            byHtml[xpath] = result;
            return result;
        }

        return item;
    };
}
function XPathOptimizationCache(newMaxSize) {
// private
    var cache = new BoundedCache(newMaxSize);

// public
    /**
     * Returns the optimized item by document markup and XPath, or null if
     * it is not found in the cache. Never calls put() on the underlying cache.
     */
    this.get = function(html, xpath) {
        var byHtml = cache.get(html);

        return byHtml ? byHtml[xpath] : null;
    };

    /**
     * Returns the optimization item by document markup and XPath. Returns an
     * empty map object that has been added to the cache if the item did not
     * exist previously. Never returns null.
     */
    this.getOrCreate = function(html, xpath) {
        var byHtml = cache.get(html);

        if (byHtml == null) {
            var result = {};
            var optimizations = {};

            optimizations[xpath] = result;
            cache.put(html, optimizations);
            return result;
        }

        var item = byHtml[xpath];

        if (item == null) {
            var result = {};

            byHtml[xpath] = result;
            return result;
        }

        return item;
    };
}
function XPathOptimizationCache ( newMaxSize ) { // private var cache = new BoundedCache ( newMaxSize ) ; // public /**
     * Returns the optimized item by document markup and XPath, or null if
     * it is not found in the cache. Never calls put() on the underlying cache.
     */ this . get = function ( html , xpath ) { var byHtml = cache . get ( html ) ; return byHtml ? byHtml [ xpath ] : null ; } ; /**
     * Returns the optimization item by document markup and XPath. Returns an
     * empty map object that has been added to the cache if the item did not
     * exist previously. Never returns null.
     */ this . getOrCreate = function ( html , xpath ) { var byHtml = cache . get ( html ) ; if ( byHtml == null ) { var result = { } ; var optimizations = { } ; optimizations [ xpath ] = result ; cache . put ( html , optimizations ) ; return result ; } var item = byHtml [ xpath ] ; if ( item == null ) { var result = { } ; byHtml [ xpath ] = result ; return result ; } return item ; } ; }
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
XPathOptimizationCache - A cache that is used to optimize the given xpath.