primitive.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. '''*****************************************************************************
  2. AToMPM - A Tool for Multi-Paradigm Modelling
  3. Copyright (c) 2011 Eugene Syriani
  4. This file is part of AToMPM.
  5. AToMPM is free software: you can redistribute it and/or modify it under the
  6. terms of the GNU Lesser General Public License as published by the Free Software
  7. Foundation, either version 3 of the License, or (at your option) any later
  8. version.
  9. AToMPM is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  11. PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License along
  13. with AToMPM. If not, see <http://www.gnu.org/licenses/>.
  14. *****************************************************************************'''
  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)