forked from puemos/graphplan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproposition.py
40 lines (30 loc) · 1.06 KB
/
proposition.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
32
33
34
35
36
37
38
39
40
class Proposition(object):
"""
A class for representing propositions.
Each proposition object has a name and a list of producers,
that is the actions that have the proposition on their add list.
Two propositions are considered equal if they have the same name.
"""
def __init__(self,name):
"""
Constructor
"""
self.name = name # the name of the proposition as string
self.producers = [] # list of all possible actions in the layer that have the proposition on their add list
def getName(self):
return self.name
def getProducers(self):
return self.producers
def setProducers(self, producers):
self.producers = producers
def addProducer(self, producer):
self.producers.append(producer)
def __eq__(self, other):
return (isinstance(other, self.__class__)
and self.name == other.name)
def __str__(self):
return self.name
def __ne__(self, other):
return not self.__eq__(other)
def __lt__(self, other):
return self.name < other.name