<commit_before>#ifndef SEGMENTLIST_HH
#define SEGMENTLIST_HH

#include <Segment.hh>

class SegmentList
{
public:
   SegmentList()
      : countM(0)
   {
   }

   class Iterator
   {
   public:
      Iterator(SegmentList* list)
	 : next(list->head.nextSegment),
           segmentList(list)
      {
      }

      bool hasNext()
      {
	 return next != &segmentList->head;
      }

      Segment& getNext()
      {
	 Segment* item = next;

	 KASSERT(item != &segmentList->head);

	 next = next->nextSegment;

	 return *item;
      }

      void remove()
      {
	 Segment* item = next->prevSegment;

         KASSERT(item != &segmentList->head);

	 Segment* oldNext = item->nextSegment;
	 Segment* oldPrev = item->prevSegment;

	 oldPrev->nextSegment = oldNext;
	 oldNext->prevSegment = oldPrev;

         --segmentList->countM;
      }

   private:
      Segment *next;
      SegmentList *segmentList;
   };

   SegmentList::Iterator getIterator()
   {
      return SegmentList::Iterator(this);
   }

   void add(Segment* item)
   {
      Segment* prev = head.prevSegment;
      Segment* next = &head;

      item->nextSegment = next;
      item->prevSegment = prev;

      prev->nextSegment = item;
      next->prevSegment = item;

      ++countM;
   }

   unsigned long count()
   {
      return countM;
   }

private:
   Segment head;
   unsigned long countM;
};

#endif
<commit_msg>Properly fix the assert this time<commit_after>#ifndef SEGMENTLIST_HH
#define SEGMENTLIST_HH

#include <Segment.hh>

class SegmentList
{
public:
   SegmentList()
      : countM(0)
   {
   }

   class Iterator
   {
   public:
      Iterator(SegmentList* list)
	 : next(list->head.nextSegment),
           segmentList(list)
      {
      }

      bool hasNext()
      {
	 return next != &segmentList->head;
      }

      Segment& getNext()
      {
	 Segment* item = next;

	 KASSERT(item != &segmentList->head);

	 next = next->nextSegment;

	 return *item;
      }

      void remove()
      {
         KASSERT(next != &segmentList->head);

	 Segment* item = next->prevSegment;

	 Segment* oldNext = item->nextSegment;
	 Segment* oldPrev = item->prevSegment;

	 oldPrev->nextSegment = oldNext;
	 oldNext->prevSegment = oldPrev;

         --segmentList->countM;
      }

   private:
      Segment *next;
      SegmentList *segmentList;
   };

   SegmentList::Iterator getIterator()
   {
      return SegmentList::Iterator(this);
   }

   void add(Segment* item)
   {
      Segment* prev = head.prevSegment;
      Segment* next = &head;

      item->nextSegment = next;
      item->prevSegment = prev;

      prev->nextSegment = item;
      next->prevSegment = item;

      ++countM;
   }

   unsigned long count()
   {
      return countM;
   }

private:
   Segment head;
   unsigned long countM;
};

#endif

{'fraction_non_alphanumeric': 0.11954187544738726, 'fraction_numerical': 0.0007158196134574087, 'mean_word_length': 2.2805164319248825, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1964280', 'n_tokens_mistral': 944, 'n_tokens_neox': 867, 'n_words': 187}