/**
 * Constructor.
 * @class
 * @author eric.wittmann@gmail.com
 */
var ReferenceResolverChain = /** @class */ (function () {
    function ReferenceResolverChain() {
        this.resolvers = ([]);
        this.addResolver(new LocalReferenceResolver());
    }
    ReferenceResolverChain.instance_$LI$ = function () { if (ReferenceResolverChain.instance == null)
        ReferenceResolverChain.instance = new ReferenceResolverChain(); return ReferenceResolverChain.instance; };
    ;
    ReferenceResolverChain.getInstance = function () {
        return ReferenceResolverChain.instance_$LI$();
    };
    /**
     * @return {*[]} the resolvers
     */
    ReferenceResolverChain.prototype.getResolvers = function () {
        return this.resolvers;
    };
    /**
     * @param {*} resolver
     */
    ReferenceResolverChain.prototype.addResolver = function (resolver) {
        /* add */ this.resolvers.splice(0, 0, resolver);
    };
    /**
     * @param {*} resolver
     */
    ReferenceResolverChain.prototype.removeResolver = function (resolver) {
        /* remove */ (function (a) { var index = a.indexOf(resolver); if (index >= 0) {
            a.splice(index, 1);
            return true;
        }
        else {
            return false;
        } })(this.resolvers);
    };
    /**
     *
     * @param {string} reference
     * @param {Node} from
     * @return {Node}
     */
    ReferenceResolverChain.prototype.resolveRef = function (reference, from) {
        for (var index137 = 0; index137 < this.resolvers.length; index137++) {
            var resolver = this.resolvers[index137];
            {
                var resolvedNode = resolver.resolveRef(reference, from);
                if (resolvedNode != null) {
                    return resolvedNode;
                }
            }
        }
        return null;
    };
    return ReferenceResolverChain;
}());
export { ReferenceResolverChain };
ReferenceResolverChain["__class"] = "io.apicurio.datamodels.core.util.ReferenceResolverChain";
ReferenceResolverChain["__interfaces"] = ["io.apicurio.datamodels.core.util.IReferenceResolver"];
import { LocalReferenceResolver } from './LocalReferenceResolver';
//# sourceMappingURL=ReferenceResolverChain.js.map