Package edu.umd.cloud9.util.map

Examples of edu.umd.cloud9.util.map.HMapIL$Entry


    DocumentVectorOnTheFlyIndexing generator = new DocumentVectorOnTheFlyIndexing(env, fs);

    //Parse queries, judgemnts and features
    HMapIV<String> parsedQueries = QueryUtility.loadQueries(queryPath);
    HMapIV<int[]> queries = QueryUtility.queryToIntegerCode(env, parsedQueries);
    HMapIF idfs = QueryUtility.loadIdf(env, parsedQueries);
    HMapIF cfs = QueryUtility.loadCf(env, parsedQueries);
    HMapIV<int[]> qrels = QrelUtility.parseQrelsFromTabDelimited(qrelPath);
    Map<String, Feature> featuresMap = FeatureUtility.parseFeatures(featurePath);
    Feature[] features = new Feature[featuresMap.size()];
    int index = 0;
    for(String key: featuresMap.keySet()) {
View Full Code Here


    RankAndFeaturesSmallAdaptive generator = new RankAndFeaturesSmallAdaptive(env, fs);

    //Parse queries and find integer codes for the query terms.
    HMapIV<String> parsedQueries = QueryUtility.loadQueries(queryPath);
    HMapIV<int[]> queries = QueryUtility.queryToIntegerCode(env, parsedQueries);
    HMapIF idfs = QueryUtility.loadIdf(env, parsedQueries);
    HMapIF cfs = QueryUtility.loadCf(env, parsedQueries);
    HMapIV<int[]> qrels = QrelUtility.parseQrelsFromTabDelimited(qrelPath);
    Map<String, Feature> featuresMap = FeatureUtility.parseFeatures(featurePath);
    Feature[] features = new Feature[featuresMap.size()];
    int index = 0;
    for(String key: featuresMap.keySet()) {
View Full Code Here

                            (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

  public void testBasic1() {
    int size = 100000;
    Random r = new Random();
    long[] longs = new long[size];

    MapIL map = new HMapIL();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(size);
      map.put(i, k * 2);
      longs[i] = k * 2;
    }

    for (int i = 0; i < size; i++) {
      long v = map.get(i);

      assertEquals(longs[i], v);
      assertTrue(map.containsKey(i));
    }
  }
View Full Code Here

  public void testUpdate() {
    int size = 100000;
    Random r = new Random();
    long[] longs = new long[size];

    MapIL map = new HMapIL();
    for (int i = 0; i < size; i++) {
      int k = r.nextInt(size);
      map.put(i, k + 10L);
      longs[i] = k + 10L;
    }

    assertEquals(size, map.size());

    for (int i = 0; i < size; i++) {
      map.put(i, longs[i] + 10L);
    }

    assertEquals(size, map.size());

    for (int i = 0; i < size; i++) {
      long v = map.get(i);

      assertEquals(longs[i] + 10L, v);
      assertTrue(map.containsKey(i));
    }
  }
View Full Code Here

    }
  }

  @Test
  public void testBasic() throws IOException {
    HMapIL m = new HMapIL();

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

    long value;

    assertEquals(2, m.size());

    value = m.get(1);
    assertEquals(5L, value);

    value = m.remove(1);
    assertEquals(m.size(), 1);

    value = m.get(2);
    assertEquals(22L, value);
  }
View Full Code Here

    assertEquals(22L, value);
  }

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

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

    HMapIL m2 = new HMapIL();

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

    m1.plus(m2);

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

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

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

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

    HMapIL m2 = new HMapIL();

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

    long s = m1.dot(m2);

    assertEquals(6L, s);
  }
View Full Code Here

    assertEquals(6L, s);
  }

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

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

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

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

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

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

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

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

    assertEquals(2, e.length);

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

TOP

Related Classes of edu.umd.cloud9.util.map.HMapIL$Entry

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.