@Test public void testFile() throws Exception { UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(model); UserNeighborhood neighborhood = new NearestNUserNeighborhood(3, userSimilarity, model); Recommender recommender = new GenericUserBasedRecommender(model, neighborhood, userSimilarity); assertEquals(1, recommender.recommend(123, 3).size()); assertEquals(0, recommender.recommend(234, 3).size()); assertEquals(1, recommender.recommend(345, 3).size()); model.refresh(null); }
@Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (dataFile.lastModified() > lastModified + minReloadIntervalMS || readLastUpdateFileModified() > lastUpdateFileModified + minReloadIntervalMS) { log.debug("File has changed; reloading..."); reload(); } }
FileDataModel extends AbstractDataModel { @Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (dataFile.lastModified() > lastModified + minReloadIntervalMS || readLastUpdateFileModified() > lastUpdateFileModified + minReloadIntervalMS) { log.debug("File has changed; reloading..."); reload(); } } }
FileDataModel extends AbstractDataModel { @Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (dataFile.lastModified() > lastModified + minReloadIntervalMS || readLastUpdateFileModified() > lastUpdateFileModified + minReloadIntervalMS) { log.debug("File has changed; reloading..."); reload(); } } FileDataModel(File dataFile);  FileDataModel(File dataFile, String delimiterRegex);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS, String delimiterRegex); }
FileDataModel extends AbstractDataModel { @Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (dataFile.lastModified() > lastModified + minReloadIntervalMS || readLastUpdateFileModified() > lastUpdateFileModified + minReloadIntervalMS) { log.debug("File has changed; reloading..."); reload(); } } FileDataModel(File dataFile);  FileDataModel(File dataFile, String delimiterRegex);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS, String delimiterRegex); File getDataFile(); static char determineDelimiter(String line); @Override LongPrimitiveIterator getUserIDs(); @Override PreferenceArray getPreferencesFromUser(long userID); @Override FastIDSet getItemIDsFromUser(long userID); @Override LongPrimitiveIterator getItemIDs(); @Override PreferenceArray getPreferencesForItem(long itemID); @Override Float getPreferenceValue(long userID, long itemID); @Override Long getPreferenceTime(long userID, long itemID); @Override int getNumItems(); @Override int getNumUsers(); @Override int getNumUsersWithPreferenceFor(long itemID); @Override int getNumUsersWithPreferenceFor(long itemID1, long itemID2); @Override void setPreference(long userID, long itemID, float value); @Override void removePreference(long userID, long itemID); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override boolean hasPreferenceValues(); @Override float getMaxPreference(); @Override float getMinPreference(); @Override String toString(); }
FileDataModel extends AbstractDataModel { @Override public void refresh(Collection<Refreshable> alreadyRefreshed) { if (dataFile.lastModified() > lastModified + minReloadIntervalMS || readLastUpdateFileModified() > lastUpdateFileModified + minReloadIntervalMS) { log.debug("File has changed; reloading..."); reload(); } } FileDataModel(File dataFile);  FileDataModel(File dataFile, String delimiterRegex);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS);  FileDataModel(File dataFile, boolean transpose, long minReloadIntervalMS, String delimiterRegex); File getDataFile(); static char determineDelimiter(String line); @Override LongPrimitiveIterator getUserIDs(); @Override PreferenceArray getPreferencesFromUser(long userID); @Override FastIDSet getItemIDsFromUser(long userID); @Override LongPrimitiveIterator getItemIDs(); @Override PreferenceArray getPreferencesForItem(long itemID); @Override Float getPreferenceValue(long userID, long itemID); @Override Long getPreferenceTime(long userID, long itemID); @Override int getNumItems(); @Override int getNumUsers(); @Override int getNumUsersWithPreferenceFor(long itemID); @Override int getNumUsersWithPreferenceFor(long itemID1, long itemID2); @Override void setPreference(long userID, long itemID, float value); @Override void removePreference(long userID, long itemID); @Override void refresh(Collection<Refreshable> alreadyRefreshed); @Override boolean hasPreferenceValues(); @Override float getMaxPreference(); @Override float getMinPreference(); @Override String toString(); static final long DEFAULT_MIN_RELOAD_INTERVAL_MS; }