Completed
Push — master ( f1f19a...ab9d67 )
by Xianshun
01:10
created

ContingencyTable.set_cell()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
1
from pysie.dsl.set import TernarySearchSet, TernarySearchTrie
2
3
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
25
26