# Path: retired/discrete/operators.py
# def is_discrete_effect(effect):
#   return isinstance(effect, ValueEffect)
# 
# Path: misc/generators.py
# class GeneratorWrapper(Iterator):
#   def __init__(self, generator):
#     self.generator = generator
#   def next(self):
#     return self.generator.next()
#   def __call__(self):
#     return self.next()


from .operators import is_discrete_effect
from misc.generators import GeneratorWrapper
    self.queued = False
    self.locked = False
    #self() # To immediately call the generator
  def __call__(self):
    if self.locked: return
    self.locked = True
    try:
      next(self.generator)
      self.generations += 1
    except StopIteration:
      self.exhausted = True
    self.locked = False
  def __str__(self):
    return str(self.__class__.__name__) + '(' + str(self.goal_connector) + ')'
  __repr__ = __str__

###########################################################################

class DiscreteSubplanner(Subplanner):
  def __init__(self, operators):
    self.operators = operators
  def generator(self, start_vertex, goal_connector, rg):
    #yield # NOTE - include if don't want initial generation
    vertex = rg.vertex(goal_connector.condition.substate)
    vertex.connect(goal_connector)
    variable, value = list(vertex.substate)[0]

    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]

# Path: retired/discrete/operators.py
# def is_discrete_effect(effect):
#   return isinstance(effect, ValueEffect)
# 
# Path: misc/generators.py
# class GeneratorWrapper(Iterator):
#   def __init__(self, generator):
#     self.generator = generator
#   def next(self):
#     return self.generator.next()
#   def __call__(self):
#     return self.next()


# Path: retired/discrete/subplanners.py
from .operators import is_discrete_effect
from misc.generators import GeneratorWrapper

    self.queued = False
    self.locked = False
    #self() # To immediately call the generator
  def __call__(self):
    if self.locked: return
    self.locked = True
    try:
      next(self.generator)
      self.generations += 1
    except StopIteration:
      self.exhausted = True
    self.locked = False
  def __str__(self):
    return str(self.__class__.__name__) + '(' + str(self.goal_connector) + ')'
  __repr__ = __str__

###########################################################################

class DiscreteSubplanner(Subplanner):
  def __init__(self, operators):
    self.operators = operators
  def generator(self, start_vertex, goal_connector, rg):
    #yield # NOTE - include if don't want initial generation
    vertex = rg.vertex(goal_connector.condition.substate)
    vertex.connect(goal_connector)
    variable, value = list(vertex.substate)[0]

    for operator in self.operators:
      if variable in operator.effects:
        effect = operator.effects[variable]

        if is_discrete_effect(effect) and effect.value == value: