コード例 #1
0
 internal void Set(ref NodeSequenceItem item, int position, int size)
 {
     this.node     = item.node;
     this.position = position;
     this.size     = size;
     this.flags    = item.flags;
 }
コード例 #2
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
        public int Compare(object obj1, object obj2)
        {
            NodeSequenceItem item1 = (NodeSequenceItem)obj1;
            NodeSequenceItem item2 = (NodeSequenceItem)obj2;

            XmlNodeOrder order = item1.Node.Node.ComparePosition(item1.Node.Position, item2.Node.Position);
            int          ret;

            switch (order)
            {
            case XmlNodeOrder.Before:
                ret = -1;
                break;

            case XmlNodeOrder.Same:
                ret = 0;
                break;

            case XmlNodeOrder.After:
                ret = 1;
                break;

            case XmlNodeOrder.Unknown:
            default:
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XPathException(SR.GetString(SR.QueryNotSortable)), TraceEventType.Critical);
            }

            return(ret);
        }
コード例 #3
0
 internal void AddCopy(ref NodeSequenceItem item)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.items[this.count++] = item;
 }
コード例 #4
0
 internal void AddCopy(ref NodeSequenceItem item)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.items[this.count++] = item;
 }
コード例 #5
0
 internal void AddCopy(ref NodeSequenceItem item, int size)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.items[this.count]        = item;
     this.items[this.count++].Size = size;
 }
コード例 #6
0
 internal void Add(ref NodeSequenceItem item)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.position++;
     this.items[this.count++].Set(ref item, this.position, this.sizePosition);
 }
コード例 #7
0
 private void Grow(int newSize)
 {
     NodeSequenceItem[] destinationArray = new NodeSequenceItem[newSize];
     if (this.items != null)
     {
         Array.Copy(this.items, destinationArray, this.items.Length);
     }
     this.items = destinationArray;
 }
コード例 #8
0
 internal void AddCopy(ref NodeSequenceItem item, int size)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.items[this.count] = item;
     this.items[this.count++].Size = size;
 }
コード例 #9
0
 internal void Add(ref NodeSequenceItem item)
 {
     if (this.sequence == null)
     {
         this.sequence = this.context.CreateSequence();
         this.sequence.StartNodeset();
     }
     this.sequence.Add(ref item);
 }
コード例 #10
0
 internal void Add(ref NodeSequenceItem item)
 {
     if (this.count == this.items.Length)
     {
         this.Grow(this.items.Length * 2);
     }
     this.position++;
     this.items[this.count++].Set(ref item, this.position, this.sizePosition);
 }
コード例 #11
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 void Grow(int newSize)
 {
     NodeSequenceItem[] newItems = new NodeSequenceItem[newSize];
     if (this.items != null)
     {
         Array.Copy(this.items, newItems, this.items.Length);
     }
     this.items = newItems;
 }
コード例 #12
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     for (int i = 0; i < this.count; ++i)
     {
         if (this.items[i].Compare(ref item, op))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #13
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 public void Trim()
 {
     if (this.count == 0)
     {
         this.items = null;
     }
     else if (this.count < this.items.Length)
     {
         NodeSequenceItem[] newItems = new NodeSequenceItem[this.count];
         Array.Copy(this.items, newItems, this.count);
         this.items = newItems;
     }
 }
コード例 #14
0
        internal static void NumberSum(ProcessingContext context)
        {
            StackFrame topArg = context.TopArg;

            while (topArg.basePtr <= topArg.endPtr)
            {
                NodeSequence sequence = context.PeekSequence(topArg.basePtr);
                double       val      = 0.0;
                for (int i = 0; i < sequence.Count; i++)
                {
                    NodeSequenceItem item = sequence[i];
                    val += QueryValueModel.Double(item.StringValue());
                }
                context.SetValue(context, topArg.basePtr, val);
                topArg.basePtr++;
            }
        }
コード例 #15
0
        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame topSequenceArg = context.TopSequenceArg;

            Value[] sequences = context.Sequences;
            context.PushFrame();
            for (int i = topSequenceArg.basePtr; i <= topSequenceArg.endPtr; i++)
            {
                NodeSequence sequence = sequences[i].Sequence;
                for (int j = 0; j < sequence.Count; j++)
                {
                    NodeSequenceItem item = sequence[j];
                    context.Push(item.Position == this.ordinal);
                }
            }
            return(base.next);
        }
