primitive.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. # Copyright 2023 Modelling, Simulation and Design Lab (MSDL)
  2. # at the University of Antwerp (http://msdl.uantwerpen.be/).
  3. #
  4. # Licensed under the GNU Public License v3 (the "License");
  5. # you may not use this file except in compliance with the
  6. # License. You may obtain a copy of the License at
  7. # https://www.gnu.org/licenses/gpl-3.0.en.html
  8. #
  9. # Unless required by applicable law or agreed to in writing,
  10. # software distributed under the License is distributed on an
  11. # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  12. # either express or implied. See the License for the specific
  13. # language governing permissions and limitations under the
  14. # License.
  15. import uuid
  16. # Abstract class
  17. class Primitive(object):
  18. def __init__(self):
  19. self.is_success = False # flags weather the primitive's action resulted in a success or not
  20. self.exception = None # holds the exception object if one was raised
  21. self._id = uuid.uuid4()
  22. def cancelIn(self, cancel):
  23. self.is_success = False
  24. self.exception = None
  25. def __str__(self):
  26. return '%s %s' % (str(self.__class__.__name__), self._id)