/** * Given a nodeInfo containing the social proofs and weight information regarding a rightNode, * convert and store these data in a SocialProofResult object, to comply with the class interface. * * @param nodeInfo Contains all the social proofs on a particular right node, along with the * accumulated node weight */ private SocialProofResult makeSocialProofResult(NodeInfo nodeInfo) { Byte2ObjectArrayMap<LongSet> socialProofsMap = new Byte2ObjectArrayMap<>(); for (int socialProofType = 0; socialProofType < NUM_OF_SOCIAL_PROOF_TYPES; socialProofType++) { SmallArrayBasedLongToDoubleMap socialProofsByType = nodeInfo.getSocialProofs()[socialProofType]; if (socialProofsByType == null || socialProofsByType.size() == 0) { continue; } LongSet rightNodeIds = new LongArraySet( Arrays.copyOfRange(socialProofsByType.keys(), 0, socialProofsByType.size())); socialProofsMap.put((byte)socialProofType, rightNodeIds); } return new SocialProofResult( nodeInfo.getNodeId(), socialProofsMap, nodeInfo.getWeight(), recommendationType ); }
nodeMetadataToSocialProofMap.put(metadataId, new Byte2ObjectArrayMap<>());