Пример #1
0
 static void Main(string[] args)
 {
     WriteLine(Contains("methods")(GetText()));
     WriteLine(Contains("anything")(GetText()));
     WriteLine(StartsWith("Provides")(GetText()));
     WriteLine(StartsWith("anything")(GetText()));
     WriteLine(EndsWith("objects")(GetText()));
     WriteLine(EndsWith("anything")(GetText()));
     WriteLine(IndexOf("objects")(GetText()));
     WriteLine(IndexOf("anything")(GetText()));
     WriteLine(Replace("Provides")("Xpto")(GetText()));
     WriteLine(Replace("anything")("Xpto")(GetText()));
 }
Пример #2
0
 private int ComputeHashCode()
 {
     return(HashCode.Compute(
                StartsWith.GetHashCode(),
                Expression.GetHashCode(),
                EndsWith.GetHashCode()));
 }
Пример #3
0
        public override string visit(StartsWith startswith)
        {
            string sToSplit = base.visit(startswith);

            this.addtodic(sToSplit);
            return(sToSplit);
        }
Пример #4
0
 public IEnumerator <ITask> StartsWithHandler(StartsWith startsWith)
 {
     startsWith.ResponsePort.Post(
         StartsWithResponse.FromRequest(startsWith.Body)
         );
     yield break;
 }
Пример #5
0
        public void Exercise4()
        {
            //Dim a As String = "Hello"
            //Dim b As Integer = 6
            var Dim          = new StartsWithWord("Dim");
            var whitespace   = new Many(new StartsWithAnyChar(new char[] { ' ', '\t' })).Apply(ListToString);
            var As           = new StartsWithWord("As");
            var varString    = new StartsWithWord("String");
            var varInteger   = new StartsWithWord("Integer");
            var equals       = new StartsWithChar('=');
            var doubleQuotes = new StartsWithChar('"');
            var anyChar      = new StartsWith(c => c != '"');
            var identifier   = (new Many(new StartsWith(c => char.IsLetterOrDigit(c)))).Apply(ListToString);
            var stringLit    = (doubleQuotes + (new Many(anyChar)) + doubleQuotes).Apply(ListToString);
            var isDigit      = new StartsWithAnyChar("0123456789".ToCharArray());
            var isInteger    = new Many(isDigit).Apply(ListToString);

            var varType      = varString | varInteger;
            var defaultValue = stringLit | isInteger;
            var declaration  = (Dim + whitespace + identifier + whitespace + As + whitespace + varType + whitespace + equals + whitespace + defaultValue).Apply(a => { var l = (List <object>)a; return(new Declaration((string)l[2], (string)l[6], (string)l[10])); });

            var parseResult = declaration.Parse(@"Dim a As String = ""Hello""");

            Assert.AreEqual(true, parseResult.Success);

            parseResult = declaration.Parse(@"Dim b As Integer = 6");
            Assert.AreEqual(true, parseResult.Success);
        }
        private ComparisonOperator ComparisonOperator()
        {
            if (this.lexer.Token == null || !this.lexer.Token.Is(TokenType.Name))
            {
                this.SyntaxError("comparision operator");
            }

            ComparisonOperator comparisonOperator = null;

            switch (this.lexer.Token.Value)
            {
            case "pr":
                comparisonOperator = new Present();
                break;

            case "eq":
                comparisonOperator = new Equal();
                break;

            case "ne":
                comparisonOperator = new NotEqual();
                break;

            case "co":
                comparisonOperator = new Contains();
                break;

            case "sw":
                comparisonOperator = new StartsWith();
                break;

            case "ew":
                comparisonOperator = new EndsWith();
                break;

            case "gt":
                comparisonOperator = new GreaterThan();
                break;

            case "lt":
                comparisonOperator = new LessThan();
                break;

            case "ge":
                comparisonOperator = new GreaterThanOrEqual();
                break;

            case "le":
                comparisonOperator = new LessThanOrEqual();
                break;

            default:
                this.SyntaxError("comparision operator");
                break;
            }

            this.Match(this.lexer.Token.Name);
            return(comparisonOperator);
        }
Пример #7
0
        public void Evaluate_TextAndText_ReturnsFalse(string text, string substring)
        {
            var startsWith = new StartsWith();

            startsWith.AddArgument(new HypnoGreen.Types.Text(text));
            startsWith.AddArgument(new HypnoGreen.Types.Text(substring));
            Assert.False(startsWith.EvaluateWithData <bool>());
        }
