-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_structure.py
More file actions
40 lines (33 loc) · 962 Bytes
/
data_structure.py
File metadata and controls
40 lines (33 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/python
# coding: utf8
"""
Contains range related data structures
List of data structures:
- VariableRangeValue
"""
class VariableRangeValue(object):
"""
Contains the range [lower_bound, 0, upper_bound]
Initialize the range to [-inf, 0, +inf]
"""
identifier = ""
bit_vector_size = 0
value = None
range = [-float("inf"), 0, float("inf")]
LOWER_BOUND = 0
UPPER_BOUND = 2
def __init__(self, size, variable_name, default_range):
self.bit_vector_size = size
self.identifier = variable_name
self.value = None
self.range = default_range
def set_lower_bound(self, new_bound):
"""
Sets the lower bound value
"""
self.range[VariableRangeValue.LOWER_BOUND] = new_bound
def set_upper_bound(self, new_bound):
"""
Sets the upper bound value
"""
self.range[VariableRangeValue.UPPER_BOUND] = new_bound