sbaldu / DynamicalSystemFramework

Framework for modelling dynamical complex systems

Home Page:https://sbaldu.github.io/DynamicalSystemFramework/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`setPhase` is not working properly

NotLudovico opened this issue · comments

 void TrafficLight<Id, Size, Delay>::setPhase(Delay phase) {
    if (!m_delay.has_value()) {
      throw std::runtime_error(buildLog("TrafficLight's delay has not been set."));
    }
    if (phase > m_delay.value().first + m_delay.value().second) {
      phase -= m_delay.value().first + m_delay.value().second;
    }
    phase == 0 ? m_counter = 0 : m_counter = m_delay.value().first % phase;
  }

Misused modulus operator