Пример #8
0
        public void ToString_TextArgument_ReturnsExpected()
        {
            var function = new StartsWith();

            function.AddArgument(new HypnoGreen.Types.Text("denmark"));
            function.AddArgument(new HypnoGreen.Types.Text("den"));
            Assert.AreEqual("StartsWith(\"denmark\", \"den\")", function.ToString());
        }
Пример #9
0
        private void AtIdSupplement_Shown(object sender, EventArgs e)
        {
            TextId.Text = _startChar;
            if (!string.IsNullOrEmpty(StartsWith))
            {
                TextId.Text += StartsWith.Substring(0, StartsWith.Length);
            }

            TextId.SelectionStart = TextId.Text.Length;
            TextId.Focus();
        }
Пример #10
0
        public void Evaluate_NullAndText_ReturnsFalse()
        {
            var startsWith = new StartsWith();

            startsWith.AddArgument(Null.Instance);
            startsWith.AddArgument(new HypnoGreen.Types.Text("denmark"));
            Assert.Throws <InvalidOperationException>(() =>
            {
                startsWith.EvaluateWithData();
            });
        }
Пример #11
0
        public void Evaluate_NonStringType_ThrowsInvalidCastException()
        {
            var startsWith = new StartsWith();

            startsWith.AddArgument(new Boolean(false));
            startsWith.AddArgument(new HypnoGreen.Types.Text("denmark"));
            Assert.Throws <InvalidOperationException>(() =>
            {
                startsWith.EvaluateWithData <bool>();
            });
        }
Пример #12
0
        public void SelectsStartsWith()
        {
            var spec = new StartsWith("value");

            Assert.That(spec.IsSatisfiedBy("value"), Is.True);
            Assert.That(spec.IsSatisfiedBy("ValuE"), Is.True);
            Assert.That(spec.IsSatisfiedBy("avalue"), Is.False);
            Assert.That(spec.IsSatisfiedBy("valuea"), Is.True);
            Assert.That(spec.IsSatisfiedBy("val"), Is.False);
            Assert.That(spec.IsSatisfiedBy(String.Empty), Is.False);
            //Assert.That(spec.IsSatisfiedBy(null), Is.False);
        }
Пример #13
0
 public StringFilter ToUpper()
 {
     Equal         = Equal?.ToUpper();
     NotEqual      = NotEqual?.ToUpper();
     Contains      = Contains?.ToUpper();
     NotContains   = NotContains?.ToUpper();
     StartsWith    = StartsWith?.ToUpper();
     NotStartsWith = NotStartsWith?.ToUpper();
     EndsWith      = EndsWith?.ToUpper();
     NotEndsWith   = NotEndsWith?.ToUpper();
     return(this);
 }
Пример #14
0
        public void Exercise1()
        {
            var print        = new StartsWithWord("Print");
            var whitespace   = new StartsWithAnyChar(new char[] { ' ', '\t' });
            var openBracket  = new StartsWithChar('(');
            var closeBracket = new StartsWithChar(')');
            var doubleQuotes = new StartsWithChar('"');
            var anyChar      = new StartsWith(c => c != '"');
            var stringLit    = doubleQuotes + (new Many(anyChar)) + doubleQuotes;
            var semiColon    = new StartsWithChar(';');
            var command      = print + (new Many(whitespace)) + openBracket + stringLit + closeBracket + semiColon;

            var parseResult = command.Parse(@"Print     (""Hello World"");");

            Assert.AreEqual(true, parseResult.Success);
        }
Пример #15
0
        public void Exercise3()
        {
            var print        = new StartsWithWord("Print");
            var whitespace   = new Many(new StartsWithAnyChar(new char[] { ' ', '\t' })).Apply(ListToString);
            var openBracket  = new StartsWithChar('(');
            var closeBracket = new StartsWithChar(')');
            var doubleQuotes = new StartsWithChar('"');
            var anyChar      = new StartsWith(c => c != '"');
            var stringLit    = (doubleQuotes + (new Many(anyChar)) + doubleQuotes).Apply(ListToString);
            var semiColon    = new StartsWithChar(';');
            var command      = print + whitespace + openBracket + stringLit + closeBracket + semiColon;

            command.Apply6((a, b, c, d, e, f) => new PrintCommand((string)d));
            var parseResult = command.Parse(@"Print     (""Hello World"");");

            Assert.AreEqual(true, parseResult.Success);
            Assert.IsInstanceOfType(parseResult.Parsed, typeof(PrintCommand));
        }
