private void initSimilarityMaps(IEnumerator <ItemItemSimilarity> similarities) { while (similarities.MoveNext()) { ItemItemSimilarity current = similarities.Current; long num = current.getItemID1(); long num2 = current.getItemID2(); 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, new double?(current.getValue())); this.doIndex(num3, num4); this.doIndex(num4, num3); } } }
private void initSimilarityMaps(IEnumerator <ItemItemSimilarity> similarities) { while (similarities.MoveNext()) { ItemItemSimilarity iic = similarities.Current; long similarityItemID1 = iic.getItemID1(); long similarityItemID2 = iic.getItemID2(); if (similarityItemID1 != similarityItemID2) { // Order them -- first key should be the "smaller" one long itemID1; long itemID2; if (similarityItemID1 < similarityItemID2) { itemID1 = similarityItemID1; itemID2 = similarityItemID2; } else { itemID1 = similarityItemID2; itemID2 = similarityItemID1; } FastByIDMap <double?> map = similarityMaps.Get(itemID1); if (map == null) { map = new FastByIDMap <double?>(); similarityMaps.Put(itemID1, map); } map.Put(itemID2, iic.getValue()); doIndex(itemID1, itemID2); doIndex(itemID2, itemID1); } // else similarity between item and itself already assumed to be 1.0 } }