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

◆ Compare()

int BIBasis::MonomDL::Compare ( const MonomDL & anotherMonom)

Definition at line 18 of file monomDL.cpp.

19 {
20 if (TotalDegree < anotherMonom.TotalDegree)
21 {
22 return -1;
23 }
24 else if (TotalDegree > anotherMonom.TotalDegree)
25 {
26 return 1;
27 }
28 else
29 {
30 VarsListNode *iterator(ListHead),
31 *iteratorAnother(anotherMonom.ListHead);
32 while (iterator)
33 {
34 if (iterator->Value < iteratorAnother->Value)
35 {
36 return 1;
37 }
38 if (iterator->Value > iteratorAnother->Value)
39 {
40 return -1;
41 }
42 iterator = iterator->Next;
43 iteratorAnother = iteratorAnother->Next;
44 }
45 return 0;
46 }
47 }
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, MonomDL(), BIBasis::Monom::VarsListNode::Next, BIBasis::Monom::TotalDegree, and BIBasis::Monom::VarsListNode::Value.