Macaulay2 Engine
Loading...
Searching...
No Matches

◆ operator=()

const MonomDRL & BIBasis::MonomDRL::operator= ( const MonomDRL & anotherMonom)
inline

Definition at line 185 of file monomDRL.hpp.

186 {
187 if (this == &anotherMonom)
188 {
189 return *this;
190 }
191
192 if (!anotherMonom.ListHead)
193 {
194 SetOne();
195 }
196 else
197 {
198 TotalDegree = anotherMonom.TotalDegree;
199
200 VarsListNode *iteratorAnother = anotherMonom.ListHead,
201 **iterator = &ListHead;
202 while (*iterator && iteratorAnother)
203 {
204 (*iterator)->Value = iteratorAnother->Value;
205 iterator = &((*iterator)->Next);
206 iteratorAnother = iteratorAnother->Next;
207 }
208
209 if (*iterator)
210 {
211 VarsListNode *nodeToDelete = (*iterator)->Next;
212 *iterator = nullptr;
213 while (nodeToDelete)
214 {
215 iteratorAnother = nodeToDelete;
216 nodeToDelete = nodeToDelete->Next;
217 delete iteratorAnother;
218 }
219 }
220 else while (iteratorAnother)
221 {
222 *iterator = new VarsListNode();
223 (*iterator)->Value = iteratorAnother->Value;
224
225 iterator = &((*iterator)->Next);
226 iteratorAnother = iteratorAnother->Next;
227 }
228 }
229 return *this;
230 }
Integer TotalDegree
Definition monom.hpp:106
VarsListNode * ListHead
Definition monom.hpp:105
Singly linked-list node of a Monom's variable list, with a per-class slab allocator.
Definition monom.hpp:94

References BIBasis::Monom::ListHead, MonomDRL(), BIBasis::Monom::VarsListNode::Next, operator=(), SetOne(), BIBasis::Monom::TotalDegree, and BIBasis::Monom::VarsListNode::Value.

Referenced by operator=().