def eg_rule_action1(memories_info): def eg_req_func(protocols): for protocol in protocols: if isinstance(protocol, EntanglementGenerationA): return protocol memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, "mid_node", "node2", memory) protocol.primary = True return [protocol, ["node2"], [eg_req_func]]
def eg_rule_action(memories_info: List["MemoryInfo"]): memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, middle_names[index - 1], node_names[index - 1], memory) return [protocol, [None], [None]]
def eg_rule_action_f1_1(memories_info: List["MemoryInfo"]): def req_func(protocols): for protocol in protocols: if isinstance( protocol, EntanglementGenerationA ) and protocol.other == "r1" and r2.memory_array.memories.index( protocol.memory) < 10: return protocol memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, "m12", "r2", memory) return [protocol, ["r2"], [req_func]]
def eg_rule_action(memories_info: List["MemoryInfo"]): def req_func(protocols): for protocol in protocols: if isinstance(protocol, EntanglementGenerationA ) and protocol.other == node.name and path[ index + 1].memory_array.memories.index( protocol.memory) in range( node_mems[index + 1][0], node_mems[index + 1][1]): return protocol memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, middle_names[index], node_names[index + 1], memory) return [protocol, [node_names[index + 1]], [req_func]]
def eg_rule_action2(memories_info): memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, "mid_node", "node1", memory) return [protocol, [None], [None]]
def eg_rule_action_f1_2(memories_info: List["MemoryInfo"]): memories = [info.memory for info in memories_info] memory = memories[0] protocol = EntanglementGenerationA(None, "EGA." + memory.name, "m12", "r1", memory) return [protocol, [None], [None]]
def create_protocol(self, middle: str, other: str): self.protocols = [EntanglementGenerationA(self, '%s.eg'%self.name, middle, other, self.memory)]