<commit_before>package de.domisum.lib.auxilium.util.time;

import de.domisum.lib.auxilium.util.java.annotations.API;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

import java.time.Duration;
import java.time.Instant;

@API
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class PassiveTimer
{

	// SETTINGS
	private final Duration duration;

	// TEMP
	private Instant startTime = null;


	// INIT
	@API public static PassiveTimer fromDurationAndStart(Duration duration)
	{
		PassiveTimer timer = new PassiveTimer(duration);
		timer.start();

		return timer;
	}


	// TIMER
	@API public synchronized void start()
	{
		if(startTime != null)
			throw new IllegalStateException("can't start timer that has already been started, use #reset() first");

		startTime = Instant.now();
	}

	@API public synchronized void reset()
	{
		startTime = null;
	}


	@API public synchronized void resetAndStart()
	{
		reset();
		start();
	}<commit_msg>Added simple construction method to PassiveTimer<commit_after>package de.domisum.lib.auxilium.util.time;

import de.domisum.lib.auxilium.util.java.annotations.API;
import lombok.AccessLevel;
import lombok.RequiredArgsConstructor;

import java.time.Duration;
import java.time.Instant;

@API
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public class PassiveTimer
{

	// SETTINGS
	private final Duration duration;

	// TEMP
	private Instant startTime = null;


	// INIT
	@API public static PassiveTimer fromDuration(Duration duration)
	{
		return new PassiveTimer(duration);
	}

	@API public static PassiveTimer fromDurationAndStart(Duration duration)
	{
		PassiveTimer timer = fromDuration(duration);
		timer.start();

		return timer;
	}


	// TIMER
	@API public synchronized void start()
	{
		if(startTime != null)
			throw new IllegalStateException("can't start timer that has already been started, use #reset() first");

		startTime = Instant.now();
	}

	@API public synchronized void reset()
	{
		startTime = null;
	}


	@API public synchronized void resetAndStart()
	{
		reset();
		start();
	}
{'fraction_non_alphanumeric': 0.10135135135135136, 'fraction_numerical': 0.0, 'mean_word_length': 4.513297872340425, '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': '6078997', 'n_tokens_mistral': 691, 'n_tokens_neox': 635, 'n_words': 171}