Пример #1
0
 internal WindowFuncExpr(Identifier serverName
                         , Identifier databaseName
                         , Identifier schemaName
                         , Identifier name
                         , QuantifierType quantifier
                         , bool hasWildcard
                         , Exprs arguments
                         , PartitionBy partitionBy
                         , OrderBy orderBy
                         , Comments comments)
 {
     this.Comments    = comments;
     _serverName      = serverName;
     _dataBaseName    = databaseName;
     _schemaName      = schemaName;
     _name            = name;
     _quantifier      = quantifier;
     _hasWildcard     = hasWildcard;
     this.Arguments   = arguments;
     this.PartitionBy = partitionBy;
     this.OrderBy     = orderBy;
     //
     if (this.PartitionBy != null)
     {
         this.PartitionBy.Parent = this;
     }
     if (this.OrderBy != null)
     {
         this.OrderBy.Parent = this;
     }
 }
Пример #2
0
 public Quantifier(int min, int max, bool lazy)
 {
     _type = QuantifierType.Brace;
     if (lazy)
     {
         _type |= QuantifierType.Lazy;
     }
     _min = min;
     _max = max;
     if (min == Infinity)
     {
         if (max == Infinity)
         {
             throw new ArgumentException("UnknownQuantifierDefinition");
         }
         _type |= QuantifierType.SingleDef;
     }
     else
     {
         if (max == Infinity)
         {
             _type |= QuantifierType.HalfDef;
         }
         else
         {
             _type |= QuantifierType.RangeDef;
         }
     }
 }
Пример #3
0
 public WindowFuncExpr(Identifier serverName
                       , Identifier databaseName
                       , Identifier schemaName
                       , Identifier name
                       , QuantifierType quantifier
                       , PartitionBy partitionBy
                       , OrderBy orderBy)
 {
     this.Comments     = new Comments(7 + quantifier != QuantifierType.None? 0 : 1);
     this.ServerName   = serverName;
     this.DataBaseName = databaseName;
     this.SchemaName   = schemaName;
     this.Name         = name;
     this.Quantifier   = quantifier;
     this.HasWildcard  = true;
     this.Arguments    = new Exprs();
     this.PartitionBy  = partitionBy;
     this.OrderBy      = orderBy;
     //
     if (this.PartitionBy != null)
     {
         this.PartitionBy.Parent = this;
     }
     if (this.OrderBy != null)
     {
         this.OrderBy.Parent = this;
     }
 }
Пример #4
0
        protected QuantifierToken(QuantifierType type, bool isLazy)
        {
            Type   = type;
            IsLazy = isLazy;
            switch (type)
            {
            case QuantifierType.Optional:
                TokenType = IsLazy ? RegexTokenType.LazyOptionalQuantifier : RegexTokenType.GreedyOptionalQuantifier;
                break;

            case QuantifierType.OptionalRepeat:
                TokenType = IsLazy ? RegexTokenType.LazyOptionalRepeatQuantifier : RegexTokenType.GreedyOptionalRepeatQuantifier;
                break;

            case QuantifierType.Multiple:
                TokenType = IsLazy ? RegexTokenType.LazyMultipleQuantifier : RegexTokenType.GreedyMultipleQuantifier;
                break;

            case QuantifierType.Fixed:
                TokenType = IsLazy ? RegexTokenType.LazyFixedQuantifier : RegexTokenType.GreedyFixedQuantifier;
                break;

            case QuantifierType.MinRepeat:
                TokenType = IsLazy ? RegexTokenType.LazyMinRepeatQuantifier : RegexTokenType.GreedyMinRepeatQuantifier;
                break;

            default:
                TokenType = IsLazy ? RegexTokenType.LazyLimitedQuantifier : RegexTokenType.GreedyLimitedQuantifier;
                break;
            }
        }
Пример #5
0
        internal SingleQueryClause(QuantifierType quantifier
                                   , bool hasTop
                                   , int top
                                   , bool hasWildcard
                                   , ResultColumns results
                                   , IFromSource from
                                   , Predicate where
                                   , GroupBy groupBy
                                   , Predicate having
                                   , Comments comments)
        {
            _quantifier   = quantifier;
            _hasTop       = hasTop;
            this.Top      = top;
            _hasWildcard  = hasWildcard;
            this.Results  = results;
            _from         = from;
            _where        = where;
            this.GroupBy  = groupBy;
            _having       = having;
            this.Comments = comments;
            //this.IsSubQuery = true;

            this.SetParent(from);
            this.SetParent(where);
            this.SetParent(having);
        }
