-
Notifications
You must be signed in to change notification settings - Fork 1
/
policy.py
31 lines (27 loc) · 1.28 KB
/
policy.py
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
class Policy:
"""Policy for every object in the ecosystem.
Every policy contains the following:
* policy_number
* object_name
* source_name
* activity_name
* Conditions(pre, post and current) are a list of lists of the format
[ object1, acitivity, value]
"""
policy_number = None
object_name = ""
state_name = ""
activity_name = ""
pre_condition = []
current_condition = []
post_condition = []
def __init__(self, policy_number=None, object_name="", state_name="", activity_name="", pre_condition="", current_condition="", post_condition=""):
self.policy_number = policy_number
self.object_name = object_name
self.state_name = state_name
self.activity_name = activity_name
self.pre_condition = pre_condition
self.current_condition = current_condition
self.post_condition = post_condition
def get_policy_string(self):
return (f"{self.policy_number}) <({self.object_name}, {self.state_name}, {self.activity_name}), ({self.pre_condition[0]}, {self.pre_condition[1]}, {self.pre_condition[2]}), ({self.current_condition[0]}, {self.current_condition[1]}, {self.current_condition[2]}), ({self.post_condition[0]}, {self.post_condition[1]}, {self.post_condition[2]})>")