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

ContingencyTable   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A get_cell() 0 3 1
A set_cell() 0 3 1
A make_key() 0 2 1
A __init__() 0 4 1
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