Пример #1
0
 public bool GetBool(CsvVLine line)
 {
     if (!line.HasHeader(Key))
     {
         throw new Exception(string.Format("The key: {0} is not a legal header", Key));
     }
     return(false);
 }
Пример #2
0
        public bool GetBool(CsvVLine line)
        {
            var v = line.GetValue(Key);

            for (var i = 0; i < Values.Count; i++)
            {
                var value = Values[i];
                if (value == v)
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #3
0
        public bool GetBool(CsvVLine line)
        {
            var r = true;

            for (var i = 0; i < this.Count; i++)
            {
                var child = this[i];
                var b     = child.GetBool(line);
                if (child.ContextOperator == ContextOperator.And)
                {
                    r = r && b;
                }
                else
                {
                    r = r || b;
                }
            }
            return(r);
        }
Пример #4
0
        public bool GetBool(CsvVLine line)
        {
            if (!line.HasHeader(Key))
            {
                throw new Exception(string.Format("The key: {0} is not a legal header", Key));
            }
            var v1 = line.GetValue(Key);
            var v2 = Value;

            switch (Operator)
            {
            case TernaryOperator.Equal:
                return(string.Compare(v1, v2) == 0);

            case TernaryOperator.NotEqual:
                return(string.Compare(v1, v2) != 0);

            case TernaryOperator.Greater:
                return(string.Compare(v1, v2) > 0);

            case TernaryOperator.Less:
                return(string.Compare(v1, v2) < 0);

            case TernaryOperator.GreaterOrEqual:
                return(string.Compare(v1, v2) >= 0);

            case TernaryOperator.LessOrEqual:
                return(string.Compare(v1, v2) <= 0);

            case TernaryOperator.Has:
                return(new Regex(v2).IsMatch(v1));

            case TernaryOperator.Hasnot:
                return(!new Regex(v2).IsMatch(v1));

            default:
                throw new Exception("Unsupported ternary operator");
            }
        }
Пример #5
0
 public bool GetBool(CsvVLine line)
 {
     return(true);
 }