Total Complexity | 4 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | from pysie.dsl.set import TernarySearchSet, TernarySearchTrie |
||
4 | class ContingencyTable(object): |
||
5 | values = None |
||
6 | rows = None |
||
7 | columns = None |
||
8 | |||
9 | def __init__(self): |
||
10 | self.rows = TernarySearchSet() |
||
11 | self.columns = TernarySearchSet() |
||
12 | self.values = TernarySearchTrie() |
||
13 | |||
14 | def set_cell(self, row_name, column_name, value): |
||
15 | key = self.make_key(row_name, column_name) |
||
16 | self.values.put(key, value) |
||
17 | |||
18 | def get_cell(self, row_name, column_name): |
||
19 | key = self.make_key(row_name, column_name) |
||
20 | return self.values.get(key) |
||
21 | |||
22 | def make_key(self, row_name, column_name): |
||
23 | return row_name + '-' + column_name |
||
24 | |||
26 |