## 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.

Constructor Summary
`MemoryIDMigrator()`

Method Summary
`void` `initialize(Iterable<String> stringIDs)` Make the mapping aware of the given string IDs.
`void` `storeMapping(long longID, String stringID)` Stores the reverse long-to-String mapping in some kind of backing store.
`String` `toStringID(long longID)`

Methods inherited from class org.apache.mahout.cf.taste.impl.model.AbstractIDMigrator
`hash, refresh, toLongID`

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
`toLongID`

Methods inherited from interface org.apache.mahout.cf.taste.common.Refreshable
`refresh`

Constructor Detail

### MemoryIDMigrator

    public MemoryIDMigrator()

Method Detail

### 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 ID
    `stringID` - 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.