import "copyrightAndOthers.stg"

targetPath() ::= "org/eclipse/collections/api/factory/set/primitive"

fileName(primitive) ::= "Mutable<primitive.name>SetFactory"

class(primitive) ::= <<
<body(primitive.type, primitive.name, primitive.wrapperName)>
>>

body(type, name, wrapperName) ::= <<
<copyrightAndOthers()>

package org.eclipse.collections.api.factory.set.primitive;

import org.eclipse.collections.api.<name>Iterable;
import org.eclipse.collections.api.set.primitive.Mutable<name>Set;
<(wideStreamImport.(type))>

/**
 * A factory which creates instances of type {@link Mutable<name>Set}.
 * This file was automatically generated from template file mutablePrimitiveSetFactory.stg.
 *
 * @since 6.0.
 */
public interface Mutable<name>SetFactory
{
    Mutable<name>Set empty();

    /**
     * Same as {@link #empty()}.
     */
    Mutable<name>Set of();

    /**
     * Same as {@link #empty()}.
     */
    Mutable<name>Set with();
    <(capacityMethods.(type))()>
    
    /**
     * Same as {@link #with(<type>[])}.
     */
    Mutable<name>Set of(<type>... items);

    Mutable<name>Set with(<type>... items);

    /**
     * Same as {@link #withAll(<name>Iterable)}.
     */
    Mutable<name>Set ofAll(<name>Iterable items);

    Mutable<name>Set withAll(<name>Iterable items);

    /**
     * Same as {@link #withAll(Iterable)}.
     */
    Mutable<name>Set ofAll(Iterable\<<wrapperName>\> iterable);

    Mutable<name>Set withAll(Iterable\<<wrapperName>\> iterable);
    <(streamMethods.(type))()>
}

>>

capacityMethods ::= [
    "byte": "noMethods",
    "short": "capacityMethods",
    "char": "capacityMethods",
    "int": "capacityMethods",
    "long": "capacityMethods",
    "float": "capacityMethods",
    "double": "capacityMethods",
    "boolean": "noMethods"
    ]

capacityMethods() ::= <<


/**
 * Same as {@link #empty()}. but takes in an initial capacity
 * @since 10.3
 */
default Mutable<name>Set withInitialCapacity(int capacity)
{
    throw new UnsupportedOperationException("Default method to ensure backwards compatibility");
}
>>

streamMethods ::= [
    "byte": "noMethods",
    "short": "noMethods",
    "char": "noMethods",
    "int": "allMethods",
    "long": "allMethods",
    "float": "noMethods",
    "double": "allMethods",
    "boolean": "noMethods"
    ]

allMethods() ::= <<


/**
 * @since 9.0
 */
Mutable<name>Set ofAll(<(wideStream.(type))> items);

/**
 * @since 9.0
 */
Mutable<name>Set withAll(<(wideStream.(type))> items);
>>

noMethods() ::= ""

wideStream ::= [
    "int": "IntStream",
    "long": "LongStream",
    "double": "DoubleStream",
    default: "no matching wide type"
]

wideStreamImport ::= [
    "boolean": "",
    "byte": "",
    "short": "",
    "char": "",
    "int": "import java.util.stream.IntStream;",
    "long": "import java.util.stream.LongStream;",
    "float": "",
    "double": "import java.util.stream.DoubleStream;",
    default: "no matching wide type"
]
