Examples of toLongID()


Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

    Thread.sleep(2000L);
    writeLines(testFile, UPDATED_STRING_IDS);

    /* we shouldn't see any changes in the data as we have not yet refreshed */
    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertNull(migrator.toStringID(donkeyAsLong));
  }

View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

  @Test
  public void testRefreshAfterFileUpdate() throws Exception {
    IDMigrator migrator = new FileIDMigrator(testFile, 0L);

    /* call a method to make sure the original file is loaded */
    long dogAsLong = migrator.toLongID("dog");
    migrator.toStringID(dogAsLong);

    /* change the underlying file,
     * we have to wait at least a second to see the change in the file's lastModified timestamp */
    Thread.sleep(2000L);
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

    Thread.sleep(2000L);
    writeLines(testFile, UPDATED_STRING_IDS);

    migrator.refresh(null);

    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertEquals("donkey", migrator.toStringID(donkeyAsLong));
  }
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

    writeLines(testFile, UPDATED_STRING_IDS);

    migrator.refresh(null);

    long cowAsLong = migrator.toLongID("cow");
    long donkeyAsLong = migrator.toLongID("donkey");
    assertEquals("dog", migrator.toStringID(dogAsLong));
    assertEquals("cow", migrator.toStringID(cowAsLong));
    assertEquals("donkey", migrator.toStringID(donkeyAsLong));
  }
}
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

  private static final long DUMMY_ID = -6311185995763544451L;

  @Test
  public void testToLong() {
    IDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
    assertEquals(DUMMY_ID, id);
  }

  @Test
  public void testStore() throws Exception {
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

        try {
         
          String userIDString = it.next();
          userIsTag = userIDString.startsWith("\"");
          if (userIsTag) {
            userID = hash.toLongID(userIDString.substring(1, userIDString.length() - 1));
          } else {
            userID = Long.parseLong(userIDString);
          }
         
          String itemIDString = it.next();
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

          }
         
          String itemIDString = it.next();
          itemIsTag = itemIDString.startsWith("\"");
          if (itemIsTag) {
            itemID = hash.toLongID(itemIDString.substring(1, itemIDString.length() - 1));
          } else {
            itemID = Long.parseLong(itemIDString);           
          }
         
          if (it.hasNext()) {
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

public final class OneWayMigratorTest extends MyrrixTest {

  @Test
  public void testForward() throws Exception {
    IDMigrator migrator = new OneWayMigrator();
    assertEquals(4060265690780417169L, migrator.toLongID("foobar"));
    assertEquals(-3162216497309240828L, migrator.toLongID(""));
  }

  @Test(expected = UnsupportedOperationException.class)
  public void testBackward() throws Exception {
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.IDMigrator.toLongID()

  @Test
  public void testForward() throws Exception {
    IDMigrator migrator = new OneWayMigrator();
    assertEquals(4060265690780417169L, migrator.toLongID("foobar"));
    assertEquals(-3162216497309240828L, migrator.toLongID(""));
  }

  @Test(expected = UnsupportedOperationException.class)
  public void testBackward() throws Exception {
    IDMigrator migrator = new OneWayMigrator();
View Full Code Here

Examples of org.apache.mahout.cf.taste.model.UpdatableIDMigrator.toLongID()

  }

  @Test
  public void testStore() throws Exception {
    UpdatableIDMigrator migrator = new MemoryIDMigrator();
    long id = migrator.toLongID(DUMMY_STRING);
    assertNull(migrator.toStringID(id));
    migrator.storeMapping(id, DUMMY_STRING);
    assertEquals(DUMMY_STRING, migrator.toStringID(id));
  }
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.