org.apache.mahout.cf.taste.impl.model
Class AbstractIDMigrator

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.model.AbstractIDMigrator
All Implemented Interfaces:
IDMigrator
Direct Known Subclasses:
AbstractJDBCIDMigrator, MemoryIDMigrator

public abstract class AbstractIDMigrator
extends java.lang.Object
implements IDMigrator


Constructor Summary
protected AbstractIDMigrator()
           
 
Method Summary
protected  long hash(java.lang.String value)
           
 void initialize(java.lang.Iterable<java.lang.String> stringIDs)
          Make the mapping aware of the given string IDs.
 long toLongID(java.lang.String stringID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mahout.cf.taste.model.IDMigrator
storeMapping, toStringID
 

Constructor Detail

AbstractIDMigrator

protected AbstractIDMigrator()
Method Detail

hash

protected final long hash(java.lang.String value)
Returns:
most significant 8 bytes of the MD5 hash of the string, as a long

toLongID

public long toLongID(java.lang.String stringID)
Specified by:
toLongID in interface IDMigrator
Returns:
the top 8 bytes of the MD5 hash of the bytes of the given String's UTF-8 encoding as a long.

initialize

public void initialize(java.lang.Iterable<java.lang.String> stringIDs)
                throws TasteException
Description copied from interface: IDMigrator
Make the mapping aware of the given string IDs. This must be called initially before the implementation is used, or else it will not be aware of reverse long-to-String mappings.

Specified by:
initialize in interface IDMigrator
Throws:
TasteException - if an error occurs while storing the mappings


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.