<commit_before>//
//  NotificationManager.swift
//  ESOcean
//
//  Created by <NAME> on H27/04/23.
//
//

import Foundation
import Swim
import ESThread

// MARK: - Manager

/// Current notification manager.
let _notificationManager = NotificationManager()

public func == (lhs:NotificationManager.HandlerID, rhs:NotificationManager.HandlerID) -> Bool {

	return lhs.value == rhs.value
}

/// Manage native notifications.
public class NotificationManager {
	
	public static var dammingNotifications:Bool {

		get {
			
			return _notificationManager.dammingNotifications
		}

		set {

			_notificationManager.dammingNotifications = newValue
		}
	}
	
	public var dammingNotifications:Bool = false {
		
		didSet {
			
			if !self.dammingNotifications {
				
				self.invokeDammedNotifications()
			}
		}
	}
	
	private var notificationDam = [Notification]()
	
	public struct HandlerID : Equatable {
		
		public var value:UInt16
		
		init(_ value:UInt16) {
			
			self.value = value
		}
		
		mutating func increment() {

			++self.value
		}
		
		/// Release observing handler by HandlerID
		public func release() {
			
			_notificationManager.release(self)
		}
	}
	
	/// Native notifications that the manager managed.
	private var _notificationHandlers = ContiguousArray<_NotificationHandler>()
	<commit_msg>Output log messages related notification dam.<commit_after>//
//  NotificationManager.swift
//  ESOcean
//
//  Created by <NAME> on H27/04/23.
//
//

import Foundation
import Swim
import ESThread

// MARK: - Manager

/// Current notification manager.
let _notificationManager = NotificationManager()

public func == (lhs:NotificationManager.HandlerID, rhs:NotificationManager.HandlerID) -> Bool {

	return lhs.value == rhs.value
}

/// Manage native notifications.
public class NotificationManager {
	
	public static var dammingNotifications:Bool {

		get {
			
			return _notificationManager.dammingNotifications
		}

		set {

			_notificationManager.dammingNotifications = newValue
		}
	}
	
	public var dammingNotifications:Bool = false {
		
		didSet {
			
			if self.dammingNotifications {
				
				NSLog("Damming notification.")
			}
			else {

				NSLog("Release notification dam.")
				self.invokeDammedNotifications()
			}
		}
	}
	
	private var notificationDam = [Notification]()
	
	public struct HandlerID : Equatable {
		
		public var value:UInt16
		
		init(_ value:UInt16) {
			
			self.value = value
		}
		
		mutating func increment() {

			++self.value
		}
		
		/// Release observing handler by HandlerID
		public func release() {
			
			_notificationManager.release(self)
		}
	}
	
	/// Native notifications that the manager managed.
	private var _notificationHandlers = ContiguousArray<_NotificationHandler>()
	
{'fraction_non_alphanumeric': 0.09314264759809314, 'fraction_numerical': 0.007334066740007334, 'mean_word_length': 3.2098765432098766, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, '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': '962487', 'n_tokens_mistral': 963, 'n_tokens_neox': 758, 'n_words': 195}