<commit_before>﻿using GladNet.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Booma.Entity.Identity
{
	//Format: 0xSSEE XXXX IIII IIII
	//[IIII IIII] unsigned 32bit unique identifier.
	//[X] unsued
	//[SS] Server ID. Will probably remain unimplemented for awhile until cross-server is needed.
	//[EE] Entity type. Reserves 255 indicies for possible entity types.
	/// <summary>
	/// Unique GUID identifier for network entites. Based on Blizzard's 64bit GUID implementation
	/// which encodes flags and uses masking to dervive information about a GUID.
	/// See: http://wowwiki.wikia.com/wiki/API_UnitGUID
	/// </summary>
	[GladNetSerializationContract]
	public class NetworkEntityGuid : IEntityIdentifiable, IEquatable<NetworkEntityGuid>
	{
		//Sent over the network.
		/// <summary>
		/// Raw 64bit numerical representation of the GUID.
		/// </summary>
		[GladNetMember(GladNetDataIndex.Index1, IsRequired = true)]
		public ulong RawGuidValue { get; private set; } //dont use readonly prop. Some libraries can't serialize it yet.

		/// <summary>
		/// Represents an Empty or uninitialized <see cref="NetworkEntityGuid"/>.
		/// </summary>
		public static NetworkEntityGuid Empty { get; } = new NetworkEntityGuid(0);

		/// <summary>
		/// Indicates the <see cref="EntityType"/> that this <see cref="NetworkEntityGuid"/> is for.
		/// </summary>
		public EntityType EntityType { get { return (EntityType)(byte)((RawGuidValue & 0x00FF000000000000) >> 48); } } //mask out to the EE (entity Type) and then shift it down to a byte

		/// <summary>
		/// Indiciates if the GUID is an empty or unitialized GUID.
		/// </summary>
		/// <returns></returns>
		public bool isEmpty { get { return RawGuidValue == 0; } }

		/// <summary>
		/// Indiciates the current GUID of the entity. This is the last chunk represents the actual ID without any type or identifying information.
		/// </summary>
		public int EntityId { get { return (int)(RawGuidValue & 0x00000000FFFFFFFF); } } //FFFF FFFF masks out everything but an unsigned integer. Casts to int. We waste bits this way but we gain considerable perf.

		public NetworkEntityGuid(ulong guidValue)
		{
			RawGuidValue = guidValue;
		}

		//For serializers
		protected NetworkEntityGuid()
		{

		}

		/// <summary><commit_msg>Made EntityGuid paramless ctor public for unity3d<commit_after>﻿using GladNet.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Booma.Entity.Identity
{
	//Format: 0xSSEE XXXX IIII IIII
	//[IIII IIII] unsigned 32bit unique identifier.
	//[X] unsued
	//[SS] Server ID. Will probably remain unimplemented for awhile until cross-server is needed.
	//[EE] Entity type. Reserves 255 indicies for possible entity types.
	/// <summary>
	/// Unique GUID identifier for network entites. Based on Blizzard's 64bit GUID implementation
	/// which encodes flags and uses masking to dervive information about a GUID.
	/// See: http://wowwiki.wikia.com/wiki/API_UnitGUID
	/// </summary>
	[GladNetSerializationContract]
	public class NetworkEntityGuid : IEntityIdentifiable, IEquatable<NetworkEntityGuid>
	{
		//Sent over the network.
		/// <summary>
		/// Raw 64bit numerical representation of the GUID.
		/// </summary>
		[GladNetMember(GladNetDataIndex.Index1, IsRequired = true)]
		public ulong RawGuidValue { get; private set; } //dont use readonly prop. Some libraries can't serialize it yet.

		/// <summary>
		/// Represents an Empty or uninitialized <see cref="NetworkEntityGuid"/>.
		/// </summary>
		public static NetworkEntityGuid Empty { get; } = new NetworkEntityGuid(0);

		/// <summary>
		/// Indicates the <see cref="EntityType"/> that this <see cref="NetworkEntityGuid"/> is for.
		/// </summary>
		public EntityType EntityType { get { return (EntityType)(byte)((RawGuidValue & 0x00FF000000000000) >> 48); } } //mask out to the EE (entity Type) and then shift it down to a byte

		/// <summary>
		/// Indiciates if the GUID is an empty or unitialized GUID.
		/// </summary>
		/// <returns></returns>
		public bool isEmpty { get { return RawGuidValue == 0; } }

		/// <summary>
		/// Indiciates the current GUID of the entity. This is the last chunk represents the actual ID without any type or identifying information.
		/// </summary>
		public int EntityId { get { return (int)(RawGuidValue & 0x00000000FFFFFFFF); } } //FFFF FFFF masks out everything but an unsigned integer. Casts to int. We waste bits this way but we gain considerable perf.

		public NetworkEntityGuid(ulong guidValue)
		{
			RawGuidValue = guidValue;
		}

		//For serializers
		public NetworkEntityGuid()
		{

		}

		/// <summary>
{'fraction_non_alphanumeric': 0.11383500319761244, 'fraction_numerical': 0.01684075890002132, 'mean_word_length': 3.515880654475457, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 6, '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': '4549804', 'n_tokens_mistral': 1520, 'n_tokens_neox': 1356, 'n_words': 501}