package cz.muni.disa.adamiss.se.generators;

import cz.muni.disa.adamiss.core.objects.TransactionFile;
import cz.muni.disa.adamiss.se.common.Dataset;
import javafx.util.Pair;

import java.util.Collection;
import java.util.Random;

public class SubsetGenerator {

    public static Pair<String, TransactionFile> generateSubset(Pair<String, TransactionFile> dataset, Random random, int index) {
            var data = dataset.getValue();
            var startIndex = random.nextInt(0, data.getTransactions().size());
            var endIndex = random.nextInt(startIndex, data.getTransactions().size());
        return new Pair<>(
                dataset.getKey() + index,
                new TransactionFile(data.getTransactions().subList(startIndex,endIndex))
        );
    }
}
