public class Item 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
Item unique identifier
|
protected int |
itemIndex
Item index in the DataModel
|
protected double |
max
Maximum (training) rating value
|
protected double |
min
Minimum (training) rating value
|
protected SortedRatingList |
usersRatings
Users that have rated the item
|
Constructor and Description |
---|
Item(String id,
int index)
Creates a new instance of an item.
|
Modifier and Type | Method and Description |
---|---|
void |
addRating(int userIndex,
double rating)
Adds a new rating of an user to the item.
|
int |
findUser(int userIndex)
Finds position of a rating that an user has made to the item given the index of the User in the
DataModel.
|
DataBank |
getDataBank()
Gets the DataBank instance that stores heterogeneous information related to the Item.
|
String |
getId()
Returns the item unique identifier
|
int |
getItemIndex()
Return the item index inside the DataModel
|
double |
getMaxRating()
Gets the maximum rating received by the item.
|
double |
getMinRating()
Gets the minimum rating received by the item.
|
int |
getNumberOfRatings()
Gets the number of ratings that the item have received
|
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 |
getUserAt(int pos)
Returns the index of the User that have rated the Item at the given position
|
protected String id
protected int itemIndex
protected double min
protected double max
protected double average
protected DataBank dataBank
protected SortedRatingList usersRatings
public Item(String id, int index)
id
- Item unique identifierindex
- Index of the item in the Items' array of the DataModelpublic DataBank getDataBank()
public String getId()
public int getItemIndex()
public int getUserAt(int pos)
pos
- Positionpublic double getRatingAt(int pos)
pos
- Positionpublic int findUser(int userIndex)
userIndex
- User indexpublic int getNumberOfRatings()
public void addRating(int userIndex, double rating)
userIndex
- User index which identifies the specific user in the DataModelrating
- Rating valuepublic double getMinRating()
public double getMaxRating()
public double getRatingAverage()
Copyright © 2020. All rights reserved.