Пример #16
0
        public void StartsWithCriteria()
        {
            var spec = new StartsWith("value", StringComparison.Ordinal);
            var criteria = spec.Criteria;

            Assert.That(criteria.Body, Is.AssignableTo<MethodCallExpression>());

            var call = (MethodCallExpression)criteria.Body;

            Assert.That(call.Arguments, Has.Count.EqualTo(2));
            Assert.That(call.Arguments[0], Is.TypeOf<ConstantExpression>());
            Assert.That(call.Arguments[1], Is.TypeOf<ConstantExpression>());
            Assert.That(call.Method, Is.EqualTo(typeof(String).GetMethod("StartsWith", new[] { typeof(string), typeof(StringComparison) })));
            Assert.That(call.Object, Is.AssignableTo<ParameterExpression>());

            var arg0 = (ConstantExpression)call.Arguments[0];
            Assert.That(arg0.Value, Is.EqualTo("value"));

            var arg1 = (ConstantExpression)call.Arguments[1];
            Assert.That(arg1.Value, Is.EqualTo(StringComparison.Ordinal));

            ExpressionWriter.Write(criteria);
        }
Пример #17
0
 public StringFilter ToUpper()
 {
     if (Equal != null)
     {
         Equal = Equal.ToUpper();
     }
     if (NotEqual != null)
     {
         NotEqual = NotEqual.ToUpper();
     }
     if (Contains != null)
     {
         Contains = Contains.ToUpper();
     }
     if (NotContains != null)
     {
         NotContains = NotContains.ToUpper();
     }
     if (StartsWith != null)
     {
         StartsWith = StartsWith.ToUpper();
     }
     if (NotStartsWith != null)
     {
         NotStartsWith = NotStartsWith.ToUpper();
     }
     if (EndsWith != null)
     {
         EndsWith = EndsWith.ToUpper();
     }
     if (NotEndsWith != null)
     {
         NotEndsWith = NotEndsWith.ToUpper();
     }
     return(this);
 }
Пример #18
0
 public IEnumerable <Word> GetWordsThatStartWith(StartsWith startsWith)
 {
     return(_wordsByStartsWith[startsWith.Value].Select(v => new Word(v)));
 }
Пример #19
0
        public void StartsWithCorrectlyConvertsToJson()
        {
            var sw = new StartsWith("closed");

            sw.ToString().ShouldEqual(StartsWithJson);
        }
Пример #20
0
 protected override bool ThisEquals(Regex other)
 {
     return(StartsWith.Equals(other.StartsWith) &&
            Expression.Equals(other.Expression) &&
            EndsWith.Equals(other.EndsWith));
 }
