StateConnection.cpp 1.8 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: 2022-05-12
  7. *
  8. * */
  9. #include <ls_std/logic/StateConnection.hpp>
  10. #include <ls_std/core/exception/IllegalArgumentException.hpp>
  11. ls::std::logic::StateConnection::StateConnection(const ls::std::core::type::state_connection_id& _connectionId, const ls::std::core::type::state_id& _stateId) : ls::std::core::Class("StateConnection")
  12. {
  13. this->_assignConnectionId(_connectionId);
  14. this->_assignStateId(_stateId);
  15. }
  16. ls::std::core::type::state_connection_id ls::std::logic::StateConnection::getConnectionId()
  17. {
  18. return this->connectionId;
  19. }
  20. ls::std::core::type::state_id ls::std::logic::StateConnection::getStateId()
  21. {
  22. return this->stateId;
  23. }
  24. bool ls::std::logic::StateConnection::isPassable() const
  25. {
  26. return this->condition;
  27. }
  28. void ls::std::logic::StateConnection::setConnectionId(const ls::std::core::type::state_connection_id& _connectionId)
  29. {
  30. this->_assignConnectionId(_connectionId);
  31. }
  32. void ls::std::logic::StateConnection::setStateId(const ls::std::core::type::state_id& _stateId)
  33. {
  34. this->_assignStateId(_stateId);
  35. }
  36. void ls::std::logic::StateConnection::updatePassCondition(bool _condition)
  37. {
  38. this->condition = _condition;
  39. }
  40. void ls::std::logic::StateConnection::_assignConnectionId(const ls::std::core::type::state_connection_id &_connectionId)
  41. {
  42. if (_connectionId.empty())
  43. {
  44. throw ls::std::core::IllegalArgumentException{};
  45. }
  46. this->connectionId = _connectionId;
  47. }
  48. void ls::std::logic::StateConnection::_assignStateId(const ls::std::core::type::state_id &_stateId)
  49. {
  50. if (_stateId.empty())
  51. {
  52. throw ls::std::core::IllegalArgumentException{};
  53. }
  54. this->stateId = _stateId;
  55. }