<commit_before>/* License
 * 
 * The MIT License (MIT)
 *
 * Copyright (c) 2014, <NAME> (<EMAIL>)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

using System;

namespace Pulsar
{
/// <summary>
	/// Base class for all Pulsar game components. 
	/// </summary>
	public class GameComponent : IGameComponent, IUpdateable
	{
		/// <summary>
		/// Object use for lock operation
		/// </summary>
		private object _syncRoot = new object();

		/// <summary>
		/// Indicates whether GameComponent.Update should be called when Game.Update is called.
		/// </summary>
		private bool _enabled;

		/// <summary>
		/// Indicates the order in which the GameComponent should be updated relative to other GameComponent instances. Lower values are updated first. 
		/// </summary>
		private int _updateOrder;

		/// <summary>
		/// Gets the Game associated with this GameComponent. 
		/// </summary>
		public Game Game { get; private set; }

		/// <summary>
		/// Indicates whether GameComponent.Update should be called when Game.Update is called.
		/// </summary>
		public bool Enabled
		{
			get 
			{
				return _enabled;
			}
			set
			{
				if (_enabled != value)
				{
					_enabled = value;
					OnEnabledChanged(EventArgs.Empty);
				}
			}
		}

		/// <summary>
		/// Indicates the order in which the GameComponent should be updated relative to other GameComponent instances. Lower values are updated first. 
		/// </summary>
		public int UpdateOrder
		{
			get 
			{
				return _updateOrder;
			}
			set
			{
				if (_updateOrder != value)
				{
					_updateOrder = value;
					OnUpdateOrderChanged(EventArgs.Empty);
				}
			}
		}

		/// <summary>
		/// Raised when the Enabled property changes.
		/// </summary>
		public event EventHandler<EventArgs> EnabledChanged;

		/// <summary>
		/// Raised when the UpdateOrder property changes.
		/// </summary>
		public event EventHandler<EventArgs> UpdateOrderChanged;

		/// <summary>
		/// Creates a new instance of GameComponent.
		/// </summary>
		/// <param name="game">Game that the game component should be attached to.</param>
		public GameComponent(Game game)
		{
			Game = game;
			_enabled = true;
		}

		/// <summary><commit_msg>Refactoring GameComponent<commit_after>/* License
 * 
 * The MIT License (MIT)
 *
 * Copyright (c) 2014, <NAME> (<EMAIL>)
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

using System;

namespace Pulsar
{
/// <summary>
	/// Base class for all Pulsar game components. 
	/// </summary>
	public class GameComponent : IGameComponent, IUpdateable
	{
		/// <summary>
		/// Object use for lock operation
		/// </summary>
		private readonly object _syncRoot = new object();

		/// <summary>
		/// Indicates whether GameComponent.Update should be called when Game.Update is called.
		/// </summary>
		private bool _enabled;

		/// <summary>
		/// Indicates the order in which the GameComponent should be updated relative to other GameComponent instances. Lower values are updated first. 
		/// </summary>
		private int _updateOrder;

		/// <summary>
		/// Gets the Game associated with this GameComponent. 
		/// </summary>
		public Game Game { get; private set; }

		/// <summary>
		/// Indicates whether GameComponent.Update should be called when Game.Update is called.
		/// </summary>
		public bool Enabled
		{
			get 
			{
				return _enabled;
			}
			set
			{
			    if (_enabled == value) return;

			    _enabled = value;
			    OnEnabledChanged(EventArgs.Empty);
			}
		}

		/// <summary>
		/// Indicates the order in which the GameComponent should be updated relative to other GameComponent instances. Lower values are updated first. 
		/// </summary>
		public int UpdateOrder
		{
			get 
			{
				return _updateOrder;
			}
			set
			{
			    if (_updateOrder == value) return;

			    _updateOrder = value;
			    OnUpdateOrderChanged(EventArgs.Empty);
			}
		}

		/// <summary>
		/// Raised when the Enabled property changes.
		/// </summary>
		public event EventHandler<EventArgs> EnabledChanged;

		/// <summary>
		/// Raised when the UpdateOrder property changes.
		/// </summary>
		public event EventHandler<EventArgs> UpdateOrderChanged;

		/// <summary>
		/// Creates a new instance of GameComponent.
		/// </summary>
		/// <param name="game">Game that the game component should be attached to.</param>
		public GameComponent(Game game)
		{
			Game = game;
			_enabled = true;
		}

		/// <summary>
{'fraction_non_alphanumeric': 0.0965089216446858, 'fraction_numerical': 0.0012412723041117144, 'mean_word_length': 2.9765576804441705, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, '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': '734798', 'n_tokens_mistral': 1977, 'n_tokens_neox': 1692, 'n_words': 739}