Пример #21
0
        public Expression GetNode(ExpressionParser parser)
        {
            Lexem      lex   = parser.Collection.CurrentLexem();
            Expression ex    = null;
            bool       uniar = parser.waitValue;

            if (lex.LexemType == LexType.Arfimetic)
            {
                switch (lex.LexemText)
                {
                case "+":
                    if (uniar)
                    {
                        ex = new UniarPlus_BoolExpr();
                    }
                    else
                    {
                        ex = new Plus_Arifmetic();
                    }
                    break;

                case "-":
                    if (uniar)
                    {
                        ex = new UniarMinus_BoolExpr();
                    }
                    else
                    {
                        ex = new Minus_Arifmetic();
                    }
                    break;

                case "*":
                    if (uniar)
                    {
                        ex = new AllColumnExpr();
                    }
                    else
                    {
                        ex = new Multi_Arifmetic();
                    }
                    break;

                case "/":
                    ex = new Div_Arifmetic();
                    break;

                case "<":
                    ex = new Less_CompExpr();
                    break;

                case "<=":
                    ex = new LessOrEqual_CompExpr();
                    break;

                case ">=":
                    ex = new GreatOrEqual_CompExpr();
                    break;

                case ">":
                    ex = new Great_CompExpr();
                    break;

                case "=":
                    ex = new Equal_CompExpr();
                    break;

                case "<>":
                case "!=":
                    ex = new NotEqual_CompExpr();
                    break;
                }
            }
            if (lex.LexemType == LexType.Number)
            {
                ex = new ConstExpr();
                if (lex.LexemText.Contains('.'))
                {
                    (ex as ConstExpr).Init(lex.LexemText.ParseDouble(), SimpleTypes.Float);
                }
                else
                {
                    (ex as ConstExpr).Init(long.Parse(lex.LexemText), SimpleTypes.Integer);
                }
            }
            if (lex.LexemType == LexType.Text)
            {
                if (lex.LexemText.StartsWith("'"))
                {
                    ex = new ConstExpr();
                    (ex as ConstExpr).Init(ParserUtils.StandartDecodeEscape(lex.LexemText), SimpleTypes.String);
                }
            }
            Lexem n1;

            if (lex.LexemType == LexType.Command)
            {
                switch (lex.LexemText.ToLower())
                {
                case "not":
                    n1 = parser.Collection.GetNext();
                    if (n1 != null && n1.LexemType == LexType.Command && n1.LexemText.ToLower() == "in")
                    {
                        ex = new NotInExpr();
                        parser.Collection.GotoNext();
                        break;
                    }
                    ex = new Not_BoolExpr();
                    break;

                case "case":
                    ex = new CaseExpr();
                    break;

                case "contains":
                    ex = new Contains();
                    break;

                case "containsic":     //ic = ignore case
                case "containscase":
                    ex = new ContainsIgnoreCase();
                    break;

                case "startwith":
                case "startswith":
                    ex = new StartsWith();
                    break;

                case "endwith":
                case "endswith":
                    ex = new EndsWith();
                    break;
                }
                if (parser.Collection.GetNext() != null && parser.Collection.GetNext().IsSkobraOpen())
                {
                    switch (lex.LexemText.ToLower())
                    {
                    case "cast":
                        ex = new Cast();
                        break;

                    case "in":
                        ex = new InExpr();
                        break;

                    case "abs":
                        ex = new Abs();
                        break;

                    case "substring":
                        ex = new SubString();
                        break;

                    case "position":
                        ex = new Position();
                        break;

                    case "ltrim":
                        ex = new LTrim();
                        break;

                    case "rtrim":
                        ex = new RTrim();
                        break;

                    case "trim":
                        ex = new Trim();
                        break;

                    case "length":
                        ex = new Length();
                        break;

                    case "upper":
                        ex = new Upper_operation();
                        break;

                    case "lower":
                        ex = new Lower_operation();
                        break;

                    case "left":
                        ex = new Left();
                        break;

                    case "right":
                        ex = new Right();
                        break;

                    case "replace":
                        ex = new Replace();
                        break;

                    case "now":
                        ex = new Now();
                        break;

                    case "tostr":
                        ex = new ToString();
                        break;

                    case "strtotime":
                        ex = new StrToTime();
                        break;

                    case "strtodatetime":
                        ex = new StrToDateTime();
                        break;

                    case "addseconds":
                        ex = new AddSeconds();
                        break;

                    case "addminutes":
                        ex = new AddMinutes();
                        break;

                    case "addhours":
                        ex = new AddHours();
                        break;

                    case "adddays":
                        ex = new AddDays();
                        break;

                    case "day":
                        ex = new Day();
                        break;

                    case "month":
                        ex = new Month();
                        break;

                    case "year":
                        ex = new Year();
                        break;

                    case "round":
                        ex = new ParserCore.Expr.Extend.Math.Round();
                        break;

                    case "ceiling":
                        ex = new ParserCore.Expr.Extend.Math.Ceiling();
                        break;

                    case "floor":
                        ex = new ParserCore.Expr.Extend.Math.Floor();
                        break;

                    case "pi":
                        ex = new ParserCore.Expr.Extend.Math.Pi();
                        break;

                    case "tan":
                        ex = new ParserCore.Expr.Extend.Math.Tan();
                        break;

                    case "log":
                        ex = new ParserCore.Expr.Extend.Math.Log();
                        break;
                    }
                }
            }
            return(ex);
        }
