MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __need_index_manager

Method __need_index_manager

other/bankers_algorithm.py:86–101  ·  view source on GitHub ↗

This function builds an index control dictionary to track original ids/indices of processes when altered during execution of method "main" :Return: {0: [a: int, b: int], 1: [c: int, d: int]} >>> index_control = BankersAlgorithm( ... test_claim_vecto

(self)

Source from the content-addressed store, hash-verified

84 ]
85
86 def __need_index_manager(self) -> dict[int, list[int]]:
87 """
88 This function builds an index control dictionary to track original ids/indices
89 of processes when altered during execution of method "main"
90
91 :Return: {0: [a: int, b: int], 1: [c: int, d: int]}
92
93 >>> index_control = BankersAlgorithm(
94 ... test_claim_vector, test_allocated_res_table, test_maximum_claim_table
95 ... )._BankersAlgorithm__need_index_manager()
96 >>> {key: [int(x) for x in value] for key, value
97 ... in index_control.items()} # doctest: +NORMALIZE_WHITESPACE
98 {0: [1, 2, 0, 3], 1: [0, 1, 3, 1], 2: [1, 1, 0, 2], 3: [1, 3, 2, 0],
99 4: [2, 0, 0, 3]}
100 """
101 return {self.__need().index(i): i for i in self.__need()}
102
103 def main(self, **kwargs) -> None:
104 """

Callers 1

mainMethod · 0.95

Calls 1

__needMethod · 0.95

Tested by

no test coverage detected