Package com.browseengine.bobo.facets.data

Examples of com.browseengine.bobo.facets.data.TermIntList


    assertEquals("Should skip index 0 which is used for dummy null", 1, tsl1.indexOf(""));
  }

  public void testTermIntListAddWrongOrder()
  {
    TermIntList tsl1 = new TermIntList("000");
    tsl1.add(null);
    tsl1.add("1");
    try
    {
      tsl1.add("0");
    } catch(Exception e)
    {
      assertTrue("There should be an exception and the message contains ascending order", e.getMessage().contains("ascending order"));
      return;
    }
View Full Code Here


    fail("There should be an exception and the message contains ascending order");
  }
 
  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)
    {
      fail("There should NOT be an exception and the message contains ascending order");
      return;
    }
    tsl1.seal();
    assertEquals("Should skip index 0 which is used for dummy null", 1, tsl1.indexOf(0));
  }
View Full Code Here

    String format = "00";
    DecimalFormat df = new DecimalFormat(format);
    List<IntFacetIterator> list = new ArrayList<IntFacetIterator>();
    for(int seg = 0; seg < 5; seg++)
    {
      TermIntList tsl1 = new TermIntList(format);
      int limit = 25;
      int [] count = new int[limit];
      String[] terms = new String[limit];
      for(int i = limit - 1; i>=0; i--)
      {
        terms[i] = df.format(i);
      }
      Arrays.sort(terms);
      for(int i = 0; i< limit; i++)
      {
        tsl1.add(terms[i]);
        count[i] = i;
      }
      tsl1.seal();
      DefaultIntFacetIterator itr1 = new DefaultIntFacetIterator(tsl1, count, limit, true);
      list.add(itr1);
    }
    CombinedIntFacetIterator ctr = new CombinedIntFacetIterator(list);
    String result = "";
View Full Code Here

      cache.freqs[i]=v;
    }
    //Arrays.fill(cache.freqs,1);
    cache.maxIDs = new int[numVals];
    cache.minIDs = new int[numVals];
    cache.valArray = new TermIntList(numVals,"0000000000");
    DecimalFormat formatter = new DecimalFormat("0000000000");
   
    for (int i=0;i<numVals;++i){
      cache.valArray.add(formatter.format(i+1));
    }
View Full Code Here

  //  Comparable c2 = Integer.valueOf(2);

    DecimalFormat formatter = new DecimalFormat("0000000000");
   
    int count = 500000;
    TermValueList list = new TermIntList(count,"0000000000");
    for (int i=0;i<count;++i){
      list.add(formatter.format(i));
    }
    /*IntList list = new IntArrayList(count);
    for (int i=0;i<count;++i){
      list.add(i);
    }*/
    int v1 =1;
    int v2=2;
    System.out.println("start");
    long s=System.currentTimeMillis();
    for (int i =0;i<count;++i){
      list.getRawValue(i);
    }
    long e=System.currentTimeMillis();
   
    System.out.println("timeL: "+(e-s));
  }
View Full Code Here

      cache.freqs[i] = v;
    }
    // Arrays.fill(cache.freqs,1);
    cache.maxIDs = new int[numVals];
    cache.minIDs = new int[numVals];
    cache.valArray = new TermIntList(numVals, "0000000000");
    DecimalFormat formatter = new DecimalFormat("0000000000");

    for (int i = 0; i < numVals; ++i) {
      cache.valArray.add(formatter.format(i + 1));
    }
View Full Code Here

    tsl1.seal();
    assertEquals("Should skip index 0 which is used for dummy null", 1, tsl1.indexOf(""));
  }

  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) {
      fail("There should NOT be an exception and the message contains ascending order");
      return;
    }
    tsl1.seal();
    assertEquals("Should skip index 0 which is used for dummy null", 1, tsl1.indexOf(0));
  }
View Full Code Here

  public void testDefaultIntFacetIterator() {
    String format = "00";
    DecimalFormat df = new DecimalFormat(format);
    List<IntFacetIterator> list = new ArrayList<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] = df.format(i);
      }
      Arrays.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 = "";
View Full Code Here

      }
      else if(_start instanceof Integer)
      {
        int start = _start.intValue();
        int unit = _unit.intValue();
        TermIntList valArray = (TermIntList)_valArray;
        for(int i = startIdx; i < endIdx; i++)
        {
          int val = valArray.getPrimitiveValue(i);
          int idx = ((val - start) / unit);
          if(idx >= 0 && idx < _count.size())
          {
            _count.add(idx, _count.get(idx) + baseCounts.get(i));
          }
View Full Code Here

      }
      else if(_start instanceof Integer)
      {
        int start = _start.intValue();
        int unit = _unit.intValue();
        TermIntList valArray = (TermIntList)_valArray;
        for(int i = startIdx; i < endIdx; i++)
        {
          int val = valArray.getPrimitiveValue(i);
          int idx = ((val - start) / unit);
          if(idx >= 0 && idx < _count.length)
          {
            _count[idx] += baseCounts[i];
          }
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.facets.data.TermIntList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.