public int Compare(DocumentProducer <OrderByQueryResult> producer1, DocumentProducer <OrderByQueryResult> producer2)
        {
            OrderByQueryResult result1 = producer1.Current;
            OrderByQueryResult result2 = producer2.Current;

            if (object.ReferenceEquals(result1, result2))
            {
                return(0);
            }

            if (result1 == null)
            {
                return(-1);
            }

            if (result2 == null)
            {
                return(1);
            }

            int cmp = this.CompareOrderByItems(result1.OrderByItems, result2.OrderByItems);

            if (cmp != 0)
            {
                return(cmp);
            }

            return(string.CompareOrdinal(producer1.TargetRange.MinInclusive, producer2.TargetRange.MinInclusive));
        }
 public DocumentProducerComparableTask(
     DocumentProducer <T> producer,
     IDocumentClientRetryPolicy retryPolicyInstance) :
     base(producer.taskPriorityFunc(producer))
 {
     this.producer            = producer;
     this.retryPolicyInstance = retryPolicyInstance;
 }