示例#1
0
        public void Push(T value)
        {
            if (head == null)
            {
                head    = new Node(value);
                minHead = new MinNode(value);
                return;
            }

            var comparison = minHead.Min.CompareTo(value);

            if (comparison <= 0)
            {
                minHead.Count++;
            }
            else if (comparison > 0)
            {
                var newMin = new MinNode(value);
                newMin.Next = minHead;
                minHead     = newMin;
            }

            var node = new Node(value);

            node.Next = head;
            head      = node;
        }
示例#2
0
        public override NodeViewModel CreateModel()
        {
            CombinerNode result = null;

            switch (combineType)
            {
            case CombinerType.Add:
                result = new AddNode();
                break;

            case CombinerType.Max:
                result = new MaxNode();
                break;

            case CombinerType.Min:
                result = new MinNode();
                break;

            case CombinerType.Multiply:
                result = new MultiplyNode();
                break;

            case CombinerType.Power:
                result = new PowerNode();
                break;
            }

            result.Name     = name;
            result.Position = pos;

            return(result);
        }
示例#3
0
 /// <summary>
 /// Removes the context info.
 /// </summary>
 /// <param name="contextInfoNode">Context info node.</param>
 public void RemoveContextInfo(ContextInfoNode contextInfoNode)
 {
     if (contextInfoNode.Successor != null)
     {
         MinNode.Remove(contextInfoNode);
         contextInfoNode.Successor = null;
     }
 }
        protected virtual QueryNode VisitMin(MinNode node, AzureQueryOptimizerState state)
        {
            QueryNode queryNode1 = this.Visit(node.SourceNode, state);
            QueryNode queryNode2 = this.Visit(node.PredicateNode, state);

            if (queryNode2.NodeType == QueryNodeType.MatchAll)
            {
                return((QueryNode) new MinNode(queryNode1, queryNode2, node.AllowDefaultValue));
            }
            return((QueryNode) new MinNode(this.VisitAnd(new AndNode(queryNode1, queryNode2), state), (QueryNode) new MatchAllNode(), node.AllowDefaultValue));
        }
        protected virtual QueryNode VisitMin(MinNode node, ElasticSearchQueryOptimizerState state)
        {
            var node2 = Visit(node.SourceNode, state);
            var node3 = Visit(node.PredicateNode, state);

            if (node3.NodeType == QueryNodeType.MatchAll)
            {
                return(new MinNode(node2, node3, node.AllowDefaultValue));
            }
            return(new MinNode(VisitAnd(new AndNode(node2, node3), state), new MatchAllNode(), node.AllowDefaultValue));
        }
示例#6
0
 private void UpdateScore(MinNode node, int score)
 {
     if (!node.m_children.IsEmpty)
     {
         var maxNode = (GameNode)node.m_children.Peek();
         if (maxNode.m_score < score)
         {
             node.m_score = maxNode.m_score;
             return;
         }
     }
     node.m_score = score;
 }
示例#7
0
        public T Pop()
        {
            if (--minHead.Count == 0)
            {
                minHead = minHead.Next;
            }

            var tmp = head.Data;

            head = head.Next;

            return(tmp);
        }
 protected virtual void StripMin(MinNode node, HashSet <QueryMethod> additionalQueryMethods)
 {
     additionalQueryMethods.Add(new MinMethod(node.AllowDefaultValue));
 }