コード例 #1
0
        public void AddChild(TypeValueQuery child)
        {
            if (child.IsAlternative)
            {
                _alternativeChild = true;
            }
            if (_children == null)
            {
                _children = new TypeValueQuery[] { child };
                return;
            }
            TypeValueQuery[] ary = new TypeValueQuery[_children.Length + 1];
            int ndx = 0;

            for (int i = 0, icnt = _children.Length; i < icnt; ++i)
            {
                if (child != null && child._fldIndex < _children[i]._fldIndex)
                {
                    ary[ndx++] = child;
                    child      = null;
                }
                ary[ndx++] = _children[i];
            }
            if (child != null)
            {
                ary[_children.Length] = child;
            }
            _children = ary;
        }
コード例 #2
0
        public void SetAlternativeSiblings()
        {
            if (Parent == null || !IsAlternative)
            {
                return;
            }
            var children = Parent.Children;

            for (int i = 0, icnt = children.Length; i < icnt; ++i)
            {
                var child = children[i];
                if (child.Id == Id) // this is me
                {
                    int j = i - 1;
                    if (j >= 0 && children[j].FieldIndex == FieldIndex)
                    {
                        var sibling = children[j];
                        Debug.Assert(sibling.IsAlternative);
                        _leftAlternativeSibling = sibling;
                    }
                    j = i + 1;
                    if (j < children.Length && children[j].FieldIndex == FieldIndex)
                    {
                        var sibling = children[j];
                        Debug.Assert(sibling.IsAlternative);
                        _rightAlternativeSibling = sibling;
                    }
                    break;
                }
            }
        }
コード例 #3
0
 public TypeValueQuery(long id, TypeValueQuery parent, string typeName, int typeId, string fieldName, int fieldIndex, bool isAlternative, FilterValue filter, bool getValue)
 {
     _id          = id;
     _parent      = parent;
     _typeName    = typeName;
     _typeId      = typeId;
     _fieldName   = fieldName;
     _fldIndex    = fieldIndex;
     _alternative = isAlternative;
     _filter      = filter;
     _getValue    = getValue;
 }