StateConnection.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-09-10
  6. * Changed: 2021-05-27
  7. *
  8. * */
  9. #include <ls_std/logic/StateConnection.hpp>
  10. #include <ls_std/exception/IllegalArgumentException.hpp>
  11. ls_std::StateConnection::StateConnection(const ls_std::StateConnectionId& _connectionId, const ls_std::StateId& _stateId) : ls_std::Class("StateConnection")
  12. {
  13. this->_assignConnectionId(_connectionId);
  14. this->_assignStateId(_stateId);
  15. }
  16. ls_std::StateConnectionId ls_std::StateConnection::getConnectionId()
  17. {
  18. return this->connectionId;
  19. }
  20. ls_std::StateId ls_std::StateConnection::getStateId()
  21. {
  22. return this->stateId;
  23. }
  24. bool ls_std::StateConnection::isPassable() const
  25. {
  26. return this->condition;
  27. }
  28. void ls_std::StateConnection::setConnectionId(const ls_std::StateConnectionId& _connectionId)
  29. {
  30. this->_assignConnectionId(_connectionId);
  31. }
  32. void ls_std::StateConnection::setStateId(const ls_std::StateId& _stateId)
  33. {
  34. this->_assignStateId(_stateId);
  35. }
  36. void ls_std::StateConnection::updatePassCondition(bool _condition)
  37. {
  38. this->condition = _condition;
  39. }
  40. void ls_std::StateConnection::_assignConnectionId(const ls_std::StateConnectionId &_connectionId)
  41. {
  42. if (_connectionId.empty())
  43. {
  44. throw ls_std::IllegalArgumentException{};
  45. }
  46. this->connectionId = _connectionId;
  47. }
  48. void ls_std::StateConnection::_assignStateId(const ls_std::StateId &_stateId)
  49. {
  50. if (_stateId.empty())
  51. {
  52. throw ls_std::IllegalArgumentException{};
  53. }
  54. this->stateId = _stateId;
  55. }