<commit_before>#include "hex.h"

#include <cassert>

namespace hex {


Edge*
Edge::complement(void) const
{
  Hex* adjacent_hex =_hex->go(_direction);
  if(adjacent_hex)
      return adjacent_hex->edge(_direction+3);
  else
      return NULL;
}


bool
Edge::is_next(const Edge& v) const
{
  // TRUE iff: &v == next_in(T) || next_in(F) || next_out(T) || next_out(F)
  return(
       ( _hex == v._hex &&
         (_direction+1 == v._direction || _direction-1 == v._direction) )
    || &v == next_out(true)
    || &v == next_out(false)
  );
}


Edge*
Edge::next_in(bool clockwise) const
{
  return _hex->edge(_direction + (clockwise? -1: 1) );
}


Edge*
Edge::next_out(bool clockwise) const
{
  int one =(clockwise? -1: 1);
  Edge* c =_hex->edge( _direction + one )->complement();
  if(c)
      return c->_hex->edge( _direction - one );
  else
      return NULL;
}


/** Helper function. Offsets p towards the start_point of edge d. */
Point corner_offset(Point p, Direction d, float bias)
{
  Distance dx =0.0;
  Distance dy =0.0;<commit_msg>Improved readability of Edge implementation.<commit_after>#include "hex.h"

#include <cassert>

namespace hex {


Edge*
Edge::complement(void) const
{
  Hex* adjacent_hex =_hex->go(_direction);
  if(adjacent_hex)
      return adjacent_hex->edge(_direction+3);
  else
      return NULL;
}


bool
Edge::is_next(const Edge& v) const
{
  // TRUE iff: &v == next_in(T) || next_in(F) || next_out(T) || next_out(F)
  if( _hex == v._hex )
      return( _direction+1 == v._direction || _direction-1 == v._direction );
  else
      return( &v == next_out(true) || &v == next_out(false) );
}


Edge*
Edge::next_in(bool clockwise) const
{
  int one =(clockwise? -1: 1);
  return _hex->edge( _direction + one );
}


Edge*
Edge::next_out(bool clockwise) const
{
  int one =(clockwise? -1: 1);
  Edge* c =_hex->edge( _direction + one )->complement();
  if(c)
      return c->_hex->edge( _direction - one );
  else
      return NULL;
}


/** Helper function. Offsets p towards the start_point of edge d. */
Point corner_offset(Point p, Direction d, float bias)
{
  Distance dx =0.0;
  Distance dy =0.0;
{'fraction_non_alphanumeric': 0.1599247412982126, 'fraction_numerical': 0.010348071495766699, 'mean_word_length': 3.459119496855346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '3880047', 'n_tokens_mistral': 807, 'n_tokens_neox': 782, 'n_words': 202}