// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ContainerNode.java
// public interface ContainerNode<C extends Node> extends Node {
//     /**
//      * @return a map of child nodes
//      */
//     Map<String, C> getChildren();
// 
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ListNode.java
// public interface ListNode<E extends Node> extends Node {
//     /**
//      * @return the elements of this {@link ListNode}
//      */
//     List<E> getElements();
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/Node.java
// public interface Node {
//     /**
//      * Apply the defaults or apply some kind of inheritance in case the values of some attributes were not set
//      * explicitly. See also {@link DefaultsAndInheritanceVisitor}.
//      *
//      * @param configurationStack the stack of ancestor configuration nodes. Can be queried to inherit values.
//      */
//     void applyDefaultsAndInheritance(Stack<Node> configurationStack);
// 
//     /**
//      * @return a list of comment lines that should appear before this node
//      */
//     List<String> getCommentBefore();
// 
//     /**
//      * @return the name of the present node that is supposed to be unique within the parent node. Can be {@code null} in
//      *         case this {@link Node} is an element of a {@link NodeList}.
//      */
//     String getName();
// 
//     /**
//      * Fully reset the state of this {@link Node} using the given {@code source} {@link Node}.
//      *
//      * @param source the {@link Node} to take the values from
//      */
//     void init(Node source);
// 
//     /**
//      * @param stack the ancestor hierarchy of this {@link Node}
//      * @return {@code true} if this {@link Node}'s internal state has not been set yet or if the state is in the
//      *         instance or implementation specific default state. Otherwise returns {@code false}
//      */
//     boolean isInDefaultState(Stack<Node> stack);
// 
//     /**
//      * @return {@code true} if the name of the node will commonly contain special characters, esp. periods. Otherwise
//      *         returns {@code false}
//      */
//     boolean shouldEscapeName();
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ScalarNode.java
// public interface ScalarNode<T> extends Node {
//     /**
//      * @return the default value to be used if the value of this {@link ScalarNode} is not set explicitly
//      */
//     T getDefaultValue();
// 
//     /**
//      * @return the type of the value
//      */
//     Class<T> getType();
// 
//     /**
//      * @return the value stored in this {@link ScalarNode}
//      */
//     T getValue();
// 
//     /**
//      * Sets the value stored in this {@link ScalarNode}.
//      *
//      * @param value the value to set
//      */
//     void setValue(T value);
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/Visitor.java
// public interface Visitor {
// 
//     /**
//      * Check whether the children of the given {@link ContainerNode} should be visited.
//      *
//      * @param node the current {@link ContainerNode}
//      * @return {@code true} if the calling walker should traverse the children of the given {@code node}; {@code false}
//      *         otherwise
//      */
//     boolean containerBegin(ContainerNode<? extends Node> node);
// 
//     /**
//      * Called just after {@link #containerBegin(ContainerNode)} if it returned {@code true} or after the children of a
//      * {@link ContainerNode} were visited.
//      */
//     void containerEnd();
// 
//     /**
//      * Check whether the elements of the given {@link ListNode} should be visited.
//      *
//      * @param node the current {@link ListNode}
//      * @return {@code true} if the calling walker should traverse the elements of the given {@code node}; {@code false}
//      *         otherwise
//      */
//     boolean listBegin(ListNode<? extends Node> node);
// 
//     /**
//      * Called just after {@link #containerBegin(ContainerNode)} if it returned {@code true} or after the children of a
//      * {@link ListNode} were visited.
//      */
//     void listEnd();
// 
//     /**
//      * Visit the given {@link ScalarNode}.
//      *
//      * @param node the {@link ScalarNode} to visit
//      */
//     void scalar(ScalarNode<Object> node);
// 
// }


import java.util.Stack;
import org.srcdeps.core.config.tree.ContainerNode;
import org.srcdeps.core.config.tree.ListNode;
import org.srcdeps.core.config.tree.Node;
import org.srcdeps.core.config.tree.ScalarNode;
import org.srcdeps.core.config.tree.Visitor;
/**
 * Copyright 2015-2018 Maven Source Dependencies
 * Plugin contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.srcdeps.core.config.tree.walk;



/**
 * A base for several other {@link Visitor}s that maintains the {@link #stack} of {@link Node}s.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 */
public abstract class AbstractVisitor implements Visitor {

    protected final Stack<Node> stack = new Stack<>();

