def receive(self, from_node, contexts, timestamp=0): """receive_data 1. Stores the information who sent what 2. Increase the hopcount when the context is a single context >>> d = ContextAggregator() >>> # two contexts are received >>> r = d.receive(1, {Context(value=1.0, cohorts=[0,1,2]), Context(value=1.0, cohorts=[0,1,3])}) >>> same(d.get_received_data(1), [[0,1,2],[0,1,3]]) True >>> """ contexts = Context.increase_hop_count(contexts) self.input[from_node] = contexts received_info = contexts_to_standard(contexts) self.context_history.add_to_history(node_number=from_node, value=received_info, timestamp=timestamp)