コード例 #1
0
        public static void Validate(string nameStringValue, VariableValidationResults resultContainer)
        {
            if (!nameStringValue.All(c => Char.IsLetterOrDigit(c) || c == '_'))
            {
                resultContainer.AddError(InvalidName);
            }

            if (nameStringValue == UnnamedColumn.Name)
            {
                resultContainer.AddError(Unnamed);
            }
        }
コード例 #2
0
        void CheckMaxBlockPermutationsAllowed(bool isBlockVariable)
        {
            if (!isBlockVariable || valuesProperty.arraySize <= ExperimentDesign.MaxBlockPermutationsAllowed)
            {
                return;
            }


            IExperimentDesignFile iExperimentDesignFile = VariableProperty.serializedObject.targetObject as IExperimentDesignFile;

            if (iExperimentDesignFile == null)
            {
                return;
            }

            if (iExperimentDesignFile.GetBlockOrderConfigurations.Count == 0)
            {
                VariableValidationResults.AddError(
                    "Too many Block Values for automatic permutation. " +
                    "Must define possible Block orders manually using BlockOrderDefinition files. " +
                    "Please see docs.");
            }

            if (!iExperimentDesignFile.GetBlockOrderIsValid)
            {
                VariableValidationResults.AddWarning("A recent change has invalidated your manual block order configurations. " +
                                                     "Please update them before running your experiment");
            }
        }
コード例 #3
0
        void CheckProbabilityErrors(bool customProb)
        {
            if (!customProb || probabilitiesProperty.arraySize == 0)
            {
                return;
            }

            float  runningTotal = GetRunningTotal();
            string direction    = "";
            float  remainder    = 1 - runningTotal;

            if (Math.Abs(remainder) > 0.01f && probabilitiesProperty.arraySize > 0)
            {
                if (runningTotal > 1)
                {
                    direction = " (too high)";
                }
                if (runningTotal < 1)
                {
                    direction = " (too low)";
                }

                VariableValidationResults.AddError($"Custom Probabilities Error: Total = {runningTotal}{direction}");
            }
        }