public override UserItemRating[] ItemRatings(int i) { var playerDidRate = PlayerDidRate(i); var count = playerDidRate ? userCount : userCount - 1; var tuples = new UserItemRating[count]; for (var u = 0; u < count; u++) { tuples[u].user = u; tuples[u].item = i; tuples[u].rating = m_Data[u, i]; } return(tuples); }
public override UserItemRating[] UserRatings(int u) { if (u != m_PlayerUserId) { var tuples = new UserItemRating[itemCount]; for (var i = 0; i < itemCount; i++) { tuples[i].user = u; tuples[i].item = i; tuples[i].rating = m_Data[u, i]; } return(tuples); } return(Enumerable.Range(0, itemCount) .Where(PlayerDidRate) .Select(i => new UserItemRating(u, i, m_Data[u, i])).ToArray()); }