org.apache.mahout.cf.taste.impl.model
Class MemoryIDMigrator
java.lang.Object
org.apache.mahout.cf.taste.impl.model.AbstractIDMigrator
org.apache.mahout.cf.taste.impl.model.MemoryIDMigrator
- All Implemented Interfaces:
- Refreshable, IDMigrator, UpdatableIDMigrator
public final class MemoryIDMigrator
- extends AbstractIDMigrator
- implements UpdatableIDMigrator
Implementation which stores the reverse long-to-String mapping in memory.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MemoryIDMigrator
public MemoryIDMigrator()
storeMapping
public void storeMapping(long longID,
String stringID)
- Description copied from interface:
UpdatableIDMigrator
- Stores the reverse long-to-String mapping in some kind of backing store. Note that this must be called
directly (or indirectly through
UpdatableIDMigrator.initialize(Iterable)
) for every String that might be encountered
in the application, or else the mapping will not be known.
- Specified by:
storeMapping
in interface UpdatableIDMigrator
- Parameters:
longID
- long IDstringID
- string ID that maps to/from that long ID
toStringID
public String toStringID(long longID)
- Specified by:
toStringID
in interface IDMigrator
- Returns:
- the string ID most recently associated with the given long ID, or null if doesn't exist
initialize
public void initialize(Iterable<String> stringIDs)
- Description copied from interface:
UpdatableIDMigrator
- 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 UpdatableIDMigrator
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.