def _in(self, interval): """ Generates an atom. """ if type(interval) is list and len(interval) == 2: return formula_tree.StateValueLengthInInterval( self._state, self._name, interval) elif type(interval) is tuple and len(interval) == 2: return formula_tree.StateValueLengthInOpenInterval( self._state, self._name, interval) else: raise Exception( "Value of type %s given to _in comparison with %s('%s').length() is not supported." % (interval.__class__.__name__, self._state, self._name))
def __le__(self, value): """ Generates an atom. """ if type(value) is int: return formula_tree.StateValueLengthInInterval( self._state, self._name, [0, value]) elif type(value) is StateValueLength: return formula_tree.StateValueLengthLessThanEqualStateValueLengthMixed( self._state, self._name, value._state, value._name) else: raise Exception( "Value of type %s given to _in comparison with %s('%s').length() is not supported." % (value.__class__.__name__, self._state, self._name))
def _in(self, interval): """ Generates an atom. """ return formula_tree.StateValueLengthInInterval(self._state, self._name, interval)