    /**
     * Pushes the given node to the {@link #stack}.
     *
     * @param node {@inheritDoc}
     * @return {@inheritDoc}
     */
    @Override
    public boolean containerBegin(ContainerNode<? extends Node> node) {
        this.stack.push(node);
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ContainerNode.java
// public interface ContainerNode<C extends Node> extends Node {
//     /**
//      * @return a map of child nodes
//      */
//     Map<String, C> getChildren();
// 
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ListNode.java
// public interface ListNode<E extends Node> extends Node {
//     /**
//      * @return the elements of this {@link ListNode}
//      */
//     List<E> getElements();
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/Node.java
// public interface Node {
//     /**
//      * Apply the defaults or apply some kind of inheritance in case the values of some attributes were not set
//      * explicitly. See also {@link DefaultsAndInheritanceVisitor}.
//      *
//      * @param configurationStack the stack of ancestor configuration nodes. Can be queried to inherit values.
//      */
//     void applyDefaultsAndInheritance(Stack<Node> configurationStack);
// 
//     /**
//      * @return a list of comment lines that should appear before this node
//      */
//     List<String> getCommentBefore();
// 
//     /**
//      * @return the name of the present node that is supposed to be unique within the parent node. Can be {@code null} in
//      *         case this {@link Node} is an element of a {@link NodeList}.
//      */
//     String getName();
// 
//     /**
//      * Fully reset the state of this {@link Node} using the given {@code source} {@link Node}.
//      *
//      * @param source the {@link Node} to take the values from
//      */
//     void init(Node source);
// 
//     /**
//      * @param stack the ancestor hierarchy of this {@link Node}
//      * @return {@code true} if this {@link Node}'s internal state has not been set yet or if the state is in the
//      *         instance or implementation specific default state. Otherwise returns {@code false}
//      */
//     boolean isInDefaultState(Stack<Node> stack);
// 
//     /**
//      * @return {@code true} if the name of the node will commonly contain special characters, esp. periods. Otherwise
//      *         returns {@code false}
//      */
//     boolean shouldEscapeName();
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ScalarNode.java
// public interface ScalarNode<T> extends Node {
//     /**
//      * @return the default value to be used if the value of this {@link ScalarNode} is not set explicitly
//      */
//     T getDefaultValue();
// 
//     /**
//      * @return the type of the value
//      */
//     Class<T> getType();
// 
//     /**
//      * @return the value stored in this {@link ScalarNode}
//      */
//     T getValue();
// 
//     /**
//      * Sets the value stored in this {@link ScalarNode}.
//      *
//      * @param value the value to set
//      */
//     void setValue(T value);
// }
// 
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/Visitor.java
// public interface Visitor {
// 
//     /**
//      * Check whether the children of the given {@link ContainerNode} should be visited.
//      *
//      * @param node the current {@link ContainerNode}
//      * @return {@code true} if the calling walker should traverse the children of the given {@code node}; {@code false}
//      *         otherwise
//      */
//     boolean containerBegin(ContainerNode<? extends Node> node);
// 
//     /**
//      * Called just after {@link #containerBegin(ContainerNode)} if it returned {@code true} or after the children of a
//      * {@link ContainerNode} were visited.
//      */
//     void containerEnd();
// 
//     /**
//      * Check whether the elements of the given {@link ListNode} should be visited.
//      *
//      * @param node the current {@link ListNode}
//      * @return {@code true} if the calling walker should traverse the elements of the given {@code node}; {@code false}
//      *         otherwise
//      */
//     boolean listBegin(ListNode<? extends Node> node);
// 
//     /**
//      * Called just after {@link #containerBegin(ContainerNode)} if it returned {@code true} or after the children of a
//      * {@link ListNode} were visited.
//      */
//     void listEnd();
// 
//     /**
//      * Visit the given {@link ScalarNode}.
//      *
//      * @param node the {@link ScalarNode} to visit
//      */
//     void scalar(ScalarNode<Object> node);
// 
// }


// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/walk/AbstractVisitor.java
import java.util.Stack;
import org.srcdeps.core.config.tree.ContainerNode;
import org.srcdeps.core.config.tree.ListNode;
import org.srcdeps.core.config.tree.Node;
import org.srcdeps.core.config.tree.ScalarNode;
import org.srcdeps.core.config.tree.Visitor;

/**
 * Copyright 2015-2018 Maven Source Dependencies
 * Plugin contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.srcdeps.core.config.tree.walk;



/**
 * A base for several other {@link Visitor}s that maintains the {@link #stack} of {@link Node}s.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 */
public abstract class AbstractVisitor implements Visitor {

    protected final Stack<Node> stack = new Stack<>();

    /**
     * Pushes the given node to the {@link #stack}.
     *
     * @param node {@inheritDoc}
     * @return {@inheritDoc}
     */
    @Override
    public boolean containerBegin(ContainerNode<? extends Node> node) {
        this.stack.push(node);
        return true;