Esempio n. 1
0
        internal BaseSelector GetSelector()
        {
            if (_complexSelector != null)
            {
                _complexSelector.ConcludeSelector(_currentSelector);
                _currentSelector = _complexSelector;
            }

            if (_aggregateSelectorList == null || _aggregateSelectorList.Length == 0)
            {
                return(_currentSelector ?? SimpleSelector.All);
            }

            if (_currentSelector == null && _aggregateSelectorList.Length == 1)
            {
                return(_aggregateSelectorList[0]);
            }

            if (_currentSelector == null)
            {
                return(_aggregateSelectorList);
            }

            _aggregateSelectorList.AppendSelector(_currentSelector);
            _currentSelector = null;

            return(_aggregateSelectorList);
        }
Esempio n. 2
0
        private void Insert(BaseSelector selector)
        {
            if (_currentSelector != null)
            {
                if (!_hasCombinator)
                {
                    var compound = _currentSelector as AggregateSelectorList;

                    if (compound == null)
                    {
                        compound = new AggregateSelectorList("");
                        compound.AppendSelector(_currentSelector);
                    }

                    compound.AppendSelector(selector);
                    _currentSelector = compound;
                }
                else
                {
                    if (_complexSelector == null)
                    {
                        _complexSelector = new ComplexSelector();
                    }

                    _complexSelector.AppendSelector(_currentSelector, _combinator);
                    _combinator      = Combinator.Descendent;
                    _hasCombinator   = false;
                    _currentSelector = selector;
                }
            }
            else
            {
                if (_currentSelector == null && _complexSelector == null && _combinator == Combinator.Namespace)
                {
                    _complexSelector = new ComplexSelector();
                    _complexSelector.AppendSelector(SimpleSelector.Type(""), _combinator);
                    _currentSelector = selector;
                }
                else
                {
                    _combinator      = Combinator.Descendent;
                    _hasCombinator   = false;
                    _currentSelector = selector;
                }
            }
        }