Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed default methods on MetaPlanner. #176

Merged
merged 1 commit into from
Sep 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions src/prpy/planning/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,9 @@ def __init__(self):
class MetaPlanner(Planner):
__metaclass__ = abc.ABCMeta

def __init__(self):
super(MetaPlanner, self).__init__()
self._planners = list()

def has_planning_method(self, method_name):
for planner in self._planners:
if planner.has_planning_method(method_name):
return True

return False

@abc.abstractmethod
def get_planning_method_names(self):
method_names = set()
for planner in self._planners:
method_names.update(planner.get_planning_method_names())

return list(method_names)
pass

@abc.abstractmethod
def get_planners(self, method_name):
Expand Down Expand Up @@ -224,6 +210,13 @@ def __init__(self, *planners):
def __str__(self):
return 'Sequence({:s})'.format(', '.join(map(str, self._planners)))

def get_planning_method_names(self):
method_names = set()
for planner in self._planners:
method_names.update(planner.get_planning_method_names())

return list(method_names)

def get_planners(self, method_name):
return [planner for planner in self._planners
if planner.has_planning_method(method_name)]
Expand Down Expand Up @@ -268,6 +261,13 @@ def __init__(self, *planners):
def __str__(self):
return 'Ranked({0:s})'.format(', '.join(map(str, self._planners)))

def get_planning_method_names(self):
method_names = set()
for planner in self._planners:
method_names.update(planner.get_planning_method_names())

return list(method_names)

def get_planners(self, method_name):
return [planner for planner in self._planners
if planner.has_planning_method(method_name)]
Expand Down Expand Up @@ -338,6 +338,13 @@ def __init__(self, *planners):
def __str__(self):
return 'Fallback({:s})'.format(', '.join(map(str, self._planners)))

def get_planning_method_names(self):
method_names = set()
for planner in self._planners:
method_names.update(planner.get_planning_method_names())

return list(method_names)

def get_planners(self, method_name):
return [planner for planner in self._planners
if planner.has_planning_method(method_name)]
Expand Down