Пример #22
0
        public Expression Process(ParameterExpression ctxExpression, Type parameterType)
        {
            var leftExpression = ctxExpression.EvaluateExpression(Left, false);

            leftExpression = leftExpression.AddToStringWithEnumType();
            if (Operator != Operator.IsNull && Operator != Operator.NotIsNull)
            {
                leftExpression = leftExpression.AddValueWithNullableNumberType();
            }
            var        leftSideType = leftExpression.Type;
            Expression rightExpression;

            if (RightSideIsExpression)
            {
                rightExpression = ctxExpression.EvaluateExpression(Right);
                rightExpression = rightExpression.AddToStringWithEnumType().AddValueWithNullableNumberType();
            }
            else
            {
                rightExpression = GetRightConstantExpression(leftSideType);
            }

            Expression generatedExpression;

            switch (Operator)
            {
            case Operator.Equals:
                generatedExpression = Expression.Equal(leftExpression, rightExpression);
                break;

            case Operator.NotEquals:
                generatedExpression = Expression.Not(Expression.Equal(leftExpression, rightExpression));
                break;

            case Operator.GreaterThan:
                generatedExpression = leftExpression.Type == typeof(DateTime)
                        ? Expression.MakeBinary(ExpressionType.GreaterThan, leftExpression, rightExpression)
                        : Expression.GreaterThan(leftExpression, rightExpression);
                break;

            case Operator.GreaterOrEqual:
                generatedExpression = leftExpression.Type == typeof(DateTime)
                        ? Expression.MakeBinary(ExpressionType.GreaterThanOrEqual, leftExpression, rightExpression)
                        : Expression.GreaterThanOrEqual(leftExpression, rightExpression);
                break;

            case Operator.LessThan:
                generatedExpression = leftExpression.Type == typeof(DateTime)
                        ? Expression.MakeBinary(ExpressionType.LessThan, leftExpression, rightExpression)
                        : Expression.LessThan(leftExpression, rightExpression);
                break;

            case Operator.LessOrEqual:
                generatedExpression = leftExpression.Type == typeof(DateTime)
                        ? Expression.MakeBinary(ExpressionType.LessThanOrEqual, leftExpression, rightExpression)
                        : Expression.LessThanOrEqual(leftExpression, rightExpression);
                break;

            case Operator.Contains:
                generatedExpression = new Contains(leftExpression, rightExpression).Create();
                break;

            case Operator.NotContains:
                generatedExpression = Expression.Not(new Contains(leftExpression, rightExpression).Create());
                break;

            case Operator.ContainsAll:
                generatedExpression = new ContainsAll(leftExpression, rightExpression).Create();
                break;

            case Operator.NotContainsAll:
                generatedExpression = Expression.Not(new ContainsAll(leftExpression, rightExpression).Create());
                break;

            case Operator.StartsWith:
                generatedExpression = new StartsWith(leftExpression, rightExpression).Create();
                break;

            case Operator.NotStartsWith:
                generatedExpression = Expression.Not(new StartsWith(leftExpression, rightExpression).Create());
                break;

            case Operator.In:
                generatedExpression = new In(leftExpression, rightExpression).Create();
                break;

            case Operator.NotIn:
                generatedExpression = Expression.Not(new In(leftExpression, rightExpression).Create());
                break;

            case Operator.AllIn:
                generatedExpression = new AllIn(leftExpression, rightExpression).Create();
                break;

            case Operator.NotAllIn:
                generatedExpression = Expression.Not(new AllIn(leftExpression, rightExpression).Create());
                break;

            case Operator.AnyIn:
                generatedExpression = new AnyIn(leftExpression, rightExpression).Create();
                break;

            case Operator.NotAnyIn:
                generatedExpression = Expression.Not(new AnyIn(leftExpression, rightExpression).Create());
                break;

            case Operator.IsNull:
                if (leftSideType.IsPrimitiveType() && Nullable.GetUnderlyingType(leftSideType) != null)
                {
                    rightExpression = Expression.Constant(null, leftSideType);
                }
                generatedExpression = Expression.Equal(leftExpression, rightExpression);
                break;

            case Operator.NotIsNull:
                if (leftSideType.IsPrimitiveType() && Nullable.GetUnderlyingType(leftSideType) != null)
                {
                    rightExpression = Expression.Constant(null, leftSideType);
                }
                generatedExpression = Expression.Not(Expression.Equal(leftExpression, rightExpression));
                break;

            case Operator.IsEmpty:
                generatedExpression = new IsEmpty(leftExpression, rightExpression).Create();
                break;

            case Operator.NotIsEmpty:
                generatedExpression = Expression.Not(new IsEmpty(leftExpression, rightExpression).Create());
                break;

            case Operator.DiffWithinPct:
                generatedExpression = new DiffWithinPct(leftExpression, rightExpression, OperatorArgs).Create();
                break;

            case Operator.AllInRangePct:
                generatedExpression = new AllInRange(leftExpression, rightExpression, OperatorArgs).Create();
                break;

            default:
                throw new NotSupportedException($"operation {Operator} is not supported");
            }

            if (Operator == Operator.IsNull || Operator == Operator.NotIsNull)
            {
                return(generatedExpression);
            }

            return(leftExpression.AddNotNullCheck(out var nullCheckExpression)
                ? Expression.AndAlso(nullCheckExpression, generatedExpression)
                : generatedExpression);
        }
