/** * Constructor to copy all the attributes of another dataset but the itemsets. * * @param dataset The dataset to be copied. * @param capacity The number of itemsets. */ public MyDataset(MyDataset dataset, int capacity) { if (capacity < 0) capacity = 0; classIndex = dataset.classIndex; name = dataset.getName(); attributes = dataset.attributes; itemsets = new Vector(capacity); totalCond = dataset.totalCond; }
/** * Constructor that copies another dataset. * * @param dataset The dataset to be copied. */ public MyDataset(MyDataset dataset) { this(dataset, dataset.numItemsets()); dataset.copyItemsets(0, this, dataset.numItemsets()); totalCond = dataset.totalCond; }
/** * Function to add the instances of one set to the end of another. * * @param from The index of the first that is going to be copied. * @param dest The dataset where the itemsets are going to be copied. * @param num The number of itemsets to copy. */ private void copyItemsets(int from, MyDataset dest, int num) { for (int i = 0; i < num; i++) dest.addItemset(itemset(from + i)); }