Package es.upm.etsisi.cf4j.data
Class TestUser
- java.lang.Object
-
- es.upm.etsisi.cf4j.data.User
-
- es.upm.etsisi.cf4j.data.TestUser
-
- All Implemented Interfaces:
Serializable
public class TestUser extends User
A TestUser extends an User given him or her the following properties:- Index in the DataModel array which stores test users.
- Array of items rated in test by the user.
It is not recommended that developers generate new instances of this class since this is a memory-structural class.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleaverageTestAverage test ratingprotected doublemaxTestMaximum test rating valueprotected doubleminTestMinimum test rating valueprotected SortedRatingListtestItemsRatingsTestItems rated by the userprotected inttestUserIndexIndex in the DataModel array which stores test users
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTestRating(int testItemIndex, double rating)Adds a new test rating of the test user to an test item.intfindTestItem(int testItemIndex)Finds position of a user's test rating given the index of the TestItem in the DataModel.doublegetMaxTestRating()Gets the maximum test rating of the userdoublegetMinTestRating()Gets the minimum test rating of the userintgetNumberOfTestRatings()Gets the number of test items rated by the user.intgetTestItemAt(int pos)Returns the index of the TestItem rated by the TestUser at the given position.doublegetTestRatingAt(int pos)Returns the test rating of the user to the test item at the pos positiondoublegetTestRatingAverage()Gets the average value of test ratingsintgetTestUserIndex()Returns the test user index inside the DataModel-
Methods inherited from class es.upm.etsisi.cf4j.data.User
addRating, findItem, getDataBank, getId, getItemAt, getMaxRating, getMinRating, getNumberOfRatings, getRatingAt, getRatingAverage, getUserIndex
-
-
-
-
Field Detail
-
testUserIndex
protected int testUserIndex
Index in the DataModel array which stores test users
-
minTest
protected double minTest
Minimum test rating value
-
maxTest
protected double maxTest
Maximum test rating value
-
averageTest
protected double averageTest
Average test rating
-
testItemsRatings
protected SortedRatingList testItemsRatings
TestItems rated by the user
-
-
Constructor Detail
-
TestUser
public TestUser(String id, int userIndex, int testUserIndex)
Creates a new instance of a test user. This constructor should not be used by developers.- Parameters:
id- User unique identifieruserIndex- Index in the DataModel array which stores userstestUserIndex- Index in the DataModel array which stores test users
-
-
Method Detail
-
getTestUserIndex
public int getTestUserIndex()
Returns the test user index inside the DataModel- Returns:
- testUserIndex inside the DataModel
-
getTestItemAt
public int getTestItemAt(int pos)
Returns the index of the TestItem rated by the TestUser at the given position.- Parameters:
pos- Position- Returns:
- Index of the test item in the TestItems' array of the DataModel
-
getTestRatingAt
public double getTestRatingAt(int pos)
Returns the test rating of the user to the test item at the pos position- Parameters:
pos- Position- Returns:
- Test rating at indicated position
-
findTestItem
public int findTestItem(int testItemIndex)
Finds position of a user's test rating given the index of the TestItem in the DataModel.- Parameters:
testItemIndex- Test item index- Returns:
- TestItem position if the test item has been rated by the test user or -1 if do not
-
getNumberOfTestRatings
public int getNumberOfTestRatings()
Gets the number of test items rated by the user.- Returns:
- Number of test ratings
-
addTestRating
public void addTestRating(int testItemIndex, double rating)Adds a new test rating of the test user to an test item. You cannot overwrite an existing rating, otherwise this method will throws an IllegalArgumentException. It is not recommended to use this method, use DataModel.addTestRating(...) instead.- Parameters:
testItemIndex- Test item index which identifies a test item in the DataModelrating- Rating value
-
getMinTestRating
public double getMinTestRating()
Gets the minimum test rating of the user- Returns:
- Minimum test rating
-
getMaxTestRating
public double getMaxTestRating()
Gets the maximum test rating of the user- Returns:
- Maximum test rating
-
getTestRatingAverage
public double getTestRatingAverage()
Gets the average value of test ratings- Returns:
- Test rating average
-
-