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); } }
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"); } }
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}"); } }