Пример #1
0
 private void initSimilarityMaps(IEnumerator <UserUserSimilarity> similarities)
 {
     while (similarities.MoveNext())
     {
         UserUserSimilarity current = similarities.Current;
         long num  = current.getUserID1();
         long num2 = current.getUserID2();
         if (num != num2)
         {
             long num3;
             long num4;
             if (num < num2)
             {
                 num3 = num;
                 num4 = num2;
             }
             else
             {
                 num3 = num2;
                 num4 = num;
             }
             FastByIDMap <double> map = this.similarityMaps.get(num3);
             if (map == null)
             {
                 map = new FastByIDMap <double>();
                 this.similarityMaps.put(num3, map);
             }
             map.put(num4, current.getValue());
         }
     }
 }
Пример #2
0
 private void initSimilarityMaps(IEnumerator <UserUserSimilarity> similarities)
 {
     while (similarities.MoveNext())
     {
         UserUserSimilarity uuc = similarities.Current;
         long similarityUser1   = uuc.getUserID1();
         long similarityUser2   = uuc.getUserID2();
         if (similarityUser1 != similarityUser2)
         {
             // Order them -- first key should be the "smaller" one
             long user1;
             long user2;
             if (similarityUser1 < similarityUser2)
             {
                 user1 = similarityUser1;
                 user2 = similarityUser2;
             }
             else
             {
                 user1 = similarityUser2;
                 user2 = similarityUser1;
             }
             FastByIDMap <Double> map = similarityMaps.Get(user1);
             if (map == null)
             {
                 map = new FastByIDMap <Double>();
                 similarityMaps.Put(user1, map);
             }
             map.Put(user2, uuc.getValue());
         }
         // else similarity between user and itself already assumed to be 1.0
     }
 }