/**
 * Sets the summands on the left side of the constraint.
 * The old summands are NOT deleted.
 *
 * @param summands	a BList containing the Summand objects that make up the new left side
 */
void
Constraint::SetLeftSide(SummandList* summands)
{
	if (!fIsValid)
		return;

	// check left side
	for (int32 i = 0; i < summands->CountItems(); i++) {
		Summand* summand = summands->ItemAt(i);
		for (int32 a = i + 1; a < summands->CountItems(); a++) {
			Summand* nextSummand = summands->ItemAt(a);
			if (summand->Var() == nextSummand->Var()) {
				summand->SetCoeff(summand->Coeff() + nextSummand->Coeff());
				summands->RemoveItem(nextSummand);
				delete nextSummand;
				a--;	
			}
		}
	}

	fLeftSide = summands;
	fLS->UpdateLeftSide(this);
}