Go to the documentation of this file.00001 import pddl_types
00002
00003 class Function(object):
00004 def __init__(self, name, arguments):
00005 self.name = name
00006 self.arguments = arguments
00007 def parse(alist):
00008 name = alist[0]
00009 arguments = pddl_types.parse_typed_list(alist[1:], only_variables=True)
00010 return Function(name, arguments)
00011 def parse_typed(alist,type):
00012 function = Function.parse(alist)
00013 function.type = type
00014 return function
00015 parse = staticmethod(parse)
00016 parse_typed = staticmethod(parse_typed)
00017 def __str__(self):
00018 if self.type:
00019 return "%s(%s):%s" % (self.name, ", ".join(map(str, self.arguments)),self.type)
00020 else:
00021 return "%s(%s)" % (self.name, ", ".join(map(str, self.arguments)))
00022