<commit_before>package view

import (
	"log"
	"sync"
)

type CurrentView struct {
	view *View
	mu   *sync.RWMutex
}

func NewCurrentView() CurrentView {
	newCurrentView := CurrentView{}
	newCurrentView.view = newView()
	newCurrentView.mu = &sync.RWMutex{}
	return newCurrentView
}

func (currentView CurrentView) String() string {
	currentView.mu.RLock()
	defer currentView.mu.RUnlock()

	return currentView.view.String()
}

func (currentView *CurrentView) Update(newView *View) {
	currentView.mu.Lock()
	defer currentView.mu.Unlock()

	if newView.LessUpdatedThan(currentView.view) {
		return
	}

	currentView.view = newView
	log.Println("CurrentView updated to:", currentView.view)
}

func (currentView *CurrentView) View() *View {
	currentView.mu.RLock()
	defer currentView.mu.RUnlock()

	return currentView.view
}
<commit_msg>Not to change currentview if views are equal<commit_after>package view

import (
	"log"
	"sync"
)

type CurrentView struct {
	view *View
	mu   *sync.RWMutex
}

func NewCurrentView() CurrentView {
	newCurrentView := CurrentView{}
	newCurrentView.view = newView()
	newCurrentView.mu = &sync.RWMutex{}
	return newCurrentView
}

func (currentView CurrentView) String() string {
	currentView.mu.RLock()
	defer currentView.mu.RUnlock()

	return currentView.view.String()
}

func (currentView *CurrentView) Update(newView *View) {
	currentView.mu.Lock()
	defer currentView.mu.Unlock()

	if newView.LessUpdatedThan(currentView.view) || newView.Equal(currentView.view) {
		return
	}

	currentView.view = newView
	log.Println("CurrentView updated to:", currentView.view)
}

func (currentView *CurrentView) View() *View {
	currentView.mu.RLock()
	defer currentView.mu.RUnlock()

	return currentView.view
}

{'fraction_non_alphanumeric': 0.11832946635730858, 'fraction_numerical': 0.0, 'mean_word_length': 5.073943661971831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '191036', 'n_tokens_mistral': 590, 'n_tokens_neox': 587, 'n_words': 128}