# Path: ltlbroom/specgeneration.py
# def chunks_from_gentree(gen_tree):
#     """Return all the SpecChunk contained in a generation tree."""
#     return [spec_lines for command_spec_lines in gen_tree.values()
#             for spec_lines_list in command_spec_lines.values()
#             for spec_lines in spec_lines_list]
# 
# def goal_to_chunk(goal_idx, spec_chunks):
#     """Return the unique SpecChunk that contain a goal index."""
#     chunks = [spec_chunk for spec_chunk in spec_chunks if spec_chunk.contains_goal(goal_idx)]
#     if len(chunks) == 1:
#         return chunks[0]
#     elif len(chunks) > 1:
#         print >> sys.stderr, "Error: Found multiple chunks for goal {}.".format(goal_idx)
#     # Zero length case returns None without printing an error
#     return None


from ltlbroom.specgeneration import chunks_from_gentree, goal_to_chunk
# Copyright (C) 2011-2013 Kenton Lee, Constantine Lignos, and Ian Perera
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



class DialogManager(object):
    """Supports stateful dialog with the NL system."""

    def __init__(self, generation_tree=None):
        # Store the logic generation tree if it is provided.
        self._gen_tree = None
        self._spec_lists = None
        self.set_gen_tree(generation_tree)
        self._user_history = []
        self._system_history = []

    def set_gen_tree(self, gen_tree):
        """Set the generation tree."""
        self._gen_tree = gen_tree

# Path: ltlbroom/specgeneration.py
# def chunks_from_gentree(gen_tree):
#     """Return all the SpecChunk contained in a generation tree."""
#     return [spec_lines for command_spec_lines in gen_tree.values()
#             for spec_lines_list in command_spec_lines.values()
#             for spec_lines in spec_lines_list]
# 
# def goal_to_chunk(goal_idx, spec_chunks):
#     """Return the unique SpecChunk that contain a goal index."""
#     chunks = [spec_chunk for spec_chunk in spec_chunks if spec_chunk.contains_goal(goal_idx)]
#     if len(chunks) == 1:
#         return chunks[0]
#     elif len(chunks) > 1:
#         print >> sys.stderr, "Error: Found multiple chunks for goal {}.".format(goal_idx)
#     # Zero length case returns None without printing an error
#     return None


# Path: ltlbroom/dialog.py
from ltlbroom.specgeneration import chunks_from_gentree, goal_to_chunk

# Copyright (C) 2011-2013 Kenton Lee, Constantine Lignos, and Ian Perera
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.



class DialogManager(object):
    """Supports stateful dialog with the NL system."""

    def __init__(self, generation_tree=None):
        # Store the logic generation tree if it is provided.
        self._gen_tree = None
        self._spec_lists = None
        self.set_gen_tree(generation_tree)
        self._user_history = []
        self._system_history = []

    def set_gen_tree(self, gen_tree):
        """Set the generation tree."""
        self._gen_tree = gen_tree

        self._spec_lists = chunks_from_gentree(self._gen_tree) if self._gen_tree else None