public class User extends Object implements Serializable
It is not recommended that developers generate new instances of this class since this is a memory-structural class.
Modifier and Type | Field and Description |
---|---|
protected double |
average
Average (training) rating
|
protected DataBank |
dataBank
DataBank to store heterogeneous information
|
protected String |
id
User unique identifier
|
protected SortedRatingList |
itemsRatings
Items rated by the user
|
protected double |
max
Maximum (training) rating value
|
protected double |
min
Minimum (training) rating value
|
protected int |
userIndex
User index in the DataModel
|
Constructor and Description |
---|
User(String id,
int index)
Creates a new instance of an user.
|
Modifier and Type | Method and Description |
---|---|
void |
addRating(int itemIndex,
double rating)
Adds a new rating of the user to an item.
|
int |
findItem(int itemIndex)
Finds position of a user's rating given the index of the Item in the DataModel.
|
DataBank |
getDataBank()
Gets the DataBank instance that stores heterogeneous information related to the User.
|
String |
getId()
Returns the user unique identifier
|
int |
getItemAt(int pos)
Returns the index of the Item rated by the User at the given position.
|
double |
getMaxRating()
Gets the maximum rating of the user
|
double |
getMinRating()
Gets the minimum rating of the user
|
int |
getNumberOfRatings()
Gets the number of items rated by the user
|
double |
getRatingAt(int pos)
Returns the rating of the user to the item at the pos position
|
double |
getRatingAverage()
Gets the average value of ratings
|
int |
getUserIndex()
Return the user index inside the DataModel
|
protected String id
protected int userIndex
protected double min
protected double max
protected double average
protected DataBank dataBank
protected SortedRatingList itemsRatings
public User(String id, int index)
id
- User unique identifierindex
- Index of the user in the Users' array of the DataModelpublic DataBank getDataBank()
public String getId()
public int getUserIndex()
public int getItemAt(int pos)
pos
- Positionpublic double getRatingAt(int pos)
pos
- Positionpublic int findItem(int itemIndex)
itemIndex
- Item indexpublic int getNumberOfRatings()
public void addRating(int itemIndex, double rating)
itemIndex
- Item index which identifies an item in the DataModelrating
- Rating valuepublic double getMinRating()
public double getMaxRating()
public double getRatingAverage()
Copyright © 2020. All rights reserved.