コード例 #16
0
        internal override Opcode Eval(ProcessingContext context)
        {
            Value[]    values = context.Values;
            StackFrame topArg = context.TopArg;

            for (int i = topArg.basePtr; i <= topArg.endPtr; i++)
            {
                NodeSequence sequence = values[i].Sequence;
                NodeSequence val      = context.CreateSequence();
                for (int j = 0; j < sequence.Count; j++)
                {
                    NodeSequenceItem item = sequence[j];
                    val.AddCopy(ref item);
                }
                val.Merge();
                context.SetValue(context, i, val);
            }
            return(base.next);
        }
コード例 #17
0
        internal override Opcode Eval(ProcessingContext context)
        {
            StackFrame topSequenceArg = context.TopSequenceArg;
            StackFrame topArg         = context.TopArg;

            Value[] sequences = context.Sequences;
            int     basePtr   = topSequenceArg.basePtr;
            int     index     = topArg.basePtr;

            while (basePtr <= topSequenceArg.endPtr)
            {
                NodeSequence sequence = sequences[basePtr].Sequence;
                for (int i = 0; i < sequence.Count; i++)
                {
                    NodeSequenceItem item = sequence[i];
                    context.Values[index].Boolean = item.Position == context.Values[index].Double;
                    index++;
                }
                basePtr++;
            }
            return(base.next);
        }
コード例 #18
0
        internal override void InvokeInternal(ProcessingContext context, int argCount)
        {
            StackFrame topArg = context.TopArg;

            while (topArg.basePtr <= topArg.endPtr)
            {
                string       val      = string.Empty;
                NodeSequence sequence = context.PeekSequence(topArg.basePtr);
                if (sequence.Count > 0)
                {
                    NodeSequenceItem       item      = sequence[0];
                    SeekableXPathNavigator node      = item.Node.Node;
                    long             currentPosition = node.CurrentPosition;
                    NodeSequenceItem item2           = sequence[0];
                    node.CurrentPosition = item2.Node.Position;
                    val = ExtractFromNavigator(node);
                    node.CurrentPosition = currentPosition;
                }
                context.SetValue(context, topArg.basePtr, val);
                topArg.basePtr++;
            }
        }
コード例 #19
0
        internal override Opcode Eval(ProcessingContext context)
        {
            Value[]    values = context.Values;
            StackFrame arg    = context.TopArg;

            for (int i = arg.basePtr; i <= arg.endPtr; ++i)
            {
                Fx.Assert(ValueDataType.Sequence == values[i].Type, "");
                NodeSequence seq = values[i].Sequence;

                NodeSequence newSeq = context.CreateSequence();
                for (int j = 0; j < seq.Count; ++j)
                {
                    NodeSequenceItem item = seq[j];
                    newSeq.AddCopy(ref item);
                }
                newSeq.Merge();

                context.SetValue(context, i, newSeq);
            }

            return(this.next);
        }
コード例 #20
0
 public override bool MoveNext()
 {
     if (this.data.seq == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("QueryIteratorOutOfScope")));
     }
     if (this.index < this.data.seq.Count)
     {
         if (this.nav == null)
         {
             NodeSequenceItem item = this.data.seq[this.index];
             this.nav = (SeekableXPathNavigator)item.GetNavigator().Clone();
         }
         else
         {
             this.nav.CurrentPosition = this.data.seq[this.index].GetNavigatorPosition();
         }
         this.index++;
         return(true);
     }
     this.index++;
     this.nav = null;
     return(false);
 }
コード例 #21
0
 private void Grow(int newSize)
 {
     NodeSequenceItem[] destinationArray = new NodeSequenceItem[newSize];
     if (this.items != null)
     {
         Array.Copy(this.items, destinationArray, this.items.Length);
     }
     this.items = destinationArray;
 }
コード例 #22
0
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     for (int i = 0; i < this.count; i++)
     {
         if (this.items[i].Compare(ref item, op))
         {
             return true;
         }
     }
     return false;
 }
コード例 #23
0
ファイル: QueryNode.cs プロジェクト: longde123/playscript
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     return(QueryValueModel.Compare(this.StringValue(), item.StringValue(), op));
 }
 internal void Set(ref NodeSequenceItem item, int position, int size)
 {
     this.node = item.node;
     this.position = position;
     this.size = size;
     this.flags = item.flags;
 }
 internal bool Compare(ref NodeSequenceItem item, RelationOperator op)
 {
     return QueryValueModel.Compare(this.StringValue(), item.StringValue(), op);
 }