var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
/* Generated from Java with JSweet 2.3.7 - http://www.jsweet.org */
import { CombinedAllNodeVisitor } from '../../../combined/visitors/CombinedAllNodeVisitor';
/**
 * Collect all nodes representing reference objects. Those nodes
 * MUST implement {@link IReferenceNode} and {@link INamed}.
 * <p>
 * Warning: The nodes are not cloned, so modifying them would modify the original model.
 * You MUST clone them yourself before changing their state.
 * <p>
 * Do not reuse visitor instances for multiple traversals.
 *
 * @author Jakub Senko <jsenko@redhat.com>
 * @class
 * @extends CombinedAllNodeVisitor
 */
var ReferenceCollectionVisitor = /** @class */ (function (_super) {
    __extends(ReferenceCollectionVisitor, _super);
    function ReferenceCollectionVisitor() {
        var _this = _super.call(this) || this;
        _this.fullNodes = ([]);
        _this.referencedNodes = ([]);
        return _this;
    }
    /**
     * Visit a node.  This is a common method called for every node type.
     *
     * @param {Node} node
     */
    ReferenceCollectionVisitor.prototype.visitNode = function (node) {
        if (node != null && (node["__interfaces"] != null && node["__interfaces"].indexOf("io.apicurio.datamodels.core.models.IReferenceNode") >= 0 || node.constructor != null && node.constructor["__interfaces"] != null && node.constructor["__interfaces"].indexOf("io.apicurio.datamodels.core.models.IReferenceNode") >= 0)) {
            var refNode = node;
            if (refNode.getReference() != null) /* add */
                (this.referencedNodes.push(refNode) > 0);
            else /* add */
                (this.fullNodes.push(refNode) > 0);
        }
    };
    /**
     * @return {*[]} An map of collected nodes that CONTAIN an actual reference string.
     */
    ReferenceCollectionVisitor.prototype.getReferencedNodes = function () {
        return (this.referencedNodes.slice(0));
    };
    /**
     * @return {*[]} An map of collected nodes that DO NOT CONTAIN an actual reference string,
     * i.e. full nodes.
     */
    ReferenceCollectionVisitor.prototype.getFullNodes = function () {
        return (this.fullNodes.slice(0));
    };
    return ReferenceCollectionVisitor;
}(CombinedAllNodeVisitor));
export { ReferenceCollectionVisitor };
ReferenceCollectionVisitor["__class"] = "io.apicurio.datamodels.openapi.visitors.dereference.ReferenceCollectionVisitor";
ReferenceCollectionVisitor["__interfaces"] = ["io.apicurio.datamodels.core.visitors.IVisitor", "io.apicurio.datamodels.asyncapi.v2.visitors.IAai20Visitor", "io.apicurio.datamodels.openapi.v3.visitors.IOas30Visitor", "io.apicurio.datamodels.asyncapi.visitors.IAaiVisitor", "io.apicurio.datamodels.openapi.v2.visitors.IOas20Visitor", "io.apicurio.datamodels.openapi.visitors.IOasVisitor"];
//# sourceMappingURL=ReferenceCollectionVisitor.js.map