public DefaultIntFacetIterator(TermIntList valList, BigSegmentedArray countarray, int countlength, bool zeroBased)
 {
     _valList = valList;
     _count = countarray;
     _countlength = countlength;
     _countLengthMinusOne = countlength - 1;
     _index = -1;
     if (!zeroBased)
         _index++;
     _facet = TermIntList.VALUE_MISSING;
     count = 0;
 }
        public void Test2aThreeNegativeValuesInt()
        {
            TermIntList list = new TermIntList();
            list.Add(null);
            list.Add("-1");
            list.Add("-2");
            list.Add("-3");
            list.Add("0");
            list.Add("1");

            list.Seal();
            Assert.True(Arrays.Equals(new int[] { 0, -3, -2, -1, 0, 1 }, list.Elements));
        }
        public void Test2aThreeNegativeValuesInt()
        {
            TermIntList list = new TermIntList();

            list.Add(null);
            list.Add("-1");
            list.Add("-2");
            list.Add("-3");
            list.Add("0");
            list.Add("1");

            list.Seal();
            Assert.True(Arrays.Equals(new int[] { 0, -3, -2, -1, 0, 1 }, list.Elements));
        }
 public void TestTermIntListAddCorrectOrder()
 {
     TermIntList tsl1 = new TermIntList("000");
     tsl1.Add(null);
     tsl1.Add("0");
     try
     {
         tsl1.Add("1");
         tsl1.Add("2");
         tsl1.Add("3");
     }
     catch (Exception e)
     {
         Assert.False(e.Message.Contains("ascending order"), "There should NOT be an exception and the message contains ascending order");
         return;
     }
     tsl1.Seal();
     Assert.AreEqual(1, tsl1.IndexOf(0), "Should skip index 0 which is used for dummy null");
 }
 public void TestDefaultIntFacetIterator()
 {
     string format = "00";
     List<IntFacetIterator> list = new List<IntFacetIterator>();
     for (int seg = 0; seg < 5; seg++)
     {
         TermIntList tsl1 = new TermIntList(format);
         int limit = 25;
         BigIntArray count = new BigIntArray(limit);
         string[] terms = new string[limit];
         for (int i = limit - 1; i >= 0; i--)
         {
             terms[i] = i.ToString(format);
         }
         Array.Sort(terms);
         for (int i = 0; i < limit; i++)
         {
             tsl1.Add(terms[i]);
             count.Add(i, i);
         }
         tsl1.Seal();
         DefaultIntFacetIterator itr1 = new DefaultIntFacetIterator(tsl1, count, limit, true);
         list.Add(itr1);
     }
     CombinedIntFacetIterator ctr = new CombinedIntFacetIterator(list);
     string result = "";
     while (ctr.HasNext())
     {
         ctr.Next();
         result += (ctr.Facet + ":" + ctr.Count + " ");
     }
     string expected = "1:5 2:10 3:15 4:20 5:25 6:30 7:35 8:40 9:45 10:50 11:55 12:60 13:65 14:70 15:75 16:80 17:85 18:90 19:95 20:100 21:105 22:110 23:115 24:120 ";
     Assert.AreEqual(expected, result);
 }
        public static void Main1(string[] args)
        {
            //Comparable c = "00000000001";
            //Comparable c2 ="00000000002";
            //Comparable c = Integer.valueOf(1);
            //Comparable c2 = Integer.valueOf(2);

            int count = 500000;
            ITermValueList list = new TermIntList(count, "0000000000");
            for (int i = 0; i < count; ++i)
            {
                list.Add(i.ToString("0000000000"));
            }
            /*IntList list = new IntArrayList(count);
            for (int i=0;i<count;++i){
                list.add(i);
            }*/
            //int v1 = 1; // NOT USED
            //int v2 = 2; // NOT USED
            Console.WriteLine("start");
            long s = System.Environment.TickCount;
            for (int i = 0; i < count; ++i)
            {
                list.GetRawValue(i);
            }
            long e = System.Environment.TickCount;

            Console.WriteLine("timeL: " + (e - s));
        }