/// <summary>
        /// This function processes special anonymization rules that require filters
        /// </summary>
        /// <param name="rule">Anonymization rule to be processed</param>
        /// <param name="value">The value to be anonymized</param>
        /// <param name="filterVariableValue">The variabele value that has to satisfy the filter condition</param>
        /// <returns>anonymized value</returns>
        /// <remarks>
        /// This functions checks if a value or its context is filtered. If it is, the value is anonymized
        /// </remarks>
        public string ProcessFilter(AnonymizeRule rule, string value, string filterVariableValue)
        {
            string result = "";

            if (rule.IsFiltered && filterVariableValue != null)
            {
                //example rule: file;header;Empty;header3;<;20
                var compareresult = filterVariableValue.CompareTo(rule.FilterValue);
                if (rule.FilterOperator == "<" && rule.Method == AnonymizeRule.MethodType.Empty)
                {
                    result = value;
                    StringBuilder sb = new StringBuilder();
                    sb.AppendFormat("Filter rule {0} was correct (filterVariableValue={1}). Value {2} can be anonymized"
                                    , rule.Filter, filterVariableValue, value);
                    Console.WriteLine(sb.ToString());
                    if (compareresult < 0)
                    {
                        Console.WriteLine("and was emptied");
                        result = "";
                    }
                    else
                    {
                        Console.WriteLine("but wasn't because it didn't satisfy the filter condition!");
                    }
                }
            }
            else
            {
                Console.WriteLine("Filter rule {0} was incorrect (filterVariableValue={1}). Value {2} was not anonymized!"
                                  , rule.Filter, filterVariableValue, value);
            }
            return(result);
        }
        public bool IsFiltered(AnonymizeRule rule, string value)
        {
            var compareresult = value.CompareTo(rule.FilterValue);

            if (!rule.IsFiltered)
            {
                return(false);
            }

            if (rule.FilterOperator.Equals("!="))
            {
                return(compareresult != 0);
            }
            if (rule.FilterOperator.Equals("="))
            {
                return(compareresult == 0);
            }
            if (rule.FilterOperator.Equals("<"))
            {
                return(compareresult < 0);
            }
            if (rule.FilterOperator.Equals(">"))
            {
                return(compareresult > 0);
            }

            return(false);
        }
 /// <summary>
 /// This method processes a single rule in the anonymization riles file, then adds it to the _AnonymizerRules list.
 /// This method is a hook for derived classes to implement their own method and extend the basic handling of this class. see class
 /// Core.XMLRecords.Anonymization.AnonymizerXML  for an example
 /// </summary>
 /// <param name="fields">The fields that have been extracted from the line to be processed in the rules file</param>
 protected virtual void ProcessRule(string[] fields)
 {
     if (fields[2].ToLower().IndexOf(fnIndicator.ToLower()) >= 0)
     {
         _anonymizerRulesFilename.Add(fields[1]);
     }
     else
     {
         AnonymizeRule rule = new AnonymizeRule();
         rule.Location = fields[1];
         rule.Method   = AnonymizeRule.getMethod(fields[2]);
         //Add filter elements if they are present
         if (fields.Length > 3)
         {
             rule.FilterLocation = fields[3];
         }
         if (fields.Length > 4)
         {
             rule.FilterOperator = fields[4];
         }
         if (fields.Length > 5)
         {
             rule.FilterValue = fields[5];
         }
         _AnonymizerRules.Add(rule);
     }
 }