// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ListOfScalarsNode.java
// public interface ListOfScalarsNode<E> extends ListNode<ScalarNode<E>> {
//     /**
//      * Creates a new {@link ScalarNode} out of the given scalar {@code value} and adds it to this list.
//      *
//      * @param value the scalar value to add
//      */
//     void add(E value);
// 
//     /**
//      * For each of the given {@code values}, creates a new {@link ScalarNode} out of the given scalar value and adds it
//      * to this list.
//      *
//      * @param values the scalar values to add
//      */
//     void addAll(Collection<E> values);
// 
//     /**
//      * Gathers the values of each {@link ScalarNode} present in {@link #getElements()} and returns them as a
//      * {@link List}
//      *
//      * @return a new list of scalar values stored in this list
//      */
//     List<E> asListOfValues();
// 
//     /**
//      * Gathers the values of each {@link ScalarNode} present in {@link #getElements()} and returns them as a {@link Set}
//      *
//      * @return a new {@link LinkedHashSet} of scalar values stored in this list
//      */
//     Set<E> asSetOfValues();
// 
//     /**
//      * Removes all elements from this list.
//      */
//     void clear();
// 
//     /**
//      * @return the type of the value of this list's elements. Basically the value of the {@code <E>} type parameter.
//      */
//     Class<E> getElementType();
// }
// 
// 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);
// }


import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.srcdeps.core.config.tree.ListOfScalarsNode;
import org.srcdeps.core.config.tree.ScalarNode;
/**
 * 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.impl;



/**
 * The default implementation of {@link ListOfScalarsNode}.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 *
 * @param <E> the type of the scalar values stored in this list
 */
public class DefaultListOfScalarsNode<E> extends DefaultListNode<ScalarNode<E>> implements ListOfScalarsNode<E> {
    private final Class<E> elementType;

    public DefaultListOfScalarsNode(String name, Class<E> elementType) {
        super(name);
        this.elementType = elementType;
    }

    /** {@inheritDoc} */
    @Override
    public void add(E value) {
        elements.add(DefaultScalarNode.of(value));
    }

    /** {@inheritDoc} */
    @Override
    public void addAll(Collection<E> values) {
        for (E val : values) {
            elements.add(DefaultScalarNode.of(val));
        }
    }

    /** {@inheritDoc} */
    @Override
    public List<E> asListOfValues() {
        List<E> result = new ArrayList<>(elements.size());
        for (ScalarNode<E> elem : elements) {
            result.add(elem.getValue());
        }
        return Collections.unmodifiableList(result);
    }

    /** {@inheritDoc} */
    @Override
    public Set<E> asSetOfValues() {
        Set<E> result = new LinkedHashSet<>(elements.size());
// Path: srcdeps-core/src/main/java/org/srcdeps/core/config/tree/ListOfScalarsNode.java
// public interface ListOfScalarsNode<E> extends ListNode<ScalarNode<E>> {
//     /**
//      * Creates a new {@link ScalarNode} out of the given scalar {@code value} and adds it to this list.
//      *
//      * @param value the scalar value to add
//      */
//     void add(E value);
// 
//     /**
//      * For each of the given {@code values}, creates a new {@link ScalarNode} out of the given scalar value and adds it
//      * to this list.
//      *
//      * @param values the scalar values to add
//      */
//     void addAll(Collection<E> values);
// 
//     /**
//      * Gathers the values of each {@link ScalarNode} present in {@link #getElements()} and returns them as a
//      * {@link List}
//      *
//      * @return a new list of scalar values stored in this list
//      */
//     List<E> asListOfValues();
// 
//     /**
//      * Gathers the values of each {@link ScalarNode} present in {@link #getElements()} and returns them as a {@link Set}
//      *
//      * @return a new {@link LinkedHashSet} of scalar values stored in this list
//      */
//     Set<E> asSetOfValues();
// 
//     /**
//      * Removes all elements from this list.
//      */
//     void clear();
// 
//     /**
//      * @return the type of the value of this list's elements. Basically the value of the {@code <E>} type parameter.
//      */
//     Class<E> getElementType();
// }
// 
// 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/impl/DefaultListOfScalarsNode.java
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.srcdeps.core.config.tree.ListOfScalarsNode;
import org.srcdeps.core.config.tree.ScalarNode;

/**
 * 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.impl;



/**
 * The default implementation of {@link ListOfScalarsNode}.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 *
 * @param <E> the type of the scalar values stored in this list
 */
public class DefaultListOfScalarsNode<E> extends DefaultListNode<ScalarNode<E>> implements ListOfScalarsNode<E> {
    private final Class<E> elementType;

    public DefaultListOfScalarsNode(String name, Class<E> elementType) {
        super(name);
        this.elementType = elementType;
    }

    /** {@inheritDoc} */
    @Override
    public void add(E value) {
        elements.add(DefaultScalarNode.of(value));
    }

    /** {@inheritDoc} */
    @Override
    public void addAll(Collection<E> values) {
        for (E val : values) {
            elements.add(DefaultScalarNode.of(val));
        }
    }

    /** {@inheritDoc} */
    @Override
    public List<E> asListOfValues() {
        List<E> result = new ArrayList<>(elements.size());
        for (ScalarNode<E> elem : elements) {
            result.add(elem.getValue());
        }
        return Collections.unmodifiableList(result);
    }

    /** {@inheritDoc} */
    @Override
    public Set<E> asSetOfValues() {
        Set<E> result = new LinkedHashSet<>(elements.size());
        for (ScalarNode<E> elem : elements) {