Пример #6
0
        public Quantifier(char special, bool lazy)
        {
            switch (special)
            {
            case '+':
                _type = QuantifierType.Plus;
                break;

            case '*':
                _type = QuantifierType.Star;
                break;

            case '?':
                _type = QuantifierType.Question;
                break;

            default:
                _type = QuantifierType.Invalid;
                break;
            }
            if (lazy)
            {
                _type |= QuantifierType.Lazy;
            }
        }
        public SimpleQualifierToken(QuantifierType type, bool isLazy)
            : base(type, isLazy)
        {
            switch (type)
            {
            case QuantifierType.Optional:
            case QuantifierType.OptionalRepeat:
            case QuantifierType.Multiple:
                break;

            default:
                throw new ArgumentOutOfRangeException("tokenType");
            }
        }
Пример #8
0
 internal AggregateFuncExpr(string name
                            , QuantifierType quantifier
                            , bool wildcard
                            , Expr argument1
                            , Expr argument2
                            , Comments comments)
 {
     this.Comments   = comments;
     this.Name       = name;
     this.Quantifier = quantifier;
     this.Wildcard   = wildcard;
     this.Argument1  = argument1;
     this.Argument2  = argument2;
 }
Пример #9
0
 internal SingleQuery(QuantifierType quantifier
                      , bool hasTop
                      , int top
                      , bool hasWildcard
                      , ResultColumns results
                      , IFromSource from
                      , Predicate where
                      , GroupBy groupBy
                      , Predicate having
                      , OrderBy orderBy
                      , ILimitClause limit
                      , Comments comments)
     : base(quantifier, hasTop, top, hasWildcard, results, from, where, groupBy, having, comments)
 {
     this.OrderBy = orderBy;
     this.Limit   = limit;
     //this.IsSubQuery = true;
 }
Пример #10
0
            private IQuantifiedExpression GetQuantifier(QuantifierType type, IExpression expression)
            {
                ++index; // swallow '*', '+', '?' or '{'
                int min = 0;
                int?max = null;

                if (type == QuantifierType.Explicit)
                {
                    (min, max) = GetQuantifierRange();
                }
                bool isGreedy = (index == regex.Length || regex[index] != '?') ? true : false;

                if (!isGreedy)
                {
                    ++index;
                }
                switch (type)
                {
                case QuantifierType.ZeroOrMore: return(Quantifiers.ZeroOrMore(expression, isGreedy));

                case QuantifierType.OneOrMore: return(Quantifiers.OneOrMore(expression, isGreedy));

                case QuantifierType.ZeroOrOne: return(Quantifiers.ZeroOrOne(expression, isGreedy));

                case QuantifierType.Explicit:
                {
                    if (max == null)
                    {
                        return(Quantifiers.AtLeast(expression, min, isGreedy));
                    }
                    else if (min == max.Value)
                    {
                        return(Quantifiers.Exactly(expression, min, isGreedy));
                    }
                    else
                    {
                        return(Quantifiers.Between(expression, min, max.Value, isGreedy));
                    }
                }

                default: throw new InvalidOperationException();
                }
            }
Пример #11
0
        public AggregateFuncExpr(string name
                                 , QuantifierType quantifier
                                 , bool wildcard
                                 , Expr argument1
                                 , Expr argument2)
        {
            this.Name       = name;
            this.Quantifier = quantifier;
            this.Wildcard   = wildcard;
            this.Argument1  = argument1;
            this.Argument2  = argument2;

            var c = CountTrue(this.Quantifier != QuantifierType.None
                              , this.Wildcard
                              , this.Argument2 != null // Commaの有無
                              );

            this.Comments = new Comments(c + 3);
        }
Пример #12
0
 internal Quantifier(QuantifierType quantifierType)
 {
     QuantifierType = quantifierType;
 }
Пример #13
0
 public Quantifier(string label, IMembershipFunction membership, QuantifierType type, double xmin, double xmax) : base(label, membership, xmin, xmax)
 {
     Type = type;
 }
Пример #14
0
 internal Quantifier(QuantifierType quantifierType, long cardinality)
 {
     QuantifierType = quantifierType;
     Cardinality    = cardinality;
 }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Quantifier"/> class.
 /// </summary>
 /// <param name="variable">Name of variable to replace.</param>
 /// <param name="type">Type of quantifier.</param>
 /// <param name="bindings">Possible bindings for variable.</param>
 public Quantifier(string variable, QuantifierType type, IEnumerable <string> bindings)
 {
     Variable = variable;
     Type     = type;
     Bindings = bindings;
 }
Пример #16
0
 internal Quantifier(QuantifierType quantifierType, long minCardinality, long maxCardinality)
 {
     QuantifierType = quantifierType;
     MinCardinality = minCardinality;
     MaxCardinality = maxCardinality;
 }
Пример #17
0
 public Quantifier(string description, IMembershipFunction membershipFunction, QuantifierType type, double minValueOfColumn, double maxValueOfColumn) : base(description, membershipFunction, minValueOfColumn, maxValueOfColumn)
 {
     Type       = type;
     IsAbsolute = Type == QuantifierType.Absolute ? true : false;
 }
Пример #18
0
 public Quantifier(QuantifierType type)
 {
     _type = type;
 }