Ejemplo n.º 1
0
bool WorkspaceBound::InplaceIntersection(const WorkspaceBound& b)
{
  WorkspaceBound temp=*this;
  return SetIntersection(temp,b);
}
Ejemplo n.º 2
0
sft_generic_set<IType>& sft_generic_set<IType>::intersect_with( sft_generic_set<IType> &other)
{
	sft_generic_set<IType> newSet = SetIntersection(*this, other);
	(*this) = newSet;
	return (*this);
}
Ejemplo n.º 3
0
sft_generic_set<IType>& sft_generic_set<IType>::complement( sft_generic_set<IType> &universe)
{
	sft_generic_set<IType> newSet = SetIntersection(universe, *this);
	(*this) = newSet;
	return (*this);
}
Ejemplo n.º 4
0
int main (void)
{
	PtSet set1 = NULL, set2 = NULL, set3 = NULL;
	char filename[21], car; int st; 

	system ("clear");

	printf ("\nLer conjunto do ficheiro - Read set from a text file\n");
	do
	{
  		printf ("Nome do ficheiro (Filename) -> ");
		st = scanf ("%20[^\n]", filename);
		scanf ("%*[^\n]"); scanf ("%*c");
	} while (st == 0);

	set1 = SetCreateFile (filename);
	printf ("\nConjunto lido do ficheiro - Set acquired from text file %s\n", filename);
	WriteSet (set1);

	printf ("\nLer conjunto do teclado [# para terminar] - Read set from keyboard [# to stop]\n");
	set2 = SetCreate ();
	do
	{
		do
		{
			printf ("Elemento do conjunto (Set's element) ? "); st = scanf ("%c", &car);
			scanf ("%*[^\n]"); scanf ("%*c");
		} while (st == 0);
		car = toupper (car);
		if (isupper(car)) SetInsertElement (set2, car);
	} while (car != '#');

	printf ("\nConjunto lido do teclado - Set acquired from keyboard\n");
	WriteSet (set2);

	printf ("\nEscrever conjunto no ficheiro - Storing the set in a text file\n");
	do
	{
  		printf ("Nome do ficheiro (Filename) -> ");
		st = scanf ("%20[^\n]", filename);
		scanf ("%*[^\n]"); scanf ("%*c");
	} while (st == 0);
	SetStoreFile (set2, filename);

	set3 = SetReunion (set1, set2);
	printf ("\nConjunto Reuniao - Union set\n");
	WriteSet (set3);

	SetDestroy (&set3);
	set3 = SetIntersection (set1, set2);
	printf ("\nConjunto Interseccao - Intersection set\n");
	WriteSet (set3);

	SetDestroy (&set3);
	set3 = SetSymmetricDifference (set1, set2);
	printf ("\nConjunto Diferença - Symmetric Difference set\n");
	WriteSet (set3);

	printf ("\nDestruir os conjuntos - Releasing the sets\n");
	SetDestroy (&set1);
	SetDestroy (&set2);
	SetDestroy (&set3);

	WriteSet (set3);

	return 0;
}