List of usage examples for org.apache.mahout.cf.taste.common NoSuchUserException NoSuchUserException
public NoSuchUserException()
From source file:alto.plugin.webradio.recommender.MongoDBDataModel.java
License:Apache License
private void checkData(String userID, Iterable<List<String>> items, boolean add) throws NoSuchUserException, NoSuchItemException { Preconditions.checkNotNull(userID);//from ww w. j a v a 2 s . c o m Preconditions.checkNotNull(items); Preconditions.checkArgument(!userID.isEmpty(), "userID is empty"); for (List<String> item : items) { Preconditions.checkNotNull(item.get(0)); Preconditions.checkArgument(!item.get(0).isEmpty(), "item is empty"); } if (userIsObject && !ID_PATTERN.matcher(userID).matches()) { throw new IllegalArgumentException(); } for (List<String> item : items) { if (itemIsObject && !ID_PATTERN.matcher(item.get(0)).matches()) { throw new IllegalArgumentException(); } } if (!add && !isIDInModel(userID)) { throw new NoSuchUserException(); } for (List<String> item : items) { if (!add && !isIDInModel(item.get(0))) { throw new NoSuchItemException(); } } }
From source file:com.paradigma.recommender.db.MongoDBDataModel.java
License:Apache License
private void checkData(String userID, Iterable<List<String>> items, boolean add) throws NoSuchUserException, NoSuchItemException { Preconditions.checkNotNull(userID);//from w w w .j av a 2s.c o m Preconditions.checkNotNull(items); Preconditions.checkArgument(userID.length() > 0); for (List<String> item : items) { Preconditions.checkNotNull(item.get(0)); Preconditions.checkArgument(item.get(0).length() > 0); } if (userIsObject && !ID_PATTERN.matcher(userID).matches()) { throw new IllegalArgumentException(); } for (List<String> item : items) { if (itemIsObject && !ID_PATTERN.matcher(item.get(0)).matches()) { throw new IllegalArgumentException(); } } if (!add && !isIDInModel(userID)) { throw new NoSuchUserException(); } for (List<String> item : items) { if (!add && !isIDInModel(item.get(0))) { throw new NoSuchItemException(); } } }