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:
Refreshable, IDMigrator
Direct Known Subclasses:
AbstractJDBCIDMigrator, FileIDMigrator, MemoryIDMigrator

public abstract class AbstractIDMigrator
extends Object
implements IDMigrator


Constructor Summary
protected AbstractIDMigrator()
           
 
Method Summary
protected  long hash(String value)
           
 void refresh(Collection<Refreshable> alreadyRefreshed)
           Triggers "refresh" -- whatever that means -- of the implementation.
 long toLongID(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
toStringID
 

Constructor Detail

AbstractIDMigrator

protected AbstractIDMigrator()
Method Detail

hash

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

toLongID

public long toLongID(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.

refresh

public void refresh(Collection<Refreshable> alreadyRefreshed)
Description copied from interface: Refreshable

Triggers "refresh" -- whatever that means -- of the implementation. The general contract is that any Refreshable should always leave itself in a consistent, operational state, and that the refresh atomically updates internal state from old to new.

Specified by:
refresh in interface Refreshable
Parameters:
alreadyRefreshed - Refreshables that are known to have already been refreshed as a result of an initial call to a Refreshable.refresh(Collection) method on some object. This ensure that objects in a refresh dependency graph aren't refreshed twice needlessly.


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.