Example #1
0
Bucket Bucket::operator/(int size)
{
	Bucket newBucket = Bucket(this->owner);

	for (int i = 0; i < this->elementsCount; i++)
		newBucket.addEgg(Egg(this->container[i].getName, this->container[i].getSize / size));

	return newBucket;
}
Example #2
0
Bucket Bucket::operator+(const Bucket & rhs) const
{
	Bucket newBucket = *this;

	for (size_t i = 0; i < rhs.getElementsCount(); i++)
	{
		newBucket.addEgg(rhs.getContainer()[i]);
	}

	return newBucket;
}
Example #3
0
Bucket Bucket::operator%(const Bucket & rhs) const
{
	Bucket newBucket;

	for (size_t i = 0; i < this->elementsCount; i++)
	{
		for (size_t j = 0; j < rhs.getElementsCount(); j++)
		{
			if (this->container[i] == rhs.getContainer()[j])
				newBucket.addEgg(this->container[i]);
		}
	}

	return newBucket;
}
Example #4
0
Bucket & Bucket::operator%=(const Bucket & rhs)
{
	Bucket newBucket = Bucket();

	for (size_t i = 0; i < this->elementsCount; i++)
	{
		for (size_t j = 0; j < rhs.getElementsCount(); j++)
		{
			if (this->container[i] == rhs.getContainer()[j])
				newBucket.addEgg(this->container[i]);
		}
	}

	*this = newBucket;
	return *this;
}