Пример #23
0
        public static void CreateFilter(object sender, object selectedItem)
        {
            if (selectedItem is FilterCollectionViewModel filterCollectionViewModel)
            {
                CreateFilter(sender, filterCollectionViewModel.Parent);
                return;
            }

            var button = (Button)sender;

            var type = (string)button.CommandParameter;

            FilterBase entity;

            switch (type)
            {
            case nameof(ActiveOn):
                entity = ActiveOn.New("0001-01-01");
                break;

            case nameof(ActiveWithin):
                entity = ActiveWithin.New("0001-01-01,0001-01-01");
                break;

            case nameof(OfType):
                entity = OfType.New("TypeName");
                break;

            case nameof(NotOfType):
                entity = NotOfType.New("TypeName");
                break;

            case nameof(Contain):
                entity = Contain.New("Property", "Value");
                break;

            case nameof(NotContain):
                entity = NotContain.New("Property", "Value");
                break;

            case nameof(EqualTo):
                entity = EqualTo.New("Property", "Value");
                break;

            case nameof(NotEqualTo):
                entity = NotEqualTo.New("Property", "Value");
                break;

            case nameof(GreaterThan):
                entity = GreaterThan.New("Property", "Value");
                break;

            case nameof(LessThan):
                entity = LessThan.New("Property", "Value");
                break;

            case nameof(GreaterThanEqualTo):
                entity = GreaterThanEqualTo.New("Property", "Value");
                break;

            case nameof(LessThanEqualTo):
                entity = LessThanEqualTo.New("Property", "Value");
                break;

            case nameof(Between):
                entity = Between.New("Property", "0001-01-01", "0001-01-01");
                break;

            case nameof(WithinArray):
                entity = WithinArray.New("Property", "ValueA,ValueB,ValueC");
                break;

            case nameof(NotWithinArray):
                entity = NotWithinArray.New("Property", "ValueA,ValueB,ValueC");
                break;

            case nameof(IsNull):
                entity = IsNull.New("Property");
                break;

            case nameof(IsNotNull):
                entity = IsNotNull.New("Property");
                break;

            case nameof(IsNullOrGreaterThan):
                entity = IsNullOrGreaterThan.New("Property", "Value");
                break;

            case nameof(IsNullOrGreaterThanEqualTo):
                entity = IsNullOrGreaterThanEqualTo.New("Property", "Value");
                break;

            case nameof(IsNullOrLessThan):
                entity = IsNullOrLessThan.New("Property", "Value");
                break;

            case nameof(IsNullOrLessThanEqualTo):
                entity = IsNullOrLessThanEqualTo.New("Property", "Value");
                break;

            case nameof(StartsWith):
                entity = StartsWith.New("Property", "Value");
                break;

            case nameof(EndsWith):
                entity = EndsWith.New("Property", "Value");
                break;

            case nameof(TakeFirst):
                entity = TakeFirst.New(1);
                break;

            case nameof(OfDerivedType):
                entity = OfDerivedType.New("TypeName");
                break;

            case nameof(NotOfDerivedType):
                entity = NotOfDerivedType.New("TypeName");
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            FilterViewModel           viewModel;
            FilterCollectionViewModel viewModelCollection;

            if (selectedItem is GroupViewModel entityGroupViewModel)
            {
                entityGroupViewModel.IsExpanded = true;

                entityGroupViewModel.Element.Filters.Add(entity);
                viewModelCollection = entityGroupViewModel.Children.OfType <FilterCollectionViewModel>().First();

                viewModel = new FilterViewModel(entity, viewModelCollection);
                viewModelCollection.Children.Add(viewModel);
            }
            else if (selectedItem is OutputViewModel outputViewModel)
            {
                if (!(outputViewModel.Element is AggregateOutputBase elementAsAggregate))
                {
                    return;
                }

                outputViewModel.IsExpanded = true;

                elementAsAggregate.Filters.Add(entity);
                viewModelCollection = outputViewModel.Children.OfType <FilterCollectionViewModel>().First();

                viewModel = new FilterViewModel(entity, viewModelCollection);
                viewModelCollection.Children.Add(viewModel);
            }
            else
            {
                return;
            }

            viewModelCollection.IsExpanded = true;
            viewModel.IsSelected           = true;
            viewModel.IsExpanded           = true;
        }
Пример #24
0
 public override string visit(StartsWith startswith)
 {
     string sToSplit = base.visit(startswith);
     this.addtodic(sToSplit);
     return sToSplit;
 }