57 return m_max == chunkSize-1;
79 return m_max == chunkSize2-1;
97 m_pHead = m_pTail =
nullptr;
100 void addChunk(
Chunk *p) {
101 if(m_pHead ==
nullptr)
102 m_pHead = m_pTail = p;
116 m_pHead = m_pTail =
nullptr;
120 if(m_pHead ==
nullptr)
121 m_pHead = m_pTail = p;
134 if(m_freelist !=
nullptr) {
146 if(m_freelist2 !=
nullptr) {
157 void freeChunk(
Chunk *p) {
181 bool contains(
const Row &r,
int x)
const;
183 void symDiff(Row &r,
const Row &other);
197 cout << m_objects << endl;
204 bool contains(OBJ obj)
const {
205 for(OBJ x : m_objects) {
216 return m_objects.
size();
221 while(it.
valid() && *it < obj)
237 while(itOther.
valid())
243 }
else if(*it == *itOther) {
246 m_objects.
del(itDel);
248 }
else if(*itOther < *it) {
271 Matrix() : m_equations(0, 255, nullptr), m_numRows(0), m_numCols(0) { }
274 for(
int i = 0; i < m_numRows; ++i)
275 delete m_equations[i];
281 return *m_equations[i];
287 return *m_equations[i];
295 if(i == m_equations.
size())
296 m_equations.
grow(m_equations.
size(),
nullptr);
307 for(
int i = 0; i < m_numRows; ++i)
308 delete m_equations[i];
310 m_equations.
init(0, 255,
nullptr);
311 m_numRows = m_numCols = 0;
315 for(
int i = 0; i < m_numRows; ++i) {
316 cout << std::setw(4) << i <<
": ";
317 m_equations[i]->print();
324 : m_freelist(nullptr)
325 , m_freelist2(nullptr)
Equation & operator|=(int obj)
The parameterized class Array implements dynamic arrays of type E.
static constexpr int chunkSize
iterator pushBack(const E &x)
Adds element x at the end of the list.
void init()
Reinitializes the array to an array with empty index set.
iterator begin()
Returns an iterator to the first element of the list.
Equation & operator[](int i)
Array< Equation * > m_equations
void freeChunk2(Chunk2 *p)
void del(iterator it)
Removes it from the list.
static constexpr int chunkSize2
INDEX size() const
Returns the size (number of elements) of the array.
ListConstIterator< int > end() const
iterator end()
Returns an iterator to one-past-last element of the list.
void grow(INDEX add, const E &x)
Enlarges the array by add elements and sets new elements to x.
void symDiff2(int r1, int r2, Array< Row2 > &rows, Array< List< int >> &cols)
ListConstIterator< int > begin() const
Encapsulates a pointer to a list element.
#define OGDF_NEW_DELETE
Makes the class use OGDF's memory allocator.
const Equation & operator[](int i) const
void freeChunks2(Chunk2 *pHead, Chunk2 *pTail)
GF2Solver(GF2Solver::Matrix &Mx)
int size() const
Returns the number of elements in the list.
void add(int x, ListIterator< int > it)
iterator insertBefore(const E &x, iterator it)
Inserts element x before it.
The namespace for all OGDF objects.
bool valid() const
Returns true iff the iterator points to an element.
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Declaration of doubly linked lists and iterators.