Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            StringMatcher <TKey> other = (StringMatcher <TKey>)obj;

            if (CompareToValue == null)
            {
                if (other.CompareToValue != null)
                {
                    return(false);
                }
            }
            else if (!CompareToValue.Equals(other.CompareToValue))
            {
                return(false);
            }
            if (!CompareWithOperator.Equals(other.CompareWithOperator))
            {
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public override int GetHashCode()
        {
            const int Prime  = 31;
            int       result = 1;

            result = Prime * result + (CompareToValue?.GetHashCode() ?? 0);
            result = Prime * result + CompareWithOperator.GetHashCode();
            return(result);
        }
Ejemplo n.º 3
0
 public bool IsMatch(TKey key)
 {
     return(CompareWithOperator.Evaluate(GetValue(key), CompareToValue));
 }