<commit_before>﻿using System;
using System.Diagnostics;
using System.Text;
using Ecologylab.BigSemantics.PlatformSpecifics;
using Simpl.Fundamental.Net;
using Simpl.Serialization.Context;
using Simpl.Serialization.Types;
using Simpl.Serialization.Types.Scalar;
using System.Reflection;
using System.IO;

namespace Ecologylab.BigSemantics.MetadataNS.Scalar.Types
{
	public class MetadataScalarType : ReferenceType
	{
	    ScalarType              valueScalarType;
	    FieldInfo               valueField;
		private static Boolean  metadataScalarTypesRegistered = false;


        public MetadataScalarType()
            : this(typeof(MetadataScalarType), typeof(ScalarType))
        {
            
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="metadataScalarTypeClass"></param>
		/// <param name="valueClass"></param>
		protected MetadataScalarType(Type metadataScalarTypeClass, Type valueClass)
            : base(metadataScalarTypeClass, metadataScalarTypeClass.Name, null, null)
		{
			// Get type handles for Test<String> and its field.

            this.valueScalarType = TypeRegistry.ScalarTypes[valueClass];
			//valueField = metadataScalarTypeClass.GetField(MetadataScalarBase<object>.VALUE_FIELD_NAME);
		    valueField = SemanticsPlatformSpecifics.Get().GetFieldFromTypeWithName(metadataScalarTypeClass,
		                                                                           MetadataScalarBase<object>.VALUE_FIELD_NAME);
            if (ValueField == null)
				Debug.WriteLine(metadataScalarTypeClass.Name + " does not have a valueField");
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		FieldInfo ValueField
		{
			get{ return valueField; }
		}<commit_msg>use correct method for getting value field for MetadataScalarTypes<commit_after>﻿using System;
using System.Diagnostics;
using System.Text;
using Ecologylab.BigSemantics.PlatformSpecifics;
using Simpl.Fundamental.Net;
using Simpl.Serialization.Context;
using Simpl.Serialization.Types;
using Simpl.Serialization.Types.Scalar;
using System.Reflection;
using System.IO;

namespace Ecologylab.BigSemantics.MetadataNS.Scalar.Types
{
	public class MetadataScalarType : ReferenceType
	{
	    ScalarType              valueScalarType;
	    FieldInfo               valueField;
		private static Boolean  metadataScalarTypesRegistered = false;


        public MetadataScalarType()
            : this(typeof(MetadataScalarType), typeof(ScalarType))
        {
            
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="metadataScalarTypeClass"></param>
		/// <param name="valueClass"></param>
		protected MetadataScalarType(Type metadataScalarTypeClass, Type valueClass)
            : base(metadataScalarTypeClass, metadataScalarTypeClass.Name, null, null)
		{
			// Get type handles for Test<String> and its field.

            this.valueScalarType = TypeRegistry.ScalarTypes[valueClass];
			valueField = metadataScalarTypeClass.GetRuntimeField(MetadataScalarBase<object>.VALUE_FIELD_NAME);
            if (ValueField == null)
				Debug.WriteLine(metadataScalarTypeClass.Name + " does not have a valueField");
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
		FieldInfo ValueField
		{
			get{ return valueField; }
		}
{'fraction_non_alphanumeric': 0.10088657902782024, 'fraction_numerical': 0.0, 'mean_word_length': 3.105395232120452, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2893430', 'n_tokens_mistral': 941, 'n_tokens_neox': 867, 'n_words': 177}