Examples of HMapII


Examples of edu.umd.cloud9.util.map.HMapII

                            (float) env.getDefaultDf(), (float) env.getDefaultCf());
  }

  private void preparePostings(String postingsPath) throws Exception {
    postings = new HMapIV<CompressedPositionalPostings>();
    dfs = new HMapII();
    docLengths = new HMapII();

    FSDataInputStream input = fs.open(new Path(postingsPath));
    int termid = input.readInt();
    while(termid != -1) {
      dfs.put(termid, input.readInt());
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

      }

      // if cache is non-empty, a docnos file has been entered
      if(localFiles != null){
        sLogger.setLevel(Level.INFO);
        samplesMap = new HMapII();
        try {
          FSLineReader reader = new FSLineReader(localFiles[0], FileSystem.getLocal(conf));
          Text t = new Text();
          while(reader.readLine(t)!=0){
            int docno = Integer.parseInt(t.toString());
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertTrue(value == 22);
  }

  @Test
  public void testPlus() throws IOException {
    HMapII m1 = new HMapII();

    m1.put(1, 5);
    m1.put(2, 22);

    HMapII m2 = new HMapII();

    m2.put(1, 4);
    m2.put(3, 5);

    m1.plus(m2);

    assertEquals(m1.size(), 3);
    assertTrue(m1.get(1) == 9);
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertTrue(m1.get(3) == 5);
  }

  @Test
  public void testDot() throws IOException {
    HMapII m1 = new HMapII();

    m1.put(1, 2);
    m1.put(2, 1);
    m1.put(3, 3);

    HMapII m2 = new HMapII();

    m2.put(1, 1);
    m2.put(2, 4);
    m2.put(4, 5);

    int s = m1.dot(m2);

    assertTrue(s == 6);
  }
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertTrue(s == 6);
  }

  @Test
  public void testSortedEntries1() {
    HMapII m = new HMapII();

    m.put(1, 5);
    m.put(2, 2);
    m.put(3, 3);
    m.put(4, 3);
    m.put(5, 1);

    Entry[] e = m.getEntriesSortedByValue();
    assertEquals(5, e.length);

    assertEquals(1, e[0].getKey());
    assertEquals(5, e[0].getValue());
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertEquals(1, e[4].getValue());
  }

  @Test
  public void testSortedEntries2() {
    HMapII m = new HMapII();

    m.put(1, 5);
    m.put(2, 2);
    m.put(3, 3);
    m.put(4, 3);
    m.put(5, 1);

    Entry[] e = m.getEntriesSortedByValue(2);

    assertEquals(2, e.length);

    assertEquals(1, e[0].getKey());
    assertEquals(5, e[0].getValue());
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertEquals(3, e[1].getValue());
  }

  @Test
  public void testSortedEntries3() {
    HMapII m = new HMapII();

    m.put(1, 5);
    m.put(2, 2);

    Entry[] e = m.getEntriesSortedByValue(5);

    assertEquals(2, e.length);

    assertEquals(1, e[0].getKey());
    assertEquals(5, e[0].getValue());
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertEquals(2, e[1].getValue());
  }

  @Test
  public void testSortedEntries4() {
    HMapII m = new HMapII();

    Entry[] e = m.getEntriesSortedByValue();
    assertTrue(e == null);
  }
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertTrue(e == null);
  }

  @Test
  public void testPut() {
    HMapII m = new HMapII();
    // When we put a value, we should get back the old value.

    assertEquals(MapII.DEFAULT_VALUE, m.put(1, 5));
    assertEquals(5, m.put(1, 6));
    assertEquals(6, m.put(1, 2));
    assertEquals(2, m.get(1));
  }
View Full Code Here

Examples of edu.umd.cloud9.util.map.HMapII

    assertEquals(2, m.get(1));
  }

  @Test
  public void testIncrement() {
    HMapII m = new HMapII();
    // When we put a value, we should get back the old value.

    assertEquals(0, m.get(1));
    m.increment(1);

    assertEquals(1, m.get(1));
    m.increment(1, 5);
    m.increment(2, 0);
    m.increment(3, 2);

    assertEquals(6, m.get(1));
    assertEquals(0, m.get(2));
    assertEquals(2, m.get(3));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.