// 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/util/Equals.java
// public interface Equals<T> {
//     class EqualsImplementations {
//         private static final Equals<Object> DEFAULT = new Equals<Object>() {
// 
//             @Override
//             public boolean test(Object value1, Object value2) {
//                 return value1 == value2 || (value1 != null && value1.equals(value2));
//             }
// 
//         };
//         private static final Equals<Pattern> PATTERN = new Equals<Pattern>() {
// 
//             @Override
//             public boolean test(Pattern value1, Pattern value2) {
//                 return value1 == value2
//                         || (value1 != null && value1.pattern().equals(value2 == null ? null : value2.pattern()));
//             }
// 
//         };
// 
//         /**
//          * @return a default {@link Equals} implementation that works for any type {@code T} which overrides
//          *         {@link Object#equals(Object)}.
//          */
//         @SuppressWarnings("unchecked")
//         public static <T> Equals<T> equals() {
//             return (Equals<T>) DEFAULT;
//         }
// 
//         /**
//          * @return an {@link Equals} implementation that compares based on {@link Pattern#pattern()}.
//          */
//         public static Equals<Pattern> equalsPattern() {
//             return PATTERN;
//         }
//     }
// 
//     /**
//      * As long as type {@code T} overrides {@link Object#equals(Object)}, must be equivalent to {@code value1 == value2
//      *                  || (value1 != null && value1.pattern().equals(value2 == null ? null : value2.pattern()))}
//      * otherwise the implementations have to come up with some alternative which obey the contact of
//      * {@link Object#equals(Object)}.
//      *
//      * @param value1 the first value to compare
//      * @param value2 the second value to compare
//      * @return {@code true} of {@code value1} and {@code value2} are equal
//      */
//     boolean test(T value1, T value2);
// }


import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import org.srcdeps.core.config.tree.Node;
import org.srcdeps.core.config.tree.ScalarNode;
import org.srcdeps.core.util.Equals;
    @Override
    public Class<T> getType() {
        return type;
    }

    /** {@inheritDoc} */
    @Override
    public T getValue() {
        return value;
    }

    public void inheritFrom(ScalarNode<T> inheritFrom, Stack<Node> configurationStack) {
        if (this.value == null) {
            inheritFrom.applyDefaultsAndInheritance(configurationStack);
            this.value = inheritFrom.getValue();
        }
    }

    /** {@inheritDoc} */
    @Override
    public void init(Node source) {
        if (getClass() != source.getClass()) {
            throw new IllegalArgumentException(
                    String.format("Cannot init [%s] from [%s]", this.getClass(), source.getClass()));
        }
        @SuppressWarnings("unchecked")
        ScalarNode<T> sourceScalar = (DefaultScalarNode<T>) source;
        this.value = sourceScalar.getValue();
    }

// 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/util/Equals.java
// public interface Equals<T> {
//     class EqualsImplementations {
//         private static final Equals<Object> DEFAULT = new Equals<Object>() {
// 
//             @Override
//             public boolean test(Object value1, Object value2) {
//                 return value1 == value2 || (value1 != null && value1.equals(value2));
//             }
// 
//         };
//         private static final Equals<Pattern> PATTERN = new Equals<Pattern>() {
// 
//             @Override
//             public boolean test(Pattern value1, Pattern value2) {
//                 return value1 == value2
//                         || (value1 != null && value1.pattern().equals(value2 == null ? null : value2.pattern()));
//             }
// 
//         };
// 
//         /**
//          * @return a default {@link Equals} implementation that works for any type {@code T} which overrides
//          *         {@link Object#equals(Object)}.
//          */
//         @SuppressWarnings("unchecked")
//         public static <T> Equals<T> equals() {
//             return (Equals<T>) DEFAULT;
//         }
// 
//         /**
//          * @return an {@link Equals} implementation that compares based on {@link Pattern#pattern()}.
//          */
//         public static Equals<Pattern> equalsPattern() {
//             return PATTERN;
//         }
//     }
// 
//     /**
//      * As long as type {@code T} overrides {@link Object#equals(Object)}, must be equivalent to {@code value1 == value2
//      *                  || (value1 != null && value1.pattern().equals(value2 == null ? null : value2.pattern()))}
//      * otherwise the implementations have to come up with some alternative which obey the contact of
//      * {@link Object#equals(Object)}.
//      *
//      * @param value1 the first value to compare
//      * @param value2 the second value to compare
//      * @return {@code true} of {@code value1} and {@code value2} are equal
//      */
//     boolean test(T value1, T value2);
// }


// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/impl/DefaultScalarNode.java
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import org.srcdeps.core.config.tree.Node;
import org.srcdeps.core.config.tree.ScalarNode;
import org.srcdeps.core.util.Equals;

    @Override
    public Class<T> getType() {
        return type;
    }

    /** {@inheritDoc} */
    @Override
    public T getValue() {
        return value;
    }

    public void inheritFrom(ScalarNode<T> inheritFrom, Stack<Node> configurationStack) {
        if (this.value == null) {
            inheritFrom.applyDefaultsAndInheritance(configurationStack);
            this.value = inheritFrom.getValue();
        }
    }

    /** {@inheritDoc} */
    @Override
    public void init(Node source) {
        if (getClass() != source.getClass()) {
            throw new IllegalArgumentException(
                    String.format("Cannot init [%s] from [%s]", this.getClass(), source.getClass()));
        }
        @SuppressWarnings("unchecked")
        ScalarNode<T> sourceScalar = (DefaultScalarNode<T>) source;
        this.value = sourceScalar.getValue();
    }

    public boolean isInDefaultState(ScalarNode<T> inheritFrom, Stack<Node> configurationStack) {