Commit 562804a1 authored by VIGNET Pierre's avatar VIGNET Pierre

[lib] Simulator: Fix error when a file with multiple solutions is loaded

parent 697d7d49
......@@ -49,6 +49,11 @@ from string import atoi
from cadbiom.models.guard_transitions.simulator.simul_exceptions import \
SimulException, SimulStopException
from cadbiom import commons as cm
LOGGER = cm.logger()
class InputStream(object):
"""
General class for all input buffers. Input buffers manage dynamic discrete systems inputs
......@@ -238,9 +243,18 @@ class ActInput(InputStream):
# end of buffer
if self.current_index >= self.max_index:
raise SimulStopException()
cin = self.input_buffer[self.current_index]
cin = self.input_buffer[self.current_index].split()
if not cin or cin[0] != "%":
# Next solution, or bad statement
LOGGER.warning(
"Input file can contain multiple solutions (the first is taken here)"
"or is malformed at line %s; ",
self.current_index + 1
)
raise SimulStopException()
self.current_index += 1
return cin.split()[1:]
# Return events
return cin[1:]
def rewind(self):
self.current_index = self.init_index
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment