<commit_before>#pragma once

#include "physics/discrete_trajectory_iterator.hpp"

#include "geometry/named_quantities.hpp"

namespace principia {
namespace physics {
namespace internal_discrete_trajectory_iterator {

using geometry::Instant;

template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator++() {
  CHECK(!is_at_end(point_));
  auto& point = iterator(point_);
  for (;;) {
    if (point == --segment_->timeline_end()) {
      ++segment_;
      if (segment_ == segment_.end()) {
        point_.reset();
        break;
      } else {
        point = segment_->timeline_begin();
      }
    } else {
      ++point;
    }
    if (point->first != previous_time_) {
      previous_time_ = point->first;
      break;
    }
  }
  return *this;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator--() {
  if (is_at_end(point_)) {
    segment_ = --segment_.end();
    point_ = --segment_->timeline_end();
  } else {
    auto& point = iterator(point_);
    for (;;) {
      if (point == segment_->timeline_begin()) {
        CHECK(segment_ != segment_.begin());
        --segment_;
        point = --segment_->timeline_end();
      } else {
        --point;
      }
      if (point->first != previous_time_) {
        previous_time_ = point->first;
        break;
      }
    }
  }
  return *this;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator++(int) {
  auto const initial = *this;
  ++*this;
  return initial;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator--(int) {
  auto const initial = *this;
  --*this;
  return initial;
}

template<typename Frame>
typename internal_discrete_trajectory_types::Timeline<Frame>::value_type const&
DiscreteTrajectoryIterator<Frame>::operator*() const {
  CHECK(!is_at_end(point_));
  return *iterator(point_);
}

template<typename Frame>
typename internal_discrete_trajectory_types::Timeline<Frame>::value_type const*
DiscreteTrajectoryIterator<Frame>::operator->() const {
  CHECK(!is_at_end(point_));
  return &*iterator(point_);
}

template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator==(<commit_msg>Lint.<commit_after>#pragma once

#include "physics/discrete_trajectory_iterator.hpp"

#include "geometry/named_quantities.hpp"

namespace principia {
namespace physics {
namespace internal_discrete_trajectory_iterator {

using geometry::Instant;

template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator++() {
  CHECK(!is_at_end(point_));
  auto& point = iterator(point_);
  for (;;) {
    if (point == --segment_->timeline_end()) {
      ++segment_;
      if (segment_ == segment_.end()) {
        point_.reset();
        break;
      } else {
        point = segment_->timeline_begin();
      }
    } else {
      ++point;
    }
    if (point->first != previous_time_) {
      previous_time_ = point->first;
      break;
    }
  }
  return *this;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>&
DiscreteTrajectoryIterator<Frame>::operator--() {
  if (is_at_end(point_)) {
    segment_ = --segment_.end();
    point_ = --segment_->timeline_end();
  } else {
    auto& point = iterator(point_);
    for (;;) {
      if (point == segment_->timeline_begin()) {
        CHECK(segment_ != segment_.begin());
        --segment_;
        point = --segment_->timeline_end();
      } else {
        --point;
      }
      if (point->first != previous_time_) {
        previous_time_ = point->first;
        break;
      }
    }
  }
  return *this;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator++(int) {  // NOLINT
  auto const initial = *this;
  ++*this;
  return initial;
}

template<typename Frame>
DiscreteTrajectoryIterator<Frame>
DiscreteTrajectoryIterator<Frame>::operator--(int) {  // NOLINT
  auto const initial = *this;
  --*this;
  return initial;
}

template<typename Frame>
typename internal_discrete_trajectory_types::Timeline<Frame>::value_type const&
DiscreteTrajectoryIterator<Frame>::operator*() const {
  CHECK(!is_at_end(point_));
  return *iterator(point_);
}

template<typename Frame>
typename internal_discrete_trajectory_types::Timeline<Frame>::value_type const*
DiscreteTrajectoryIterator<Frame>::operator->() const {
  CHECK(!is_at_end(point_));
  return &*iterator(point_);
}

template<typename Frame>
bool DiscreteTrajectoryIterator<Frame>::operator==(
{'fraction_non_alphanumeric': 0.14020122484689415, 'fraction_numerical': 0.0, 'mean_word_length': 4.025274725274725, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 63, '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': '7650612', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1430, 'n_words': 249}