-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
38 changed files
with
1,132 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
rival-core/src/main/java/net/recommenders/rival/core/DataModelIF.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* | ||
* Copyright 2015 recommenders.net. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package net.recommenders.rival.core; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
/** | ||
* Interface for the data model used throughout the toolkit. Able to store | ||
* users, items, and preferences. | ||
* | ||
* @author <a href="http://github.com/abellogin">Alejandro</a>, <a | ||
* href="http://github.com/alansaid">Alan</a> | ||
* | ||
* @param <U> generic type for users | ||
* @param <I> generic type for items | ||
*/ | ||
public interface DataModelIF<U, I> { | ||
|
||
/** | ||
* Method that returns the preference map between users and items. | ||
* | ||
* @return the preference map between users and items. | ||
*/ | ||
public Map<U, Map<I, Double>> getUserItemPreferences(); | ||
|
||
/** | ||
* Method that adds a preference to the model between a user and an item. | ||
* | ||
* @param u the user. | ||
* @param i the item. | ||
* @param d the preference. | ||
*/ | ||
public void addPreference(final U u, final I i, final Double d); | ||
|
||
/** | ||
* Method that returns the items in the model. | ||
* | ||
* @return the items in the model. | ||
*/ | ||
public Set<I> getItems(); | ||
|
||
/** | ||
* Method that returns the users in the model. | ||
* | ||
* @return the users in the model. | ||
*/ | ||
public Set<U> getUsers(); | ||
|
||
/** | ||
* Method that returns the number of items in the model. | ||
* | ||
* @return the number of items in the model. | ||
*/ | ||
public int getNumItems(); | ||
|
||
/** | ||
* Method that returns the number of users in the model. | ||
* | ||
* @return the number of users in the model. | ||
*/ | ||
public int getNumUsers(); | ||
|
||
/** | ||
* Method that clears all the maps contained in the model. | ||
*/ | ||
public void clear(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.