Ejemplo n.º 1
0
void	run_test2(t_algo *best, t_info *info)
{
	t_info	*w_sort;

	w_sort = weight_sort(info);
	compress_ops(w_sort->steps, &w_sort->elem_steps);
	rollback_sort(info);
	compress_ops(info->steps, &info->elem_steps);
	if (info->elem_steps < best->op_count && stack_sorted(info->a))
	{
		if (info->elem_steps < w_sort->elem_steps)
			print_steps(info->steps);
		else
			print_steps(w_sort->steps);
	}
	else
		print_steps(best->operations);
	delete_mask(w_sort);
	delete_mask(info);
}
Ejemplo n.º 2
0
void metadb_handle_list::remove_duplicates(bool b_release)
{
	unsigned count = get_count();
	if (count>0)
	{
		bit_array_bittable mask(count);
		mem_block_t<int> order(count);

		sort_by_format_get_order(order,"%_path_raw%|$num(%_subsong%,9)",0);

		unsigned n;
		for(n=0;n<count-1;n++)
		{
			if (get_item(order[n])==get_item(order[n+1]))
			{
				mask.set(order[n+1],true);
			}
		}

		if (b_release) delete_mask(mask);
		else remove_mask(mask);
	}
}
Ejemplo n.º 3
0
void metadb_handle_list::remove_duplicates_quick(bool b_release)
{
	unsigned count = get_count();
	if (count>0)
	{
		sort(remove_duplicates_quick_compare);
		bit_array_bittable mask(count);
		unsigned n;
		bool b_found = false;
		for(n=0;n<count-1;n++)
		{
			if (get_item(n)==get_item(n+1))
			{
				b_found = true;
				mask.set(n+1,true);
			}
		}
		if (b_found)
		{
			if (b_release) delete_mask(mask);
			else remove_mask(mask);
		}
	}
}